Bug 1286530 - Switch BrowserElement-related mochitests to chrome draft
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Mon, 02 May 2016 16:10:50 +0200
changeset 387114 0ced60c7e9f53c29f3dfb6e1195e8007253ccc29
parent 387113 f0405bd5d363f9ba6cf4839bc038d193f49dd67e
child 387115 738925365e95eee413847b835ac36b10f8b5a79e
push id22896
push userbmo:lissyx+mozillians@lissyx.dyndns.org
push dateWed, 13 Jul 2016 13:02:44 +0000
bugs1286530
milestone50.0a1
Bug 1286530 - Switch BrowserElement-related mochitests to chrome MozReview-Commit-ID: H5jkW4umLVK Conflicts: dom/base/test/mochitest.ini dom/base/test/mozbrowser_api_utils.js dom/browser-element/mochitest/browserElement_ActiveStateChangeOnChangingMutedOrVolume.js dom/browser-element/mochitest/browserElement_getStructuredData.js dom/browser-element/mochitest/mochitest.ini dom/browser-element/mochitest/priority/mochitest.ini dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChangeOnChangingMutedOrVolume.html dom/browser-element/mochitest/test_browserElement_inproc_getStructuredData.html dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChangeOnChangingMutedOrVolume.html dom/browser-element/moz.build
dom/base/test/chrome.ini
dom/base/test/mozbrowser_api_utils.js
dom/base/test/test_mozbrowser_apis_allowed.html
dom/browser-element/mochitest/browserElementTestHelpers.js
dom/browser-element/mochitest/browserElement_ActiveStateChange.js
dom/browser-element/mochitest/browserElement_AudioChannel.js
dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
dom/browser-element/mochitest/browserElement_AudioPlayback.js
dom/browser-element/mochitest/browserElement_BackForward.js
dom/browser-element/mochitest/browserElement_BadScreenshot.js
dom/browser-element/mochitest/browserElement_DOMRequestError.js
dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js
dom/browser-element/mochitest/browserElement_Find.js
dom/browser-element/mochitest/browserElement_GetContentDimensions.js
dom/browser-element/mochitest/browserElement_GetScreenshot.js
dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js
dom/browser-element/mochitest/browserElement_NextPaint.js
dom/browser-element/mochitest/browserElement_NoAudioTrack.js
dom/browser-element/mochitest/browserElement_OpenMixedProcess.js
dom/browser-element/mochitest/browserElement_PurgeHistory.js
dom/browser-element/mochitest/browserElement_ReloadPostRequest.js
dom/browser-element/mochitest/browserElement_SendEvent.js
dom/browser-element/mochitest/browserElement_SetInputMethodActive.js
dom/browser-element/mochitest/browserElement_SetNFCFocus.js
dom/browser-element/mochitest/browserElement_SetVisible.js
dom/browser-element/mochitest/browserElement_SetVisibleFrames.js
dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js
dom/browser-element/mochitest/browserElement_Stop.js
dom/browser-element/mochitest/browserElement_VisibilityChange.js
dom/browser-element/mochitest/browserElement_getWebManifest.js
dom/browser-element/mochitest/chrome.ini
dom/browser-element/mochitest/file_audio.html
dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html
dom/browser-element/mochitest/file_browserElement_SendEvent.html
dom/browser-element/mochitest/file_browserElement_SetInputMethodActive.html
dom/browser-element/mochitest/file_illegal_web_manifest.html
dom/browser-element/mochitest/mochitest.ini
dom/browser-element/mochitest/priority/chrome.ini
dom/browser-element/mochitest/priority/mochitest.ini
dom/browser-element/mochitest/priority/test_Activity.html
dom/browser-element/mochitest/priority/test_Audio.html
dom/browser-element/mochitest/priority/test_Background.html
dom/browser-element/mochitest/priority/test_Keyboard.html
dom/browser-element/mochitest/priority/test_MultipleFrames.html
dom/browser-element/mochitest/priority/test_NestedFrames.html
dom/browser-element/mochitest/priority/test_Visibility.html
dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChange.html
dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel.html
dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelMutedByDefault.html
dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelSeeking.html
dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel_nested.html
dom/browser-element/mochitest/test_browserElement_inproc_AudioPlayback.html
dom/browser-element/mochitest/test_browserElement_inproc_BackForward.html
dom/browser-element/mochitest/test_browserElement_inproc_BadScreenshot.html
dom/browser-element/mochitest/test_browserElement_inproc_DOMRequestError.html
dom/browser-element/mochitest/test_browserElement_inproc_DocumentFirstPaint.html
dom/browser-element/mochitest/test_browserElement_inproc_ExecuteScript.html
dom/browser-element/mochitest/test_browserElement_inproc_Find.html
dom/browser-element/mochitest/test_browserElement_inproc_GetContentDimensions.html
dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshot.html
dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshotDppx.html
dom/browser-element/mochitest/test_browserElement_inproc_NextPaint.html
dom/browser-element/mochitest/test_browserElement_inproc_NoAudioTrack.html
dom/browser-element/mochitest/test_browserElement_inproc_OpenMixedProcess.html
dom/browser-element/mochitest/test_browserElement_inproc_PurgeHistory.html
dom/browser-element/mochitest/test_browserElement_inproc_SendEvent.html
dom/browser-element/mochitest/test_browserElement_inproc_SetInputMethodActive.html
dom/browser-element/mochitest/test_browserElement_inproc_SetNFCFocus.html
dom/browser-element/mochitest/test_browserElement_inproc_SetVisible.html
dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames.html
dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames2.html
dom/browser-element/mochitest/test_browserElement_inproc_Stop.html
dom/browser-element/mochitest/test_browserElement_inproc_VisibilityChange.html
dom/browser-element/mochitest/test_browserElement_inproc_getWebManifest.html
dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChange.html
dom/browser-element/moz.build
--- a/dom/base/test/chrome.ini
+++ b/dom/base/test/chrome.ini
@@ -1,15 +1,16 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g' || os == 'android'
 support-files =
   file_empty.html
   file_bug945152.jar
   file_bug945152_worker.js
   file_bug1008126_worker.js
+  mozbrowser_api_utils.js
 
 [test_anonymousContent_xul_window.xul]
 [test_bug715041.xul]
 [test_bug715041_removal.xul]
 [test_domrequesthelper.xul]
 [test_navigator_resolve_identity_xrays.xul]
 support-files = file_navigator_resolve_identity_xrays.xul
 [test_navigator_resolve_identity.html]
@@ -20,8 +21,9 @@ support-files = file_navigator_resolve_i
 subsuite = clipboard
 [test_messagemanager_principal.html]
 [test_messagemanager_send_principal.html]
 skip-if = buildapp == 'mulet'
 [test_bug945152.html]
 [test_bug1008126.html]
 [test_sandboxed_blob_uri.html]
 [test_websocket_frame.html]
+[test_mozbrowser_apis_allowed.html]
--- a/dom/base/test/mozbrowser_api_utils.js
+++ b/dom/base/test/mozbrowser_api_utils.js
@@ -15,57 +15,59 @@ const METHODS = {
   stop: {},
   download: {},
   purgeHistory: {},
   getScreenshot: {},
   zoom: {},
   getCanGoBack: {},
   getCanGoForward: {},
   getContentDimensions: {},
-  setInputMethodActive: { alwaysFails: true }, // needs input-manage
-  setNFCFocus: { alwaysFails: true }, // needs nfc-manager
+  setInputMethodActive: {},
+  setNFCFocus: {},
   findAll: {},
   findNext: {},
   clearMatch: {},
-  executeScript: { alwaysFails: true }, // needs browser:universalxss
+  executeScript: {},
   getWebManifest: {},
   mute: {},
   unmute: {},
   getMuted: {},
   setVolume: {},
   getVolume: {},
 };
 
 const ATTRIBUTES = [
   "allowedAudioChannels",
 ];
 
 function once(target, eventName, useCapture = false) {
-  info("Waiting for event: '" + eventName + "' on " + target + ".");
+  info("Waiting for event: '" + JSON.stringify(eventName) + "' on " + target + ".");
 
   return new Promise(resolve => {
     for (let [add, remove] of [
       ["addEventListener", "removeEventListener"],
       ["addMessageListener", "removeMessageListener"],
     ]) {
       if ((add in target) && (remove in target)) {
-        target[add](eventName, function onEvent(...aArgs) {
-          info("Got event: '" + eventName + "' on " + target + ".");
-          target[remove](eventName, onEvent, useCapture);
-          resolve(aArgs);
-        }, useCapture);
+        eventName.forEach(evName => {
+          target[add](evName, function onEvent(...aArgs) {
+            info("Got event: '" + evName + "' on " + target + ".");
+            target[remove](evName, onEvent, useCapture);
+            resolve(aArgs);
+          }, useCapture);
+	});
         break;
       }
     }
   });
 }
 
 function* loadFrame(attributes = {}) {
   let iframe = document.createElement("iframe");
   iframe.setAttribute("src", FRAME_URL);
   for (let key in attributes) {
     iframe.setAttribute(key, attributes[key]);
   }
-  let loaded = once(iframe, "load");
+  let loaded = once(iframe, [ "load", "mozbrowserloadend" ]);
   document.body.appendChild(iframe);
   yield loaded;
   return iframe;
 }
--- a/dom/base/test/test_mozbrowser_apis_allowed.html
+++ b/dom/base/test/test_mozbrowser_apis_allowed.html
@@ -1,40 +1,34 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Verify mozbrowser APIs are allowed with browser permission</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
   <script type="text/javascript" src="mozbrowser_api_utils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 
 <body>
 <script type="application/javascript;version=1.8">
   add_task(function*() {
     yield new Promise(resolve => {
       SpecialPowers.pushPrefEnv(
         { "set": [["dom.mozBrowserFramesEnabled", true]] },
         resolve);
     });
   });
 
   add_task(function*() {
-    yield new Promise(resolve => {
-      SpecialPowers.pushPermissions([
-        { "type": "browser", "allow": 1, "context": document }
-      ], resolve);
-    });
-  });
-
-  add_task(function*() {
     // Create <iframe mozbrowser>
     let frame = yield loadFrame({
-      mozbrowser: "true"
+      mozbrowser: "true",
+      // FIXME: Bug 1270790
+      remote: true
     });
 
     // Verify that mozbrowser APIs are accessible
     for (let method in METHODS) {
       let { alwaysFails } = METHODS[method];
       if (alwaysFails) {
         ok(!(method in frame), `frame does not have method ${method}, ` +
                                `needs more permissions`);
--- a/dom/browser-element/mochitest/browserElementTestHelpers.js
+++ b/dom/browser-element/mochitest/browserElementTestHelpers.js
@@ -104,16 +104,17 @@ const browserElementTestHelpers = {
     for (var i = 0; i < this._observers.length; i++) {
       SpecialPowers.removeObserver(this._observers[i][0],
                                    this._observers[i][1]);
     }
   },
 
   // Some basically-empty pages from different domains you can load.
   'emptyPage1': 'http://example.com' + _getPath() + '/file_empty.html',
+  'fileEmptyPage1': 'file_empty.html',
   'emptyPage2': 'http://example.org' + _getPath() + '/file_empty.html',
   'emptyPage3': 'http://test1.example.org' + _getPath() + '/file_empty.html',
   'focusPage': 'http://example.org' + _getPath() + '/file_focus.html',
 };
 
 // Returns a promise which is resolved when a subprocess is created.  The
 // argument to resolve() is the childID of the subprocess.
 function expectProcessCreated(/* optional */ initialPriority) {
--- a/dom/browser-element/mochitest/browserElement_ActiveStateChange.js
+++ b/dom/browser-element/mochitest/browserElement_ActiveStateChange.js
@@ -1,15 +1,14 @@
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
-var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html';
+var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_ActiveStateChangeOnChangingMutedOrVolume.html';
 var generator = runTests();
 var testFrame;
 var ac;
 
 function assert(aVal, aMessage) {
   return (!aVal) ? error(aMessage) : 0;
 }
 
@@ -34,19 +33,23 @@ function finish() {
 function setCommand(aArg) {
   assert(!!ac, "Audio channel doesn't exist!");
   info("# Command = " + aArg);
 
   testFrame.src = fileURL + '#' + aArg;
   var expectedActive = false;
   switch (aArg) {
     case 'play':
+    case 'unmute':
+    case 'volume-1':
       expectedActive = true;
       break;
     case 'pause':
+    case 'mute':
+    case 'volume-0':
       expectedActive = false;
       break;
     default :
       error("Undefined command!");
   }
 
   ac.onactivestatechanged = () => {
     ac.onactivestatechanged = null;
@@ -57,33 +60,45 @@ function setCommand(aArg) {
     }
   };
 }
 
 function runTests() {
   setCommand('play');
   yield undefined;
 
+  setCommand('mute');
+  yield undefined;
+
+  setCommand('unmute');
+  yield undefined;
+
+  setCommand('volume-0');
+  yield undefined;
+
+  setCommand('volume-1');
+  yield undefined;
+
   setCommand('pause');
   yield undefined;
 
   finish();
   yield undefined;
 }
 
 function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     ac = channels[0];
 
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("isActive" in ac, "isActive exists");
     ok("onactivestatechanged" in ac, "onactivestatechanged exists");
 
     generator.next();
--- a/dom/browser-element/mochitest/browserElement_AudioChannel.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel.js
@@ -2,34 +2,33 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 1113086 - tests for AudioChannel API into BrowserElement
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function noaudio() {
   info("Test : no-audio");
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-  iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_empty.html';
+  iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_empty.html';
 
   function noaudio_loadend() {
     ok("mute" in iframe, "iframe.mute exists");
     ok("unmute" in iframe, "iframe.unmute exists");
     ok("getMuted" in iframe, "iframe.getMuted exists");
     ok("getVolume" in iframe, "iframe.getVolume exists");
     ok("setVolume" in iframe, "iframe.setVolume exists");
 
     ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
     var channels = iframe.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     var ac = channels[0];
 
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("getVolume" in ac, "ac.getVolume exists");
     ok("setVolume" in ac, "ac.setVolume exists");
     ok("getMuted" in ac, "ac.getMuted exists");
     ok("setMuted" in ac, "ac.setMuted exists");
@@ -141,28 +140,28 @@ function noaudio() {
   iframe.addEventListener('mozbrowserloadend', noaudio_loadend);
   document.body.appendChild(iframe);
 }
 
 function audio() {
   info("Test : audio");
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-  iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/iframe_file_audio.html';
+  iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/iframe_file_audio.html';
 
   function audio_loadend() {
     ok("mute" in iframe, "iframe.mute exists");
     ok("unmute" in iframe, "iframe.unmute exists");
     ok("getMuted" in iframe, "iframe.getMuted exists");
     ok("getVolume" in iframe, "iframe.getVolume exists");
     ok("setVolume" in iframe, "iframe.setVolume exists");
 
     ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
     var channels = iframe.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     var ac = channels[0];
 
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("getVolume" in ac, "ac.getVolume exists");
     ok("setVolume" in ac, "ac.setVolume exists");
     ok("getMuted" in ac, "ac.getMuted exists");
     ok("setMuted" in ac, "ac.setMuted exists");
--- a/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
@@ -1,15 +1,14 @@
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
-var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannelMutedByDefault.html';
+var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannelMutedByDefault.html';
 var testFrame;
 var ac;
 
 function alertListener(e) {
   var message = e.detail.message
   if (/^OK/.exec(message)) {
     ok(true, "Message from file : " + message);
   } else if (/^KO/.exec(message)) {
@@ -73,17 +72,17 @@ function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     ac = channels[0];
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("getMuted" in ac, "ac.getMuted exists");
     ok("setMuted" in ac, "ac.setMuted exists");
     ok("onactivestatechanged" in ac, "onactivestatechanged exists");
 
     runTests();
--- a/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
@@ -1,15 +1,14 @@
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
-var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannelSeeking.html';
+var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannelSeeking.html';
 var generator = runTests();
 var testFrame;
 var ac;
 
 function alertListener(e) {
   var message = e.detail.message
   if (/^OK/.exec(message)) {
     ok(true, "Message from file : " + message);
@@ -99,17 +98,17 @@ function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     ac = channels[0];
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("onactivestatechanged" in ac, "onactivestatechanged exists");
 
     continueTest();
   }
 
--- a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
@@ -2,77 +2,68 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 1113086 - tests for AudioChannel API into BrowserElement
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTests() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
 
   var listener = function(e) {
     var 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);
+      SimpleTest.finish();
     }
   }
 
   function audio_loadend() {
     ok("mute" in iframe, "iframe.mute exists");
     ok("unmute" in iframe, "iframe.unmute exists");
     ok("getMuted" in iframe, "iframe.getMuted exists");
     ok("getVolume" in iframe, "iframe.getVolume exists");
     ok("setVolume" in iframe, "iframe.setVolume exists");
 
     ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
     var channels = iframe.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     var ac = channels[0];
 
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("getVolume" in ac, "ac.getVolume exists");
     ok("setVolume" in ac, "ac.setVolume exists");
     ok("getMuted" in ac, "ac.getMuted exists");
     ok("setMuted" in ac, "ac.setMuted exists");
     ok("isActive" in ac, "ac.isActive exists");
 
     info("Setting the volume...");
     ac.setVolume(0.5);
 
     ac.onactivestatechanged = function() {
       ok(true, "activestatechanged event received.");
       ac.onactivestatechanged = null;
-      SimpleTest.finish();
     }
   }
 
   iframe.addEventListener('mozbrowserloadend', audio_loadend);
   iframe.addEventListener('mozbrowsershowmodalprompt', listener, false);
   document.body.appendChild(iframe);
 
-  var context = { 'url': 'http://example.org',
-                  'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
-                  'isInIsolatedMozBrowserElement': true };
-  SpecialPowers.pushPermissions([
-    {'type': 'browser', 'allow': 1, 'context': context},
-    {'type': 'embed-apps', 'allow': 1, 'context': context}
-  ], function() {
-    iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html';
-  });
+  iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html';
 }
 
 addEventListener('testready', function() {
   SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(runTests);
   });
 });
--- a/dom/browser-element/mochitest/browserElement_AudioPlayback.js
+++ b/dom/browser-element/mochitest/browserElement_AudioPlayback.js
@@ -3,17 +3,16 @@
 
 // Test the mozbrowseraudioplaybackchange event is fired correctly.
 'use strict';
 
 const { Services } = SpecialPowers.Cu.import('resource://gre/modules/Services.jsm');
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 /**
  * Content script passed to the child iframe
  */
 function playAudioScript() {
   var audio = new content.Audio();
   content.document.body.appendChild(audio);
   audio.oncanplay = function() {
@@ -60,17 +59,17 @@ function runTest() {
 
   // Make sure an event only goes to the first iframe.
   iframe2.addEventListener('mozbrowseraudioplaybackchange', (e) => {
     ok(false,
        'mozbrowseraudioplaybackchange should dispatch to the correct browser');
   });
 
   // Load a simple page to get the process started.
-  iframe.src = browserElementTestHelpers.emptyPage1;
+  iframe.src = browserElementTestHelpers.fileEmptyPage1;
 }
 
 addEventListener('testready', function() {
   SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(runTest);
   });
 });
--- a/dom/browser-element/mochitest/browserElement_BackForward.js
+++ b/dom/browser-element/mochitest/browserElement_BackForward.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 741755 - Test that canGo{Back,Forward} and go{Forward,Back} work with
 // <iframe mozbrowser>.
 
 "use strict";
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 function addOneShotIframeEventListener(event, fn) {
   function wrapper(e) {
     iframe.removeEventListener(event, wrapper);
     fn(e);
   };
 
--- a/dom/browser-element/mochitest/browserElement_BadScreenshot.js
+++ b/dom/browser-element/mochitest/browserElement_BadScreenshot.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 800170 - Test that we get errors when we pass bad arguments to
 // mozbrowser's getScreenshot.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 var numPendingTests = 0;
 
 // Call iframe.getScreenshot with the given args.  If expectSuccess is true, we
 // expect the screenshot's onsuccess handler to fire.  Otherwise, we expect
 // getScreenshot() to throw an exception.
 function checkScreenshotResult(expectSuccess, args) {
--- a/dom/browser-element/mochitest/browserElement_DOMRequestError.js
+++ b/dom/browser-element/mochitest/browserElement_DOMRequestError.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test if DOMRequest returned by an iframe gets an error callback when
 // the iframe is not in the DOM.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   var iframe1 = document.createElement('iframe');
   iframe1.setAttribute('mozbrowser', 'true');
   iframe1.src = 'data:text/html,<html>' +
     '<body style="background:green">hello</body></html>';
   document.body.appendChild(iframe1);
 
--- a/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js
+++ b/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 829486 - Add mozdocumentbrowserfirstpaint event.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 
 function runTestQueue(queue) {
   if (queue.length == 0) {
     SimpleTest.finish();
     return;
   }
--- a/dom/browser-element/mochitest/browserElement_Find.js
+++ b/dom/browser-element/mochitest/browserElement_Find.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 1163961 - Test search API
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
 
   let iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
   iframe.src = 'data:text/html,foo bar foo XXX Foo BAR foobar foobar';
 
   const once = (eventName) => {
--- a/dom/browser-element/mochitest/browserElement_GetContentDimensions.js
+++ b/dom/browser-element/mochitest/browserElement_GetContentDimensions.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 757859 - Test the getContentDimensions functionality of mozbrowser
 
 "use strict";
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var resizeContent = function() {
   var innerBox = content.document.getElementById('abox');
   innerBox.style.width = '800px';
   innerBox.style.height = '800px';
 }
 
 function runTest() {
--- a/dom/browser-element/mochitest/browserElement_GetScreenshot.js
+++ b/dom/browser-element/mochitest/browserElement_GetScreenshot.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test the getScreenshot property for mozbrowser
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   var iframe1 = document.createElement('iframe');
   iframe1.setAttribute('mozbrowser', 'true');
 
   iframe1.src = 'data:text/html,<html>' +
     '<body style="background:green">hello</body></html>';
   document.body.appendChild(iframe1);
--- a/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js
+++ b/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test the getScreenshot property for mozbrowser
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   var dppxPref = 'layout.css.devPixelsPerPx';
   var cssPixelWidth = 600;
   var cssPixelHeight = 400;
 
   var iframe1 = document.createElement('iframe');
   iframe1.setAttribute('width', cssPixelWidth);
--- a/dom/browser-element/mochitest/browserElement_NextPaint.js
+++ b/dom/browser-element/mochitest/browserElement_NextPaint.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 808231 - Add mozbrowsernextpaint event.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
   document.body.appendChild(iframe);
 
   // Add a first listener that we'll remove shortly after.
   iframe.addNextPaintListener(wrongListener);
--- a/dom/browser-element/mochitest/browserElement_NoAudioTrack.js
+++ b/dom/browser-element/mochitest/browserElement_NoAudioTrack.js
@@ -1,15 +1,14 @@
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
-var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_NoAudioTrack.html';
+var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_NoAudioTrack.html';
 var generator = runTests();
 var testFrame;
 
 function alertListener(e) {
   var message = e.detail.message;
   if (/^OK/.exec(message)) {
     ok(true, "Message from file : " + message);
     continueTest();
@@ -62,17 +61,17 @@ function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
+    is(channels.length, 9, "9 audio channel by default");
 
     var ac = channels[0];
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("onactivestatechanged" in ac, "onactivestatechanged exists");
 
     ac.onactivestatechanged = () => {
       ac.onactivestatechanged = null;
       error("Should not receive onactivestatechanged!");
--- a/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js
+++ b/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js
@@ -15,17 +15,16 @@
 // Since the name of the test determines the OOP-by-default pref, the "inproc"
 // version of this test opens an OOP frame, and the "oop" version opens an
 // in-process frame.  Enjoy.  :)
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   // We're going to open a remote frame if OOP off by default.  If OOP is on by
   // default, we're going to open an in-process frame.
   var remote = !browserElementTestHelpers.getOOPByDefaultPref();
 
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
--- a/dom/browser-element/mochitest/browserElement_PurgeHistory.js
+++ b/dom/browser-element/mochitest/browserElement_PurgeHistory.js
@@ -2,31 +2,32 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 807056 - [Browser] Clear History doesn't clear back/forward history in open tabs
 // <iframe mozbrowser>.
 
 "use strict";
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 function addOneShotIframeEventListener(event, fn) {
   function wrapper(e) {
     iframe.removeEventListener(event, wrapper);
     fn(e);
   };
 
   iframe.addEventListener(event, wrapper);
 }
 
 function runTest() {
   iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
+  // FIXME: Bug 1270790
+  iframe.setAttribute('remote', 'true');
 
   addOneShotIframeEventListener('mozbrowserloadend', function() {
     SimpleTest.executeSoon(test2);
   });
 
   iframe.src = browserElementTestHelpers.emptyPage1;
   document.body.appendChild(iframe);
 }
--- a/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js
+++ b/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js
@@ -3,17 +3,16 @@
 
 // Bug 793644, fire an event when attempting to reloads browser element after
 // POST respest.
 
 "use strict";
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 var gotConfirmRepost = false;
 var doRepost = true;
 var timer;
 var isPostRequestSubmitted;
 
 function getExpectedStrings() {
--- a/dom/browser-element/mochitest/browserElement_SendEvent.js
+++ b/dom/browser-element/mochitest/browserElement_SendEvent.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that sendMouseEvent dispatch events.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
   var iframe = document.createElement("iframe");
   iframe.setAttribute('mozbrowser', 'true');
   document.body.appendChild(iframe);
   var x = 10;
   var y = 10;
   // First we force a reflow so that getChildProcessOffset actually returns
@@ -74,27 +73,13 @@ function runTest() {
         iframe.sendTouchEvent("touchcancel", [1], [x], [y], [2], [2],
                               [20], [0.5], 1, 0);
         iframe.removeEventListener('mozbrowserlocationchange', onlocchange);
         SimpleTest.finish();
         break;
     }
   });
 
-  iframe.src = "data:text/html,<html><body>" +
-               "<button>send[Mouse|Touch]Event</button>" +
-               "</body><script>" +
-               "function changeHash(e) {" +
-               "  document.location.hash = e.type;" +
-               "};" +
-               "window.addEventListener('mousedown', changeHash);" +
-               "window.addEventListener('mousemove', changeHash);" +
-               "window.addEventListener('mouseup', changeHash);" +
-               "window.addEventListener('click', changeHash, true);" +
-               "window.addEventListener('touchstart', changeHash);" +
-               "window.addEventListener('touchmove', changeHash);" +
-               "window.addEventListener('touchend', changeHash);" +
-               "window.addEventListener('touchcancel', changeHash);" +
-               "</script></html>";
+  iframe.src = "file_browserElement_SendEvent.html";
 
 }
 
 addEventListener('testready', runTest);
--- a/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js
+++ b/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 905573 - Add setInputMethodActive to browser elements to allow gaia
 // system set the active IME app.
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 // We'll need to get the appId from the current document,
 // it's either SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID when
 // we are not running inside an app (e.g. Firefox Desktop),
 // or the appId of Mochitest app when we are running inside that app
 // (e.g. Emulator).
 var currentAppId = SpecialPowers.wrap(document).nodePrincipal.appId;
 var inApp =
@@ -62,31 +61,29 @@ function createFrames() {
     if (loadendCount === 3) {
       setPermissions();
      }
    };
 
    // Create an input field to receive string from input method iframes.
    gInputFrame = document.createElement('iframe');
    gInputFrame.setAttribute('mozbrowser', 'true');
-   gInputFrame.src =
-     'data:text/html,<input autofocus value="hello" />' +
-     '<p>This is targetted mozbrowser frame.</p>';
+   gInputFrame.src = 'file_browserElement_SetInputMethodActive.html';
    document.body.appendChild(gInputFrame);
    gInputFrame.addEventListener('mozbrowserloadend', countLoadend);
 
    for (let i = 0; i < 2; i++) {
-    let frame = gInputMethodFrames[i] = document.createElement('iframe');
-    frame.setAttribute('mozbrowser', 'true');
-    if (currentAppManifestURL) {
-      frame.setAttribute('mozapp', currentAppManifestURL);
-    }
-    frame.src = 'file_empty.html#' + i;
+     let frame = gInputMethodFrames[i] = document.createElement('iframe');
+     frame.setAttribute('mozbrowser', 'true');
+     if (currentAppManifestURL) {
+       frame.setAttribute('mozapp', currentAppManifestURL);
+     }
+     frame.addEventListener('mozbrowserloadend', countLoadend);
+     frame.src = 'file_empty.html#' + i;
      document.body.appendChild(frame);
-     frame.addEventListener('mozbrowserloadend', countLoadend);
    }
  }
 
 function setPermissions() {
   let permissions = [{
     type: 'input',
     allow: true,
     context: {
--- a/dom/browser-element/mochitest/browserElement_SetNFCFocus.js
+++ b/dom/browser-element/mochitest/browserElement_SetNFCFocus.js
@@ -1,30 +1,27 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Bug 1188639 - Check permission to use setNFCFocus
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function hasSetNFCFocus() {
   return new Promise((resolve, reject) => {
     var iframe = document.createElement('iframe');
     iframe.setAttribute('mozbrowser', 'true');
     iframe.addEventListener('mozbrowserloadend', e => {
       is(iframe.setNFCFocus !== undefined, true,
          "has permission to use setNFCFocus");
       resolve();
     });
     document.body.appendChild(iframe);
   });
 }
 
 function runTest() {
-  SpecialPowers.pushPermissions(
-    [{ 'type': 'nfc-manager', 'allow': 1, 'context': document }],
-    () => hasSetNFCFocus().then(SimpleTest.finish));
+  hasSetNFCFocus().then(SimpleTest.finish);
 }
 
 addEventListener('testready', runTest);
--- a/dom/browser-element/mochitest/browserElement_SetVisible.js
+++ b/dom/browser-element/mochitest/browserElement_SetVisible.js
@@ -2,17 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test the setVisible property for mozbrowser
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframeScript = function() {
   content.document.addEventListener("visibilitychange", function() {
     sendAsyncMessage('test:visibilitychange', {
       hidden: content.document.hidden
     });
   }, false);
 }
--- a/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js
+++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js
@@ -7,28 +7,20 @@
 // In this test, we modify the parent's visibility and check that the child's
 // visibility is changed as appopriate.  We test modifying the child's
 // visibility in a separate testcase.
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 
 function runTest() {
-  var principal = SpecialPowers.wrap(document).nodePrincipal;
-  SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
-                                                originAttributes: {
-                                                  appId: principal.appId,
-                                                  inIsolatedMozBrowser: true
-                                                }});
-
   iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
 
   // Our test involves three <iframe mozbrowser>'s, parent, child1, and child2.
   // child1 and child2 are contained inside parent.  child1 is visibile, and
   // child2 is not.
   //
   // For the purposes of this test, we want there to be a process barrier
@@ -70,23 +62,16 @@ function getVisibleTest2() {
 
 function finish() {
   // We need to remove this listener because when this test finishes and the
   // iframe containing this document is navigated, we'll fire a
   // visibilitychange(false) event on all child iframes.  That's OK and
   // expected, but if we don't remove our listener, then we'll end up causing
   // the /next/ test to fail!
   iframe.removeEventListener('mozbrowsershowmodalprompt', checkMessage);
-
-  var principal = SpecialPowers.wrap(document).nodePrincipal;
-  SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
-                                             originAttributes: {
-                                               appId: principal.appId,
-                                               inIsolatedMozBrowser: true
-                                             }});
   SimpleTest.finish();
 }
 
 var expectedMsg = null;
 var expectedMsgCallback = null;
 function expectMessage(msg, next) {
   expectedMsg = msg;
   expectedMsgCallback = next;
--- a/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js
+++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js
@@ -3,26 +3,18 @@
 
 // Bug 762939 - Test that setting a <iframe mozbrowser> to invisible / visible
 // inside an invisible <iframe mozbrowser> doesn't trigger any events.
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 function runTest() {
-  var principal = SpecialPowers.wrap(document).nodePrincipal;
-  SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
-                                                originAttributes: {
-                                                  appId: principal.appId,
-                                                  inIsolatedMozBrowser: true
-                                                }});
-
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
 
   // We need remote = false here until bug 761935 is fixed; see
   // SetVisibleFrames.js for an explanation.
   iframe.remote = false;
 
   iframe.addEventListener('mozbrowserloadend', function loadEnd(e) {
@@ -52,19 +44,12 @@ function runTest() {
       ok(false, "Got unexpected message: " + e.detail.message);
     }
   });
 
   document.body.appendChild(iframe);
 }
 
 function finish() {
-  var principal = SpecialPowers.wrap(document).nodePrincipal;
-  SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
-                                             originAttributes: {
-                                               appId: principal.appId,
-                                               inIsolatedMozBrowser: true
-                                             }});
-
   SimpleTest.finish();
 }
 
 addEventListener('testready', runTest);
--- a/dom/browser-element/mochitest/browserElement_Stop.js
+++ b/dom/browser-element/mochitest/browserElement_Stop.js
@@ -7,26 +7,26 @@
 // the page from loading, the timeout ensures that the page is
 // actually blocked from loading, once stop is called the
 // image load will be cancaelled and mozbrowserloadend should be called.
 
 "use strict";
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe;
 var stopped = false;
 var imgSrc = 'http://test/tests/dom/browser-element/mochitest/file_bug709759.sjs';
 
 function runTest() {
   iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-
+  // FIXME: Bug 1270790
+  iframe.setAttribute('remote', 'true');
   iframe.addEventListener('mozbrowserloadend', loadend);
   iframe.src = 'data:text/html,<html>' +
     '<body><img src="' + imgSrc + '" /></body></html>';
 
   document.body.appendChild(iframe);
 
   setTimeout(function() {
     stopped = true;
--- a/dom/browser-element/mochitest/browserElement_VisibilityChange.js
+++ b/dom/browser-element/mochitest/browserElement_VisibilityChange.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the onmozbrowservisibilitychange event works.
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 var iframe1 = null;
 function runTest() {
   iframe1 = document.createElement('iframe');
   iframe1.setAttribute('mozbrowser', 'true');
   document.body.appendChild(iframe1);
 
   iframe1.src = 'data:text/html,<html><head><title>Title</title></head><body></body></html>';
--- a/dom/browser-element/mochitest/browserElement_getWebManifest.js
+++ b/dom/browser-element/mochitest/browserElement_getWebManifest.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /*globals async, ok, is, SimpleTest, browserElementTestHelpers*/
 
 // Bug 1169633 - getWebManifest tests
 'use strict';
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 
 // request to load a manifest from a page that doesn't have a manifest.
 // The expected result to be null.
 var test1 = async(function* () {
   var manifest = yield requestManifest('file_empty.html');
   is(manifest, null, 'it should be null.');
 });
 
--- a/dom/browser-element/mochitest/chrome.ini
+++ b/dom/browser-element/mochitest/chrome.ini
@@ -1,12 +1,101 @@
 [DEFAULT]
-skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
+skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || e10s
 
 support-files =
   audio.ogg
+  async.js
+  browserElementTestHelpers.js
+  browserElement_ActiveStateChange.js
+  browserElement_AudioChannelSeeking.js
+  browserElement_AudioChannelMutedByDefault.js
+  browserElement_AudioPlayback.js
+  browserElement_AudioChannel.js
+  browserElement_AudioChannel_nested.js
+  browserElement_BackForward.js
+  browserElement_BadScreenshot.js
+  browserElement_DocumentFirstPaint.js
+  browserElement_DOMRequestError.js
+  browserElement_ExecuteScript.js
+  browserElement_Find.js
+  browserElement_GetContentDimensions.js
+  browserElement_GetScreenshot.js
+  browserElement_GetScreenshotDppx.js
+  browserElement_getWebManifest.js
   browserElement_MultipleAudioChannels.js
+  browserElement_NextPaint.js
+  browserElement_NoAudioTrack.js
+  browserElement_PurgeHistory.js
+  browserElement_ReloadPostRequest.js
+  browserElement_SendEvent.js
+  browserElement_SetInputMethodActive.js
+  browserElement_SetNFCFocus.js
+  browserElement_SetVisible.js
+  browserElement_SetVisibleFrames.js
+  browserElement_SetVisibleFrames2.js
+  browserElement_Stop.js
+  browserElement_VisibilityChange.js
+  file_audio.html
+  file_browserElement_ActiveStateChange.html
+  file_browserElement_AudioChannelSeeking.html
+  file_browserElement_AudioChannel_nested.html
+  file_browserElement_AudioChannelMutedByDefault.html
+  file_browserElement_ExecuteScript.html
   file_browserElement_MultipleAudioChannels.html
+  file_browserElement_NextPaint.html
+  file_browserElement_NoAudioTrack.html
+  file_browserElement_SendEvent.html
+  file_browserElement_SetInputMethodActive.html
+  file_browserElement_SetVisibleFrames2_Outer.html
+  file_browserElement_SetVisibleFrames_Inner.html
+  file_browserElement_SetVisibleFrames_Outer.html
+  file_bug709759.sjs
+  file_empty.html
+  file_post_request.html
+  file_web_manifest.html
+  file_web_manifest.json
+  file_illegal_web_manifest.html
+  iframe_file_audio.html
   multipleAudioChannels_manifest.webapp
   multipleAudioChannels_manifest.webapp^headers^
 
 [test_browserElement_MultipleAudioChannels.html]
 tags = audiochannel
+skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
+[test_browserElement_inproc_ActiveStateChange.html]
+tags = audiochannel
+[test_browserElement_inproc_AudioChannelMutedByDefault.html]
+tags = audiochannel
+skip-if = toolkit == 'android'
+[test_browserElement_inproc_AudioChannelSeeking.html]
+tags = audiochannel
+[test_browserElement_inproc_AudioPlayback.html]
+[test_browserElement_inproc_AudioChannel.html]
+tags = audiochannel
+[test_browserElement_inproc_AudioChannel_nested.html]
+tags = audiochannel
+[test_browserElement_inproc_BackForward.html]
+[test_browserElement_inproc_BadScreenshot.html]
+[test_browserElement_inproc_DocumentFirstPaint.html]
+[test_browserElement_inproc_DOMRequestError.html]
+[test_browserElement_inproc_ExecuteScript.html]
+[test_browserElement_inproc_Find.html]
+[test_browserElement_inproc_GetContentDimensions.html]
+[test_browserElement_inproc_GetScreenshot.html]
+[test_browserElement_inproc_GetScreenshotDppx.html]
+[test_browserElement_inproc_getWebManifest.html]
+[test_browserElement_inproc_NextPaint.html]
+[test_browserElement_inproc_NoAudioTrack.html]
+tags = audiochannel
+[test_browserElement_inproc_PurgeHistory.html]
+[test_browserElement_inproc_ReloadPostRequest.html]
+disabled = no modal prompt on POST reload for chrome window
+[test_browserElement_inproc_SendEvent.html]
+# The setInputMethodActive() tests will timed out on Android
+[test_browserElement_inproc_SetInputMethodActive.html]
+skip-if = (os == "android")
+[test_browserElement_inproc_SetNFCFocus.html]
+[test_browserElement_inproc_SetVisible.html]
+[test_browserElement_inproc_SetVisibleFrames.html]
+[test_browserElement_inproc_SetVisibleFrames2.html]
+[test_browserElement_inproc_Stop.html]
+[test_browserElement_inproc_VisibilityChange.html]
--- a/dom/browser-element/mochitest/file_audio.html
+++ b/dom/browser-element/mochitest/file_audio.html
@@ -1,11 +1,11 @@
 <html>
 <body>
-<audio src="http://mochi.test:8888/tests/dom/browser-element/mochitest/audio.ogg" id="audio" />
+<audio src="chrome://mochitests/content/chrome/dom/browser-element/mochitest/audio.ogg" id="audio" />
 <script>
 var audio = document.getElementById('audio');
 audio.play();
 audio.onended = function() {
   setTimeout(function() {
     audio.play();
   }, 0);
 }
--- a/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html
+++ b/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html
@@ -26,38 +26,38 @@
       ok("mute" in iframe, "iframe.mute exists");
       ok("unmute" in iframe, "iframe.unmute exists");
       ok("getMuted" in iframe, "iframe.getMuted exists");
       ok("getVolume" in iframe, "iframe.getVolume exists");
       ok("setVolume" in iframe, "iframe.setVolume exists");
 
       ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
       var channels = iframe.allowedAudioChannels;
-      is(channels.length, 1, "1 audio channel by default");
+      is(channels.length, 9, "9 audio channel by default");
 
       var ac = channels[0];
 
       ok(ac instanceof BrowserElementAudioChannel, "Correct class");
       ok("getVolume" in ac, "ac.getVolume exists");
       ok("setVolume" in ac, "ac.setVolume exists");
       ok("getMuted" in ac, "ac.getMuted exists");
       ok("setMuted" in ac, "ac.setMuted exists");
       ok("isActive" in ac, "ac.isActive exists");
 
       ac.onactivestatechanged = function() {
-        ok("activestatechanged event received.");
+        ok(true, "activestatechanged event received.");
 
         ac.getVolume().onsuccess = function(e) {
           ok(e.target.result, 1, "Default volume is 1");
         };
 
         finish();
       }
     });
 
     document.body.appendChild(iframe);
-    iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_audio.html';
+    iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_audio.html';
   });
 </script>
 </head>
 <body>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_SendEvent.html
@@ -0,0 +1,15 @@
+<html><body>
+<button>send[Mouse|Touch]Event</button>
+</body><script>
+function changeHash(e) {
+  document.location.hash = e.type;
+};
+window.addEventListener('mousedown', changeHash);
+window.addEventListener('mousemove', changeHash);
+window.addEventListener('mouseup', changeHash);
+window.addEventListener('click', changeHash, true);
+window.addEventListener('touchstart', changeHash);
+window.addEventListener('touchmove', changeHash);
+window.addEventListener('touchend', changeHash);
+window.addEventListener('touchcancel', changeHash);
+</script></html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_SetInputMethodActive.html
@@ -0,0 +1,2 @@
+<input autofocus value="hello" />
+<p>This is targetted mozbrowser frame.</p>
--- a/dom/browser-element/mochitest/file_illegal_web_manifest.html
+++ b/dom/browser-element/mochitest/file_illegal_web_manifest.html
@@ -1,6 +1,7 @@
 <!doctype html>
 <meta charset=utf-8>
 <head>
-<link rel="manifest" href="file://this_is_not_allowed!">
+<!-- FIXME: we should keep file:// here ... -->
+<link rel="manifest" href="sshfs://this_is_not_allowed!">
 </head>
 <h1>Support Page for Web Manifest Tests</h1>
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -1,217 +1,161 @@
 [DEFAULT]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || e10s
 support-files =
   audio.ogg
   ../../../dom/media/test/short-video.ogv
   async.js
   browserElementTestHelpers.js
-  browserElement_ActiveStateChange.js
   browserElement_Alert.js
   browserElement_AlertInFrame.js
   browserElement_AllowEmbedAppsInNestedOOIframe.js
   browserElement_AppFramePermission.js
   browserElement_AppWindowNamespace.js
-  browserElement_AudioChannelSeeking.js
-  browserElement_AudioChannelMutedByDefault.js
-  browserElement_AudioPlayback.js
   browserElement_Auth.js
-  browserElement_BackForward.js
-  browserElement_BadScreenshot.js
   browserElement_Viewmode.js
   browserElement_ThemeColor.js
   browserElement_BrowserWindowNamespace.js
   browserElement_BrowserWindowResize.js
   browserElement_Close.js
   browserElement_CloseApp.js
   browserElement_CloseFromOpener.js
   browserElement_ContextmenuEvents.js
   browserElement_CookiesNotThirdParty.js
   browserElement_CopyPaste.js
-  browserElement_DOMRequestError.js
   browserElement_DataURI.js
   browserElement_DisallowEmbedAppsInOOP.js
-  browserElement_DocumentFirstPaint.js
   browserElement_Download.js
   browserElement_ErrorSecurity.js
-  browserElement_ExecuteScript.js
   browserElement_ExposableURI.js
-  browserElement_Find.js
   browserElement_FirstPaint.js
   browserElement_ForwardName.js
   browserElement_FrameWrongURI.js
-  browserElement_GetScreenshot.js
-  browserElement_GetScreenshotDppx.js
-  browserElement_getWebManifest.js
   browserElement_Iconchange.js
   browserElement_LoadEvents.js
   browserElement_Manifestchange.js
   browserElement_Metachange.js
   browserElement_NextPaint.js
-  browserElement_NoAudioTrack.js
   browserElement_OpenNamed.js
   browserElement_OpenTab.js
   browserElement_OpenWindow.js
   browserElement_OpenWindowDifferentOrigin.js
   browserElement_OpenWindowEmpty.js
   browserElement_OpenWindowInFrame.js
   browserElement_OpenWindowRejected.js
   browserElement_Opensearch.js
   browserElement_PrivateBrowsing.js
   browserElement_PromptCheck.js
   browserElement_PromptConfirm.js
   browserElement_Proxy.js
-  browserElement_PurgeHistory.js
   browserElement_Reload.js
-  browserElement_ReloadPostRequest.js
   browserElement_RemoveBrowserElement.js
   browserElement_ScrollEvent.js
   browserElement_SecurityChange.js
-  browserElement_SendEvent.js
-  browserElement_SetInputMethodActive.js
-  browserElement_SetNFCFocus.js
-  browserElement_SetVisible.js
-  browserElement_SetVisibleFrames.js
-  browserElement_SetVisibleFrames2.js
-  browserElement_Stop.js
   browserElement_TargetBlank.js
   browserElement_TargetTop.js
   browserElement_Titlechange.js
   browserElement_TopBarrier.js
-  browserElement_VisibilityChange.js
   browserElement_XFrameOptions.js
   browserElement_XFrameOptionsAllowFrom.js
   browserElement_XFrameOptionsDeny.js
   browserElement_XFrameOptionsSameOrigin.js
-  browserElement_GetContentDimensions.js
-  browserElement_AudioChannel.js
-  browserElement_AudioChannel_nested.js
-  file_browserElement_ActiveStateChange.html
   file_browserElement_AlertInFrame.html
   file_browserElement_AlertInFrame_Inner.html
   file_browserElement_AllowEmbedAppsInNestedOOIframe.html
   file_browserElement_AppFramePermission.html
   file_browserElement_AppWindowNamespace.html
-  file_browserElement_AudioChannelSeeking.html
-  file_browserElement_AudioChannel_nested.html
-  file_browserElement_AudioChannelMutedByDefault.html
   file_browserElement_Viewmode.html
   file_browserElement_ThemeColor.html
   file_browserElement_BrowserWindowNamespace.html
   file_browserElement_CloseApp.html
   file_browserElement_CloseFromOpener.html
   file_browserElement_CookiesNotThirdParty.html
   file_browserElement_DisallowEmbedAppsInOOP.html
-  file_browserElement_ExecuteScript.html
   file_browserElement_ForwardName.html
   file_browserElement_FrameWrongURI.html
   file_browserElement_LoadEvents.html
   file_browserElement_Metachange.sjs
   file_browserElement_NextPaint.html
-  file_browserElement_NoAudioTrack.html
   file_browserElement_Open1.html
   file_browserElement_Open2.html
   file_browserElement_OpenNamed.html
   file_browserElement_OpenNamed2.html
   file_browserElement_OpenWindowDifferentOrigin.html
   file_browserElement_OpenWindowEmpty.html
   file_browserElement_OpenWindowInFrame.html
   file_browserElement_OpenWindowRejected.html
   file_browserElement_PrivateBrowsing.html
   file_browserElement_SecurityChange.html
-  file_browserElement_SetVisibleFrames2_Outer.html
-  file_browserElement_SetVisibleFrames_Inner.html
-  file_browserElement_SetVisibleFrames_Outer.html
   file_browserElement_TargetBlank.html
   file_browserElement_TargetTop.html
   file_browserElement_XFrameOptions.sjs
   file_browserElement_XFrameOptionsAllowFrom.html
   file_browserElement_XFrameOptionsAllowFrom.sjs
   file_browserElement_XFrameOptionsDeny.html
   file_browserElement_XFrameOptionsSameOrigin.html
-  file_bug709759.sjs
   file_bug741717.sjs
   file_download_bin.sjs
   file_empty.html
   file_empty_script.js
   file_focus.html
   file_http_401_response.sjs
   file_http_407_response.sjs
-  file_post_request.html
   file_wyciwyg.html
   file_audio.html
   iframe_file_audio.html
   file_web_manifest.html
   file_web_manifest.json
   file_illegal_web_manifest.html
   noaudio.webm
 
 # Note: browserElementTestHelpers.js looks at the test's filename to determine
 # whether the test should be OOP.  "_oop_" signals OOP, "_inproc_" signals in
 # process.  Default is OOP.
-[test_browserElement_inproc_getWebManifest.html]
 [test_browserElement_NoAttr.html]
 [test_browserElement_NoPref.html]
 [test_browserElement_NoPermission.html]
 [test_browserElement_inproc_Alert.html]
-[test_browserElement_inproc_AudioChannelSeeking.html]
-tags = audiochannel
 [test_browserElement_inproc_Viewmode.html]
 [test_browserElement_inproc_ThemeColor.html]
 skip-if = buildapp == 'b2g'
 [test_browserElement_inproc_AlertInFrame.html]
 [test_browserElement_inproc_AppFramePermission.html]
-skip-if = buildapp != 'mulet'
+skip-if = true  ### Bug 1255339: blacklist because no more mozApps
 [test_browserElement_inproc_AppWindowNamespace.html]
-skip-if = toolkit == 'android' || buildapp == 'b2g' # android(TIMED_OUT, bug 783509) androidx86(TIMED_OUT, bug 783509)
-[test_browserElement_inproc_AudioChannelMutedByDefault.html]
-tags = audiochannel
-skip-if = toolkit == 'android'
-[test_browserElement_inproc_AudioPlayback.html]
+skip-if = true # android(TIMED_OUT, bug 783509) androidx86(TIMED_OUT, bug 783509)  ### Bug 1255339: blacklist because no more mozApps
 [test_browserElement_inproc_Auth.html]
 skip-if = buildapp == 'b2g'
-[test_browserElement_inproc_BackForward.html]
-[test_browserElement_inproc_BadScreenshot.html]
 [test_browserElement_inproc_BrowserWindowNamespace.html]
 skip-if = buildapp == 'b2g'
 [test_browserElement_inproc_BrowserWindowResize.html]
 [test_browserElement_inproc_Close.html]
 [test_browserElement_inproc_CloseApp.html]
-skip-if = toolkit == 'android' || buildapp == 'b2g' # android(FAILS, bug 796982) androidx86(FAILS, bug 796982)
+skip-if = true # android(FAILS, bug 796982) androidx86(FAILS, bug 796982) ### Bug 1255339: blacklist because no more mozApps
 [test_browserElement_inproc_CloseFromOpener.html]
 skip-if = buildapp == 'b2g'
 [test_browserElement_inproc_ContextmenuEvents.html]
 [test_browserElement_inproc_CookiesNotThirdParty.html]
 [test_browserElement_inproc_CopyPaste.html]
 subsuite = clipboard
 skip-if = (os == "android") # Disabled on Android, see bug 1230421
-[test_browserElement_inproc_DOMRequestError.html]
 [test_browserElement_inproc_DataURI.html]
 [test_browserElement_inproc_DisallowEmbedAppsInOOP.html]
-skip-if = buildapp != 'mulet'
-[test_browserElement_inproc_DocumentFirstPaint.html]
+skip-if = true ### Bug 1255339: blacklist because no more mozApps
 [test_browserElement_inproc_Download.html]
 disabled = bug 1022281
-[test_browserElement_inproc_ExecuteScript.html]
 [test_browserElement_inproc_ExposableURI.html]
-[test_browserElement_inproc_Find.html]
 [test_browserElement_inproc_FirstPaint.html]
 [test_browserElement_inproc_ForwardName.html]
 [test_browserElement_inproc_FrameWrongURI.html]
 skip-if = (toolkit == 'gonk' && !debug)
-[test_browserElement_inproc_GetScreenshot.html]
-[test_browserElement_inproc_GetScreenshotDppx.html]
 [test_browserElement_inproc_Iconchange.html]
 [test_browserElement_inproc_LoadEvents.html]
 [test_browserElement_inproc_Manifestchange.html]
 [test_browserElement_inproc_Metachange.html]
-[test_browserElement_inproc_NextPaint.html]
-[test_browserElement_inproc_NoAudioTrack.html]
-tags = audiochannel
 [test_browserElement_inproc_OpenNamed.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_inproc_OpenTab.html]
 disabled = won't work as Firefox desktop will intercept ctrl-click
 [test_browserElement_inproc_OpenWindow.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_inproc_OpenWindowDifferentOrigin.html]
 skip-if = (toolkit == 'gonk' && !debug)
@@ -222,46 +166,28 @@ skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_inproc_Opensearch.html]
 [test_browserElement_inproc_PrivateBrowsing.html]
 [test_browserElement_inproc_PromptCheck.html]
 [test_browserElement_inproc_PromptConfirm.html]
 # Disabled on B2G Emulator because permission cannot be asserted in content process,
 # need to fix either bug 1094055 or bug 1020135.
 [test_browserElement_inproc_Proxy.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet'
-[test_browserElement_inproc_PurgeHistory.html]
-[test_browserElement_inproc_ReloadPostRequest.html]
 [test_browserElement_inproc_RemoveBrowserElement.html]
 [test_browserElement_inproc_ScrollEvent.html]
 [test_browserElement_inproc_SecurityChange.html]
 skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) # android(TIMED_OUT, bug 766586) androidx86(TIMED_OUT, bug 766586)
-[test_browserElement_inproc_SendEvent.html]
-# The setInputMethodActive() tests will timed out on Android
-[test_browserElement_inproc_SetInputMethodActive.html]
-skip-if = (os == "android")
-[test_browserElement_inproc_SetVisible.html]
-[test_browserElement_inproc_SetVisibleFrames.html]
-[test_browserElement_inproc_SetVisibleFrames2.html]
-[test_browserElement_inproc_Stop.html]
 [test_browserElement_inproc_TargetBlank.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_inproc_TargetTop.html]
 [test_browserElement_inproc_Titlechange.html]
 [test_browserElement_inproc_TopBarrier.html]
-[test_browserElement_inproc_VisibilityChange.html]
 [test_browserElement_inproc_XFrameOptions.html]
 [test_browserElement_inproc_XFrameOptionsAllowFrom.html]
 [test_browserElement_inproc_XFrameOptionsDeny.html]
 [test_browserElement_inproc_XFrameOptionsSameOrigin.html]
 [test_browserElement_oop_NextPaint.html]
 # Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
+disabled = temp disabling some OOP tests for WebIDL scope changes
 [test_browserElement_inproc_Reload.html]
 disabled = bug 774100
-[test_browserElement_inproc_GetContentDimensions.html]
-[test_browserElement_inproc_AudioChannel.html]
-tags = audiochannel
-[test_browserElement_inproc_AudioChannel_nested.html]
-tags = audiochannel
-[test_browserElement_inproc_SetNFCFocus.html]
 [test_browserElement_inproc_OpenWindowEmpty.html]
 skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator
-[test_browserElement_inproc_ActiveStateChange.html]
-tags = audiochannel
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/priority/chrome.ini
@@ -0,0 +1,19 @@
+[DEFAULT]
+# Good luck running these tests on anything but desktop Linux.
+run-if = os == 'linux' && buildapp == 'browser' && !e10s
+support-files =
+  file_Audio.html
+  file_MultipleFrames.html
+  file_NestedFramesOuter.html
+  file_WebGLContextLost.html
+  silence.ogg
+  !/dom/browser-element/mochitest/browserElementTestHelpers.js
+  !/dom/browser-element/mochitest/file_empty.html
+
+[test_Activity.html]
+[test_Audio.html]
+[test_Background.html]
+[test_Keyboard.html]
+[test_MultipleFrames.html]
+[test_NestedFrames.html]
+[test_Visibility.html]
--- a/dom/browser-element/mochitest/priority/mochitest.ini
+++ b/dom/browser-element/mochitest/priority/mochitest.ini
@@ -1,32 +1,23 @@
 [DEFAULT]
 # Good luck running these tests on anything but desktop Linux.
 run-if = os == 'linux' && buildapp == 'browser' && !e10s
 support-files =
-  file_Audio.html
   file_HighPriority.html
-  file_MultipleFrames.html
-  file_NestedFramesOuter.html
-  file_WebGLContextLost.html
   silence.ogg
   !/dom/browser-element/mochitest/browserElementTestHelpers.js
   !/dom/browser-element/mochitest/file_empty.html
 
 # Note: ../browserElementTestHelpers.js makes all tests in this directory OOP,
 # because testing the process-priority manager without OOP frames does not make
 # much sense.
 
 [test_Simple.html]
-[test_Visibility.html]
 [test_HighPriority.html]
-[test_Background.html]
 [test_BackgroundLRU.html]
-[test_Activity.html]
-[test_Audio.html]
-[test_Keyboard.html]
+skip-if = true ### Bug 1255339: blacklist because no more mozApps
 [test_MultipleActivities.html]
-[test_MultipleFrames.html]
+skip-if = true ### Bug 1255339: blacklist because no more mozApps
 [test_Preallocated.html]
 disabled = bug 968604, bug 987164
-[test_NestedFrames.html]
 [test_WebGLContextLost.html]
 disabled = bug 865844
--- a/dom/browser-element/mochitest/priority/test_Activity.html
+++ b/dom/browser-element/mochitest/priority/test_Activity.html
@@ -1,27 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that calling setVisible("false") on an iframe that has an open activity
 causes its priority to change.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                         .getService(SpecialPowers.Ci.nsIObserverService);
   var iframe = document.createElement("iframe");
   iframe.setAttribute("mozbrowser", true);
 
--- a/dom/browser-element/mochitest/priority/test_Audio.html
+++ b/dom/browser-element/mochitest/priority/test_Audio.html
@@ -1,26 +1,25 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that frames playing audio get BACKGROUND_PERCEIVABLE priority.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
   iframe.src = 'file_Audio.html';
 
   var childID = null;
--- a/dom/browser-element/mochitest/priority/test_Background.html
+++ b/dom/browser-element/mochitest/priority/test_Background.html
@@ -1,27 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that calling setVisible('false') on an iframe causes its visibility to
 change.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
 
   iframe.src = browserElementTestHelpers.emptyPage1;
 
--- a/dom/browser-element/mochitest/priority/test_Keyboard.html
+++ b/dom/browser-element/mochitest/priority/test_Keyboard.html
@@ -1,27 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that frames with mozapptype=inputmethod gets the keyboard-specific
 priority level when in the foreground.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
   iframe.setAttribute('mozapptype', 'inputmethod');
   iframe.src = browserElementTestHelpers.emptyPage1;
 
--- a/dom/browser-element/mochitest/priority/test_MultipleFrames.html
+++ b/dom/browser-element/mochitest/priority/test_MultipleFrames.html
@@ -1,27 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that when we remove one of a process's frames from the DOM, the process's
 priority is recomputed.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
   iframe.src = 'file_MultipleFrames.html';
 
   var childID = null;
--- a/dom/browser-element/mochitest/priority/test_NestedFrames.html
+++ b/dom/browser-element/mochitest/priority/test_NestedFrames.html
@@ -1,46 +1,28 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test changing the visibility of an <iframe mozbrowser> changes the visibility
 (and thus the priority) of any <iframe mozbrowser>s it contains.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
-// Give our origin permission to open browsers, and remove it when the test is complete.
-var principal = SpecialPowers.wrap(document).nodePrincipal;
-SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
-                                              originAttributes: {
-                                                appId: principal.appId,
-                                                inIsolatedMozBrowser: true
-                                              }});
-
-addEventListener('unload', function() {
-  var principal = SpecialPowers.wrap(document).nodePrincipal;
-  SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
-                                             originAttributes: {
-                                               appId: principal.appId,
-                                               inIsolatedMozBrowser: true
-                                             }});
-});
-
 function runTest() {
   // Set up the following hierarchy of frames:
   //
   //   <iframe mozbrowser remote=false src='file_NestedFramesOuter.html'>
   //     <iframe mozbrowser remote=true src='file_empty.html'>
   //
   // When we change the visibility of the outer iframe, it should change the
   // priority of the inner one.
--- a/dom/browser-element/mochitest/priority/test_Visibility.html
+++ b/dom/browser-element/mochitest/priority/test_Visibility.html
@@ -1,26 +1,25 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test that setVisible() changes a process's priority.
 -->
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
 function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
   iframe.src = browserElementTestHelpers.emptyPage1;
 
   var childID = null;
--- a/dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChange.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChange.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_ActiveStateChange.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element audioChannel.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_AudioChannel.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelMutedByDefault.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelMutedByDefault.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Bug 1235535 - Audio Channel Muted-By-Default.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_AudioChannelMutedByDefault.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelSeeking.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannelSeeking.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Bug 1225425 - Do not unregister the AudioChannelAgent during seeking</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_AudioChannelSeeking.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel_nested.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_AudioChannel_nested.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element audioChannel in nested mozbrowser iframes.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_AudioChannel_nested.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_AudioPlayback.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_AudioPlayback.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1180824
 -->
 <head>
   <title>Test for Bug 1180824</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180824">Mozilla Bug 1180824</a>
 
 <script type="application/javascript;version=1.7" src="browserElement_AudioPlayback.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_BackForward.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_BackForward.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_BackForward.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_BadScreenshot.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_BadScreenshot.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 800170</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_BadScreenshot.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_DOMRequestError.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_DOMRequestError.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=787519
 -->
 <head>
   <title>Test for Bug 787519</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=787519">Mozilla Bug 787519</a>
 
 <script type="application/javascript;version=1.7" src='browserElement_DOMRequestError.js'>
 </script>
 
 </body>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_DocumentFirstPaint.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_DocumentFirstPaint.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 829486</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_DocumentFirstPaint.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_ExecuteScript.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_ExecuteScript.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1174733
 -->
 <head>
   <title>Test for Bug 1163961</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1174733">Mozilla Bug 1174733</a>
 
 <script type="application/javascript;version=1.7" src="browserElement_ExecuteScript.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_Find.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_Find.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1163961
 -->
 <head>
   <title>Test for Bug 1163961</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1163961">Mozilla Bug 1163961</a>
 
 <script type="application/javascript;version=1.7" src="browserElement_Find.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_GetContentDimensions.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_GetContentDimensions.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_GetContentDimensions.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshot.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshot.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=753595
 -->
 <head>
   <title>Test for Bug 753595</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=753595">Mozilla Bug 753595</a>
 
 <script type="application/javascript;version=1.7" src='browserElement_GetScreenshot.js'>
 </script>
 
 </body>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshotDppx.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_GetScreenshotDppx.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=959066
 -->
 <head>
   <title>Test for Bug 959066</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=959066">Mozilla Bug 959066</a>
 
 <script type="application/javascript;version=1.7" src='browserElement_GetScreenshotDppx.js'>
 </script>
 
 </body>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_NextPaint.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_NextPaint.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 808231</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_NextPaint.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_NoAudioTrack.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_NoAudioTrack.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Bug 1227051 - No audio track video shouldn't register the AudioChannelAgent</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_NoAudioTrack.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_OpenMixedProcess.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_OpenMixedProcess.html
@@ -5,9 +5,9 @@
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_OpenMixedProcess.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_PurgeHistory.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_PurgeHistory.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_PurgeHistory.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SendEvent.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SendEvent.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=774809
 -->
 <head>
   <title>Test for Bug 774809</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=774809">Mozilla Bug 774809</a>
 
 <script type="application/javascript;version=1.7" src="browserElement_SendEvent.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SetInputMethodActive.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetInputMethodActive.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 905573</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_SetInputMethodActive.js">
 </script>
 </body>
 </html>
 
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SetNFCFocus.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetNFCFocus.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 1188639</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_SetNFCFocus.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SetVisible.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetVisible.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=702880
 -->
  <head>
   <title>Test for Bug 702880</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=753595">Mozilla Bug 702880</a>
 
 <script type="application/javascript;version=1.7" src='browserElement_SetVisible.js'>
 </script>
 
 </body>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 762939</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames2.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames2.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 762939</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames2.js">
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_Stop.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_Stop.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test of browser element.</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_Stop.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_VisibilityChange.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_VisibilityChange.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=868816
 -->
 <head>
   <title>Test for Bug 868816</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=868816">Mozilla Bug 868816</a>
 
 <script type="application/javascript;version=1.7" src='browserElement_VisibilityChange.js'>
 </script>
 
 </body>
--- a/dom/browser-element/mochitest/test_browserElement_inproc_getWebManifest.html
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_getWebManifest.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Bug 1169633</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/dom/browser-element/mochitest/browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.8"
   src="async.js">
 </script>
 <script type="application/javascript;version=1.8"
   src="browserElement_getWebManifest.js">
 </script>
--- a/dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChange.html
+++ b/dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChange.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script type="application/javascript;version=1.7" src="browserElement_ActiveStateChange.js">
 </script>
 </body>
 </html>
--- a/dom/browser-element/moz.build
+++ b/dom/browser-element/moz.build
@@ -49,9 +49,13 @@ LOCAL_INCLUDES += [
     '/dom/ipc',
 ]
 
 MOCHITEST_MANIFESTS += [
     'mochitest/mochitest-oop.ini',
     'mochitest/mochitest.ini',
     'mochitest/priority/mochitest.ini',
 ]
-MOCHITEST_CHROME_MANIFESTS += ['mochitest/chrome.ini']
+
+MOCHITEST_CHROME_MANIFESTS += [
+    'mochitest/chrome.ini',
+    'mochitest/priority/chrome.ini',
+]