Commit 6695fdd5 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Mechanically replace Shadow DOM v0 with v1 in web_tests [CL 2 of 3]

This CL is the result of the following mechanical replacements, within
the third_party/blink/web_tests folder, on only .html and .js files:

'.createShadowRoot()'               -> '.attachShadow({mode: 'open'})'
'document.createElement('content')' -> 'document.createElement('span')'

Several web_tests did not pass after the above replacements were made.
Those tests were reverted - the changes in this CL are only the tests
that pass in the same way that they did prior to the replacements.
The only exceptions, which were re-baselined here, had *only* a
console warning message like this, which is now missing:

CONSOLE WARNING: line 27: Element.createShadowRoot is deprecated
and will be removed in M80, around February 2020. Please use...

In addition, most of the same test expectations files were completely
removed from the virtual/web-components-v0-disabled folder, since these
tests no longer depend on WCv0 features, and no longer fail.

Bug: 937746
Change-Id: Ie27e959a39e4c6de6655abb13f71b2e0d56853c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208387
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771443}
parent a32c160d
CONSOLE WARNING: line 15: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
PASS unless crash
PASS successfullyParsed is true
......
......@@ -12,7 +12,7 @@ document.body.appendChild(newStyle);
newDiv = document.createElement("div");
// Inserting <iframe> into tree flushes the pending @onload event.
newDiv.innerHTML = "<iframe></iframe><style></style>";
myDiv.createShadowRoot().appendChild(newDiv);
myDiv.attachShadow({mode: 'open'}).appendChild(newDiv);
debug("PASS unless crash");
</script>
......
CONSOLE WARNING: line 12: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
Test that cycle detection traverses over both templates and shadow roots
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
......@@ -9,7 +9,7 @@ description('Test that cycle detection traverses over both templates and shadow
var outerDiv = document.getElementById('container');
var template = document.querySelector('template');
var div = template.content.firstChild;
var shadowRoot = div.createShadowRoot();
var shadowRoot = div.attachShadow({mode: 'open'});
var shadowDiv = shadowRoot.appendChild(document.createElement('div'));
shouldThrow('shadowDiv.appendChild(outerDiv)');
</script>
......
CONSOLE WARNING: line 11: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
......@@ -8,7 +8,7 @@ if (window.testRunner)
var sandbox = document.getElementById('sandbox');
var host = document.createElement('p');
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<style>div { width: 100px; height: 100px; }</style><div></div>';
sandbox.appendChild(host);
document.body.offsetLeft;
......
CONSOLE WARNING: line 12: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
Testing <style>...
PASS sheet.ownerNode is style
PASS style.sheet === sheet is true
......
......@@ -9,7 +9,7 @@
<script>
var sandbox = document.getElementById('sandbox');
var host = document.createElement('div');
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<style>* { }</style><div>Shadow</div>';
sandbox.appendChild(host);
......
CONSOLE WARNING: line 12: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
PASS shadowRoot.styleSheets.length is 2
PASS successfullyParsed is true
......
......@@ -9,7 +9,7 @@
<script>
var sandbox = document.getElementById('sandbox');
var host = document.createElement('div');
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<style></style><div>Shadow</div>';
shadowRoot.appendChild(document.createElement('style'));
sandbox.appendChild(host);
......
CONSOLE WARNING: line 38: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
PASS shadowRoot.elementsFromPoint() threw exception TypeError: Failed to execute 'elementsFromPoint' on 'ShadowRoot': 2 arguments required, but only 0 present..
PASS shadowRoot.elementsFromPoint(0) threw exception TypeError: Failed to execute 'elementsFromPoint' on 'ShadowRoot': 2 arguments required, but only 1 present..
......
......@@ -35,7 +35,7 @@ function centerY(element) {
return element.offsetTop + element.offsetHeight / 2;
}
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
var box11 = createBox();
var box12 = createBox();
var box13 = createBox();
......@@ -44,7 +44,7 @@ shadowRoot.appendChild(box12);
shadowRoot.appendChild(box13);
var nestedHost = document.createElement('div');
var nestedShadowRoot = nestedHost.createShadowRoot();
var nestedShadowRoot = nestedHost.attachShadow({mode: 'open'});
var box21 = createBox();
var box22 = createBox();
var box23 = createBox();
......@@ -73,9 +73,9 @@ assertElementsFromPoint(
'document.elementsFromPoint(x22, y22)',
[host, document.body, document.documentElement]);
var root3 = blockHost.createShadowRoot();
var root3 = blockHost.attachShadow({mode: 'open'});
root3.appendChild(document.createTextNode('text1'));
var root4 = inlineBlockHost.createShadowRoot();
var root4 = inlineBlockHost.attachShadow({mode: 'open'});
root4.appendChild(document.createTextNode('text2'));
assertElementsFromPoint(
......
CONSOLE WARNING: line 28: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
This test should not crash on ASAN
......@@ -25,7 +25,7 @@ div0.addEventListener("DOMNodeRemoved", function () {
});
// hovered element (<img>) will disappear.
div1.createShadowRoot();
div1.attachShadow({mode: 'open'});
div0.appendChild(p0);
// This causes synchronous DOMNodeRemoved event
div0.replaceChild(span0, p0);
......
CONSOLE WARNING: line 9: Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
importNode should throw informative errors for unsupported node types
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
......@@ -6,6 +6,6 @@ description('importNode should throw informative errors for unsupported node typ
var doc = document.implementation.createHTMLDocument('');
shouldThrow("document.importNode(doc)")
var shadow = document.createElement('div').createShadowRoot();
var shadow = document.createElement('div').attachShadow({mode: 'open'});
shouldThrow("document.importNode(shadow)")
</script>
CONSOLE ERROR: line 15: Uncaught TypeError: myDiv.createShadowRoot is not a function
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
CONSOLE ERROR: line 12: Uncaught TypeError: div.createShadowRoot is not a function
Test that cycle detection traverses over both templates and shadow roots
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
CONSOLE ERROR: line 12: Uncaught TypeError: host.createShadowRoot is not a function
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
CONSOLE ERROR: line 12: Uncaught TypeError: host.createShadowRoot is not a function
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
CONSOLE ERROR: line 38: Uncaught TypeError: host.createShadowRoot is not a function
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
CONSOLE ERROR: line 28: Uncaught TypeError: div1.createShadowRoot is not a function
1
This test should not crash on ASAN
CONSOLE ERROR: line 9: Uncaught TypeError: document.createElement(...).createShadowRoot is not a function
importNode should throw informative errors for unsupported node types
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.importNode(doc) threw exception NotSupportedError: Failed to execute 'importNode' on 'Document': The node provided is a document, which may not be imported..
FAIL successfullyParsed should be true. Was false.
TEST COMPLETE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment