<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[208878] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/208878">208878</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-11-17 21:30:24 -0800 (Thu, 17 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add an experimental API to find elements across shadow boundaries
https://bugs.webkit.org/show_bug.cgi?id=164851
<rdar://problem/28220092>
Reviewed by Sam Weinig.
Source/JavaScriptCore:
* runtime/CommonIdentifiers.h:
Source/WebCore:
Add window.collectMatchingElementsInFlatTree(Node node, DOMString selectors)
as an experimental API which finds a list of elements that matches the given CSS selectors
and expose it to a JSWorld on which WKBundleScriptWorldMakeAllShadowRootsOpen was called.
No new tests. More test cases are added to WebKit2.InjectedBundleMakeAllShadowRootsOpen.
* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck): Added. Abstracts checks for EnabledAtRuntime and EnabledForWorld.
(OperationShouldBeOnInstance):
(GeneratePropertiesHashTable):
(GetRuntimeEnableFunctionName): Use worldForDOMObject(this).condition() for EnabledForWorld.
Also split the line for EnabledAtRuntime and EnabledAtRuntime for a better readability.
(GenerateImplementation):
(addIterableProperties):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/preprocess-idls.pl:
(GenerateConstructorAttribute):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSTestGlobalObject::finishCreation):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
(WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod):
(WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodCaller):
* bindings/scripts/test/TestGlobalObject.idl: Added a test case.
* bindings/scripts/test/TestObj.idl: Ditto.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::collectMatchingElementsInFlatTree): Added. Implements the feature by
calling SelectorQuery's matches on a node yielded by ComposedTreeIterator.
* page/DOMWindow.h:
* page/DOMWindow.idl:
Tools:
Added test cases for window.collectMatchingElementsInFlatTree to WebKit2.InjectedBundleMakeAllShadowRootOpen.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRoot*s*Open_Bundle.cpp: Renamed
from InjectedBundleMakeAllShadowRootOpen_Bundle.cpp.
(TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::initialize): Added test cases for
window.collectMatchingElementsInFlatTree by calling alert() many times.
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp:
(TestWebKitAPI::runJavaScriptAlert): Added expectations for multiple test cases. Each test case
finishes with a call to alert, and moves testNumber forward.
(TestWebKitAPI::TEST): Use the newly added closed-shadow-tree-test.html
* TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html: Added. Creates a shadow tree with slots
and tests that window.collectMatchingElementsInFlatTree is not present when
an event named "testnormalworld" is dispatched by the injected bundle.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributestxt">trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptspreprocessidlspl">trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestGlobalObjectidl">trunk/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpencpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpen_Bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2closedshadowtreetesthtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootOpen_Bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-11-17 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add an experimental API to find elements across shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=164851
+ <rdar://problem/28220092>
+
+ Reviewed by Sam Weinig.
+
+ * runtime/CommonIdentifiers.h:
+
</ins><span class="cx"> 2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [JSC] Drop arguments.caller
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -260,6 +260,7 @@
</span><span class="cx"> macro(value) \
</span><span class="cx"> macro(valueOf) \
</span><span class="cx"> macro(webkit) \
</span><ins>+ macro(collectMatchingElementsInFlatTree) \
</ins><span class="cx"> macro(webkitIDBCursor) \
</span><span class="cx"> macro(webkitIDBDatabase) \
</span><span class="cx"> macro(webkitIDBFactory) \
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/ChangeLog        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-11-17 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add an experimental API to find elements across shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=164851
+ <rdar://problem/28220092>
+
+ Reviewed by Sam Weinig.
+
+ Add window.collectMatchingElementsInFlatTree(Node node, DOMString selectors)
+ as an experimental API which finds a list of elements that matches the given CSS selectors
+ and expose it to a JSWorld on which WKBundleScriptWorldMakeAllShadowRootsOpen was called.
+
+ No new tests. More test cases are added to WebKit2.InjectedBundleMakeAllShadowRootsOpen.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (NeedsRuntimeCheck): Added. Abstracts checks for EnabledAtRuntime and EnabledForWorld.
+ (OperationShouldBeOnInstance):
+ (GeneratePropertiesHashTable):
+ (GetRuntimeEnableFunctionName): Use worldForDOMObject(this).condition() for EnabledForWorld.
+ Also split the line for EnabledAtRuntime and EnabledAtRuntime for a better readability.
+ (GenerateImplementation):
+ (addIterableProperties):
+ * bindings/scripts/IDLAttributes.txt:
+ * bindings/scripts/preprocess-idls.pl:
+ (GenerateConstructorAttribute):
+ * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+ (WebCore::JSTestGlobalObject::finishCreation):
+ (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld):
+ (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::JSTestObjPrototype::finishCreation):
+ (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod):
+ (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodCaller):
+ * bindings/scripts/test/TestGlobalObject.idl: Added a test case.
+ * bindings/scripts/test/TestObj.idl: Ditto.
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::collectMatchingElementsInFlatTree): Added. Implements the feature by
+ calling SelectorQuery's matches on a node yielded by ComposedTreeIterator.
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+
</ins><span class="cx"> 2016-11-17 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><span class="cx"> [WebIDL] Add support for ByteString
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -693,6 +693,13 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub NeedsRuntimeCheck
+{
+ my $interface = shift;
+ return $interface->extendedAttributes->{EnabledAtRuntime}
+ || $interface->extendedAttributes->{EnabledForWorld};
+}
+
</ins><span class="cx"> # https://heycam.github.io/webidl/#es-operations
</span><span class="cx"> sub OperationShouldBeOnInstance
</span><span class="cx"> {
</span><span class="lines">@@ -702,7 +709,7 @@
</span><span class="cx"> return 1 if IsGlobalOrPrimaryGlobalInterface($interface);
</span><span class="cx">
</span><span class="cx"> # FIXME: The bindings generator does not support putting runtime-enabled operations on the instance yet (except for global objects).
</span><del>- return 0 if $function->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ return 0 if NeedsRuntimeCheck($function);
</ins><span class="cx">
</span><span class="cx"> # [Unforgeable] operations should be on the instance. https://heycam.github.io/webidl/#Unforgeable
</span><span class="cx"> return 1 if IsUnforgeable($interface, $function);
</span><span class="lines">@@ -1875,7 +1882,7 @@
</span><span class="cx"> next if AttributeShouldBeOnInstance($interface, $attribute) != $isInstance;
</span><span class="cx">
</span><span class="cx"> # Global objects add RuntimeEnabled attributes after creation so do not add them to the static table.
</span><del>- if ($isInstance && $attribute->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if ($isInstance && NeedsRuntimeCheck($attribute)) {
</ins><span class="cx"> $propertyCount -= 1;
</span><span class="cx"> next;
</span><span class="cx"> }
</span><span class="lines">@@ -1904,7 +1911,7 @@
</span><span class="cx"> my $conditional = $attribute->extendedAttributes->{Conditional};
</span><span class="cx"> $conditionals->{$name} = $conditional if $conditional;
</span><span class="cx">
</span><del>- if ($attribute->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if (NeedsRuntimeCheck($attribute)) {
</ins><span class="cx"> push(@$runtimeEnabledAttributes, $attribute);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1920,7 +1927,7 @@
</span><span class="cx"> next if $function->name eq "[Symbol.Iterator]";
</span><span class="cx">
</span><span class="cx"> # Global objects add RuntimeEnabled operations after creation so do not add them to the static table.
</span><del>- if ($isInstance && $function->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if ($isInstance && NeedsRuntimeCheck($function)) {
</ins><span class="cx"> $propertyCount -= 1;
</span><span class="cx"> next;
</span><span class="cx"> }
</span><span class="lines">@@ -1947,7 +1954,7 @@
</span><span class="cx"> my $conditional = getConditionalForFunctionConsideringOverloads($function);
</span><span class="cx"> $conditionals->{$name} = $conditional if $conditional;
</span><span class="cx">
</span><del>- if ($function->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if (NeedsRuntimeCheck($function)) {
</ins><span class="cx"> push(@$runtimeEnabledFunctions, $function);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2511,8 +2518,16 @@
</span><span class="cx"> {
</span><span class="cx"> my $context = shift;
</span><span class="cx">
</span><ins>+ AddToImplIncludes("RuntimeEnabledFeatures.h");
+
+ if ($context->extendedAttributes->{EnabledForWorld}) {
+ return "worldForDOMObject(this)." . ToMethodName($context->extendedAttributes->{EnabledForWorld});
+ }
+
</ins><span class="cx"> # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::sharedFeatures().{FeatureName}Enabled() method.
</span><del>- return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->extendedAttributes->{EnabledAtRuntime}) . "Enabled" if ($context->extendedAttributes->{EnabledAtRuntime} && $context->extendedAttributes->{EnabledAtRuntime} ne "VALUE_IS_MISSING");
</del><ins>+ if ($context->extendedAttributes->{EnabledAtRuntime} && $context->extendedAttributes->{EnabledAtRuntime} ne "VALUE_IS_MISSING") {
+ return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->extendedAttributes->{EnabledAtRuntime}) . "Enabled";
+ }
</ins><span class="cx">
</span><span class="cx"> # Otherwise return a function named RuntimeEnabledFeatures::sharedFeatures().{methodName}Enabled().
</span><span class="cx"> return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->name) . "Enabled";
</span><span class="lines">@@ -3000,10 +3015,9 @@
</span><span class="cx">
</span><span class="cx"> # Support for RuntimeEnabled attributes on instances.
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless $attribute->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ next unless NeedsRuntimeCheck($attribute);
</ins><span class="cx"> next unless AttributeShouldBeOnInstance($interface, $attribute);
</span><span class="cx">
</span><del>- AddToImplIncludes("RuntimeEnabledFeatures.h");
</del><span class="cx"> my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
</span><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> my $enable_function = GetRuntimeEnableFunctionName($attribute);
</span><span class="lines">@@ -3035,11 +3049,10 @@
</span><span class="cx">
</span><span class="cx"> # Support for RuntimeEnabled operations on instances.
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- next unless $function->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ next unless NeedsRuntimeCheck($function);
</ins><span class="cx"> next unless OperationShouldBeOnInstance($interface, $function);
</span><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><span class="cx">
</span><del>- AddToImplIncludes("RuntimeEnabledFeatures.h");
</del><span class="cx"> my $conditionalString = $codeGenerator->GenerateConditionalString($function);
</span><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> my $enable_function = GetRuntimeEnableFunctionName($function);
</span><span class="lines">@@ -5027,8 +5040,7 @@
</span><span class="cx"> my $interface = shift;
</span><span class="cx"> my $className = shift;
</span><span class="cx">
</span><del>- if ($interface->iterable->extendedAttributes->{EnabledAtRuntime}) {
- AddToImplIncludes("RuntimeEnabledFeatures.h");
</del><ins>+ if (NeedsRuntimeCheck($interface->iterable)) {
</ins><span class="cx"> my $enable_function = GetRuntimeEnableFunctionName($interface->iterable);
</span><span class="cx"> push(@implContent, " if (${enable_function}())\n ");
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> DocumentEventHandler
</span><span class="cx"> EnabledAtRuntime=*
</span><span class="cx"> EnabledBySetting=*
</span><ins>+EnabledForWorld=*
</ins><span class="cx"> EnforceRange
</span><span class="cx"> ExportMacro=WEBCORE_EXPORT|WEBCORE_TESTSUPPORT_EXPORT
</span><span class="cx"> ExportToWrappedFunction
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptspreprocessidlspl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx"> my $code = " ";
</span><span class="cx"> my @extendedAttributesList;
</span><span class="cx"> foreach my $attributeName (sort keys %{$extendedAttributes}) {
</span><del>- next unless ($attributeName eq "Conditional" || $attributeName eq "EnabledAtRuntime" || $attributeName eq "EnabledBySetting" || $attributeName eq "PrivateIdentifier" || $attributeName eq "PublicIdentifier");
</del><ins>+ next unless ($attributeName eq "Conditional" || $attributeName eq "EnabledAtRuntime" || $attributeName eq "EnabledForWorld" || $attributeName eq "EnabledBySetting" || $attributeName eq "PrivateIdentifier" || $attributeName eq "PublicIdentifier");
</ins><span class="cx"> my $extendedAttribute = $attributeName;
</span><span class="cx"> $extendedAttribute .= "=" . $extendedAttributes->{$attributeName} unless $extendedAttributes->{$attributeName} eq "VALUE_IS_MISSING";
</span><span class="cx"> push(@extendedAttributesList, $extendedAttribute);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation(JSC::ExecState*);
</span><span class="cx"> #endif
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld(JSC::ExecState*);
</ins><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionTestPrivateFunction(JSC::ExecState*);
</span><span class="cx"> #endif
</span><span class="lines">@@ -159,6 +160,8 @@
</span><span class="cx"> if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
</span><span class="cx"> putDirectNativeFunction(vm, this, vm.propertyNames->enabledAtRuntimeOperation, 1, jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation, NoIntrinsic, attributesForStructure(JSC::Function));
</span><span class="cx"> #endif
</span><ins>+ if (worldForDOMObject(this).specificWorld())
+ putDirectNativeFunction(vm, this, vm.propertyNames->enabledInSpecificWorld, 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld, NoIntrinsic, attributesForStructure(JSC::Function));
</ins><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
</span><span class="cx"> putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().testPrivateFunctionPrivateName(), 0, jsTestGlobalObjectInstanceFunctionTestPrivateFunction, NoIntrinsic, attributesForStructure(JSC::Function));
</span><span class="lines">@@ -451,6 +454,26 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller(JSC::ExecState*, JSTestGlobalObject*, JSC::ThrowScope&);
+
+EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld(ExecState* state)
+{
+ return BindingCaller<JSTestGlobalObject>::callOperation<jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller>(state, "enabledInSpecificWorld");
+}
+
+static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller(JSC::ExecState* state, JSTestGlobalObject* castedThis, JSC::ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0), IntegerConversionConfiguration::Normal);
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ impl.enabledInSpecificWorld(WTFMove(testParam));
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionTestPrivateFunctionCaller(JSC::ExecState*, JSTestGlobalObject*, JSC::ThrowScope&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -938,6 +938,7 @@
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledAtRuntimeOperation(JSC::ExecState*);
</span><span class="cx"> #endif
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWorldSpecificMethod(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionByteMethod(JSC::ExecState*);
</span><span class="lines">@@ -1545,6 +1546,7 @@
</span><span class="cx"> #else
</span><span class="cx"> { 0, 0, NoIntrinsic, { 0, 0 } },
</span><span class="cx"> #endif
</span><ins>+ { "worldSpecificMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWorldSpecificMethod), (intptr_t) (1) } },
</ins><span class="cx"> { "voidMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t) (0) } },
</span><span class="cx"> { "voidMethodWithArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t) (3) } },
</span><span class="cx"> { "byteMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionByteMethod), (intptr_t) (0) } },
</span><span class="lines">@@ -1726,6 +1728,11 @@
</span><span class="cx"> JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+ if (!worldForDOMObject(this).someWorld()) {
+ Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("worldSpecificMethod"), strlen("worldSpecificMethod"));
+ VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+ JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+ }
</ins><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
</span><span class="cx"> Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttribute"), strlen("enabledAtRuntimeAttribute"));
</span><span class="lines">@@ -4711,6 +4718,26 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionWorldSpecificMethodCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWorldSpecificMethod(ExecState* state)
+{
+ return BindingCaller<JSTestObj>::callOperation<jsTestObjPrototypeFunctionWorldSpecificMethodCaller>(state, "worldSpecificMethod");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionWorldSpecificMethodCaller(JSC::ExecState* state, JSTestObj* castedThis, JSC::ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0), IntegerConversionConfiguration::Normal);
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ impl.worldSpecificMethod(WTFMove(testParam));
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionVoidMethodCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestGlobalObjectidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam);
</span><span class="cx"> [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam);
</span><span class="cx">
</span><ins>+ [EnabledForWorld=specificWorld] void enabledInSpecificWorld(long testParam);
+
</ins><span class="cx"> [PrivateIdentifier, Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void testPrivateFunction();
</span><span class="cx"> [JSBuiltin, Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void testJSBuiltinFunction();
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -109,6 +109,8 @@
</span><span class="cx"> [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam);
</span><span class="cx"> [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam);
</span><span class="cx">
</span><ins>+ [EnabledForWorld=someWorld] void worldSpecificMethod(long testParam);
+
</ins><span class="cx"> // TypedArray attribute
</span><span class="cx"> attribute Float32Array typedArrayAttr;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "CSSRuleList.h"
</span><span class="cx"> #include "Chrome.h"
</span><span class="cx"> #include "ChromeClient.h"
</span><ins>+#include "ComposedTreeIterator.h"
</ins><span class="cx"> #include "ContentExtensionActions.h"
</span><span class="cx"> #include "ContentExtensionRule.h"
</span><span class="cx"> #include "Crypto.h"
</span><span class="lines">@@ -89,8 +90,10 @@
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx"> #include "SecurityOriginData.h"
</span><span class="cx"> #include "SecurityPolicy.h"
</span><ins>+#include "SelectorQuery.h"
</ins><span class="cx"> #include "SerializedScriptValue.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include "StaticNodeList.h"
</ins><span class="cx"> #include "Storage.h"
</span><span class="cx"> #include "StorageArea.h"
</span><span class="cx"> #include "StorageNamespace.h"
</span><span class="lines">@@ -632,6 +635,33 @@
</span><span class="cx"> return *m_customElementRegistry;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<Ref<NodeList>> DOMWindow::collectMatchingElementsInFlatTree(Node& scope, const String& selectors)
+{
+ if (!m_frame)
+ return Exception { NOT_SUPPORTED_ERR };
+
+ Document* document = m_frame->document();
+ if (!document)
+ return Exception { NOT_SUPPORTED_ERR };
+
+ auto queryOrException = document->selectorQueryForString(selectors);
+ if (queryOrException.hasException())
+ return queryOrException.releaseException();
+
+ if (!is<ContainerNode>(scope))
+ return Ref<NodeList> { StaticElementList::create() };
+
+ SelectorQuery& query = queryOrException.releaseReturnValue();
+
+ Vector<Ref<Element>> result;
+ for (auto& node : composedTreeDescendants(downcast<ContainerNode>(scope))) {
+ if (is<Element>(node) && query.matches(downcast<Element>(node)))
+ result.append(downcast<Element>(node));
+ }
+
+ return Ref<NodeList> { StaticElementList::create(WTFMove(result)) };
+}
+
</ins><span class="cx"> #if ENABLE(ORIENTATION_EVENTS)
</span><span class="cx">
</span><span class="cx"> int DOMWindow::orientation() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> class MessagePort;
</span><span class="cx"> class Navigator;
</span><span class="cx"> class Node;
</span><ins>+class NodeList;
</ins><span class="cx"> class Page;
</span><span class="cx"> class PageConsoleClient;
</span><span class="cx"> class Performance;
</span><span class="lines">@@ -295,6 +296,8 @@
</span><span class="cx"> CustomElementRegistry* customElementRegistry() { return m_customElementRegistry.get(); }
</span><span class="cx"> CustomElementRegistry& ensureCustomElementRegistry();
</span><span class="cx">
</span><ins>+ ExceptionOr<Ref<NodeList>> collectMatchingElementsInFlatTree(Node&, const String& selectors);
+
</ins><span class="cx"> #if ENABLE(ORIENTATION_EVENTS)
</span><span class="cx"> // This is the interface orientation in degrees. Some examples are:
</span><span class="cx"> // 0 is straight up; -90 is when the device is rotated 90 clockwise;
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -173,6 +173,9 @@
</span><span class="cx">
</span><span class="cx"> [EnabledAtRuntime=CustomElements, ImplementedAs=ensureCustomElementRegistry] readonly attribute CustomElementRegistry customElements;
</span><span class="cx">
</span><ins>+ [MayThrowException, EnabledForWorld=shadowRootIsAlwaysOpen]
+ NodeList collectMatchingElementsInFlatTree(Node scope, DOMString selectors);
+
</ins><span class="cx"> // Event handlers unique to Element and DOMWindow.
</span><span class="cx"> // FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
</span><span class="cx"> [NotEnumerable] attribute EventHandler onanimationend;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Tools/ChangeLog        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-11-17 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add an experimental API to find elements across shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=164851
+ <rdar://problem/28220092>
+
+ Reviewed by Sam Weinig.
+
+ Added test cases for window.collectMatchingElementsInFlatTree to WebKit2.InjectedBundleMakeAllShadowRootOpen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRoot*s*Open_Bundle.cpp: Renamed
+ from InjectedBundleMakeAllShadowRootOpen_Bundle.cpp.
+ (TestWebKitAPI::InjectedBundleMakeAllShadowRootOpenTest::initialize): Added test cases for
+ window.collectMatchingElementsInFlatTree by calling alert() many times.
+ * TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp:
+ (TestWebKitAPI::runJavaScriptAlert): Added expectations for multiple test cases. Each test case
+ finishes with a call to alert, and moves testNumber forward.
+ (TestWebKitAPI::TEST): Use the newly added closed-shadow-tree-test.html
+ * TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html: Added. Creates a shadow tree with slots
+ and tests that window.collectMatchingElementsInFlatTree is not present when
+ an event named "testnormalworld" is dispatched by the injected bundle.
+
</ins><span class="cx"> 2016-11-17 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Add _WKIconLoadingDelegate SPI.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -433,8 +433,9 @@
</span><span class="cx">                 93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */; };
</span><span class="cx">                 9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */; };
</span><span class="cx">                 9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9984FACD1CFFB038008D198C /* editable-body.html */; };
</span><del>-                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */; };
</del><ins>+                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp */; };
</ins><span class="cx">                 9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */; };
</span><ins>+                9B270FEE1DDC2C0B002D53F3 /* closed-shadow-tree-test.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */; };
</ins><span class="cx">                 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */; };
</span><span class="cx">                 9C64DC321D76198A004B598E /* YouTubePluginReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C64DC311D76198A004B598E /* YouTubePluginReplacement.cpp */; };
</span><span class="cx">                 A1146A8D1D2D7115000FE710 /* ContentFiltering.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1146A8A1D2D704F000FE710 /* ContentFiltering.mm */; };
</span><span class="lines">@@ -579,6 +580,7 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                9B270FEE1DDC2C0B002D53F3 /* closed-shadow-tree-test.html in Copy Resources */,
</ins><span class="cx">                                 F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */,
</span><span class="cx">                                 8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */,
</span><span class="cx">                                 AD57AC221DA7466E00FF1BDE /* many-iframes.html in Copy Resources */,
</span><span class="lines">@@ -1077,9 +1079,10 @@
</span><span class="cx">                 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewTextInput.mm; sourceTree = "<group>"; };
</span><span class="cx">                 9984FACD1CFFB038008D198C /* editable-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-body.html"; sourceTree = "<group>"; };
</span><span class="cx">                 9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootsOpen.cpp; sourceTree = "<group>"; };
</span><del>-                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootOpen_Bundle.cpp; sourceTree = "<group>"; };
</del><ins>+                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 9B26FC6B159D061000CC3765 /* HTMLFormCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLFormCollectionNamedItem.mm; sourceTree = "<group>"; };
</span><span class="cx">                 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HTMLFormCollectionNamedItem.html; sourceTree = "<group>"; };
</span><ins>+                9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "closed-shadow-tree-test.html"; sourceTree = "<group>"; };
</ins><span class="cx">                 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLCollectionNamedItem.mm; sourceTree = "<group>"; };
</span><span class="cx">                 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HTMLCollectionNamedItem.html; sourceTree = "<group>"; };
</span><span class="cx">                 9B79164F1BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FirstResponderScrollingPosition.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1727,7 +1730,7 @@
</span><span class="cx">                                 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */,
</span><span class="cx">                                 F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */,
</span><span class="cx">                                 F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */,
</span><del>-                                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */,
</del><ins>+                                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp */,
</ins><span class="cx">                                 9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */,
</span><span class="cx">                                 93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */,
</span><span class="cx">                                 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */,
</span><span class="lines">@@ -1870,6 +1873,7 @@
</span><span class="cx">                                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
</span><span class="cx">                                 7C486BA01AA1254B003F6F9B /* bundle-file.html */,
</span><span class="cx">                                 1A50AA1F1A2A4EA500F4C345 /* close-from-within-create-page.html */,
</span><ins>+                                9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */,
</ins><span class="cx">                                 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
</span><span class="cx">                                 C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
</span><span class="cx">                                 BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
</span><span class="lines">@@ -2669,7 +2673,7 @@
</span><span class="cx">                                 378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */,
</span><span class="cx">                                 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */,
</span><span class="cx">                                 BC575A97126E74F1006F0F12 /* InjectedBundleMain.cpp in Sources */,
</span><del>-                                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp in Sources */,
</del><ins>+                                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp in Sources */,
</ins><span class="cx">                                 33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */,
</span><span class="cx">                                 33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */,
</span><span class="cx">                                 93F1DB3414DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootOpen_Bundlecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "InjectedBundleTest.h"
-#include <WebKit/WKBundlePageGroup.h>
-#include <WebKit/WKBundlePrivate.h>
-#include <WebKit/WKBundleScriptWorld.h>
-#include <WebKit/WKRetainPtr.h>
-#include <assert.h>
-
-namespace TestWebKitAPI {
-
-class InjectedBundleMakeAllShadowRootOpenTest : public InjectedBundleTest {
-public:
- InjectedBundleMakeAllShadowRootOpenTest(const std::string& identifier)
- : InjectedBundleTest(identifier)
- { }
-
- virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
- {
- assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
- WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
-
- auto world = WKBundleScriptWorldCreateWorld();
- WKBundleScriptWorldMakeAllShadowRootsOpen(world);
-
- WKRetainPtr<WKStringRef> source(AdoptWK, WKStringCreateWithUTF8CString(
- "var element = document.createElement('div');"
- "element.attachShadow({mode: 'closed'});"
- "alert(element.shadowRoot ? 'PASS' : 'FAIL');"));
- WKBundleAddUserScript(bundle, pageGroup, world, source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
- }
-};
-
-static InjectedBundleTest::Register<InjectedBundleMakeAllShadowRootOpenTest> registrar("InjectedBundleMakeAllShadowRootOpenTest");
-
-} // namespace TestWebKitAPI
-
-#endif
</del></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpencpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp (208877 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp        2016-11-18 05:11:18 UTC (rev 208877)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">
</span><span class="cx"> namespace TestWebKitAPI {
</span><span class="cx">
</span><ins>+static unsigned testNumber = 0;
</ins><span class="cx"> static bool done;
</span><span class="cx">
</span><span class="cx"> static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
</span><span class="lines">@@ -41,9 +42,27 @@
</span><span class="cx"> ASSERT_NOT_NULL(frame);
</span><span class="cx">
</span><span class="cx"> EXPECT_EQ(page, WKFrameGetPage(frame));
</span><del>- EXPECT_WK_STREQ("PASS", alertText);
-
- done = true;
</del><ins>+ switch (++testNumber) {
+ case 1:
+ EXPECT_WK_STREQ("PASS: shadowRoot created in injected bundle", alertText);
+ break;
+ case 2:
+ EXPECT_WK_STREQ("PASS: shadowRoot created by normal world", alertText);
+ break;
+ case 3:
+ EXPECT_WK_STREQ("PASS: query method exists", alertText);
+ break;
+ case 4:
+ EXPECT_WK_STREQ("PASS: query method was not present in the normal world", alertText);
+ break;
+ case 5:
+ EXPECT_WK_STREQ("Found:1,2,3,4,5,6", alertText);
+ break;
+ case 6:
+ EXPECT_WK_STREQ("Found:2,3,4", alertText);
+ done = true;
+ break;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(WebKit2, InjectedBundleMakeAllShadowRootOpenTest)
</span><span class="lines">@@ -61,7 +80,7 @@
</span><span class="cx">
</span><span class="cx"> WKPageSetPageUIClient(webView.page(), &uiClient.base);
</span><span class="cx">
</span><del>- WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
</del><ins>+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("closed-shadow-tree-test", "html"));
</ins><span class="cx"> WKPageLoadURL(webView.page(), url.get());
</span><span class="cx">
</span><span class="cx"> Util::run(&done);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpen_Bundlecppfromrev208877trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootOpen_Bundlecpp"></a>
<div class="copfile"><h4>Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp (from rev 208877, trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp) (0 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "InjectedBundleTest.h"
+#include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePrivate.h>
+#include <WebKit/WKBundleScriptWorld.h>
+#include <WebKit/WKRetainPtr.h>
+#include <assert.h>
+
+namespace TestWebKitAPI {
+
+class InjectedBundleMakeAllShadowRootOpenTest : public InjectedBundleTest {
+public:
+ InjectedBundleMakeAllShadowRootOpenTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+ { }
+
+ virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
+ {
+ assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
+ WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
+
+ auto world = WKBundleScriptWorldCreateWorld();
+ WKBundleScriptWorldMakeAllShadowRootsOpen(world);
+
+ WKRetainPtr<WKStringRef> source(AdoptWK, WKStringCreateWithUTF8CString(
+ "window.onload = function () {\n"
+ " const element = document.createElement('div');\n"
+ " const queryMethodName = 'collectMatchingElementsInFlatTree';\n"
+ " element.attachShadow({mode: 'closed'});\n"
+ // Test 1
+ " alert(element.shadowRoot ? 'PASS: shadowRoot created in injected bundle' : 'FAIL');\n"
+ // Test 2
+ " alert(document.querySelector('shadow-host').shadowRoot ? 'PASS: shadowRoot created by normal world' : 'FAIL');\n"
+ // Test 3
+ " alert(window[queryMethodName] ? 'PASS: query method exists' : 'FAIL');\n"
+ // Test 4
+ " document.dispatchEvent(new Event('testnormalworld'));\n"
+ // Test 5
+ " const queryMethod = window[queryMethodName];\n"
+ " let queryResult = Array.from(queryMethod(document, 'span'));\n"
+ " alert('Found:' + queryResult.map((span) => span.textContent).join(','));\n"
+ // Test 6
+ " const innerHost = queryMethod(document, 'inner-host')[0];\n"
+ " queryResult = Array.from(queryMethod(innerHost, 'span'));\n"
+ " alert('Found:' + queryResult.map((span) => span.textContent).join(','));\n"
+ "}\n"));
+ WKBundleAddUserScript(bundle, pageGroup, world, source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+ }
+};
+
+static InjectedBundleTest::Register<InjectedBundleMakeAllShadowRootOpenTest> registrar("InjectedBundleMakeAllShadowRootOpenTest");
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2closedshadowtreetesthtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html (0 => 208878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/closed-shadow-tree-test.html        2016-11-18 05:30:24 UTC (rev 208878)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<shadow-host><span>5</span><span slot="bar">2</span></shadow-host>
+<script>
+const shadowRoot = document.querySelector('shadow-host').attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = `
+ <span>1</span>
+ <inner-host>
+ <slot name="bar" slot="foo"><span>FAIL - named slot fallback</span></slot>
+ <span>FAIL - unassigned content</span>
+ <span slot="foo">3</span>
+ </inner-host>
+ <slot><span>FAIL - default slot fallback</span></slot>
+ <span>6</span>`;
+const innerHost = shadowRoot.querySelector('inner-host');
+innerHost.attachShadow({mode: 'closed'}).innerHTML = `
+ <slot name="foo"></slot>
+ <span>4</span>`;
+
+document.addEventListener('testnormalworld', function () {
+ alert(window.collectMatchingElementsInFlatTree ?
+ 'FAIL' : 'PASS: query method was not present in the normal world');
+});
+
+</script>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>