Skip to content

Commit

Permalink
WebKitTestRunner's hasDocumentElement should return false if there is…
Browse files Browse the repository at this point in the history
… no JS context

https://bugs.webkit.org/show_bug.cgi?id=267483
rdar://120933913

Reviewed by Charlie Wolfe.

A RemoteFrame has no JS context because the JS context is in another process.
This little change fixes a crash in layout tests with --site-isolation

* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::hasDocumentElement):

Canonical link: https://commits.webkit.org/273009@main
  • Loading branch information
achristensen07 authored and Ahmad Saleem committed Jan 13, 2024
1 parent ddb7082 commit 247db08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LayoutTests/platform/mac-site-isolation/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-ne
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-star-allow.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-allow.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-block.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-none-block.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-self-block.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-star-allow.html [ Skip ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-url-allow.html [ Skip ]
Expand Down Expand Up @@ -623,3 +622,4 @@ http/wpt/webrtc/audiovideo-script-transform.html [ ImageOnlyFailure Failure ]
http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html [ ImageOnlyFailure Failure ]
http/wpt/webrtc/video-script-transform-simulcast.html [ ImageOnlyFailure Failure ]
http/wpt/webrtc/video-script-transform.html [ ImageOnlyFailure Failure ]
http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-none-block.html [ ImageOnlyFailure Failure ]
2 changes: 2 additions & 0 deletions Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ void InjectedBundlePage::dumpAllFrameScrollPositions(StringBuilder& stringBuilde
static bool hasDocumentElement(WKBundleFrameRef frame)
{
auto context = WKBundleFrameGetJavaScriptContext(frame);
if (!context)
return false;
return objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement" });
}

Expand Down

0 comments on commit 247db08

Please sign in to comment.