<!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>[195686] 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/195686">195686</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-27 12:29:30 -0800 (Wed, 27 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add API to access closed shadowRoot in InjectedBundle
https://bugs.webkit.org/show_bug.cgi?id=153533
Reviewed by Antti Koivisto.
Source/WebCore:
Always return the shadow root in Element.shadowRootForBindings when the DOM wrapper world has
shadowRootIsAlwaysOpen set to true. Also renamed bindingShadowRoot to shadowRootForBindings
to be consistent.
* bindings/js/DOMWrapperWorld.h:
(WebCore::DOMWrapperWorld::setShadowRootIsAlwaysOpen): Added.
(WebCore::DOMWrapperWorld::shadowRootIsAlwaysOpen): Added.
* dom/Element.cpp:
(WebCore::Element::shadowRootForBindings): Renamed from bindingShadowRoot.
* dom/Element.h:
* dom/Element.idl:
Source/WebKit2:
Added WKBundleScriptWorldMakeAllShadowRootsOpen to make all shadow roots open.
This is needed to keep supporting certain browser-level features such as autofill.
* WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
(WKBundleScriptWorldMakeAllShadowRootsOpen): Added.
* WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h:
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
(WebKit::InjectedBundleScriptWorld::makeAllShadowRootsOpen): Added.
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
Tools:
Added WebKit2 API test for WKBundleScriptWorldMakeAllShadowRootsOpen.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp: Added.
(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakrAllShadowRootOpen_Bundle.cpp: Added.
(TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::InjectedBundleMakrAllShadowRootOpenTest):
(TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::initialize):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsDOMWrapperWorldh">trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoredomElementidl">trunk/Source/WebCore/dom/Element.idl</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleScriptWorldcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleScriptWorldh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleScriptWorldcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleScriptWorldh">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootOpen_Bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpencpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebCore/ChangeLog        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-01-27 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add API to access closed shadowRoot in InjectedBundle
+ https://bugs.webkit.org/show_bug.cgi?id=153533
+
+ Reviewed by Antti Koivisto.
+
+ Always return the shadow root in Element.shadowRootForBindings when the DOM wrapper world has
+ shadowRootIsAlwaysOpen set to true. Also renamed bindingShadowRoot to shadowRootForBindings
+ to be consistent.
+
+ * bindings/js/DOMWrapperWorld.h:
+ (WebCore::DOMWrapperWorld::setShadowRootIsAlwaysOpen): Added.
+ (WebCore::DOMWrapperWorld::shadowRootIsAlwaysOpen): Added.
+ * dom/Element.cpp:
+ (WebCore::Element::shadowRootForBindings): Renamed from bindingShadowRoot.
+ * dom/Element.h:
+ * dom/Element.idl:
+
</ins><span class="cx"> 2016-01-27 Zhuo Li <zachli@apple.com>
</span><span class="cx">
</span><span class="cx"> Need ability to specify alternate image for AutoFill button in input fields.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsDOMWrapperWorldh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -46,6 +46,9 @@
</span><span class="cx"> void didCreateWindowShell(ScriptController* scriptController) { m_scriptControllersWithWindowShells.add(scriptController); }
</span><span class="cx"> void didDestroyWindowShell(ScriptController* scriptController) { m_scriptControllersWithWindowShells.remove(scriptController); }
</span><span class="cx">
</span><ins>+ void setShadowRootIsAlwaysOpen() { m_shadowRootIsAlwaysOpen = true; }
+ bool shadowRootIsAlwaysOpen() const { return m_shadowRootIsAlwaysOpen; }
+
</ins><span class="cx"> // FIXME: can we make this private?
</span><span class="cx"> DOMObjectWrapperMap m_wrappers;
</span><span class="cx"> HashMap<CSSValue*, void*> m_cssValueRoots;
</span><span class="lines">@@ -61,6 +64,7 @@
</span><span class="cx"> JSC::VM& m_vm;
</span><span class="cx"> HashSet<ScriptController*> m_scriptControllersWithWindowShells;
</span><span class="cx"> bool m_isNormal;
</span><ins>+ bool m_shadowRootIsAlwaysOpen { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> DOMWrapperWorld& normalWorld(JSC::VM&);
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -1713,13 +1713,16 @@
</span><span class="cx"> return shadowRoot();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ShadowRoot* Element::bindingShadowRoot() const
</del><ins>+ShadowRoot* Element::shadowRootForBindings(JSC::ExecState& state) const
</ins><span class="cx"> {
</span><span class="cx"> ShadowRoot* root = shadowRoot();
</span><span class="cx"> if (!root)
</span><span class="cx"> return nullptr;
</span><del>- if (root->type() != ShadowRoot::Type::Open)
- return nullptr;
</del><ins>+
+ if (root->type() != ShadowRoot::Type::Open) {
+ if (!JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->world().shadowRootIsAlwaysOpen())
+ return nullptr;
+ }
</ins><span class="cx"> return root;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebCore/dom/Element.h        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx"> WEBCORE_EXPORT ShadowRoot* shadowRoot() const;
</span><span class="cx"> WEBCORE_EXPORT RefPtr<ShadowRoot> createShadowRoot(ExceptionCode&);
</span><span class="cx">
</span><del>- ShadowRoot* bindingShadowRoot() const;
</del><ins>+ ShadowRoot* shadowRootForBindings(JSC::ExecState&) const;
</ins><span class="cx"> RefPtr<ShadowRoot> attachShadow(const Dictionary&, ExceptionCode&);
</span><span class="cx">
</span><span class="cx"> ShadowRoot* userAgentShadowRoot() const;
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.idl (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.idl        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebCore/dom/Element.idl        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> // Shadow DOM API
</span><span class="cx"> #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
</span><span class="cx"> [Conditional=SHADOW_DOM, RaisesException] ShadowRoot attachShadow(Dictionary options);
</span><del>- [Conditional=SHADOW_DOM, ImplementedAs=bindingShadowRoot] readonly attribute ShadowRoot shadowRoot;
</del><ins>+ [Conditional=SHADOW_DOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot;
</ins><span class="cx"> [Conditional=SHADOW_DOM, Reflect] attribute DOMString slot;
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebKit2/ChangeLog        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-01-27 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add API to access closed shadowRoot in InjectedBundle
+ https://bugs.webkit.org/show_bug.cgi?id=153533
+
+ Reviewed by Antti Koivisto.
+
+ Added WKBundleScriptWorldMakeAllShadowRootsOpen to make all shadow roots open.
+ This is needed to keep supporting certain browser-level features such as autofill.
+
+ * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
+ (WKBundleScriptWorldMakeAllShadowRootsOpen): Added.
+ * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h:
+ * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
+ (WebKit::InjectedBundleScriptWorld::makeAllShadowRootsOpen): Added.
+ * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
+
</ins><span class="cx"> 2016-01-27 Zhuo Li <zachli@apple.com>
</span><span class="cx">
</span><span class="cx"> Need ability to specify alternate image for AutoFill button in input fields.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleScriptWorldcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -52,3 +52,8 @@
</span><span class="cx"> {
</span><span class="cx"> toImpl(scriptWorldRef)->clearWrappers();
</span><span class="cx"> }
</span><ins>+
+void WKBundleScriptWorldMakeAllShadowRootsOpen(WKBundleScriptWorldRef scriptWorldRef)
+{
+ toImpl(scriptWorldRef)->makeAllShadowRootsOpen();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleScriptWorldh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld();
</span><span class="cx"> WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld();
</span><span class="cx"> WK_EXPORT void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorld);
</span><ins>+WK_EXPORT void WKBundleScriptWorldMakeAllShadowRootsOpen(WKBundleScriptWorldRef scriptWorld);
</ins><span class="cx">
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleScriptWorldcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -88,4 +88,9 @@
</span><span class="cx"> m_world->clearWrappers();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InjectedBundleScriptWorld::makeAllShadowRootsOpen()
+{
+ m_world->setShadowRootIsAlwaysOpen();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleScriptWorldh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -45,8 +45,9 @@
</span><span class="cx"> virtual ~InjectedBundleScriptWorld();
</span><span class="cx">
</span><span class="cx"> WebCore::DOMWrapperWorld& coreWorld() const;
</span><del>-
</del><ins>+
</ins><span class="cx"> void clearWrappers();
</span><ins>+ void makeAllShadowRootsOpen();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> InjectedBundleScriptWorld(PassRefPtr<WebCore::DOMWrapperWorld>);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Tools/ChangeLog        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-01-27 Ryosuke Niwa <rniwa@webkit.org>
+
+ Add API to access closed shadowRoot in InjectedBundle
+ https://bugs.webkit.org/show_bug.cgi?id=153533
+
+ Reviewed by Antti Koivisto.
+
+ Added WebKit2 API test for WKBundleScriptWorldMakeAllShadowRootsOpen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp: Added.
+ (TestWebKitAPI::runJavaScriptAlert):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/InjectedBundleMakrAllShadowRootOpen_Bundle.cpp: Added.
+ (TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::InjectedBundleMakrAllShadowRootOpenTest):
+ (TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::initialize):
+
</ins><span class="cx"> 2016-01-27 Jason Marcell <jmarcell@apple.com>
</span><span class="cx">
</span><span class="cx"> Refactor logic for parsing Trac revisions into its own function and add logic for parsing git hashes.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (195685 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-01-27 20:24:37 UTC (rev 195685)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -268,6 +268,8 @@
</span><span class="cx">                 93F1DB3414DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB3314DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp */; };
</span><span class="cx">                 93F1DB5714DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB5614DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp */; };
</span><span class="cx">                 93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */; };
</span><ins>+                9B0786A31C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */; };
+                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */; };
</ins><span class="cx">                 9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */; };
</span><span class="cx">                 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */; };
</span><span class="cx">                 9B7916501BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B79164F1BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm */; };
</span><span class="lines">@@ -658,6 +660,8 @@
</span><span class="cx">                 93F1DB5614DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93F7E86B14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp; sourceTree = "<group>"; };
</span><ins>+                9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootsOpen.cpp; sourceTree = "<group>"; };
+                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootOpen_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><span class="cx">                 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLCollectionNamedItem.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1110,6 +1114,8 @@
</span><span class="cx">                                 9331407B17B4419000F083B1 /* DidNotHandleKeyDown.cpp */,
</span><span class="cx">                                 BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
</span><span class="cx">                                 BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
</span><ins>+                                9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */,
+                                9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */,
</ins><span class="cx">                                 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */,
</span><span class="cx">                                 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */,
</span><span class="cx">                                 F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */,
</span><span class="lines">@@ -1836,6 +1842,7 @@
</span><span class="cx">                                 41973B5B1AF2286A006C7B36 /* FileSystem.cpp in Sources */,
</span><span class="cx">                                 A1C4FB6E1BACCE50003742D0 /* QuickLook.mm in Sources */,
</span><span class="cx">                                 7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */,
</span><ins>+                                9B0786A31C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */,
</ins><span class="cx">                                 1A4F81CC1BDFFD37004E672E /* RemoteObjectRegistry.mm in Sources */,
</span><span class="cx">                                 51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */,
</span><span class="cx">                                 9B7916501BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm in Sources */,
</span><span class="lines">@@ -1894,6 +1901,7 @@
</span><span class="cx">                                 C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */,
</span><span class="cx">                                 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
</span><span class="cx">                                 7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */,
</span><ins>+                                9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp in Sources */,
</ins><span class="cx">                                 CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */,
</span><span class="cx">                                 BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
</span><span class="cx">                                 520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootOpen_Bundlecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp (0 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -0,0 +1,65 @@
</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(
+ "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
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2InjectedBundleMakeAllShadowRootsOpencppfromrev195685trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleScriptWorldcpp"></a>
<div class="copfile"><h4>Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp (from rev 195685, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp) (0 => 195686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp        2016-01-27 20:29:30 UTC (rev 195686)
</span><span class="lines">@@ -0,0 +1,72 @@
</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 "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
+{
+ ASSERT_NOT_NULL(frame);
+
+ EXPECT_EQ(page, WKFrameGetPage(frame));
+ EXPECT_WK_STREQ("PASS", alertText);
+
+ done = true;
+}
+
+TEST(WebKit2, InjectedBundleMakeAllShadowRootOpenTest)
+{
+ WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(WKStringCreateWithUTF8CString("InjectedBundleMakeAllShadowRootOpenTestPageGroup")));
+
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("InjectedBundleMakeAllShadowRootOpenTest", pageGroup.get()));
+ PlatformWebView webView(context.get(), pageGroup.get());
+
+ WKPageUIClientV0 uiClient;
+ memset(&uiClient, 0, sizeof(uiClient));
+
+ uiClient.base.version = 0;
+ uiClient.runJavaScriptAlert = runJavaScriptAlert;
+
+ WKPageSetPageUIClient(webView.page(), &uiClient.base);
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>