Integrate service worker manager thread

This commit is contained in:
Rahul Sharma 2016-06-09 18:52:52 +05:30
parent e8fa02a07f
commit 1e6293ea1d
39 changed files with 764 additions and 582 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard Page</title>
</head>
<body>
<div>
<a href="/">Back to home</a>
<h3>The dashboard page</h3>
<a href="http://github.com/servo/servo">Servo Project</a>
</div>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>An iframe</title>
</head>
<body>
<div>
<a href="http://github.com/servo/servo">Servo Project</a>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
console.log("dummy test file");

View file

@ -0,0 +1 @@
console.log("iframe service worker active");

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Service Worker Tests</title>
</head>
<body>
<p>This page tests the registration and initialization of Service Workers in Servo.</p>
<div id="registration">
<a href="/dashboard-page.html">Go to Dashboard</a>
<a href="/profile.html">Go to Profile</a>
<iframe id="iframe_sw" width="" height="200"></iframe>
<br>
<button onclick="register_zero()">Register for Root</button>
<button onclick="register_one()">Register for Dashboard</button>
<button onclick="register_two()">Register for Profile</button>
</div>
<script>
var reg = navigator.serviceWorker.register('iframe_sw.js', { 'scope': '/demo_iframe.html' });
console.log("From client worker registered: ", navigator.serviceWorker.controller);
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
document.getElementById('iframe_sw').src = 'demo_iframe.html';
function register_zero() {
var reg = navigator.serviceWorker.register('sw.js', { 'scope': './' });
console.log("From client worker registered: ", navigator.serviceWorker.controller);
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
}
function register_one() {
var reg = navigator.serviceWorker.register('sw_dashboard.js', { 'scope': '/dashboard' });
console.log("From client worker registered: ", navigator.serviceWorker.controller);
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
}
function register_two() {
var reg = navigator.serviceWorker.register('sw_profile.js', { 'scope': '/profile' });
console.log("From client worker registered: ", navigator.serviceWorker.controller);
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
}
</script>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Profile Page</title>
</head>
<body>
<div>
<a href="/">Back to home</a>
<h3>The profile page</h3>
<a href="http://github.com/servo/servo">Servo Project</a>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
console.log("root service worker: active");

View file

@ -0,0 +1,2 @@
importScripts('dummy.js');
console.log("dashboard service worker: active");

View file

@ -0,0 +1 @@
console.log("profile service worker: active");