WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
44734
Add LocalFileSystem.requestFileSystem interface to DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=44734
Summary
Add LocalFileSystem.requestFileSystem interface to DOMWindow
Kinuko Yasuda
Reported
2010-08-26 16:58:40 PDT
DOMWindow needs to expose LocalFileSystem.requestFileSystem interface if FileSystem API is enabled.
http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#widl-LocalFileSystem-requestFileSystem
Attachments
Patch
(11.43 KB, patch)
2010-08-27 17:13 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(11.60 KB, patch)
2010-08-28 21:32 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(11.12 KB, patch)
2010-08-31 14:54 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(11.12 KB, patch)
2010-08-31 15:04 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(11.16 KB, patch)
2010-08-31 16:43 PDT
,
Kinuko Yasuda
jianli
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Kinuko Yasuda
Comment 1
2010-08-27 17:13:20 PDT
Created
attachment 65794
[details]
Patch
Darin Fisher (:fishd, Google)
Comment 2
2010-08-27 23:26:24 PDT
Comment on
attachment 65794
[details]
Patch WebCore/page/DOMWindow.cpp:740 + errorCallback->handleEvent(FileError::create(INVALID_STATE_ERR).get()); i asked this question on the other code review, but shouldn't these dom events be dispatched asynchronously? otherwise, we end up nesting JS -> C++ -> JS calls, which is never a great thing to do. does the spec say anything about this? it seems like it would be nice to always dispatch callbacks asynchronously for consistency. WebCore/page/DOMWindow.cpp:759 + #define COMPILE_ASSERT_MATCHING_ENUM(domwindowname, asyncfsname) \ since there are only two enum values being compared here, it might not be worth defining the macro: COMPILE_ASSERT(int(DOMWindow::TEMPORARY) == int(AsyncFileSystem::Temporary), enum_mismatch); COMPILE_ASSERT(int(DOMWindow::PERSISTENT) == int(AsyncFileSystem::Persistent), enum_mismatch); WebCore/page/Settings.h:243 + #if ENABLE(FILE_SYSTEM) i don't know that this setting needs to be protected by the ifdef. afterall, localStorageDatabasePath is not protected by ENABLE(DOM_STORAGE).
Kinuko Yasuda
Comment 3
2010-08-28 21:32:55 PDT
Created
attachment 65846
[details]
Patch This change depends on the the other change for
bug 44732
Kinuko Yasuda
Comment 4
2010-08-28 21:33:43 PDT
(In reply to
comment #2
)
> (From update of
attachment 65794
[details]
) > WebCore/page/DOMWindow.cpp:740 > + errorCallback->handleEvent(FileError::create(INVALID_STATE_ERR).get()); > i asked this question on the other code review, but shouldn't these dom events be > dispatched asynchronously? otherwise, we end up nesting JS -> C++ -> JS calls, > which is never a great thing to do. does the spec say anything about this? it > seems like it would be nice to always dispatch callbacks asynchronously for > consistency.
Fixed. (The fix depends on the other change for
bug 44732
)
> WebCore/page/DOMWindow.cpp:759 > + #define COMPILE_ASSERT_MATCHING_ENUM(domwindowname, asyncfsname) \ > since there are only two enum values being compared here, it might not be worth defining the macro:
Fixed.
> WebCore/page/Settings.h:243 > + #if ENABLE(FILE_SYSTEM) > i don't know that this setting needs to be protected by the ifdef. > afterall, localStorageDatabasePath is not protected by ENABLE(DOM_STORAGE).
Removed the ifdefs.
Kinuko Yasuda
Comment 5
2010-08-31 13:32:39 PDT
Could someone review this one? Thanks,
Jian Li
Comment 6
2010-08-31 13:53:50 PDT
Comment on
attachment 65846
[details]
Patch
> WebCore/bindings/generic/RuntimeEnabledFeatures.h:141 > + static bool requestFileSystemEnabled() { return isFileSystemEnabled; }
Why do we need requestFileSystemEnabled? What's the difference between fileSystemEnabled and requestFileSystemEnabled?
> WebCore/page/DOMWindow.h:83 > +#if ENABLE(FILE_SYSTEM)
Normally we do not need to guard this.
> WebCore/page/DOMWindow.h:86 > + class ErrorCallback;
Please sort these.
> WebCore/page/Settings.h:244 > + const String& fileSystemRootPath() const { return m_fileSystemRootPath; }
Do you need to guard these?
> WebKit/chromium/ChangeLog:15 > +2010-08-27 Kinuko Yasuda <
kinuko@chromium.org
>
Why do you produce 2 ChangeLog entries?
Kinuko Yasuda
Comment 7
2010-08-31 14:54:43 PDT
Created
attachment 66117
[details]
Patch
Kinuko Yasuda
Comment 8
2010-08-31 15:02:11 PDT
Thanks! (In reply to
comment #6
)
> (From update of
attachment 65846
[details]
) > > WebCore/bindings/generic/RuntimeEnabledFeatures.h:141 > > + static bool requestFileSystemEnabled() { return isFileSystemEnabled; } > Why do we need requestFileSystemEnabled? What's the difference between fileSystemEnabled and requestFileSystemEnabled?
We need someIdlNameEnabled() method to dynamically enable someIdlName at the binding time. I basically followed what the other code does here (have one boolean flag for the feature and associate the flag with multiple methods - though for now we have only one method associated with the flag).
> > WebCore/page/DOMWindow.h:83 > > +#if ENABLE(FILE_SYSTEM) > Normally we do not need to guard this.
Removed.
> > WebCore/page/DOMWindow.h:86 > > + class ErrorCallback; > Please sort these.
Fixed.
> > WebCore/page/Settings.h:244 > > + const String& fileSystemRootPath() const { return m_fileSystemRootPath; } > Do you need to guard these?
Darin suggested that we may not need the ifdefs here.
> > WebKit/chromium/ChangeLog:15 > > +2010-08-27 Kinuko Yasuda <
kinuko@chromium.org
> > Why do you produce 2 ChangeLog entries?
Mistake... fixed.
Kinuko Yasuda
Comment 9
2010-08-31 15:04:41 PDT
Created
attachment 66121
[details]
Patch Fixed ChangeLog date
Jian Li
Comment 10
2010-08-31 16:22:21 PDT
Comment on
attachment 66121
[details]
Patch
> WebCore/bindings/generic/RuntimeEnabledFeatures.h:141 > + static bool requestFileSystemEnabled() { return isFileSystemEnabled; }
I still don't understand your comment. requestFileSystemEnabled() seems to be identical to fileSystemEnabled(). By looking into the name, I do not know what requestFileSystemEnabled is used for.
> WebCore/page/DOMWindow.cpp:742 > + if (!document) {
Can this check be moved to the beginning of this method? That is, can we still call m_localFileSystem->requestFileSystem if document is gone?
> WebCore/page/DOMWindow.cpp:759 > + m_localFileSystem->requestFileSystem(document, static_cast<AsyncFileSystem::Type>(type), size, successCallback, errorCallback);
This could be merged with the first call of "m_localFileSystem->requestFileSystem", like: if (!m_localFileSystem) { // Create m_localFileSystem ... } m_localFileSystem->requestFileSystem(document, static_cast<AsyncFileSystem::Type>(type), size, successCallback, errorCallback);
> WebCore/page/DOMWindow.h:86 > + class LocalFileSystem;
Please move all these forward declarations to the right place.
Michael Nordman
Comment 11
2010-08-31 16:25:15 PDT
(In reply to
comment #10
)
> (From update of
attachment 66121
[details]
) > > WebCore/bindings/generic/RuntimeEnabledFeatures.h:141 > > + static bool requestFileSystemEnabled() { return isFileSystemEnabled; } > I still don't understand your comment. requestFileSystemEnabled() seems to be identical to fileSystemEnabled(). By looking into the name, I do not know what requestFileSystemEnabled is used for.
This is a function of how runtime enablement works in the v8 bindings layer. The IDL compiler generates c++ code with a particular signature based on the name of the attribute/method that is tagged as being [EnabledAtRuntime].
Kinuko Yasuda
Comment 12
2010-08-31 16:43:40 PDT
Created
attachment 66139
[details]
Patch
Kinuko Yasuda
Comment 13
2010-08-31 17:05:16 PDT
(In reply to
comment #10
)
> (From update of
attachment 66121
[details]
) > > WebCore/bindings/generic/RuntimeEnabledFeatures.h:141 > > + static bool requestFileSystemEnabled() { return isFileSystemEnabled; } > I still don't understand your comment. requestFileSystemEnabled() seems to be identical to fileSystemEnabled(). By looking into the name, I do not know what requestFileSystemEnabled is used for.
(I think Michael's comment is explaining things better...) requestFileSystemEnabled() is there to dynamically enable requestFileSystem() interface defined in DOMWindow.idl annotated with [EnabledAtRuntime]. fileSystemEnabled() and isFileSystemEnabled() is supposed to be a flag for the entire feature and requestFileSystem is one of the feature's methods that needs to be exposed if the feature is enabled. If we have more methods to be enabled at runtime for the feature (actually the FileSystem API defines one more DOMWindow method that hasn't been added yet) we'll have similar xxxEnabled() methods that will look identical to fileSystemEnabled(). (And again, I don't have strong opinion here and basically am trying to follow other code.)
> > WebCore/page/DOMWindow.cpp:742 > > + if (!document) { > Can this check be moved to the beginning of this method? That is, can we still call m_localFileSystem->requestFileSystem if document is gone?
Do you mean we shouldn't call requestFileSystem if the document is gone? That's true I moved the check to the beginning.
> > WebCore/page/DOMWindow.cpp:759 > > + m_localFileSystem->requestFileSystem(document, static_cast<AsyncFileSystem::Type>(type), size, successCallback, errorCallback); > This could be merged with the first call of "m_localFileSystem->requestFileSystem", like:
Fixed.
> > WebCore/page/DOMWindow.h:86 > > + class LocalFileSystem; > Please move all these forward declarations to the right place.
Fixed.
Jian Li
Comment 14
2010-08-31 17:56:19 PDT
Comment on
attachment 66139
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=66139&action=prettypatch
> WebCore/page/DOMWindow.cpp:738 > + // No context? Not firing the errorCallback.
I do not think we need to add any comment here, like what we do in other DOMWindow method.
Kinuko Yasuda
Comment 15
2010-08-31 20:27:21 PDT
Committed
r66570
: <
http://trac.webkit.org/changeset/66570
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug