Backed out changeset 6ff483d6ba34 (bug 1172562) for timeouts in test_cache_clear_on_app_uninstall.html
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 30 Jun 2015 14:58:20 +0200
changeset 250701 ee5a1022935699be089928201c42f24349cb80af
parent 250700 92437417748518bc41e4378258b535b08f142e6f
child 250702 641b243060563f5c851cb0bf19f255814ef10fd7
push idunknown
push userunknown
push dateunknown
bugs1172562
milestone42.0a1
backs out6ff483d6ba341b882ec820b92747252235355518
Backed out changeset 6ff483d6ba34 (bug 1172562) for timeouts in test_cache_clear_on_app_uninstall.html
dom/cache/test/mochitest/app/after_clear.html
dom/cache/test/mochitest/app/before_clear.html
dom/cache/test/mochitest/app/index.html
dom/cache/test/mochitest/app/manifest.webapp
dom/cache/test/mochitest/app/manifest.webapp^headers^
dom/cache/test/mochitest/app/sw.js
dom/cache/test/mochitest/app/test.js
dom/cache/test/mochitest/mochitest.ini
dom/cache/test/mochitest/test_cache_clear_on_app_uninstall.html
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/after_clear.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Test app for bug 1172562</title>
-    <script src='test.js'></script>
-    <script type='application/javascript;version=1.7'>
-
-function runTests() {
-  return Promise.resolve()
-    .then(() => { return navigator.serviceWorker.ready })
-    .then((registration) => {
-      return new Promise((resolve) => {
-        var worker = registration.waiting || registration.active;
-        worker.postMessage('read');
-        navigator.serviceWorker.onmessage = (message) => {
-          if (message.data.type == 'done') {
-            ok(!message.data.cached, 'No cached data');
-            resolve();
-          }
-        };
-      });
-    })
-    .then(done);
-}
-  </script>
-  </head>
-  <body onload='runTests()'>
-  </body>
-</html>
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/before_clear.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Test app for bug 1172562</title>
-    <script src='test.js'></script>
-    <script type='application/javascript;version=1.7'>
-
-function runTests() {
-  return Promise.resolve()
-    .then(() => { return navigator.serviceWorker.ready })
-    .then((registration) => {
-      return new Promise((resolve) => {
-        var worker = registration.waiting || registration.active;
-        worker.postMessage('write');
-        navigator.serviceWorker.onmessage = (message) => {
-          if (message.data.type == 'written') {
-            worker.postMessage('read');
-          } else if (message.data.type == 'done') {
-            ok(message.data.cached, 'Write success');
-            resolve();
-          }
-        };
-      });
-    })
-    .then(done);
-}
-  </script>
-  </head>
-  <body onload='runTests()'>
-  </body>
-</html>
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/index.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Test app for bug 1172562</title>
-    <script type='application/javascript;version=1.7'>
-function ok(aCondition, aMessage) {
-  if (aCondition) {
-    alert('OK: ' + aMessage);
-  } else {
-    alert('KO: ' + aMessage);
-  }
-}
-
-function ready() {
-  alert('READY');
-}
-
-function registerServiceWorker() {
-  return new Promise((resolve, reject) => {
-    navigator.serviceWorker.ready.then(() => {
-      ready();
-      resolve();
-    });
-    navigator.serviceWorker.register('sw.js', {scope: '.'})
-    .then(registration => {
-      ok(true, 'service worker registered');
-    })
-    .catch(reject);
-  });
-}
-
-function runTests() {
-  return Promise.resolve()
-    .then(registerServiceWorker)
-    .then(ready)
-}
-  </script>
-  </head>
-  <body onload='runTests()'>
-  </body>
-</html>
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/manifest.webapp
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "name": "App",
-  "launch_path": "/index.html",
-  "description": "Test app for bug 1172562"
-}
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/manifest.webapp^headers^
+++ /dev/null
@@ -1,1 +0,0 @@
-Content-Type: application/manifest+json
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/sw.js
+++ /dev/null
@@ -1,18 +0,0 @@
-self.addEventListener('message', (message) => {
-  caches.open('acache').then((cache) => {
-    if(message.data == 'write') {
-      cache.add('aurl').then(() => {
-        message.source.postMessage({
-          type: 'written'
-        });
-      });
-    } else if (message.data == 'read') {
-      cache.match('aurl').then((result) => {
-        message.source.postMessage({
-          type: 'done',
-          cached: !!result
-        });
-      });
-    }
-  });
-});
deleted file mode 100644
--- a/dom/cache/test/mochitest/app/test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function ok(aCondition, aMessage) {
-  if (aCondition) {
-    alert('OK: ' + aMessage);
-  } else {
-    alert('KO: ' + aMessage);
-  }
-}
-
-function ready() {
-  alert('READY');
-}
-
-function done() {
-  alert('DONE');
-}
--- a/dom/cache/test/mochitest/mochitest.ini
+++ b/dom/cache/test/mochitest/mochitest.ini
@@ -18,17 +18,16 @@ support-files =
   test_cache_keys.js
   test_cache_put.js
   test_cache_requestCache.js
   test_cache_delete.js
   test_cache_put_reorder.js
   test_cache_https.js
   large_url_list.js
   empty.html
