Skip to content

Instantly share code, notes, and snippets.

@jugglinmike
Created May 9, 2017 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugglinmike/6e8a5033d4d676716f8ce26b70c987f0 to your computer and use it in GitHub Desktop.
Save jugglinmike/6e8a5033d4d676716f8ce26b70c987f0 to your computer and use it in GitHub Desktop.
sw-migration-i-m.diff
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/install-event-type.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/install-event-type.https.html
index 4b6d9b0..7e74af8 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/install-event-type.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/install-event-type.https.html
@@ -1,7 +1,8 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="resources/testharness-helpers.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
function wait_for_install_event(worker) {
return new Promise(function(resolve) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/interfaces.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/interfaces.https.html
index 8fc2a43..403a005 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/interfaces.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/interfaces.https.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<title>Service Worker: Interfaces</title>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
<script src="resources/interfaces.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
test(function() {
@@ -13,8 +13,7 @@ test(function() {
{
register: 'function',
getRegistration: 'function',
- oncontrollerchange: EVENT_HANDLER,
- onmessage: EVENT_HANDLER
+ oncontrollerchange: EVENT_HANDLER
});
}, 'Interfaces and attributes of ServiceWorkerContainer');
@@ -51,7 +50,7 @@ async_test(function(t) {
}, 'Interfaces and attributes of ServiceWorker');
service_worker_test(
- 'resources/interfaces-worker.js',
+ 'resources/interfaces-worker.sub.js',
'Interfaces and attributes in ServiceWorkerGlobalScope');
</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/invalid-blobtype.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/invalid-blobtype.https.html
index 02e8a67..868cf6e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/invalid-blobtype.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/invalid-blobtype.https.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<title>Service Worker: respondWith with header value containing a null byte</title>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="../resources/get-host-info.js?pipe=sub"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js?pipe=sub"></script>
<script>
async_test(function(t) {
- var SCOPE = 'resources/invalid-blobtype-iframe.html';
+ var SCOPE = 'resources/invalid-blobtype-iframe.https.html';
var SCRIPT = 'resources/invalid-blobtype-worker.js';
var host_info = get_host_info();
service_worker_unregister_and_register(t, SCRIPT, SCOPE)
@@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
- host_info['HTTP_ORIGIN'],
+ host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/invalid-header.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/invalid-header.https.html
index 28f0db3..b771f3c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/invalid-header.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/invalid-header.https.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<title>Service Worker: respondWith with header value containing a null byte</title>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="../resources/get-host-info.js?pipe=sub"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js?pipe=sub"></script>
<script>
async_test(function(t) {
- var SCOPE = 'resources/invalid-header-iframe.html';
+ var SCOPE = 'resources/invalid-header-iframe.https.html';
var SCRIPT = 'resources/invalid-header-worker.js';
var host_info = get_host_info();
service_worker_unregister_and_register(t, SCRIPT, SCOPE)
@@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
- host_info['HTTP_ORIGIN'],
+ host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/multiple-register.https.html
index f6fa229..e1d9480 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/multiple-register.https.html
@@ -1,7 +1,8 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
<script>
var worker_url = 'resources/empty-worker.js';
@@ -40,11 +41,12 @@ async_test(function(t) {
registration = r;
return wait_for_state(t, r.installing, 'activated');
})
- .then(function() { return with_iframe('out-of-scope'); })
+ .then(function() { return with_iframe('resources/404.py'); })
.then(function(f) {
frame = f;
return frame.contentWindow.navigator.serviceWorker.register(
- worker_url, { scope: scope });
+ 'empty-worker.js',
+ { scope: 'scope/subsequent-register-from-different-iframe' });
})
.then(function(new_registration) {
assert_not_equals(
@@ -69,7 +71,7 @@ async_test(function(t) {
assert_not_equals(
registration.active, new_registration.active,
- 'registration should have a different active worker');
+ 'registration should have the different active worker');
assert_equals(
registration.active.scriptURL,
new_registration.active.scriptURL,
@@ -90,12 +92,11 @@ async_test(function(t) {
async_test(function(t) {
var scope = 'resources/scope/concurrent-register';
- var number_of_registrations = 10;
service_worker_unregister(t, scope)
.then(function() {
var promises = [];
- for (var i = 0; i < number_of_registrations; ++i) {
+ for (var i = 0; i < 10; ++i) {
promises.push(navigator.serviceWorker.register(worker_url,
{ scope: scope }));
}
@@ -113,3 +114,4 @@ async_test(function(t) {
}, 'Concurrent registrations resolve to the same registration object');
</script>
+</body>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/install-event-type-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/install-event-type-worker.js
index 6f936a0..d729afa 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/install-event-type-worker.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/install-event-type-worker.js
@@ -2,7 +2,6 @@ importScripts('worker-testharness.js');
self.oninstall = function(event) {
assert_true(event instanceof ExtendableEvent);
- assert_true(event instanceof InstallEvent);
assert_equals(event.type, 'install');
assert_false(event.cancelable);
assert_false(event.bubbles);
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-blobtype-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-blobtype-worker.js
index de9e7c7..93f496e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-blobtype-worker.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-blobtype-worker.js
@@ -4,7 +4,6 @@ self.addEventListener('fetch', function(event) {
return;
}
event.respondWith(new Promise(function(resolve) {
- var headers = new Headers;
// null byte in blob type
resolve(new Response(new Blob([],{type: 'a\0b'})));
}));
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/interfaces-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js
index 75ef8c6..e5ed36f 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/interfaces-worker.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js
@@ -1,5 +1,6 @@
importScripts('interfaces.js');
importScripts('worker-testharness.js');
+importScripts('../resources/testharness-helpers.js');
var EVENT_HANDLER = 'object';
@@ -69,19 +70,12 @@ promise_test(function(t) {
}, 'Cache');
test(function() {
+ var req = new Request('http://{{host}}/',
+ {method: 'POST',
+ headers: [['Content-Type', 'Text/Html']]});
assert_equals(
new ExtendableEvent('ExtendableEvent').type,
'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent');
- assert_throws(new TypeError, function() {
- new FetchEvent('FetchEvent');
- }, 'FetchEvent constructor with one argument throws');
- assert_throws(new TypeError, function() {
- new FetchEvent('FetchEvent', {});
- }, 'FetchEvent constructor with empty init dict throws');
- assert_throws(new TypeError, function() {
- new FetchEvent('FetchEvent', {request: null});
- }, 'FetchEvent constructor with null request member throws');
- var req = new Request('https://www.example.com/', {method: 'POST'});
assert_equals(
new FetchEvent('FetchEvent', {request: req}).type,
'FetchEvent', 'Type of FetchEvent should be FetchEvent');
@@ -98,28 +92,16 @@ test(function() {
new FetchEvent('FetchEvent', {request: req}).isReload,
false, 'Default FetchEvent.isReload should be false');
assert_equals(
- new FetchEvent(
- 'FetchEvent', {request: req, cancelable: false}).cancelable,
+ new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable,
false, 'FetchEvent.cancelable should be false');
assert_equals(
- new FetchEvent(
- 'FetchEvent',
- {request: req,
- clientId: '006e6aae-cfd4-4331-bea8-fbae364703cf'}).clientId,
- '006e6aae-cfd4-4331-bea8-fbae364703cf',
- 'FetchEvent.clientId with option {clientId: string} should be ' +
- 'the value of string');
+ new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}).clientId, 'test-client-id',
+ 'FetchEvent.clientId with option {clientId : "test-client-id"} should be "test-client-id"');
assert_equals(
- new FetchEvent(
- 'FetchEvent',
- {request: req, isReload: true}).isReload,
- true,
+ new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, true,
'FetchEvent.isReload with option {isReload : true} should be true');
assert_equals(
- new FetchEvent(
- 'FetchEvent',
- {request: req, isReload: true}).request.url,
- 'https://www.example.com/',
- 'FetchEvent.request.url should return the value it was ' +
- 'initialized to');
+ new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url,
+ 'http://{{host}}/',
+ 'FetchEvent.request.url should return the value it was initialized to');
}, 'Event constructors');
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-blobtype-iframe.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-blobtype-iframe.https.html
index 8a3249d..f111bd9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-blobtype-iframe.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-blobtype-iframe.https.html
@@ -1,5 +1,4 @@
-<script src="../../resources/testharness.js"></script>
-<script src="test-helpers.js"></script>
+<script src="test-helpers.sub.js?pipe=sub"></script>
<script>
function xhr_send(method, data) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-header-iframe.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-header-iframe.https.html
index 4513537..19f302c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/invalid-header-iframe.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-header-iframe.https.html
@@ -1,5 +1,4 @@
-<script src="../../resources/testharness.js"></script>
-<script src="test-helpers.js"></script>
+<script src="test-helpers.sub.js?pipe=sub"></script>
<script>
function xhr_send(method, data) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment