Changeset 280826 in webkit
- Timestamp:
- Aug 10, 2021, 1:25:31 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/frames/sandboxed-iframe-navigation-parent-expected.txt (modified) (1 diff)
-
LayoutTests/fast/frames/sandboxed-iframe-navigation-parent.html (modified) (3 diffs)
-
LayoutTests/http/tests/security/frameNavigation/context-for-location-assign-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/Location.cpp (modified) (4 diffs)
-
Source/WebCore/page/Location.h (modified) (1 diff)
-
Source/WebCore/page/Location.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280824 r280826 1 2021-08-09 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Partially revert r280256 behavior change since it broke Facetime 4 https://bugs.webkit.org/show_bug.cgi?id=228943 5 rdar://81700268 6 7 Reviewed by Mark Lam. 8 9 * fast/frames/sandboxed-iframe-navigation-parent-expected.txt: 10 * fast/frames/sandboxed-iframe-navigation-parent.html: 11 * http/tests/security/frameNavigation/context-for-location-assign-expected.txt: 12 1 13 2021-08-09 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-parent-expected.txt
r280256 r280826 1 CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL 'sandboxed-iframe-navigation-source.html'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors. 2 3 CONSOLE MESSAGE: SecurityError: The operation is insecure. 4 This test verifies that a sandboxed IFrame cannot navigate an ancestor in the frame tree by assigning the location attribute. 5 6 This is done by loading ten non-sandboxed IFrames, and a single sandboxed one. Expect ten frames to be navigated, but the sandboxed one to not be one of them. 1 This test verifies that a sandboxed IFrame with the keywords allow-scripts and allow-same-origin is allowed to navigate an ancestor in the frame tree by assigning the location attribute. 7 2 8 3 This test will print "PASS" on success. -
trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-parent.html
r280256 r280826 14 14 var testStatus = document.getElementById('testStatus'); 15 15 16 if (self.navigated.location.href.indexOf('parent.html') == -1)17 testStatus.innerHTML = 'FAIL: disallowed frame navigated';18 else if (navigatedFrames == 1 0)16 if (self.navigated.location.href.indexOf('parent.html') != -1) 17 testStatus.innerHTML = 'FAIL: sandboxed frame couldn\'t navigate'; 18 else if (navigatedFrames == 11) 19 19 testStatus.innerHTML = 'PASS'; 20 20 else … … 29 29 ++navigatedFrames; 30 30 31 if (navigatedFrames == 1 0)31 if (navigatedFrames == 11) 32 32 checkResults(); 33 33 } … … 38 38 <body> 39 39 40 <p>This test verifies that a sandboxed IFrame cannot navigate an ancestor 40 <p>This test verifies that a sandboxed IFrame with the keywords 41 allow-scripts and allow-same-origin is allowed to navigate an ancestor 41 42 in the frame tree by assigning the location attribute.</p> 42 43 43 <p>This is done by loading ten non-sandboxed IFrames, and a single44 sandboxed one. Expect ten frames to be navigated, but the sandboxed45 one to <b>not</b> be one of them.</p>46 47 44 <p>This test will print "PASS" on success.</p> 48 45 -
trunk/LayoutTests/http/tests/security/frameNavigation/context-for-location-assign-expected.txt
r280256 r280826 1 document.referrer = http://127.0.0.1:8000/security/frameNavigation/context-for-location-assign.html1 document.referrer = 2 2 -
trunk/Source/WebCore/ChangeLog
r280824 r280826 1 2021-08-09 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Partially revert r280256 behavior change since it broke Facetime 4 https://bugs.webkit.org/show_bug.cgi?id=228943 5 rdar://81700268 6 7 Reviewed by Mark Lam. 8 9 In r280256, custom accessors start getting holder's JSGlobalObject (this is right behavior). 10 We also introduced IncumbentWindow IDL attribute to get the caller's JSGlobalObject, which is 11 necessary in Location. At that time, we replaced all ActiveWindow to IncumbentWindow, but it 12 changes the JSGlobalObject of `replace`, `assign`, and `reload` since they are functions (not 13 custom accessors). We observed that, after this change, facetime Web page is broken: when opening 14 the link to Facetime, it should show the prompt of "Open in Facetime app" in iOS. But after this 15 change, it won't happen. 16 17 We revert the semantic change by using ActiveWindow for replace, assign, and reload. This is 18 not the correct semantics from the spec, but this is the same to one before r280256, and we 19 will change this once we find the way to bypass this issue. 20 21 * page/Location.cpp: 22 (WebCore::Location::assign): 23 (WebCore::Location::replace): 24 (WebCore::Location::reload): 25 * page/Location.h: 26 * page/Location.idl: 27 1 28 2021-08-09 Chris Dumez <cdumez@apple.com> 2 29 -
trunk/Source/WebCore/page/Location.cpp
r280333 r280826 211 211 } 212 212 213 ExceptionOr<void> Location::assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& url)213 ExceptionOr<void> Location::assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url) 214 214 { 215 215 if (!frame()) 216 216 return { }; 217 return setLocation( incumbentWindow, firstWindow, url);218 } 219 220 ExceptionOr<void> Location::replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& urlString)217 return setLocation(activeWindow, firstWindow, url); 218 } 219 220 ExceptionOr<void> Location::replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString) 221 221 { 222 222 auto* frame = this->frame(); … … 235 235 236 236 // We call DOMWindow::setLocation directly here because replace() always operates on the current frame. 237 frame->document()->domWindow()->setLocation( incumbentWindow, completedURL, LockHistoryAndBackForwardList);237 frame->document()->domWindow()->setLocation(activeWindow, completedURL, LockHistoryAndBackForwardList); 238 238 return { }; 239 239 } 240 240 241 void Location::reload(DOMWindow& incumbentWindow)241 void Location::reload(DOMWindow& activeWindow) 242 242 { 243 243 auto* frame = this->frame(); … … 245 245 return; 246 246 247 ASSERT( incumbentWindow.document());247 ASSERT(activeWindow.document()); 248 248 ASSERT(frame->document()); 249 249 ASSERT(frame->document()->domWindow()); 250 250 251 auto& activeDocument = * incumbentWindow.document();251 auto& activeDocument = *activeWindow.document(); 252 252 auto& targetDocument = *frame->document(); 253 253 … … 257 257 if (!activeDocument.securityOrigin().isSameOriginDomain(targetDocument.securityOrigin())) { 258 258 auto& targetWindow = *targetDocument.domWindow(); 259 targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage( incumbentWindow, IncludeTargetOrigin::Yes));259 targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage(activeWindow, IncludeTargetOrigin::Yes)); 260 260 return; 261 261 } -
trunk/Source/WebCore/page/Location.h
r280313 r280826 46 46 String href() const; 47 47 48 ExceptionOr<void> assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);49 ExceptionOr<void> replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);50 void reload(DOMWindow& incumbentWindow);48 ExceptionOr<void> assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&); 49 ExceptionOr<void> replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&); 50 void reload(DOMWindow& activeWindow); 51 51 52 52 ExceptionOr<void> setProtocol(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&); -
trunk/Source/WebCore/page/Location.idl
r280256 r280826 46 46 [SetterCallWith=IncumbentWindow&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href; 47 47 48 [CallWith=IncumbentWindow&FirstWindow] undefined assign(USVString url); 49 [CallWith=IncumbentWindow&FirstWindow, DoNotCheckSecurity] undefined replace(USVString url); 50 [CallWith=IncumbentWindow] undefined reload(); 48 // FIXME: We should use IncumbentWindow once we found why https://bugs.webkit.org/show_bug.cgi?id=228943 issue occured. 49 [CallWith=ActiveWindow&FirstWindow] undefined assign(USVString url); 50 [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity] undefined replace(USVString url); 51 [CallWith=ActiveWindow] undefined reload(); 51 52 52 53 // URI decomposition attributes
Note:
See TracChangeset
for help on using the changeset viewer.