-
Notifications
You must be signed in to change notification settings - Fork 61
Callback with error if doc is not fully active #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Gecko patch: https://phabricator.services.mozilla.com/D117273 |
I've filed an issue against Chromium for this and updated the summary. Any chance the test you've added in the Gecko patch could be added to WPT instead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the first instances I've seen where the behavior of calling a method on a non-fully active document is well-defined. It is something I always need to handle in Chromium (because non-fully active documents in Blink have a rather conspicuous null pointer) but haven't ever specified.
Thanks @reillyeon! And I again have to give a huge shout out to @rakina and co. for producing that TAG guide and for her guidance - and to @saschanaz for a super detailed review over on the Gecko side, who caught the potential issue when used with promises. I'll see if I can create a WPT test. The challenge I've been facing is that the page requires permission to use the API. But I'll see if Webdriver, via WPT, lets me grant a page permission to use the API... Oh! might be in luck! await test_driver.set_permission({name: 'geolocation'}, 'granted'); Re non fully active in general: yeah, I've been finding really weird behavior... not sure if you are following the Permission's one, where (unsurprisingly) Chrome and Firefox are producing different results: These are a lot of fun to work on tho! So please ping if there are other APIs that could use a look over. |
Ok, WPT is up web-platform-tests/wpt#29799 - however, I'm unsure who to tag for review? @reillyeon can you suggest anyone (or review it?). That reminds me... we need to find new folks to review the tests. The current set listed over at WPT don't appear to be very active in this space as they might have moved onto other things. |
Filed WebKit bug https://bugs.webkit.org/show_bug.cgi?id=228319 |
It can be included the gecko patch so that it can be automatically upstreamed. |
@saschanaz wrote:
I was hoping to do that, but Gecko doesn't implement |
Oops! @jgraham Are we planning to implement |
… not fully active r=saschanaz Spec change w3c/geolocation#97 Differential Revision: https://phabricator.services.mozilla.com/D117273
… not fully active r=saschanaz Spec change w3c/geolocation#97 Differential Revision: https://phabricator.services.mozilla.com/D117273
Good news! WebKit patch inbound for this too! https://bugs.webkit.org/show_bug.cgi?id=228319 🎉 |
https://bugs.webkit.org/show_bug.cgi?id=228319 <rdar://problem/81450315> Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/geolocation-API/PositionOptions.https-expected.txt: Rebaseline WPT test now that more checks are passing. * web-platform-tests/geolocation-API/non-fully-active.https-expected.txt: Added. * web-platform-tests/geolocation-API/non-fully-active.https.html: Added. * web-platform-tests/geolocation-API/resources/iframe.html: Added. Import test coverage from WPT web-platform-tests/wpt#29799. * web-platform-tests/resources/testdriver-vendor.js: (window.test_driver_internal.set_permission): Add support for test_driver.set_permission("geolocation", "granted") so that Geolocation WPT tests can run with our infrastructure. Source/WebCore: Test: imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): Schedule a task to call the error callback if the document is not fully active, as per the specification: - w3c/geolocation#96 - w3c/geolocation#97 * bindings/js/JSDOMConvertCallbacks.h: (WebCore::Converter<IDLCallbackFunction<T>>::convert): (WebCore::Converter<IDLCallbackInterface<T>>::convert): Make sure we use the incumbent global object when constructing callback functions / interfaces, as per the Web IDL specification: - https://heycam.github.io/webidl/#es-callback-interface - https://heycam.github.io/webidl/#es-callback-function Without this, the geolocation API would be unable to call its error callback when in a detached frame because the callback's global object would be the geolocation object's global object. * dom/IdleCallbackController.cpp: (WebCore::IdleCallbackController::invokeIdleCallbacks): Make sure we don't fire requestIdleCallback callbacks in detached iframes, to maintain pre-existing behavior and keep layout tests passing. I had to make this change because callback interfaces / functions are now using a different global object and can now get called in cases when they previously couldn't. * dom/TaskSource.h: As Geolocation task source for the HTML5 event loop, as per the Geolocation specification. LayoutTests: Update / rebaseline existing layout tests to reflect behavior change. * fast/dom/Geolocation/callback-to-deleted-context-expected.txt: * fast/dom/Geolocation/callback-to-deleted-context.html: * fast/dom/Geolocation/disconnected-frame-already-expected.txt: * fast/dom/Geolocation/disconnected-frame-already.html: * fast/dom/Geolocation/disconnected-frame-expected.txt: * fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt: * fast/dom/Geolocation/disconnected-frame-permission-denied.html: * fast/dom/Geolocation/disconnected-frame.html: * fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html: * fast/events/detached-svg-parent-window-events-expected.txt: * fast/events/detached-svg-parent-window-events.html: Canonical link: https://commits.webkit.org/240893@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
@reillyeon, could you by chance point me to how fully active checks are done in Chromium? With a little guidance, maybe I can slap together a Chromium patch? |
I left notes on how to do this on https://bugs.chromium.org/p/chromium/issues/detail?id=1233329. |
https://bugs.webkit.org/show_bug.cgi?id=228319 <rdar://problem/81450315> Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/geolocation-API/PositionOptions.https-expected.txt: Rebaseline WPT test now that more checks are passing. * web-platform-tests/geolocation-API/non-fully-active.https-expected.txt: Added. * web-platform-tests/geolocation-API/non-fully-active.https.html: Added. * web-platform-tests/geolocation-API/resources/iframe.html: Added. Import test coverage from WPT web-platform-tests/wpt#29799. * web-platform-tests/resources/testdriver-vendor.js: (window.test_driver_internal.set_permission): Add support for test_driver.set_permission("geolocation", "granted") so that Geolocation WPT tests can run with our infrastructure. Source/WebCore: Test: imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): Schedule a task to call the error callback if the document is not fully active, as per the specification: - w3c/geolocation#96 - w3c/geolocation#97 * bindings/js/JSDOMConvertCallbacks.h: (WebCore::Converter<IDLCallbackFunction<T>>::convert): (WebCore::Converter<IDLCallbackInterface<T>>::convert): Make sure we use the incumbent global object when constructing callback functions / interfaces, as per the Web IDL specification: - https://heycam.github.io/webidl/#es-callback-interface - https://heycam.github.io/webidl/#es-callback-function Without this, the geolocation API would be unable to call its error callback when in a detached frame because the callback's global object would be the geolocation object's global object. * dom/IdleCallbackController.cpp: (WebCore::IdleCallbackController::invokeIdleCallbacks): Make sure we don't fire requestIdleCallback callbacks in detached iframes, to maintain pre-existing behavior and keep layout tests passing. I had to make this change because callback interfaces / functions are now using a different global object and can now get called in cases when they previously couldn't. * dom/TaskSource.h: As Geolocation task source for the HTML5 event loop, as per the Geolocation specification. LayoutTests: Update / rebaseline existing layout tests to reflect behavior change. * fast/dom/Geolocation/callback-to-deleted-context-expected.txt: * fast/dom/Geolocation/callback-to-deleted-context.html: * fast/dom/Geolocation/disconnected-frame-already-expected.txt: * fast/dom/Geolocation/disconnected-frame-already.html: * fast/dom/Geolocation/disconnected-frame-expected.txt: * fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt: * fast/dom/Geolocation/disconnected-frame-permission-denied.html: * fast/dom/Geolocation/disconnected-frame.html: * fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html: * fast/events/detached-svg-parent-window-events-expected.txt: * fast/events/detached-svg-parent-window-events.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@281520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228319 <rdar://problem/81450315> Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/geolocation-API/non-fully-active.https-expected.txt: Rebaseline WPT test that is now passing. Source/WebCore: Test: imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): Schedule a task to call the error callback if the document is not fully active, as per the specification: - w3c/geolocation#96 - w3c/geolocation#97 * dom/TaskSource.h: As Geolocation task source for the HTML5 event loop, as per the Geolocation specification. LayoutTests: Update existing layout tests to reflect behavior change. * fast/dom/Geolocation/disconnected-frame-already-expected.txt: * fast/dom/Geolocation/disconnected-frame-already.html: Aligns test assertions with the spec. Gecko also passes it. * TestExpectations: Unskip the WPT test. Canonical link: https://commits.webkit.org/246504@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228319 <rdar://problem/81450315> Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/geolocation-API/non-fully-active.https-expected.txt: Rebaseline WPT test that is now passing. Source/WebCore: Test: imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): Schedule a task to call the error callback if the document is not fully active, as per the specification: - w3c/geolocation#96 - w3c/geolocation#97 * dom/TaskSource.h: As Geolocation task source for the HTML5 event loop, as per the Geolocation specification. LayoutTests: Update existing layout tests to reflect behavior change. * fast/dom/Geolocation/disconnected-frame-already-expected.txt: * fast/dom/Geolocation/disconnected-frame-already.html: Aligns test assertions with the spec. Gecko also passes it. * TestExpectations: Unskip the WPT test. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Closes #96
The following tasks have been completed:
Implementation commitment:
Preview | Diff