Changeset 78362 in webkit
- Timestamp:
- Feb 11, 2011 1:39:04 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r78359 r78362 1 2011-02-11 Adam Klein <adamk@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [fileapi] Add support for filesystem: URI handling 6 https://bugs.webkit.org/show_bug.cgi?id=53529 7 8 Tests for filesystem: URIs, testing both their security origin 9 properties and the existence of the Entry.toURI method. 10 11 * fast/filesystem/directory-entry-to-uri-expected.txt: Added. 12 * fast/filesystem/directory-entry-to-uri.html: Added. 13 * fast/filesystem/file-entry-to-uri-expected.txt: Added. 14 * fast/filesystem/file-entry-to-uri.html: Added. 15 * fast/filesystem/filesystem-uri-origin-expected.txt: Added. 16 * fast/filesystem/filesystem-uri-origin.html: Added. 17 * fast/filesystem/resources/directory-entry-to-uri.js: Added. 18 (errorCallback): 19 (entryToURI): 20 (createTestDirectory): 21 (): 22 * fast/filesystem/resources/file-entry-to-uri.js: Added. 23 (errorCallback): 24 (entryToURI): 25 (createTestFile): 26 (): 27 * http/tests/security/filesystem-iframe-from-remote-expected.txt: Added. 28 * http/tests/security/filesystem-iframe-from-remote.html: Added. 29 * http/tests/security/resources/create-filesystem-file.html: Added. 30 1 31 2011-02-11 Sailesh Agrawal <sail@chromium.org> 2 32 -
trunk/LayoutTests/platform/gtk/Skipped
r78358 r78362 2481 2481 fast/filesystem 2482 2482 http/tests/local/fileapi 2483 http/tests/security/filesystem-iframe-from-remote.html 2483 2484 2484 2485 # Needs more investigation like QT -
trunk/LayoutTests/platform/mac/Skipped
r78095 r78362 258 258 # FileSystem API is not supported. 259 259 fast/filesystem 260 http/tests/security/filesystem-iframe-from-remote.html 260 261 261 262 # https://bugs.webkit.org/show_bug.cgi?id=46223 -
trunk/LayoutTests/platform/qt/Skipped
r78256 r78362 4911 4911 # FileSystem API is not supported. 4912 4912 fast/filesystem 4913 http/tests/security/filesystem-iframe-from-remote.html 4913 4914 4914 4915 # It fails, because 3D canvas is disabled by default. -
trunk/LayoutTests/platform/win/Skipped
r78095 r78362 1092 1092 # FileSystem API is not supported. 1093 1093 fast/filesystem 1094 http/tests/security/filesystem-iframe-from-remote.html 1094 1095 1095 1096 # LayoutTestController::nodesFromRect is not supported. -
trunk/Source/WebCore/ChangeLog
r78361 r78362 1 2011-02-11 Adam Klein <adamk@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [fileapi] Add support for filesystem: URI handling 6 https://bugs.webkit.org/show_bug.cgi?id=53529 7 8 There are two major parts to this patch: one is to add an 9 implementation of Entry.toURI to the FileSystem API. 10 The other is to implement security origin checking for this 11 new scheme. 12 13 All changes are guarded by the FILE_SYSTEM feature. An accompanying 14 Chromium change, to support loading of filesystem: URIs, has recently 15 been submitted as Chromium r74082. 16 17 Spec: 18 http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#methods-2 19 Proposed URI format, and discussion of security origin issues: 20 http://lists.w3.org/Archives/Public/public-webapps/2011JanMar/0218.html 21 22 Tests: fast/filesystem/directory-entry-to-uri.html 23 fast/filesystem/file-entry-to-uri.html 24 fast/filesystem/filesystem-uri-origin.html 25 http/tests/security/filesystem-iframe-from-remote.html 26 27 * fileapi/Entry.cpp: 28 (WebCore::Entry::toURI): 29 * fileapi/Entry.h: 30 * fileapi/Entry.idl: 31 - Added toURI method to the IDL, omitting the MIME type argument 32 specified in the spec as it will soon be removed. 33 * page/SecurityOrigin.cpp: 34 (WebCore::SecurityOrigin::SecurityOrigin): 35 - crack the filesystem: URI to get at the origin of the site 36 (WebCore::SecurityOrigin::canDisplay): 37 - canDisplay for filesystem: URIs is equivalent to canRequest 38 * platform/AsyncFileSystem.cpp: 39 (WebCore::AsyncFileSystem::create): 40 (WebCore::AsyncFileSystem::openFileSystem): 41 * platform/AsyncFileSystem.h: 42 (WebCore::AsyncFileSystem::type): 43 - Exposed filesystem type to allow toURI to use it as part of the 44 path. 45 (WebCore::AsyncFileSystem::AsyncFileSystem): 46 * platform/SchemeRegistry.cpp: 47 (WebCore::canDisplayOnlyIfCanRequestSchemes): 48 (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest): 49 (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest): 50 - Generalized canDisplayOnlyIfCanRequest as it applies to both 51 filesystem: and blob: URIs. 52 * platform/SchemeRegistry.h: 53 1 54 2011-02-11 Beth Dakin <bdakin@apple.com> 2 55 -
trunk/Source/WebCore/fileapi/Entry.cpp
r70741 r78362 33 33 #if ENABLE(FILE_SYSTEM) 34 34 35 #include "AsyncFileSystem.h" 35 36 #include "DirectoryEntry.h" 36 37 #include "EntryCallback.h" … … 39 40 #include "FileSystemCallbacks.h" 40 41 #include "MetadataCallback.h" 42 #include "ScriptExecutionContext.h" 43 #include "SecurityOrigin.h" 41 44 #include "VoidCallback.h" 45 #include <wtf/text/StringBuilder.h> 42 46 43 47 namespace WebCore { … … 83 87 } 84 88 85 String Entry::toURI( const String&)89 String Entry::toURI() 86 90 { 87 // FIXME: to be implemented. 88 ASSERT_NOT_REACHED(); 89 return String(); 91 StringBuilder uriBuilder; 92 uriBuilder.append("filesystem:"); 93 uriBuilder.append(filesystem()->scriptExecutionContext()->securityOrigin()->toString()); 94 uriBuilder.append("/"); 95 uriBuilder.append(m_fileSystem->asyncFileSystem()->type() == AsyncFileSystem::Temporary ? "temporary" : "persistent"); 96 uriBuilder.append(m_fullPath); 97 return uriBuilder.toString(); 90 98 } 91 99 -
trunk/Source/WebCore/fileapi/Entry.h
r70741 r78362 58 58 void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const; 59 59 60 String toURI( const String& mimeType = String());60 String toURI(); 61 61 62 62 protected: -
trunk/Source/WebCore/fileapi/Entry.idl
r69249 r78362 44 44 void moveTo(in DirectoryEntry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); 45 45 void copyTo(in DirectoryEntry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); 46 DOMString toURI(); 46 47 void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); 47 48 void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); -
trunk/Source/WebCore/page/SecurityOrigin.cpp
r77272 r78362 80 80 m_protocol = ""; 81 81 82 #if ENABLE(FILE_SYSTEM) 83 if (m_protocol == "filesystem") { 84 KURL originURL(ParsedURLString, url.path()); 85 if (originURL.isValid()) { 86 m_protocol = originURL.protocol().lower(); 87 m_host = originURL.host().lower(); 88 m_port = originURL.port(); 89 } else 90 m_isUnique = true; 91 } 92 #endif 93 82 94 // For edge case URLs that were probably misparsed, make sure that the origin is unique. 83 95 if (schemeRequiresAuthority(m_protocol) && m_host.isEmpty()) … … 314 326 String protocol = url.protocol().lower(); 315 327 316 #if ENABLE(BLOB) 317 // FIXME: We should generalize this check. 318 if (protocol == BlobURL::blobProtocol()) 328 if (SchemeRegistry::canDisplayOnlyIfCanRequest(protocol)) 319 329 return canRequest(url); 320 #endif321 330 322 331 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol)) -
trunk/Source/WebCore/platform/AsyncFileSystem.cpp
r71206 r78362 47 47 } 48 48 49 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create( const String&)49 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type, const String&) 50 50 { 51 51 notImplemented(); … … 69 69 rootPath.append(PlatformFilePathSeparator); 70 70 71 callbacks->didOpenFileSystem(name, AsyncFileSystem::create( rootPath));71 callbacks->didOpenFileSystem(name, AsyncFileSystem::create(type, rootPath)); 72 72 } 73 73 #endif -
trunk/Source/WebCore/platform/AsyncFileSystem.h
r76248 r78362 66 66 67 67 // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation. 68 static PassOwnPtr<AsyncFileSystem> create( const String& rootPath);68 static PassOwnPtr<AsyncFileSystem> create(Type, const String& rootPath); 69 69 70 70 // Opens a new file system. The create parameter specifies whether or not to create the path if it does not already exists. … … 133 133 String root() const { return m_platformRootPath; } 134 134 135 Type type() const { return m_type; } 136 135 137 protected: 136 AsyncFileSystem(const String& platformRootPath) 137 : m_platformRootPath(platformRootPath) 138 AsyncFileSystem(Type type, const String& platformRootPath) 139 : m_type(type) 140 , m_platformRootPath(platformRootPath) 138 141 { 139 142 } 140 143 144 Type m_type; 141 145 String m_platformRootPath; 142 146 }; -
trunk/Source/WebCore/platform/SchemeRegistry.cpp
r76637 r78362 87 87 } 88 88 89 static URLSchemesMap& canDisplayOnlyIfCanRequestSchemes() 90 { 91 DEFINE_STATIC_LOCAL(URLSchemesMap, canDisplayOnlyIfCanRequestSchemes, ()); 92 93 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 94 if (canDisplayOnlyIfCanRequestSchemes.isEmpty()) { 95 #if ENABLE(BLOB) 96 canDisplayOnlyIfCanRequestSchemes.add("blob"); 97 #endif 98 #if ENABLE(FILE_SYSTEM) 99 canDisplayOnlyIfCanRequestSchemes.add("filesystem"); 100 #endif 101 } 102 #endif // ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 103 104 return canDisplayOnlyIfCanRequestSchemes; 105 } 106 89 107 void SchemeRegistry::registerURLSchemeAsLocal(const String& scheme) 90 108 { … … 157 175 } 158 176 177 bool SchemeRegistry::canDisplayOnlyIfCanRequest(const String& scheme) 178 { 179 if (scheme.isEmpty()) 180 return false; 181 return canDisplayOnlyIfCanRequestSchemes().contains(scheme); 182 } 183 184 void SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest(const String& scheme) 185 { 186 canDisplayOnlyIfCanRequestSchemes().add(scheme); 187 } 188 159 189 } // namespace WebCore -
trunk/Source/WebCore/platform/SchemeRegistry.h
r75557 r78362 59 59 static void registerURLSchemeAsEmptyDocument(const String&); 60 60 static bool shouldLoadURLSchemeAsEmptyDocument(const String&); 61 62 // Such schemes should delegate to SecurityOrigin::canRequest for any URL 63 // passed to SecurityOrigin::canDisplay. 64 static bool canDisplayOnlyIfCanRequest(const String& scheme); 65 static void registerAsCanDisplayOnlyIfCanRequest(const String& scheme); 61 66 }; 62 67 -
trunk/Source/WebKit/chromium/ChangeLog
r78342 r78362 1 2011-02-11 Adam Klein <adamk@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [fileapi] Add support for filesystem: URI handling 6 https://bugs.webkit.org/show_bug.cgi?id=53529 7 8 Changes to Chromium WebKit API required to expose 9 the FileSystem type to WebCore's fileapi code, since the 10 type is part of the filesystem URI. 11 12 * src/AsyncFileSystemChromium.cpp: 13 (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): 14 * src/AsyncFileSystemChromium.h: 15 (WebCore::AsyncFileSystemChromium::create): 16 * src/LocalFileSystemChromium.cpp: 17 (WebCore::LocalFileSystem::readFileSystem): 18 (WebCore::LocalFileSystem::requestFileSystem): 19 * src/WebFileSystemCallbacksImpl.cpp: 20 (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): 21 (WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem): 22 * src/WebFileSystemCallbacksImpl.h: 23 * src/WorkerAsyncFileSystemChromium.cpp: 24 (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium): 25 * src/WorkerAsyncFileSystemChromium.h: 26 (WebCore::WorkerAsyncFileSystemChromium::create): 27 1 28 2011-02-10 Nate Chapin <japhet@chromium.org> 2 29 -
trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
r69485 r78362 51 51 } 52 52 53 AsyncFileSystemChromium::AsyncFileSystemChromium( const String& rootPath)54 : AsyncFileSystem( rootPath)53 AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const String& rootPath) 54 : AsyncFileSystem(type, rootPath) 55 55 , m_webFileSystem(WebKit::webKitClient()->fileSystem()) 56 56 { -
trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h
r69485 r78362 47 47 class AsyncFileSystemChromium : public AsyncFileSystem { 48 48 public: 49 static PassOwnPtr<AsyncFileSystem> create( const String& rootPath)49 static PassOwnPtr<AsyncFileSystem> create(AsyncFileSystem::Type type, const String& rootPath) 50 50 { 51 return adoptPtr(new AsyncFileSystemChromium( rootPath));51 return adoptPtr(new AsyncFileSystemChromium(type, rootPath)); 52 52 } 53 53 … … 67 67 68 68 private: 69 explicit AsyncFileSystemChromium(const String& rootPath);69 AsyncFileSystemChromium(AsyncFileSystem::Type, const String& rootPath); 70 70 WebKit::WebFileSystem* m_webFileSystem; 71 71 }; -
trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
r71206 r78362 63 63 Document* document = static_cast<Document*>(context); 64 64 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 65 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, false, new WebFileSystemCallbacksImpl(callbacks ));65 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, false, new WebFileSystemCallbacksImpl(callbacks, type)); 66 66 } 67 67 … … 72 72 Document* document = static_cast<Document*>(context); 73 73 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 74 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, true, new WebFileSystemCallbacksImpl(callbacks ));74 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, true, new WebFileSystemCallbacksImpl(callbacks, type)); 75 75 } else { 76 76 WorkerContext* workerContext = static_cast<WorkerContext*>(context); 77 77 WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); 78 78 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); 79 webWorker->openFileSystem(static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks, context, synchronous), synchronous);79 webWorker->openFileSystem(static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous); 80 80 } 81 81 } -
trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
r70745 r78362 37 37 #include "FileMetadata.h" 38 38 #include "ScriptExecutionContext.h" 39 #include "WebFileInfo.h" 40 #include "WebFileSystem.h" 39 41 #include "WebFileSystemEntry.h" 40 #include "WebFileInfo.h"41 42 #include "WebString.h" 42 43 #include "WorkerAsyncFileSystemChromium.h" … … 47 48 namespace WebKit { 48 49 49 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, WebCore::ScriptExecutionContext* context, bool synchronous)50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, AsyncFileSystem::Type type, WebCore::ScriptExecutionContext* context, bool synchronous) 50 51 : m_callbacks(callbacks) 52 , m_type(type) 51 53 , m_context(context) 52 54 , m_synchronous(synchronous) … … 86 88 { 87 89 if (m_context && m_context->isWorkerContext()) 88 m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, path, m_synchronous));90 m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, path, m_synchronous)); 89 91 else 90 m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create( path));92 m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path)); 91 93 delete this; 92 94 } -
trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h
r69249 r78362 32 32 #define WebFileSystemCallbacksImpl_h 33 33 34 #include "AsyncFileSystem.h" 35 #include "WebFileSystem.h" 34 36 #include "WebFileSystemCallbacks.h" 35 37 #include "WebVector.h" … … 50 52 class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { 51 53 public: 52 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore:: ScriptExecutionContext* = 0, bool synchronous = false);54 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::AsyncFileSystem::Type = WebCore::AsyncFileSystem::Temporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false); 53 55 virtual ~WebFileSystemCallbacksImpl(); 54 56 … … 62 64 OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; 63 65 66 // Used for openFileSystem callbacks. 67 WebCore::AsyncFileSystem::Type m_type; 68 64 69 // Used for worker's openFileSystem callbacks. 65 70 WebCore::ScriptExecutionContext* m_context; -
trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
r72200 r78362 57 57 static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; 58 58 59 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, const String& rootPath, bool synchronous)60 : AsyncFileSystem( rootPath)59 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const String& rootPath, bool synchronous) 60 : AsyncFileSystem(type, rootPath) 61 61 , m_scriptExecutionContext(context) 62 62 , m_webFileSystem(WebKit::webKitClient()->fileSystem()) -
trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h
r69485 r78362 53 53 class WorkerAsyncFileSystemChromium : public AsyncFileSystem { 54 54 public: 55 static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, const String& rootPath, bool synchronous)55 static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const String& rootPath, bool synchronous) 56 56 { 57 return adoptPtr(new WorkerAsyncFileSystemChromium(context, rootPath, synchronous));57 return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootPath, synchronous)); 58 58 } 59 59 … … 76 76 77 77 private: 78 WorkerAsyncFileSystemChromium(ScriptExecutionContext*, const String& rootPath, bool synchronous);78 WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const String& rootPath, bool synchronous); 79 79 80 80 PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
Note: See TracChangeset
for help on using the changeset viewer.