-  app/*
 
 [test_cache.html]
 [test_cache_add.html]
 [test_cache_match_request.html]
 [test_cache_matchAll_request.html]
 [test_cache_overwrite.html]
 [test_cache_match_vary.html]
 [test_caches.html]
@@ -36,13 +35,11 @@ support-files =
 [test_cache_put.html]
 [test_cache_requestCache.html]
 [test_cache_delete.html]
 [test_cache_put_reorder.html]
 [test_cache_https.html]
   skip-if = buildapp == 'b2g' # bug 1162353
 [test_cache_restart.html]
 [test_cache_shrink.html]
-[test_cache_clear_on_app_uninstall.html]
-  skip-if = e10s # bug 1178685
 [test_cache_orphaned_cache.html]
 [test_cache_orphaned_body.html]
 [test_cache_untrusted.html]
deleted file mode 100644
--- a/dom/cache/test/mochitest/test_cache_clear_on_app_uninstall.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Bug 1172562 - Clear QuotaManager storage when uninstalling an app</title>
-  <script type='text/javascript' src='/tests/SimpleTest/SimpleTest.js'></script>
-  <link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css' />
-</head>
-<body onload='runTests()'>
-<p id='display'></p>
-<div id='content' style='display: none'></div>
-<pre id='test'></pre>
-<script class='testbody' type='application/javascript;version=1.7'>
-
-SimpleTest.waitForExplicitFinish();
-
-const gOrigin = 'http://mochi.test:8888/tests/dom/cache/test/mochitest/app';
-const appManifestURL = gOrigin + '/manifest.webapp';
-let gApp;
-
-function setup() {
-  return new Promise((resolve, reject) => {
-    SpecialPowers.setAllAppsLaunchable(true);
-    SpecialPowers.pushPrefEnv({'set': [
-      ['dom.mozBrowserFramesEnabled', true],
-      ['dom.serviceWorkers.exemptFromPerDomainMax', true],
-      ['dom.serviceWorkers.enabled', true],
-      ['dom.serviceWorkers.testing.enabled', true],
-      ['dom.caches.enabled', true],
-    ]}, () => {
-      SpecialPowers.pushPermissions([
-        { 'type': 'webapps-manage', 'allow': 1, 'context': document },
-        { 'type': 'browser', 'allow': 1, 'context': document },
-        { 'type': 'embed-apps', 'allow': 1, 'context': document }
-      ], () => {
-        SpecialPowers.autoConfirmAppInstall(() => {
-          SpecialPowers.autoConfirmAppUninstall(resolve);
-        });
-      });
-    });
-  });
-}
-
-function installApp() {
-  return new Promise((resolve, reject) => {
-    let req = navigator.mozApps.install(appManifestURL);
-    req.onsuccess = function() {
-      gApp = req.result;
-      is(req.result.manifestURL, appManifestURL, 'app installed');
-      if (req.result.installState == 'installed') {
-        is(req.result.installState, 'installed', 'app downloaded');
-        resolve()
-      } else {
-        req.result.ondownloadapplied = function() {
-          is(req.result.installState, 'installed', 'app downloaded');
-          resolve();
-        }
-      }
-    }
-    req.onerror = reject;
-  });
-}
-
-function launchApp() {
-  if (!gApp) {
-    ok(false, 'No test application to launch');
-    return Promise.reject();
-  }
-  return new Promise((resolve, reject) => {
-    let iframe = document.createElement('iframe');
-    iframe.setAttribute('mozbrowser', 'true');
-    iframe.setAttribute('mozapp', gApp.manifestURL);
-    iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
-      let message = e.detail.message;
-      if (/OK/.exec(message)) {
-        ok(true, "Message from app: " + message);
-      } else if (/KO/.exec(message)) {
-        ok(false, "Message from app: " + message);
-      } else if (/READY/.exec(message)) {
-        ok(true, "Message from app: " + message);
-        resolve();
-      } else {
-        ok(false, "Unexpected message received: " + message);
-      }
-    }, false);
-    let domParent = document.getElementById('container');
-    domParent.appendChild(iframe);
-    SpecialPowers.wrap(iframe.contentWindow).location =
-      gOrigin + gApp.manifest.launch_path;
-  });
-}
-
-function loadControlled(aUrl) {
-  return new Promise((resolve, reject) => {
-    let iframe = document.createElement('iframe');
-    iframe.setAttribute('mozbrowser', 'true');
-    iframe.setAttribute('mozapp', gApp.manifestURL);
-    iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
-      let message = e.detail.message;
-      if (/OK/.exec(message)) {
-        ok(true, "Message from app: " + message);
-      } else if (/KO/.exec(message)) {
-        ok(false, "Message from app: " + message);
-      } else if (/DONE/.exec(message)) {
-        ok(true, "Messaging from app complete");
-        iframe.removeEventListener('mozbrowsershowmodalprompt', listener);
-        let domParent = document.getElementById('container');
-        domParent.removeChild(iframe);
-        resolve();
-      } else {
-        ok(false, "Unexpected message received: " + message);
-      }
-      }, false);
-    let domParent = document.getElementById('container');
-    domParent.appendChild(iframe);
-    SpecialPowers.wrap(iframe.contentWindow).location =
-      gOrigin + aUrl;
-  });
-}
-
-function loadBeforeClear() {
-  return loadControlled('/before_clear.html');
-}
-
-function loadAfterClear() {
-  return loadControlled('/after_clear.html');
-}
-
-function uninstallApp() {
-  return new Promise((resolve, reject) => {
-    if (!gApp) {
-      return reject();
-    }
-    let req = navigator.mozApps.mgmt.uninstall(gApp);
-    req.onsuccess = resolve;
-    req.onerror = reject;
-  });
-}
-
-function runTests() {
-  setup()
-    .then(installApp)
-    .then(launchApp)
-    .then(loadBeforeClear)
-    .then(uninstallApp)
-    .then(installApp)
-    .then(launchApp)
-    .then(loadAfterClear)
-    .then(uninstallApp)
-    .then(SimpleTest.finish)
-    .catch((e) => {
-      ok(false, 'Unexpected error ' + e.target.error.name);
-      SimpleTest.finish();
-    });
-}
-
-</script>
-<div id='container'></div>
-</body>
-</html>