Commit d916d493 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Update LayoutTests to use '%23' instead of '#' in data URIs

This is a (very) partial reland of
https://chromium-review.googlesource.com/c/chromium/src/+/738395,
restoring only the changes to LayoutTests. This should be safe since
'%23' always has been a correct encoding of '#' and so should work with
the data URI code as it is today. It will also make any future re-land
of the core original CL easier.

Bug: 123004
Change-Id: I87126ea0e3fd39756e571a8e6cf966107e7f7209
Reviewed-on: https://chromium-review.googlesource.com/1048287Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559130}
parent a2811b6b
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
var doubleEscapedBrace = "&amp;amp;lt;"; var doubleEscapedBrace = "&amp;amp;lt;";
var rawNewline = "&#10;"; var rawNewline = "&#10;";
var escapedNewline = "&amp;#10;"; var escapedNewline = "&amp;#10;";
var doubleEscapedNewline = "&amp;amp;#10;"; // doubleEscapedNewline is used inside a data URI, and so must have its '#' escaped.
var doubleEscapedNewline = "&amp;amp;%2310;";
function appendFrameAndGetElement(test, frame) { function appendFrameAndGetElement(test, frame) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
var t = async_test() var t = async_test()
function test() { function test() {
var script = createScript('data:text\/javascript,log("Script #1 ran")'); var script = createScript('data:text\/javascript,log("Script %231 ran")');
var script2 = createScript('','log("Script #2 ran")'); var script2 = createScript('','log("Script #2 ran")');
if(script2) { if(script2) {
head.removeChild(script2); head.removeChild(script2);
} }
var script3 = createScript('data:text\/javascript, log("Script #3 ran"); createScript(\'\', \'log("Script #4 ran")\')'); var script3 = createScript('data:text\/javascript, log("Script %233 ran"); createScript(\'\', \'log("Script #4 ran")\')');
if(script3) { if(script3) {
head.removeChild(script3); head.removeChild(script3);
} }
......
<!DOCTYPE html> <!DOCTYPE html>
<iframe src="data:text/html,<div style='background: #00FF01; width: 24px; height: 24px'></div>" > <iframe src="data:text/html,<div style='background: %2300FF01; width: 24px; height: 24px'></div>" >
</iframe> </iframe>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#target2 { color: 008000; } #target2 { color: 008000; }
</style> </style>
<link rel="import" href="data:text/html,<style>.test .testWithCapital { background-color: green; } .test .testwithoutcapital { border: 2px green; } #target2 { color: ff0000 } #tArGeT1 { color: green }</style>"> <link rel="import" href="data:text/html,<style>.test .testWithCapital { background-color: green; } .test .testwithoutcapital { border: 2px green; } %23target2 { color: ff0000 } %23tArGeT1 { color: green }</style>">
<div class="test"> <div class="test">
<div id="target1" class="testwithoutcapital testWithCapital"></div> <div id="target1" class="testwithoutcapital testWithCapital"></div>
</div> </div>
...@@ -23,4 +23,4 @@ test(function() { ...@@ -23,4 +23,4 @@ test(function() {
test(function() { test(function() {
assert_equals(getComputedStyle(target2).color, green); assert_equals(getComputedStyle(target2).color, green);
}, "Test that rules in <link rel=import> are parsed in strict mode"); }, "Test that rules in <link rel=import> are parsed in strict mode");
</script> </script>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
await dp.Runtime.evaluate({ await dp.Runtime.evaluate({
expression: ` expression: `
let frame = document.createElement('iframe'); let frame = document.createElement('iframe');
frame.src = 'data:text/html,<script>onmessage = (e) => e.ports[0].postMessage(\\'pong\\');//# sourceURL=iframe.js</script>'; frame.src = 'data:text/html,<script>onmessage = (e) => e.ports[0].postMessage(\\'pong\\');//%23 sourceURL=iframe.js</script>';
let p = new Promise(resolve => frame.onload = resolve); let p = new Promise(resolve => frame.onload = resolve);
document.body.appendChild(frame); document.body.appendChild(frame);
p p
...@@ -58,4 +58,4 @@ ...@@ -58,4 +58,4 @@
debuggerId); debuggerId);
testRunner.completeTest(); testRunner.completeTest();
}) })
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<link rel="stylesheet" type="text/css" href="data:text/css,#blue { color: blue !important; }"> <link rel="stylesheet" type="text/css" href="data:text/css,%23blue { color: blue !important; }">
<link rel="stylesheet" type="application/javascript" href="data:text/css,#red { color: red !important; }"> <link rel="stylesheet" type="application/javascript" href="data:text/css,%23red { color: red !important; }">
<link rel="stylesheet" href="data:text/css,#yellow { color: yellow !important; }"> <link rel="stylesheet" href="data:text/css,%23yellow { color: yellow !important; }">
<div style="color: green" id="blue">This text should be blue</div> <div style="color: green" id="blue">This text should be blue</div>
<div style="color: green" id="red">This text should be green</div> <div style="color: green" id="red">This text should be green</div>
<div style="color: green" id="yellow">This text should be yellow</div> <div style="color: green" id="yellow">This text should be yellow</div>
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
<body> <body>
<div id="host"> <div id="host">
<template mode-data="open"> <template mode-data="open">
<link rel="stylesheet" title="preferred1" href="data:text/css,#shadowChild1 { color: green }"> <link rel="stylesheet" title="preferred1" href="data:text/css,%23shadowChild1 { color: green }">
<link rel="stylesheet" title="title1" href="data:text/css,#shadowChild2 { color: green }"> <link rel="stylesheet" title="title1" href="data:text/css,%23shadowChild2 { color: green }">
<link rel="alternate stylesheet" title="prefered1" href="data:text/css,#shadowChild3 { color: green }"> <link rel="alternate stylesheet" title="prefered1" href="data:text/css,%23shadowChild3 { color: green }">
<link rel="alternate stylesheet" title="title1" href="data:text/css,#shadowChild4 { color: green }"> <link rel="alternate stylesheet" title="title1" href="data:text/css,%23shadowChild4 { color: green }">
<div id="shadowChild1"></div> <div id="shadowChild1"></div>
<div id="shadowChild2"></div> <div id="shadowChild2"></div>
<div id="shadowChild3"></div> <div id="shadowChild3"></div>
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<div id="bodyChild1"></div> <div id="bodyChild1"></div>
<div id="bodyChild2"></div> <div id="bodyChild2"></div>
<script>convertTemplatesToShadowRootsWithin(host);</script> <script>convertTemplatesToShadowRootsWithin(host);</script>
<link rel="stylesheet" title="preferred1" href="data:text/css,#bodyChild1 { color: green }"> <link rel="stylesheet" title="preferred1" href="data:text/css,%23bodyChild1 { color: green }">
<link rel="stylesheet" title="non-preferred" href="data:text/css,#bodyChild2 { color: green }"> <link rel="stylesheet" title="non-preferred" href="data:text/css,%23bodyChild2 { color: green }">
</body> </body>
<script> <script>
function colorFor(elem) { function colorFor(elem) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<defs> <defs>
<rect id='rect' width='100' height='100' fill='green'/> <rect id='rect' width='100' height='100' fill='green'/>
</defs> </defs>
<use xlink:href='#rect'/> <use xlink:href='%23rect'/>
</svg> </svg>
"></object> "></object>
</body> </body>
......
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