Changeset 281520 in webkit
- Timestamp:
- Aug 24, 2021 3:03:34 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 20 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/disconnected-frame.html (modified) (1 diff)
-
LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html (modified) (1 diff)
-
LayoutTests/fast/events/detached-svg-parent-window-events-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/events/detached-svg-parent-window-events.html (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/geolocation-API/PositionOptions.https-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/geolocation-API/resources (added)
-
LayoutTests/imported/w3c/web-platform-tests/geolocation-API/resources/iframe.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/geolocation/Geolocation.cpp (modified) (4 diffs)
-
Source/WebCore/bindings/js/JSDOMConvertCallbacks.h (modified) (2 diffs)
-
Source/WebCore/dom/IdleCallbackController.cpp (modified) (1 diff)
-
Source/WebCore/dom/TaskSource.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r281519 r281520 1 2021-08-24 Chris Dumez <cdumez@apple.com> 2 3 Geolocation API should callback with error if doc is not fully active 4 https://bugs.webkit.org/show_bug.cgi?id=228319 5 <rdar://problem/81450315> 6 7 Reviewed by Ryosuke Niwa. 8 9 Update / rebaseline existing layout tests to reflect behavior change. 10 11 * fast/dom/Geolocation/callback-to-deleted-context-expected.txt: 12 * fast/dom/Geolocation/callback-to-deleted-context.html: 13 * fast/dom/Geolocation/disconnected-frame-already-expected.txt: 14 * fast/dom/Geolocation/disconnected-frame-already.html: 15 * fast/dom/Geolocation/disconnected-frame-expected.txt: 16 * fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt: 17 * fast/dom/Geolocation/disconnected-frame-permission-denied.html: 18 * fast/dom/Geolocation/disconnected-frame.html: 19 * fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html: 20 * fast/events/detached-svg-parent-window-events-expected.txt: 21 * fast/events/detached-svg-parent-window-events.html: 22 1 23 2021-08-24 Eric Hutchison <ehutchison@apple.com> 2 24 -
trunk/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt
r231450 r281520 5 5 6 6 7 PASS Success callbackinvoked7 PASS No callbacks invoked 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html
r217390 r281520 14 14 function onSecondIframeLoaded() { 15 15 window.setTimeout(function() { 16 test Failed('No callbacks invoked');16 testPassed('No callbacks invoked'); 17 17 finishJSTest(); 18 18 }, 500); -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame-already-expected.txt
r65329 r281520 4 4 5 5 6 Method called on Geolocation object with disconnected Frame. 6 PASS Error callback invoked 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame-already.html
r217390 r281520 24 24 finishJSTest(); 25 25 }, function(e) { 26 test Failed('Error callback invoked unexpectedly');26 testPassed('Error callback invoked'); 27 27 finishJSTest(); 28 28 }); -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt
r231450 r281520 5 5 6 6 7 PASS No callbacksinvoked7 PASS Error callback invoked 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
r231450 r281520 8 8 PASS error.message is "User denied Geolocation" 9 9 10 PASS No callbacksinvoked10 PASS Error callback invoked 11 11 PASS successfullyParsed is true 12 12 -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html
r217390 r281520 37 37 finishJSTest(); 38 38 }, function(e) { 39 test Failed('Error callback invoked unexpectedly');39 testPassed('Error callback invoked'); 40 40 finishJSTest(); 41 41 }); 42 42 setTimeout(function() { 43 test Passed('No callbacks invoked');43 testFailed('No callbacks invoked'); 44 44 finishJSTest(); 45 }, 100 );45 }, 1000); 46 46 } 47 47 -
trunk/LayoutTests/fast/dom/Geolocation/disconnected-frame.html
r217390 r281520 24 24 finishJSTest(); 25 25 }, function(e) { 26 test Failed('Error callback invoked unexpectedly');26 testPassed('Error callback invoked'); 27 27 finishJSTest(); 28 28 }); 29 29 setTimeout(function() { 30 test Passed('No callbacks invoked');30 testFailed('No callbacks invoked'); 31 31 finishJSTest(); 32 }, 100 );32 }, 1000); 33 33 } 34 34 -
trunk/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html
r127923 r281520 14 14 // object attempts to invoke the callback. 15 15 window.parent.navigator.geolocation.getCurrentPosition(function() { 16 parent.test Passed('Success callback invoked');16 parent.testFailed('Success callback invoked unexpectedly'); 17 17 parent.finishJSTest(); 18 18 }, function() { -
trunk/LayoutTests/fast/events/detached-svg-parent-window-events-expected.txt
r259900 r281520 1 CONSOLE MESSAGE: error2 1 This tests creating a disconnected SVG element with resize event handler. The event handler should not get dispatched unless the element is connected 3 2 … … 5 4 6 5 6 PASS Exception thrown 7 7 PASS didFireResize is false 8 8 PASS didFireOnError is false -
trunk/LayoutTests/fast/events/detached-svg-parent-window-events.html
r257897 r281520 22 22 finishJSTest(); 23 23 }); 24 iframe.contentWindow.eval('throw "error"'); 24 try { 25 iframe.contentWindow.eval('throw "error"'); 26 } catch (e) { 27 testPassed("Exception thrown"); 28 } 25 29 }); 26 30 }; -
trunk/LayoutTests/imported/w3c/ChangeLog
r281516 r281520 1 2021-08-24 Chris Dumez <cdumez@apple.com> 2 3 Geolocation API should callback with error if doc is not fully active 4 https://bugs.webkit.org/show_bug.cgi?id=228319 5 <rdar://problem/81450315> 6 7 Reviewed by Ryosuke Niwa. 8 9 * web-platform-tests/geolocation-API/PositionOptions.https-expected.txt: 10 Rebaseline WPT test now that more checks are passing. 11 12 * web-platform-tests/geolocation-API/non-fully-active.https-expected.txt: Added. 13 * web-platform-tests/geolocation-API/non-fully-active.https.html: Added. 14 * web-platform-tests/geolocation-API/resources/iframe.html: Added. 15 Import test coverage from WPT https://github.com/web-platform-tests/wpt/pull/29799. 16 17 * web-platform-tests/resources/testdriver-vendor.js: 18 (window.test_driver_internal.set_permission): 19 Add support for test_driver.set_permission("geolocation", "granted") so that Geolocation 20 WPT tests can run with our infrastructure. 21 1 22 2021-08-24 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/LayoutTests/imported/w3c/web-platform-tests/geolocation-API/PositionOptions.https-expected.txt
r270048 r281520 2 2 PASS Call getCurrentPosition with wrong type for enableHighAccuracy. No exception expected. 3 3 PASS Call watchPosition with wrong type for enableHighAccuracy. No exception expected. 4 FAIL PositionOptions tests promise_test: Unhandled rejection with value: object "Error: unimplemented" 4 PASS PositionOptions tests 5 PASS Set timeout and maximumAge to 0, check that timeout error raised (getCurrentPosition) 6 PASS Set timeout and maximumAge to 0, check that timeout error raised (watchPosition) 7 PASS Check that a negative timeout value is equivalent to a 0 timeout value (getCurrentLocation) 8 PASS Check that a negative timeout value is equivalent to a 0 timeout value (watchPosition) 5 9 -
trunk/LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js
r273136 r281520 294 294 return dispatchMouseActions(pointerSource.actions, pointerType); 295 295 }; 296 297 window.test_driver_internal.set_permission = function(permission_params, context=null) 298 { 299 if (window.testRunner && permission_params.descriptor.name == "geolocation") { 300 setInterval(() => { 301 window.testRunner.setMockGeolocationPosition(51.478, -0.166, 100); 302 }, 100); 303 testRunner.setGeolocationPermission(permission_params.state == "granted"); 304 return Promise.resolve(); 305 } 306 return Promise.reject(new Error("unimplemented")); 307 }; 308 -
trunk/Source/WebCore/ChangeLog
r281516 r281520 1 2021-08-24 Chris Dumez <cdumez@apple.com> 2 3 Geolocation API should callback with error if doc is not fully active 4 https://bugs.webkit.org/show_bug.cgi?id=228319 5 <rdar://problem/81450315> 6 7 Reviewed by Ryosuke Niwa. 8 9 Test: imported/w3c/web-platform-tests/geolocation-API/non-fully-active.https.html 10 11 * Modules/geolocation/Geolocation.cpp: 12 (WebCore::Geolocation::getCurrentPosition): 13 (WebCore::Geolocation::watchPosition): 14 Schedule a task to call the error callback if the document is not fully active, as 15 per the specification: 16 - https://github.com/w3c/geolocation-api/issues/96 17 - https://github.com/w3c/geolocation-api/pull/97 18 19 * bindings/js/JSDOMConvertCallbacks.h: 20 (WebCore::Converter<IDLCallbackFunction<T>>::convert): 21 (WebCore::Converter<IDLCallbackInterface<T>>::convert): 22 Make sure we use the incumbent global object when constructing callback functions / 23 interfaces, as per the Web IDL specification: 24 - https://heycam.github.io/webidl/#es-callback-interface 25 - https://heycam.github.io/webidl/#es-callback-function 26 Without this, the geolocation API would be unable to call its error callback when in 27 a detached frame because the callback's global object would be the geolocation object's 28 global object. 29 30 * dom/IdleCallbackController.cpp: 31 (WebCore::IdleCallbackController::invokeIdleCallbacks): 32 Make sure we don't fire requestIdleCallback callbacks in detached iframes, to maintain 33 pre-existing behavior and keep layout tests passing. I had to make this change because 34 callback interfaces / functions are now using a different global object and can now 35 get called in cases when they previously couldn't. 36 37 * dom/TaskSource.h: 38 As Geolocation task source for the HTML5 event loop, as per the Geolocation 39 specification. 40 1 41 2021-08-24 Chris Dumez <cdumez@apple.com> 2 42 -
trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp
r278253 r281520 32 32 33 33 #include "Document.h" 34 #include "EventLoop.h" 34 35 #include "FeaturePolicy.h" 35 36 #include "Frame.h" … … 300 301 void Geolocation::getCurrentPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options) 301 302 { 302 if (!frame()) 303 return; 303 if (!document() || !document()->isFullyActive()) { 304 if (errorCallback && errorCallback->scriptExecutionContext()) { 305 errorCallback->scriptExecutionContext()->eventLoop().queueTask(TaskSource::Geolocation, [errorCallback] { 306 errorCallback->handleEvent(GeolocationPositionError::create(GeolocationPositionError::POSITION_UNAVAILABLE, "Document is not fully active"_s)); 307 }); 308 } 309 return; 310 } 304 311 305 312 auto notifier = GeoNotifier::create(*this, WTFMove(successCallback), WTFMove(errorCallback), WTFMove(options)); … … 311 318 int Geolocation::watchPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options) 312 319 { 313 if (!frame()) 320 if (!document() || !document()->isFullyActive()) { 321 if (errorCallback && errorCallback->scriptExecutionContext()) { 322 errorCallback->scriptExecutionContext()->eventLoop().queueTask(TaskSource::Geolocation, [errorCallback] { 323 errorCallback->handleEvent(GeolocationPositionError::create(GeolocationPositionError::POSITION_UNAVAILABLE, "Document is not fully active"_s)); 324 }); 325 } 314 326 return 0; 327 } 315 328 316 329 auto notifier = GeoNotifier::create(*this, WTFMove(successCallback), WTFMove(errorCallback), WTFMove(options)); … … 694 707 } 695 708 696 RefPtr<GeolocationPosition> position = lastPosition(); 697 ASSERT(position); 698 699 makeSuccessCallbacks(*position); 709 if (RefPtr position = lastPosition()) 710 makeSuccessCallbacks(*position); 700 711 } 701 712 -
trunk/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h
r260848 r281520 45 45 return nullptr; 46 46 } 47 48 JSDOMGlobalObject* incumbentGlobalObject = &globalObject; 49 if (auto* globalObject = JSC::CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame)) 50 incumbentGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(globalObject); 47 51 48 return T::create(JSC::asObject(value), &globalObject);52 return T::create(JSC::asObject(value), incumbentGlobalObject); 49 53 } 50 54 }; … … 80 84 } 81 85 82 return T::create(JSC::asObject(value), &globalObject); 86 JSDOMGlobalObject* incumbentGlobalObject = &globalObject; 87 if (auto* globalObject = JSC::CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame)) 88 incumbentGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(globalObject); 89 90 return T::create(JSC::asObject(value), incumbentGlobalObject); 83 91 } 84 92 }; -
trunk/Source/WebCore/dom/IdleCallbackController.cpp
r252607 r281520 110 110 void IdleCallbackController::invokeIdleCallbacks(MonotonicTime deadline) 111 111 { 112 if (!m_document )112 if (!m_document || !m_document->frame()) 113 113 return; 114 114 -
trunk/Source/WebCore/dom/TaskSource.h
r275241 r281520 33 33 FileReading, 34 34 FontLoading, 35 Geolocation, 35 36 IdleTask, 36 37 IndexedDB,
Note: See TracChangeset
for help on using the changeset viewer.