Skip to content

Commit

Permalink
Bug 1513462 [wpt PR 14474] - service worker: XSLT: Use response URL f…
Browse files Browse the repository at this point in the history
…or the base URL., a=testonly

Automatic update from web-platform-tests
service worker: XSLT: Use response URL for the base URL.

This aligns with the standard. See
whatwg/fetch#146

Chrome Status: https://www.chromestatus.com/feature/4857368017895424

No intent to ship because it's a trivial change.

Bug: 914135
Change-Id: I229aec6f8473bb6b7cdc88429afa830bc6eb80ed
Reviewed-on: https://chromium-review.googlesource.com/c/1372109
Commit-Queue: Matt Falkenhagen <falkenchromium.org>
Reviewed-by: Kent Tamura <tkentchromium.org>
Cr-Commit-Position: refs/heads/master{#616248}

--

wpt-commits: bc5122da94555fdf1b82b520599d860e722d8c05
wpt-pr: 14474

UltraBlame original commit: 93f7c970ddcf711010d0a29451229eee220771f0
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent 21058a7 commit 38b9abb
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="xslt-pass.xsl"/>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="resources/request-url-path/import-relative.xsl"?>
<stylesheet-test>
This tests a stylesheet which has a xsl:import with a relative URL.
</stylesheet-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
self.addEventListener('fetch', event => {
const url = new URL(event.request.url);




const path = 'request-url-path/import-relative.xsl';
if (url.pathname.indexOf(path) != -1) {

event.respondWith(fetch('import-relative.xsl'));
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<p>PASS</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Service Worker: XSL's base URL must be the response URL</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js?pipe=sub"></script>
<script>
// This test loads an XML document which is controlled a service worker. The
// document loads a stylesheet and a service worker responds with another URL.
// The stylesheet imports a relative URL to test that the base URL is the
// response URL from the service worker.
promise_test(async (t) => {
const SCOPE = 'resources/xsl-base-url-iframe.xml';
const SCRIPT = 'resources/xsl-base-url-worker.js';
let worker;
let frame;

t.add_cleanup(() => {
if (frame)
frame.remove();
service_worker_unregister(t, SCOPE);
});

const registration = await service_worker_unregister_and_register(
t, SCRIPT, SCOPE);
worker = registration.installing;
await wait_for_state(t, worker, 'activated');

frame = await with_iframe(SCOPE);
assert_equals(frame.contentDocument.body.textContent, 'PASS');
}, 'base URL when service worker does respondWith(fetch(responseUrl))');
</script>

0 comments on commit 38b9abb

Please sign in to comment.