Bug 1286530 - Switch to chrome mochitests r?fabrice draft
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Tue, 10 May 2016 10:26:29 +0200
changeset 387673 fa466177be5b26a1d5be3475d8553ff901687de3
parent 387672 36c8a67d0cd8607a926683e54a5342e2e94ea5f6
child 525402 2b0d09f6ddf22eb1d5718892a13f789fd86a3ea6
push id23021
push userbmo:lissyx+mozillians@lissyx.dyndns.org
push dateThu, 14 Jul 2016 13:39:30 +0000
reviewersfabrice
bugs1286530
milestone50.0a1
Bug 1286530 - Switch to chrome mochitests r?fabrice MozReview-Commit-ID: AzCOGgJy8bG
dom/alarm/moz.build
dom/alarm/test/chrome.ini
dom/alarm/test/mochitest.ini
dom/alarm/test/test_alarm_permitted_app.html
dom/base/test/chrome.ini
dom/base/test/file_navigator_resolve_identity.html
dom/base/test/mochitest.ini
dom/base/test/mozbrowser_api_utils.js
dom/base/test/test_getFeature_with_perm.html
dom/base/test/test_getFeature_without_perm.html
dom/base/test/test_hasFeature.html
dom/base/test/test_mozbrowser_apis_allowed.html
dom/base/test/test_navigator_resolve_identity.html
dom/base/test/test_navigator_resolve_identity_xrays.xul
dom/bindings/test/chrome.ini
dom/bindings/test/file_bug707564-2.html
dom/bindings/test/mochitest.ini
dom/bindings/test/test_bug707564-chrome.html
dom/bindings/test/test_bug707564.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_XFrameOptionsAllowFrom.js
dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.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-oop.ini
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_Simple.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
dom/contacts/tests/chrome.ini
dom/contacts/tests/file_contacts_basics.html
dom/contacts/tests/file_contacts_basics2.html
dom/contacts/tests/file_contacts_blobs.html
dom/contacts/tests/file_contacts_events.html
dom/contacts/tests/file_contacts_getall.html
dom/contacts/tests/file_contacts_getall2.html
dom/contacts/tests/file_contacts_international.html
dom/contacts/tests/file_contacts_substringmatching.html
dom/contacts/tests/file_contacts_substringmatchingCL.html
dom/contacts/tests/file_contacts_substringmatchingVE.html
dom/contacts/tests/file_migration.html
dom/contacts/tests/mochitest.ini
dom/contacts/tests/test_contacts_a_cache.xul
dom/contacts/tests/test_contacts_a_shutdown.xul
dom/contacts/tests/test_contacts_a_upgrade.xul
dom/contacts/tests/test_contacts_basics.html
dom/contacts/tests/test_contacts_basics2.html
dom/contacts/tests/test_contacts_blobs.html
dom/contacts/tests/test_contacts_cache.xul
dom/contacts/tests/test_contacts_events.html
dom/contacts/tests/test_contacts_getall.html
dom/contacts/tests/test_contacts_getall2.html
dom/contacts/tests/test_contacts_international.html
dom/contacts/tests/test_contacts_shutdown.xul
dom/contacts/tests/test_contacts_substringmatching.html
dom/contacts/tests/test_contacts_substringmatchingCL.html
dom/contacts/tests/test_contacts_substringmatchingVE.html
dom/contacts/tests/test_contacts_upgrade.xul
dom/contacts/tests/test_migration.html
dom/html/test/chrome.ini
dom/html/test/mochitest.ini
dom/html/test/test_audio_wakelock.html
dom/html/test/test_video_wakelock.html
dom/inputmethod/mochitest/chrome.ini
dom/inputmethod/mochitest/file_test_bug1066515.html
dom/inputmethod/mochitest/file_test_bug1137557.html
dom/inputmethod/mochitest/file_test_bug1175399.html
dom/inputmethod/mochitest/file_test_focus_blur_manage_events.html
dom/inputmethod/mochitest/file_test_setSupportsSwitching.html
dom/inputmethod/mochitest/file_test_simple_manage_events.html
dom/inputmethod/mochitest/file_test_sync_edit.html
dom/inputmethod/mochitest/file_test_two_inputs.html
dom/inputmethod/mochitest/file_test_two_selects.html
dom/inputmethod/mochitest/file_test_unload.html
dom/inputmethod/mochitest/file_test_unload_action.html
dom/inputmethod/mochitest/inputmethod_common.js
dom/inputmethod/mochitest/mochitest.ini
dom/inputmethod/mochitest/test_basic.html
dom/inputmethod/mochitest/test_bug1026997.html
dom/inputmethod/mochitest/test_bug1043828.html
dom/inputmethod/mochitest/test_bug1059163.html
dom/inputmethod/mochitest/test_bug1066515.html
dom/inputmethod/mochitest/test_bug1137557.html
dom/inputmethod/mochitest/test_bug1175399.html
dom/inputmethod/mochitest/test_bug944397.html
dom/inputmethod/mochitest/test_bug949059.html
dom/inputmethod/mochitest/test_bug953044.html
dom/inputmethod/mochitest/test_bug960946.html
dom/inputmethod/mochitest/test_bug978918.html
dom/inputmethod/mochitest/test_focus_blur_manage_events.html
dom/inputmethod/mochitest/test_forward_hardware_key_to_ime.html
dom/inputmethod/mochitest/test_input_registry_events.html
dom/inputmethod/mochitest/test_sendkey_cancel.html
dom/inputmethod/mochitest/test_setSupportsSwitching.html
dom/inputmethod/mochitest/test_simple_manage_events.html
dom/inputmethod/mochitest/test_sync_edit.html
dom/inputmethod/mochitest/test_two_inputs.html
dom/inputmethod/mochitest/test_two_selects.html
dom/inputmethod/mochitest/test_unload.html
dom/inputmethod/moz.build
dom/mobilemessage/moz.build
dom/mobilemessage/tests/mochitest/chrome.ini
dom/mobilemessage/tests/mochitest/mochitest.ini
dom/mobilemessage/tests/mochitest/test_sms_basics.html
dom/network/tests/chrome.ini
dom/network/tests/mochitest.ini
dom/network/tests/test_tcpsocket_client_and_server_basics.html
dom/network/tests/test_tcpsocket_client_and_server_basics.js
dom/network/tests/test_tcpsocket_enabled_no_perm.html
dom/network/tests/test_tcpsocket_enabled_with_perm.html
dom/network/tests/test_tcpsocket_legacy.html
dom/network/tests/test_udpsocket.html
dom/permission/tests/mochitest.ini
dom/power/moz.build
dom/power/test/browser_wakelocks.js
dom/power/test/chrome.ini
dom/power/test/mochitest.ini
dom/power/test/test_power_basics.html
dom/power/test/test_power_set_cpusleepallowed.html
dom/power/test/test_power_set_key_light_enabled.html
dom/power/test/test_power_set_screen_brightness.html
dom/power/test/test_power_set_screen_enabled.html
dom/presentation/tests/mochitest/chrome.ini
dom/presentation/tests/mochitest/mochitest.ini
dom/presentation/tests/mochitest/test_presentation_device_info.html
dom/presentation/tests/mochitest/test_presentation_device_info_permission.html
dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html
dom/presentation/tests/mochitest/test_presentation_tcp_sender.html
dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html
dom/settings/moz.build
dom/settings/tests/chrome.ini
dom/settings/tests/file_bug1110872.html
dom/settings/tests/mochitest.ini
dom/settings/tests/test_settings_basics.html
dom/settings/tests/test_settings_blobs.html
dom/settings/tests/test_settings_bug1110872.html
dom/settings/tests/test_settings_data_uris.html
dom/settings/tests/test_settings_events.html
dom/settings/tests/test_settings_navigator_object.html
dom/settings/tests/test_settings_observer_killer.html
dom/settings/tests/test_settings_onsettingchange.html
dom/settings/tests/test_settings_permissions.html
dom/tests/mochitest/general/chrome.ini
dom/tests/mochitest/general/mochitest.ini
dom/tests/mochitest/general/test_idleapi_permissions.html
dom/tests/mochitest/geolocation/chrome.ini
dom/tests/mochitest/geolocation/mochitest.ini
dom/tests/mochitest/geolocation/test_mozsettings.html
dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
dom/tests/mochitest/notification/chrome.ini
dom/tests/mochitest/notification/mochitest.ini
dom/tests/mochitest/notification/test_notification_noresend.html
dom/tests/moz.build
dom/tv/moz.build
dom/tv/test/mochitest/chrome.ini
dom/tv/test/mochitest/head.js
dom/tv/test/mochitest/mochitest.ini
dom/tv/test/mochitest/test_tv_get_channels.html
dom/tv/test/mochitest/test_tv_get_channels_during_scanning.html
dom/tv/test/mochitest/test_tv_get_current_program.html
dom/tv/test/mochitest/test_tv_get_programs.html
dom/tv/test/mochitest/test_tv_get_sources.html
dom/tv/test/mochitest/test_tv_get_tuners.html
dom/tv/test/mochitest/test_tv_permitted_app.html
dom/tv/test/mochitest/test_tv_scan_channels_completed.html
dom/tv/test/mochitest/test_tv_scan_channels_stopped.html
dom/tv/test/mochitest/test_tv_set_current_channel.html
dom/tv/test/mochitest/test_tv_set_current_channel_during_scanning.html
dom/tv/test/mochitest/test_tv_set_current_source.html
dom/tv/test/mochitest/test_tv_set_invalid_current_channel.html
dom/tv/test/mochitest/test_tv_set_invalid_current_source.html
--- a/dom/alarm/moz.build
+++ b/dom/alarm/moz.build
@@ -29,9 +29,11 @@ EXTRA_JS_MODULES += [
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
+
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
new file mode 100644
--- /dev/null
+++ b/dom/alarm/test/chrome.ini
@@ -0,0 +1,7 @@
+[DEFAULT]
+run-if = buildapp == 'b2g' || buildapp == 'mulet'
+support-files =
+  file_empty.html
+  system_message_chrome_script.js
+
+[test_alarm_permitted_app.html]
--- a/dom/alarm/test/mochitest.ini
+++ b/dom/alarm/test/mochitest.ini
@@ -1,21 +1,14 @@
 [DEFAULT]
+run-if = buildapp == 'b2g' || buildapp == 'mulet'
 support-files =
   file_empty.html
   system_message_chrome_script.js
 
 [test_alarm_add_data.html]
-skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_alarm_add_date.html]
-skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_alarm_add_respectTimezone.html]
-skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_alarm_non_permitted_app.html]
-[test_alarm_permitted_app.html]
 [test_alarm_remove.html]
-skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_bug1015540.html]
-skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_bug1037079.html]
-skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_bug1090896.html]
-skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
--- a/dom/alarm/test/test_alarm_permitted_app.html
+++ b/dom/alarm/test/test_alarm_permitted_app.html
@@ -1,28 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test Permitted Application for Alarm API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript">
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
-  SpecialPowers.addPermission("alarms", true, document);
-
   // mozAlarms is installed on all platforms except Android for the moment.
   if (navigator.appVersion.indexOf("Android") != -1) {
     try {
       todo('mozAlarms' in navigator,
            "mozAlarms is not allowed on Android for now. TODO Bug 863557.");
     } catch (e) {
       todo(!e, "('mozAlarms' in navigator) should not throw exceptions once " +
                "mozAlarms is installed on Android. TODO Bug 863557. " +
--- a/dom/base/test/chrome.ini
+++ b/dom/base/test/chrome.ini
@@ -1,25 +1,31 @@
 [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]
+support-files = file_navigator_resolve_identity.html
 [test_sendQueryContentAndSelectionSetEvent.html]
 [test_bug1016960.html]
 [test_copypaste.xul]
 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_getFeature_with_perm.html]
+[test_hasFeature.html]
+[test_mozbrowser_apis_allowed.html]
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_navigator_resolve_identity.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=985827
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 985827</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+  function test() {
+    var is = parent.is;
+
+    // Test WebIDL NavigatorProperty objects
+    var x = navigator.mozContacts;
+    is(typeof x, "object", "Should have a mozContacts object");
+    delete navigator.mozContacts;
+    var y = navigator.mozContacts;
+    is(x, y, "Should have gotten the same mozContacts object again");
+  }
+
+  test();
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=985827">Mozilla Bug 985827</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -672,24 +672,21 @@ skip-if = buildapp == 'mulet' || buildap
 [test_file_negative_date.html]
 [test_fileapi.html]
 [test_fileapi_slice.html]
 skip-if = (toolkit == 'android') || e10s # Android: Bug 775227, e10s: Bug 1226477
 [test_frameLoader_switchProcess.html]
 skip-if = e10s || os != 'linux' || buildapp != 'browser' # Already tests multiprocess
 [test_getAttribute_after_createAttribute.html]
 [test_getElementById.html]
-[test_getFeature_with_perm.html]
-[test_getFeature_without_perm.html]
 [test_getTranslationNodes.html]
 [test_getTranslationNodes_limit.html]
 [test_gsp-qualified.html]
 [test_gsp-quirks.html]
 [test_gsp-standards.html]
-[test_hasFeature.html]
 [test_history_document_open.html]
 [test_history_state_null.html]
 [test_html_colors_quirks.html]
 [test_html_colors_standards.html]
 [test_htmlcopyencoder.html]
 [test_htmlcopyencoder.xhtml]
 [test_iframe_referrer.html]
 [test_iframe_referrer_changing.html]
@@ -714,27 +711,25 @@ skip-if = (os != 'b2g' && os != 'android
 [test_meta_viewport4.html]
 skip-if = (os != 'b2g' && os != 'android')    # meta-viewport tag support is mobile-only
 [test_meta_viewport5.html]
 skip-if = (os != 'b2g' && os != 'android')    # meta-viewport tag support is mobile-only
 [test_meta_viewport6.html]
 skip-if = (os != 'b2g' && os != 'android')    # meta-viewport tag support is mobile-only
 [test_meta_viewport7.html]
 skip-if = (os != 'b2g' && os != 'android')    # meta-viewport tag support is mobile-only
-[test_mozbrowser_apis_allowed.html]
 [test_mozbrowser_apis_blocked.html]
 [test_mozfiledataurl.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_mozMatchesSelector.html]
 [test_mutationobserver_anonymous.html]
 [test_mutationobservers.html]
 skip-if = buildapp == 'b2g' # b2g(bug 901385, showmodaldialog) b2g-debug(bug 901385, showmodaldialog) b2g-desktop(bug 901385, showmodaldialog)
 [test_named_frames.html]
 [test_navigator_hardwareConcurrency.html]
-[test_navigator_resolve_identity.html]
 [test_navigator_language.html]
 [test_navigatorPrefOverride.html]
 [test_noAudioNotification.html]
 tags = audiochannel
 [test_noAudioNotificationOnMutedElement.html]
 tags = audiochannel
 [test_noAudioNotificationOnMutedOrVolume0Element.html]
 tags = audiochannel
--- 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_getFeature_with_perm.html
+++ b/dom/base/test/test_getFeature_with_perm.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=979109
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 979109</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <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=983502">Mozilla Bug 983502</a>
 <script type="application/javascript">
 
 function testSupported() {
   var mem;
   navigator.getFeature("hardware.memory").then(function(mem) {
@@ -109,31 +109,27 @@ function runNextTest() {
     tests[currentTest]();
   } else {
     SimpleTest.finish();
   }
 }
 
 info("About to run " + tests.length + " tests");
 
-SpecialPowers.pushPermissions([
-  {type: "feature-detection", allow: 1, context: document}
-], function() {
-  ok('getFeature' in navigator, "navigator.getFeature should exist");
-  ok('hasFeature' in navigator, "navigator.hasFeature should exist");
-  // B2G specific manifest features.
-  // Touching navigator before pushPermissions makes it fail.
-  if (!navigator.userAgent.includes("Android") &&
-        /Mobile|Tablet/.test(navigator.userAgent)) {
-    info("Adding B2G specific tests");
-    tests.push(createManifestTest("manifest.chrome.navigation"));
-    tests.push(createManifestTest("manifest.precompile"));
-    tests.push(createManifestTest("manifest.role.homescreen"));
-  }
-  runNextTest();
-  ok(true, "Test DONE");
-});
+ok('getFeature' in navigator, "navigator.getFeature should exist");
+ok('hasFeature' in navigator, "navigator.hasFeature should exist");
+// B2G specific manifest features.
+// Touching navigator before pushPermissions makes it fail.
+if (!navigator.userAgent.includes("Android") &&
+      /Mobile|Tablet/.test(navigator.userAgent)) {
+  info("Adding B2G specific tests");
+  tests.push(createManifestTest("manifest.chrome.navigation"));
+  tests.push(createManifestTest("manifest.precompile"));
+  tests.push(createManifestTest("manifest.role.homescreen"));
+}
+runNextTest();
+ok(true, "Test DONE");
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </body>
 </html>
deleted file mode 100644
--- a/dom/base/test/test_getFeature_without_perm.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=979109
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 979109</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=983502">Mozilla Bug 983502</a>
-<script type="application/javascript">
-
-
-is("getFeature" in navigator, false, "getFeature should not exist without permission");
-
-</script>
-</body>
-</html>
--- a/dom/base/test/test_hasFeature.html
+++ b/dom/base/test/test_hasFeature.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1009645
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 1009645</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <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=1009645">Mozilla Bug 1009645</a>
 <script type="application/javascript">
 
 var b2gOnly;
 
 function pref(name) {
@@ -22,19 +22,19 @@ function pref(name) {
     return false;
   }
 }
 
 function testAPIs() {
   var APIEndPoints = [
     { name: "MozMobileNetworkInfo", enabled: pref("dom.mobileconnection.enabled") },
     // { name: "Navigator.mozBluetooth", enabled: b2gOnly }, // conditional on MOZ_B2G_BT, tricky to test
-    { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") },
+    // Bug 1266035 { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") },
     { name: "Navigator.getDeviceStorage", enabled: pref("device.storage.enabled") },
-    { name: "Navigator.addIdleObserver", enabled: true },
+    // Bug 1266035 { name: "Navigator.addIdleObserver", enabled: true },
     { name: "Navigator.mozNetworkStats", enabled: pref("dom.mozNetworkStats.enabled") },
     { name: "Navigator.push", enabled: pref("services.push.enabled") },
     // { name: "Navigator.mozTime", enabled: b2gOnly }, // conditional on MOZ_TIME_MANAGER, tricky to test
     // { name: "Navigator.mozFMRadio", enabled: b2gOnly }, // conditional on MOZ_B2G_FM, tricky to test
     { name: "Navigator.mozCameras", enabled: true },
     { name: "Navigator.mozAlarms", enabled: pref("dom.mozAlarms.enabled") },
     { name: "Navigator.mozTCPSocket", enabled: pref("dom.mozTCPSocket.enabled") },
     { name: "Navigator.mozInputMethod", enabled: pref("dom.mozInputMethod.enabled") },
--- 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/base/test/test_navigator_resolve_identity.html
+++ b/dom/base/test/test_navigator_resolve_identity.html
@@ -1,42 +1,28 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=985827
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 985827</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
   /** Test for Bug 985827 **/
 
-  function test() {
-    var is = parent.is;
-
-    // Test WebIDL NavigatorProperty objects
-    var x = navigator.mozContacts;
-    is(typeof x, "object", "Should have a mozContacts object");
-    delete navigator.mozContacts;
-    var y = navigator.mozContacts;
-    is(x, y, "Should have gotten the same mozContacts object again");
-  }
-
   SimpleTest.waitForExplicitFinish();
 
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], function() {
+  addEventListener('load', function() {
     var iframe = document.createElement("iframe");
-    iframe.src = "data:text/html,<script>(" + escape(test.toString()) + ")();</scr" + "ipt>";
+    var dir = "chrome://mochitests/content/chrome/dom/base/test/";
+    iframe.src = dir + "file_navigator_resolve_identity.html";
     document.body.appendChild(iframe);
     iframe.onload = function() { SimpleTest.finish(); };
   });
 
   </script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=985827">Mozilla Bug 985827</a>
--- a/dom/base/test/test_navigator_resolve_identity_xrays.xul
+++ b/dom/base/test/test_navigator_resolve_identity_xrays.xul
@@ -23,36 +23,20 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   SimpleTest.waitForExplicitFinish();
 
   Components.utils.import("resource://gre/modules/Services.jsm");
 
   addLoadEvent(function() {
     var iframe = document.getElementById("t");
 
-    Services.perms.addFromPrincipal(iframe.contentDocument.nodePrincipal,
-                                    "contacts-read",
-                                    Services.perms.ALLOW_ACTION);
-    Services.perms.addFromPrincipal(iframe.contentDocument.nodePrincipal,
-                                    "contacts-write",
-                                    Services.perms.ALLOW_ACTION);
-    Services.perms.addFromPrincipal(iframe.contentDocument.nodePrincipal,
-                                    "contacts-create",
-                                    Services.perms.ALLOW_ACTION);
-
     var dir = "chrome://mochitests/content/chrome/dom/base/test/";
     iframe.src = dir + "file_navigator_resolve_identity_xrays.xul";
     iframe.onload = function() { finish(); };
 
     function finish() {
-      Services.perms.removeFromPrincipal(document.nodePrincipal,
-                                         "contacts-read");
-      Services.perms.removeFromPrincipal(document.nodePrincipal,
-                                         "contacts-write");
-      Services.perms.removeFromPrincipal(document.nodePrincipal,
-                                         "contacts-create");
       SimpleTest.finish();
     }
   });
 
   ]]>
   </script>
 </window>
--- a/dom/bindings/test/chrome.ini
+++ b/dom/bindings/test/chrome.ini
@@ -1,18 +1,20 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g'
 support-files =
+  file_bug707564.html
+  file_bug707564-2.html
   !/dom/bindings/test/file_bug707564.html
   !/dom/bindings/test/file_bug775543.html
   !/dom/bindings/test/file_document_location_set_via_xray.html
   !/dom/bindings/test/file_dom_xrays.html
   !/dom/bindings/test/file_proxies_via_xray.html
 
-[test_bug707564-chrome.html]
+[test_bug707564.html]
 [test_bug775543.html]
 [test_document_location_set_via_xray.html]
 [test_dom_xrays.html]
 [test_proxies_via_xray.html]
 [test_document_location_via_xray_cached.html]
 [test_blacklisted_prerendering_function.xul]
 support-files =
   file_focuser.html
--- a/dom/bindings/test/file_bug707564-2.html
+++ b/dom/bindings/test/file_bug707564-2.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=707564
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 707564</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
   /** Test for Bug 707564 **/
   var ok = parent.ok;
   var isnot = parent.isnot;
 
   addLoadEvent(function() {
     var props = Object.getOwnPropertyNames(Object.getPrototypeOf(frames[0].navigator));
--- a/dom/bindings/test/mochitest.ini
+++ b/dom/bindings/test/mochitest.ini
@@ -1,25 +1,22 @@
 [DEFAULT]
 support-files =
   file_InstanceOf.html
-  file_bug707564.html
-  file_bug707564-2.html
   file_bug775543.html
   file_document_location_set_via_xray.html
   file_dom_xrays.html
   file_proxies_via_xray.html
   forOf_iframe.html
   !/js/xpconnect/tests/mochitest/file_empty.html
 
 [test_async_stacks.html]
 [test_ByteString.html]
 [test_InstanceOf.html]
 [test_bug560072.html]
-[test_bug707564.html]
 [test_bug742191.html]
 [test_bug759621.html]
 [test_bug773326.html]
 [test_bug788369.html]
 [test_bug852846.html]
 [test_bug862092.html]
 [test_bug1036214.html]
 skip-if = debug == false
deleted file mode 100644
--- a/dom/bindings/test/test_bug707564-chrome.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=707564
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 707564</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <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=707564">Mozilla Bug 707564</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-<iframe id="t1" src="http://example.org/tests/dom/bindings/test/file_bug707564.html"></iframe>
-<iframe id="t2"></iframe>
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 775543 **/
-function test()
-{
-  var nav = document.getElementById("t1").contentWindow.navigator;
-  is(nav.foopy, undefined, "We should have an Xray now");
-  is(nav.wrappedJSObject.foopy, 5, "We should have the right navigator object");
-  var props = Object.getOwnPropertyNames(Object.getPrototypeOf(nav));
-  isnot(props.indexOf("mozContacts"), -1,
-        "Should enumerate a mozContacts property on navigator xray");
-
-  var nav = document.getElementById("t2").contentWindow.navigator;
-  is(nav.foopy, undefined, "We should have an Xray now again");
-  is(nav.wrappedJSObject.foopy, 5, "We should have the right navigator object again");
-  var found = false;
-  for (var name in nav) {
-    if (name == "mozContacts") {
-      found = true;
-    }
-  }
-  ok(found, "Should enumerate a mozContacts property on navigator xray via for...in");
-
-  SimpleTest.finish();
-}
-
-onload = test;
-onload = function() {
-  var iframe1 = document.getElementById("t1");
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: iframe1.contentDocument},
-    {type: "contacts-write", allow: true, context: iframe1.contentDocument},
-    {type: "contacts-create", allow: true, context: iframe1.contentDocument},
-  ], function() {
-    iframe1.src = "http://example.org/tests/dom/bindings/test/file_bug707564.html";
-    iframe1.onload = function() {
-      var iframe2 = document.getElementById("t2");
-      iframe2.src = "http://example.org/tests/dom/bindings/test/file_bug707564.html";
-      iframe2.onload = test;
-    };
-  });
-};
-
-</script>
-</pre>
-</body>
-</html>
--- a/dom/bindings/test/test_bug707564.html
+++ b/dom/bindings/test/test_bug707564.html
@@ -1,29 +1,24 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_bug707564-2.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+
+addEventListener('load', run_tests);
 
 </script>
 </pre>
 </body>
 </html>
--- 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_ActiveStateChange.html';
 var generator = runTests();
 var testFrame;
 var ac;
 
 function assert(aVal, aMessage) {
   return (!aVal) ? error(aMessage) : 0;
 }
 
@@ -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("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_XFrameOptionsAllowFrom.js
+++ b/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js
@@ -28,50 +28,32 @@ function arrayBuffersEqual(a, b) {
 
 function runTest() {
   var count = 0;
 
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
   iframe.height = '1000px';
 
+  var step1, stepfinish;
   // The innermost page we load will fire an alert when it successfully loads.
   iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
     switch (e.detail.message) {
     case 'step 1':
-      // Make the page wait for us to unblock it (which we do after we finish
-      // taking the screenshot).
-      e.preventDefault();
-
-      iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) {
-        var fr = new FileReader();
-        fr.onloadend = function() {
-          if (initialScreenshotArrayBuffer == null)
-            initialScreenshotArrayBuffer = fr.result;
-          e.detail.unblock();
-        };
-        fr.readAsArrayBuffer(sshot.target.result);
-      };
+      step1 = SpecialPowers.snapshotWindow(iframe.contentWindow);
       break;
     case 'step 2':
       ok(false, 'cross origin page loaded');
       break;
     case 'finish':
       // The page has now attempted to load the X-Frame-Options page; take
       // another screenshot.
-      iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) {
-        var fr = new FileReader();
-        fr.onloadend = function() {
-          ok(arrayBuffersEqual(fr.result, initialScreenshotArrayBuffer),
-             "Screenshots should be identical");
-          SimpleTest.finish();
-        };
-        fr.readAsArrayBuffer(sshot.target.result);
-      };
-      break;
+      stepfinish = SpecialPowers.snapshotWindow(iframe.contentWindow);
+      ok(step1.toDataURL() == stepfinish.toDataURL(), "Screenshots should be identical");
+      SimpleTest.finish();
     }
   });
 
   document.body.appendChild(iframe);
 
   iframe.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_XFrameOptionsAllowFrom.html';
 }
 
--- a/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js
+++ b/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js
@@ -31,44 +31,28 @@ function runTest() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
 
   // Our child will create two iframes, so make sure this iframe is big enough
   // to show both of them without scrolling, so taking a screenshot gets both
   // frames.
   iframe.height = '1000px';
 
+  var step1, stepfinish;
   iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
     switch (e.detail.message) {
     case 'step 1':
-      // Make the page wait for us to unblock it (which we do after we finish
-      // taking the screenshot).
-      e.preventDefault();
-
-      iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) {
-        var fr = new FileReader();
-        fr.onloadend = function() {
-          initialScreenshotArrayBuffer = fr.result;
-          e.detail.unblock();
-        }
-        fr.readAsArrayBuffer(sshot.target.result);
-      };
+      step1 = SpecialPowers.snapshotWindow(iframe.contentWindow);
       break;
     case 'step 2':
       // The page has now attempted to load the X-Frame-Options page; take
       // another screenshot.
-      iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) {
-        var fr = new FileReader();
-        fr.onloadend = function() {
-          ok(arrayBuffersEqual(fr.result, initialScreenshotArrayBuffer),
-             "Screenshots should be identical");
-          SimpleTest.finish();
-        }
-        fr.readAsArrayBuffer(sshot.target.result);
-      };
+      stepfinish = SpecialPowers.snapshotWindow(iframe.contentWindow);
+      ok(step1.toDataURL() == stepfinish.toDataURL(), "Screenshots should be identical");
+      SimpleTest.finish();
       break;
     }
   });
 
   document.body.appendChild(iframe);
 
   // Load this page from a different origin than ourselves.  This page will, in
   // turn, load a child from mochi.test:8888, our origin, with X-Frame-Options:
--- 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-oop.ini
+++ b/dom/browser-element/mochitest/mochitest-oop.ini
@@ -9,126 +9,159 @@ support-files =
   file_browserElement_ExecuteScript.html
   file_browserElement_OpenMixedProcess.html
   browserElement_ExecuteScript.js
   browserElement_Find.js
   browserElement_OpenTab.js
 
 [test_browserElement_oop_AudioChannelSeeking.html]
 tags = audiochannel
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Viewmode.html]
 [test_browserElement_oop_ThemeColor.html]
 [test_browserElement_inproc_ErrorSecurity.html]
 skip-if = toolkit=='gonk'
 [test_browserElement_inproc_OpenMixedProcess.html]
-skip-if = toolkit=='gonk' || (toolkit == 'gonk' && !debug)
+# skip-if = toolkit=='gonk' || (toolkit == 'gonk' && !debug)
+disabled = disabled for bug 1266035
 [test_browserElement_oop_Alert.html]
 [test_browserElement_oop_AlertInFrame.html]
 [test_browserElement_oop_AllowEmbedAppsInNestedOOIframe.html]
 skip-if = toolkit == 'gonk' || buildapp != 'b2g'
 [test_browserElement_oop_AppFramePermission.html]
 skip-if = (toolkit == 'gonk' && !debug) || buildapp != 'b2g'
 [test_browserElement_oop_AppWindowNamespace.html]
-skip-if = (toolkit == 'gonk' && !debug)
+skip-if = true ### Bug 1255339: blacklist because no more mozApps
 [test_browserElement_oop_AudioChannelMutedByDefault.html]
 tags = audiochannel
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Auth.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_BackForward.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_BadScreenshot.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_BrowserWindowNamespace.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_BrowserWindowResize.html]
 [test_browserElement_oop_Close.html]
 [test_browserElement_oop_CookiesNotThirdParty.html]
 [test_browserElement_oop_CopyPaste.html]
 [test_browserElement_oop_DOMRequestError.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_DataURI.html]
 [test_browserElement_oop_DisallowEmbedAppsInOOP.html]
 skip-if = buildapp != 'b2g'
 [test_browserElement_oop_DocumentFirstPaint.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Download.html]
 disabled = bug 1022281
 [test_browserElement_oop_ErrorSecurity.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_ExecuteScript.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Find.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_FirstPaint.html]
 [test_browserElement_oop_ForwardName.html]
 [test_browserElement_oop_FrameWrongURI.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_GetScreenshot.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_GetScreenshotDppx.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Iconchange.html]
 [test_browserElement_oop_LoadEvents.html]
 [test_browserElement_oop_Manifestchange.html]
 [test_browserElement_oop_Metachange.html]
 [test_browserElement_oop_NoAudioTrack.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_AudioPlayback.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_OpenMixedProcess.html]
-skip-if = (toolkit == 'gonk' && !debug)
+# skip-if = (toolkit == 'gonk' && !debug)
+disabled = disabled for bug 1266035
 [test_browserElement_oop_OpenNamed.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_OpenWindow.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_OpenWindowDifferentOrigin.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_OpenWindowInFrame.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_OpenWindowRejected.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_Opensearch.html]
 [test_browserElement_oop_OpenTab.html]
-skip-if = (toolkit == 'gonk') # Disabled on emulator. See bug 1144015 comment 8
+# skip-if = (toolkit == 'gonk') # Disabled on emulator. See bug 1144015 comment 8
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_PrivateBrowsing.html]
 [test_browserElement_oop_PromptCheck.html]
 [test_browserElement_oop_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_oop_Proxy.html]
 skip-if = (toolkit == 'gonk')
 [test_browserElement_oop_PurgeHistory.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Reload.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_ReloadPostRequest.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_RemoveBrowserElement.html]
 [test_browserElement_oop_ScrollEvent.html]
 [test_browserElement_oop_SecurityChange.html]
 skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) #TIMED_OUT, bug 766586
 [test_browserElement_oop_SendEvent.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_SetInputMethodActive.html]
-skip-if = (os == "android")
+# skip-if = (os == "android")
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_SetVisible.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_SetVisibleFrames.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_SetVisibleFrames2.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_Stop.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_TargetBlank.html]
 skip-if = (toolkit == 'gonk' && !debug)
 [test_browserElement_oop_TargetTop.html]
 [test_browserElement_oop_Titlechange.html]
 [test_browserElement_oop_TopBarrier.html]
 [test_browserElement_oop_VisibilityChange.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_XFrameOptions.html]
 [test_browserElement_oop_XFrameOptionsAllowFrom.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 # bug 1189592
 skip-if = asan
 [test_browserElement_oop_XFrameOptionsDeny.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_XFrameOptionsSameOrigin.html]
 # Disabled until bug 930449 makes it stop timing out
 [test_browserElement_oop_ContextmenuEvents.html]
 disabled = bug 930449
 # Disabled until bug 924771 makes them stop timing out
 [test_browserElement_oop_CloseFromOpener.html]
 disabled = bug 924771
 [test_browserElement_oop_CloseApp.html]
 disabled = bug 924771
 [test_browserElement_oop_ExposableURI.html]
 disabled = bug 924771
 [test_browserElement_oop_GetContentDimensions.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_AudioChannel.html]
 tags = audiochannel
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_AudioChannel_nested.html]
 tags = audiochannel
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_SetNFCFocus.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_getWebManifest.html]
+disabled = Disabling some OOP tests for WebIDL scope changes
 [test_browserElement_oop_OpenWindowEmpty.html]
 skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator
 [test_browserElement_oop_ActiveStateChange.html]
-tags = audiochannel
\ No newline at end of file
+tags = audiochannel
+disabled = Disabling some OOP tests for WebIDL scope changes
--- 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_Simple.html
+++ b/dom/browser-element/mochitest/priority/test_Simple.html
@@ -26,22 +26,33 @@ In other words, I think these errors are
 <script type="application/javascript;version=1.7">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.addPermission();
 browserElementTestHelpers.enableProcessPriorityManager();
 
+var allCompleted = 0;
+var allExpected  = 2;
+function finish() {
+  allCompleted++;
+  if (allCompleted === allExpected) {
+    SimpleTest.finish();
+  }
+}
+
 function runTest() {
+  var iframeLoaded = false;
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', true);
   iframe.src = browserElementTestHelpers.emptyPage1;
 
-  expectProcessCreated('FOREGROUND').then(SimpleTest.finish);
+  iframe.addEventListener('mozbrowserloadend', finish);
+  expectProcessCreated('FOREGROUND').then(finish);
 
   document.body.appendChild(iframe);
 }
 
 addEventListener('testready', runTest);
 
 </script>
 </body>
--- 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',
+]
--- a/dom/contacts/tests/chrome.ini
+++ b/dom/contacts/tests/chrome.ini
@@ -1,7 +1,45 @@
 [DEFAULT]
-skip-if = os == "android"
-skip-if = buildapp == 'b2g'
+
+support-files =
+  shared.js
+  file_contacts_basics.html
+  file_contacts_basics2.html
+  file_contacts_blobs.html
+  file_contacts_events.html
+  file_contacts_getall.html
+  file_contacts_getall2.html
+  file_contacts_international.html
+  file_contacts_substringmatching.html
+  file_contacts_substringmatchingVE.html
+  file_contacts_substringmatchingCL.html
+  test_migration_chrome.js
+  file_migration.html
 
-[test_contacts_shutdown.xul]
-[test_contacts_upgrade.xul]
-[test_contacts_cache.xul]
+# renaming with "_a_" to execure before others, since we hardcode open of 
+# database and this messes up with mozContacts when done after mozContacts
+# did opened the database. those should really be xpcshell and not chrome
+# mochitests maybe ...
+[test_contacts_a_shutdown.xul]
+skip-if = os == "android" || buildapp == 'b2g'
+[test_contacts_a_upgrade.xul]
+skip-if = os == "android" || buildapp == 'b2g'
+[test_contacts_a_cache.xul]
+skip-if = os == "android" || buildapp == 'b2g'
+[test_contacts_basics.html]
+skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+[test_contacts_basics2.html]
+skip-if = (toolkit == 'gonk' && debug) || (os == 'win' && os_version == '5.1') #debug-only failure, bug 967258 on XP
+[test_contacts_blobs.html]
+skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+[test_contacts_events.html]
+[test_contacts_getall.html]
+skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+[test_contacts_getall2.html]
+skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+[test_contacts_international.html]
+[test_contacts_substringmatching.html]
+[test_contacts_substringmatchingVE.html]
+[test_contacts_substringmatchingCL.html]
+[test_migration.html]
+  support-files +=
+  skip-if = os == "android"
--- a/dom/contacts/tests/file_contacts_basics.html
+++ b/dom/contacts/tests/file_contacts_basics.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=674720
 -->
 <head>
   <title>Test for Bug 674720 WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=674720">Mozilla Bug 674720</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_basics2.html
+++ b/dom/contacts/tests/file_contacts_basics2.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=674720
 -->
 <head>
   <title>Test for Bug 674720 WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=674720">Mozilla Bug 674720</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_blobs.html
+++ b/dom/contacts/tests/file_contacts_blobs.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=674720
 -->
 <head>
   <title>Test for Bug 674720 WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=674720">Mozilla Bug 674720</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_events.html
+++ b/dom/contacts/tests/file_contacts_events.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=764667
 -->
 <head>
   <title>Test for Bug 678695</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <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=764667">Mozilla Bug 764667</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
--- a/dom/contacts/tests/file_contacts_getall.html
+++ b/dom/contacts/tests/file_contacts_getall.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=836519
 -->
 <head>
   <title>Mozilla Bug 836519</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=836519">Mozilla Bug 836519</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_getall2.html
+++ b/dom/contacts/tests/file_contacts_getall2.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=836519
 -->
 <head>
   <title>Mozilla Bug 836519</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=836519">Mozilla Bug 836519</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_international.html
+++ b/dom/contacts/tests/file_contacts_international.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=815833
 -->
 <head>
   <title>Test for Bug 815833 WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=815833">Mozilla Bug 815833</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_substringmatching.html
+++ b/dom/contacts/tests/file_contacts_substringmatching.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=877302
 -->
 <head>
   <title>Test for Bug 877302 substring matching for WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=877302">Mozilla Bug 877302</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_substringmatchingCL.html
+++ b/dom/contacts/tests/file_contacts_substringmatchingCL.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=877302
 -->
 <head>
   <title>Test for Bug 949537 substring matching for WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=949537">Mozilla Bug 949537</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_contacts_substringmatchingVE.html
+++ b/dom/contacts/tests/file_contacts_substringmatchingVE.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=877302
 -->
 <head>
   <title>Test for Bug 877302 substring matching for WebContacts</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=877302">Mozilla Bug 877302</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/contacts/tests/file_migration.html
+++ b/dom/contacts/tests/file_migration.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
 <head>
   <title>Migration tests</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <h1>migration tests</h1>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
--- a/dom/contacts/tests/mochitest.ini
+++ b/dom/contacts/tests/mochitest.ini
@@ -1,36 +1,6 @@
 [DEFAULT]
 support-files =
   shared.js
-  file_contacts_basics.html
-  file_contacts_basics2.html
-  file_contacts_blobs.html
-  file_contacts_events.html
-  file_contacts_getall.html
-  file_contacts_getall2.html
-  file_contacts_international.html
-  file_contacts_substringmatching.html
-  file_contacts_substringmatchingVE.html
-  file_contacts_substringmatchingCL.html
-  test_migration_chrome.js
-  file_migration.html
   file_permission_denied.html
 
-[test_contacts_basics.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_basics2.html]
-skip-if = (toolkit == 'gonk' && debug) || (os == 'win' && os_version == '5.1') #debug-only failure, bug 967258 on XP
-[test_contacts_blobs.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_events.html]
-[test_contacts_getall.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_getall2.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_international.html]
-[test_contacts_substringmatching.html]
-[test_contacts_substringmatchingVE.html]
-[test_contacts_substringmatchingCL.html]
-[test_migration.html]
-  support-files +=
-  skip-if = os == "android"
 [test_permission_denied.html]
rename from dom/contacts/tests/test_contacts_cache.xul
rename to dom/contacts/tests/test_contacts_a_cache.xul
rename from dom/contacts/tests/test_contacts_shutdown.xul
rename to dom/contacts/tests/test_contacts_a_shutdown.xul
rename from dom/contacts/tests/test_contacts_upgrade.xul
rename to dom/contacts/tests/test_contacts_a_upgrade.xul
--- a/dom/contacts/tests/test_contacts_basics.html
+++ b/dom/contacts/tests/test_contacts_basics.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_basics.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_basics2.html
+++ b/dom/contacts/tests/test_contacts_basics2.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_basics2.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_blobs.html
+++ b/dom/contacts/tests/test_contacts_blobs.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_blobs.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_events.html
+++ b/dom/contacts/tests/test_contacts_events.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_events.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_getall.html
+++ b/dom/contacts/tests/test_contacts_getall.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_getall.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_getall2.html
+++ b/dom/contacts/tests/test_contacts_getall2.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_getall2.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_international.html
+++ b/dom/contacts/tests/test_contacts_international.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_international.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_substringmatching.html
+++ b/dom/contacts/tests/test_contacts_substringmatching.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_substringmatching.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_substringmatchingCL.html
+++ b/dom/contacts/tests/test_contacts_substringmatchingCL.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_substringmatchingCL.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_substringmatchingVE.html
+++ b/dom/contacts/tests/test_contacts_substringmatchingVE.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_contacts_substringmatchingVE.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/contacts/tests/test_migration.html
+++ b/dom/contacts/tests/test_migration.html
@@ -1,29 +1,23 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <iframe></iframe>
 <pre id="test">
 <script type="application/javascript">
 
 function run_tests() {
   var iframe = document.querySelector("iframe");
   iframe.src = "file_migration.html";
 }
 
 SimpleTest.waitForExplicitFinish();
-onload = function() {
-  SpecialPowers.pushPermissions([
-    {type: "contacts-read", allow: true, context: document},
-    {type: "contacts-write", allow: true, context: document},
-    {type: "contacts-create", allow: true, context: document},
-  ], run_tests);
-};
+onload = run_tests;
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/html/test/chrome.ini
+++ b/dom/html/test/chrome.ini
@@ -1,6 +1,12 @@
 [DEFAULT]
-skip-if = buildapp == 'b2g' || os == 'android'
 support-files =
   file_anchor_ping.html
+  wakelock.ogg
+  wakelock.ogv
 
 [test_anchor_ping.html]
+skip-if = buildapp == 'b2g' || os == 'android'
+[test_audio_wakelock.html]
+skip-if = buildapp == 'mulet' # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
+[test_video_wakelock.html]
+skip-if = toolkit == 'android' || (toolkit == 'gonk' && debug) #bug 871015, bug 881443
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -194,30 +194,26 @@ support-files =
   form_submit_server.sjs
   formData_worker.js
   formData_test.js
   image.png
   image-allow-credentials.png
   image-allow-credentials.png^headers^
   nnc_lockup.gif
   reflect.js
-  wakelock.ogg
-  wakelock.ogv
   file_ignoreuserfocus.html
   simpleFileOpener.js
   file_mozaudiochannel.html
   file_bug1166138_1x.png
   file_bug1166138_2x.png
   file_bug1166138_def.png
 
 [test_a_text.html]
 [test_anchor_href_cache_invalidation.html]
 [test_applet_attributes_reflection.html]
-[test_audio_wakelock.html]
-skip-if = buildapp == 'mulet' # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
 [test_base_attributes_reflection.html]
 [test_bug100533.html]
 [test_bug109445.html]
 [test_bug109445.xhtml]
 [test_bug1297.html]
 [test_bug1366.html]
 [test_bug1400.html]
 [test_bug143220.html]
@@ -539,18 +535,16 @@ skip-if = buildapp == 'mulet' || buildap
 [test_rowscollection.html]
 [test_srcdoc-2.html]
 [test_srcdoc.html]
 [test_style_attributes_reflection.html]
 [test_track.html]
 [test_track_disabled.html]
 [test_ul_attributes_reflection.html]
 [test_undoManager.html]
-[test_video_wakelock.html]
-skip-if = toolkit == 'android' || (toolkit == 'gonk' && debug) #bug 871015, bug 881443
 [test_input_files_not_nsIFile.html]
 [test_ignoreuserfocus.html]
 [test_fragment_form_pointer.html]
 [test_bug1682.html]
 [test_bug1823.html]
 [test_bug57600.html]
 [test_bug196523.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
--- a/dom/html/test/test_audio_wakelock.html
+++ b/dom/html/test/test_audio_wakelock.html
@@ -1,19 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=868943
 -->
 <head>
   <title>Test for Bug 868943</title>
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.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="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <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=868943">Mozilla Bug 868943</a>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script type="application/javascript">
@@ -110,20 +110,16 @@ function runTests() {
     SimpleTest.finish();
     return;
   }
 
   var test =  tests.pop();
   test();
 };
 
-SpecialPowers.pushPermissions(
-  [{'type': 'power', 'allow': true, 'context': document}],
-  function() {
-    SpecialPowers.pushPrefEnv({"set": [["media.wakelock_timeout", 500]]}, runTests);
-  });
+SpecialPowers.pushPrefEnv({"set": [["media.wakelock_timeout", 500]]}, runTests);
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/html/test/test_video_wakelock.html
+++ b/dom/html/test/test_video_wakelock.html
@@ -1,19 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=868943
 -->
 <head>
   <title>Test for Bug 868943</title>
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.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="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <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=868943">Mozilla Bug 868943</a>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script type="application/javascript">
@@ -182,21 +182,17 @@ function runTests() {
     SimpleTest.finish();
     return;
   }
 
   var test =  tests.pop();
   test();
 };
 
-SpecialPowers.pushPermissions(
-  [{'type': 'power', 'allow': true, 'context': document}],
-  function() {
-    SpecialPowers.pushPrefEnv({"set": [["media.wakelock_timeout", 500],
-                                       ["dom.wakelock.enabled", true]]}, runTests);
-  });
+SpecialPowers.pushPrefEnv({"set": [["media.wakelock_timeout", 500],
+                                   ["dom.wakelock.enabled", true]]}, runTests);
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/chrome.ini
@@ -0,0 +1,52 @@
+[DEFAULT]
+# dom/inputmethod only makes sense on B2G
+run-if = (buildapp == 'b2g' && toolkit != 'gonk') || buildapp == 'mulet'
+support-files =
+  bug1110030_helper.js
+  inputmethod_common.js
+  file_inputmethod.html
+  file_blank.html
+  file_test_app.html
+  file_test_bug1066515.html
+  file_test_bug1137557.html
+  file_test_bug1175399.html
+  file_test_empty_app.html
+  file_test_focus_blur_manage_events.html
+  file_test_sendkey_cancel.html
+  file_test_setSupportsSwitching.html
+  file_test_simple_manage_events.html
+  file_test_sms_app.html
+  file_test_sms_app_1066515.html
+  file_test_sync_edit.html
+  file_test_two_inputs.html
+  file_test_two_selects.html
+  file_test_unload.html
+  file_test_unload_action.html
+
+[test_basic.html]
+[test_bug944397.html]
+[test_bug949059.html]
+[test_bug953044.html]
+[test_bug960946.html]
+[test_bug978918.html]
+[test_bug1026997.html]
+[test_bug1043828.html]
+[test_bug1059163.html]
+disabled = fails because receiving bad values
+[test_bug1066515.html]
+[test_bug1137557.html]
+[test_bug1175399.html]
+[test_focus_blur_manage_events.html]
+disabled = fails because receiving bad events
+[test_forward_hardware_key_to_ime.html]
+skip-if = buildapp != 'mulet'
+[test_input_registry_events.html]
+disabled = timeout on pine
+[test_sendkey_cancel.html]
+[test_setSupportsSwitching.html]
+[test_simple_manage_events.html]
+disabled = fails because receiving bad events
+[test_sync_edit.html]
+[test_two_inputs.html]
+[test_two_selects.html]
+[test_unload.html]
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_bug1066515.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div id="text" contenteditable>Jan Jongboom</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_bug1137557.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<textarea rows=30 cols=30></textarea>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_bug1175399.html
@@ -0,0 +1,1 @@
+<html><body><input value="First" readonly></body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_focus_blur_manage_events.html
@@ -0,0 +1,22 @@
+<html><body>
+<input type="text">
+<input type="search">
+<textarea></textarea>
+<p contenteditable></p>
+<input type="number">
+<input type="tel">
+<input type="url">
+<input type="email">
+<input type="password">
+<input type="datetime">
+<input type="date" value="2015-08-03" min="1990-01-01" max="2020-01-01">
+<input type="month">
+<input type="week">
+<input type="time">
+<input type="datetime-local">
+<input type="color">
+<select><option selected>foo</option><option disabled>bar</option>
+<optgroup label="group"><option>baz</option></optgroup></select>
+<select multiple><option selected>foo</option><option disabled>bar</option>
+<optgroup label="group"><option>baz</option></optgroup></select>
+</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_setSupportsSwitching.html
@@ -0,0 +1,5 @@
+<html><body>
+<input type="text">
+<input type="number">
+<input type="password">
+</body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_simple_manage_events.html
@@ -0,0 +1,1 @@
+<html><body><input type="text"></body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_sync_edit.html
@@ -0,0 +1,1 @@
+<html><body><input value="First"></body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_two_inputs.html
@@ -0,0 +1,1 @@
+<html><body><input value="First"><input value="Second"></body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_two_selects.html
@@ -0,0 +1,1 @@
+<html><body><select><option>First</option></select><select><option>Second</option></select></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_unload.html
@@ -0,0 +1,1 @@
+<html><body><form id="form"><input value="First"><input type="submit"></form></body></html>
new file mode 100644
--- /dev/null
+++ b/dom/inputmethod/mochitest/file_test_unload_action.html
@@ -0,0 +1,1 @@
+<html><body><input value="Second"></body></html>
--- a/dom/inputmethod/mochitest/inputmethod_common.js
+++ b/dom/inputmethod/mochitest/inputmethod_common.js
@@ -2,33 +2,22 @@ function inputmethod_setup(callback) {
   SimpleTest.waitForExplicitFinish();
   SimpleTest.requestCompleteLog();
   let appInfo = SpecialPowers.Cc['@mozilla.org/xre/app-info;1']
                 .getService(SpecialPowers.Ci.nsIXULAppInfo);
   if (appInfo.name != 'B2G') {
     SpecialPowers.Cu.import("resource://gre/modules/Keyboard.jsm", this);
   }
 
-  let permissions = [];
-  ['input', 'input-manage', 'browser'].forEach(function(name) {
-    permissions.push({
-      type: name,
-      allow: true,
-      context: document
-    });
-  });
-
-  SpecialPowers.pushPermissions(permissions, function() {
-    let prefs = [
-      ['dom.mozBrowserFramesEnabled', true],
-      // Enable navigator.mozInputMethod.
-      ['dom.mozInputMethod.enabled', true]
-    ];
-    SpecialPowers.pushPrefEnv({set: prefs}, function() {
-      SimpleTest.waitForFocus(callback);
-    });
+  let prefs = [
+    ['dom.mozBrowserFramesEnabled', true],
+    // Enable navigator.mozInputMethod.
+    ['dom.mozInputMethod.enabled', true]
+  ];
+  SpecialPowers.pushPrefEnv({set: prefs}, function() {
+    SimpleTest.waitForFocus(callback);
   });
 }
 
 function inputmethod_cleanup() {
   SpecialPowers.wrap(navigator.mozInputMethod).setActive(false);
   SimpleTest.finish();
 }
deleted file mode 100644
--- a/dom/inputmethod/mochitest/mochitest.ini
+++ /dev/null
@@ -1,38 +0,0 @@
-[DEFAULT]
-# dom/inputmethod only makes sense on B2G
-run-if = (buildapp == 'b2g' && toolkit != 'gonk') || buildapp == 'mulet'
-support-files =
-  inputmethod_common.js
-  file_inputmethod.html
-  file_blank.html
-  file_test_app.html
-  file_test_sendkey_cancel.html
-  file_test_sms_app.html
-  file_test_sms_app_1066515.html
-
-[test_basic.html]
-[test_bug944397.html]
-[test_bug949059.html]
-[test_bug953044.html]
-[test_bug960946.html]
-[test_bug978918.html]
-[test_bug1026997.html]
-[test_bug1043828.html]
-[test_bug1059163.html]
-[test_bug1066515.html]
-[test_bug1175399.html]
-[test_bug1137557.html]
-[test_focus_blur_manage_events.html]
-[test_forward_hardware_key_to_ime.html]
-skip-if = buildapp != 'mulet'
-support-files =
-  bug1110030_helper.js
-  file_test_empty_app.html
-[test_input_registry_events.html]
-[test_sendkey_cancel.html]
-[test_setSupportsSwitching.html]
-[test_simple_manage_events.html]
-[test_sync_edit.html]
-[test_two_inputs.html]
-[test_two_selects.html]
-[test_unload.html]
--- a/dom/inputmethod/mochitest/test_basic.html
+++ b/dom/inputmethod/mochitest/test_basic.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=932145
 -->
 <head>
   <title>Basic test for InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=932145">Mozilla Bug 932145</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 SimpleTest.requestFlakyTimeout("untriaged");
--- a/dom/inputmethod/mochitest/test_bug1026997.html
+++ b/dom/inputmethod/mochitest/test_bug1026997.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1026997
 -->
 <head>
   <title>SelectionChange on InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1026997">Mozilla Bug 1026997</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
--- a/dom/inputmethod/mochitest/test_bug1043828.html
+++ b/dom/inputmethod/mochitest/test_bug1043828.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1043828
 -->
 <head>
   <title>Basic test for Switching Keyboards.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1043828">Mozilla Bug 1043828</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 SimpleTest.requestFlakyTimeout("untriaged");
@@ -81,55 +81,44 @@ function runTest() {
 
     keyboardB = document.createElement('iframe');
     keyboardB.setAttribute('mozbrowser', true);
     document.body.appendChild(keyboardB);
 
     // simulate two different keyboard apps
     let imeUrl = basePath + '/file_blank.html';
 
-    SpecialPowers.pushPermissions([{
-      type: 'input',
-      allow: true,
-      context: {
-        url: imeUrl,
-        originAttributes: {
-          inIsolatedMozBrowser: true
-        }
-      }
-    }], function() {
-      keyboardA.src = imeUrl;
-      keyboardB.src = imeUrl;
+    keyboardA.src = imeUrl;
+    keyboardB.src = imeUrl;
 
-      var handler = {
-        handleEvent: function(){
-          keyboardB.removeEventListener('mozbrowserloadend', this);
+    var handler = {
+      handleEvent: function(){
+        keyboardB.removeEventListener('mozbrowserloadend', this);
 
-          mmKeyboardB = SpecialPowers.getBrowserFrameMessageManager(keyboardB);
+        mmKeyboardB = SpecialPowers.getBrowserFrameMessageManager(keyboardB);
+
+        mmKeyboardB.loadFrameScript('data:,(' + kbFrameScript.toString() + ')();', false);
 
-          mmKeyboardB.loadFrameScript('data:,(' + kbFrameScript.toString() + ')();', false);
-
-          mmKeyboardB.addMessageListener('test:InputMethod:getText:Resolve', function() {
-            info('getText() was resolved');
-            inputmethod_cleanup();
-          });
+        mmKeyboardB.addMessageListener('test:InputMethod:getText:Resolve', function() {
+          info('getText() was resolved');
+          inputmethod_cleanup();
+        });
 
-          mmKeyboardB.addMessageListener('test:InputMethod:getText:Reject', function() {
-            ok(false, 'getText() was rejected');
-            inputmethod_cleanup();
-          });
+        mmKeyboardB.addMessageListener('test:InputMethod:getText:Reject', function() {
+          ok(false, 'getText() was rejected');
+          inputmethod_cleanup();
+        });
 
-          setTimeout(function(){
-            step2();
-          }, WAIT_TIME);
-        }
-      };
+        setTimeout(function(){
+          step2();
+        }, WAIT_TIME);
+      }
+    };
 
-      keyboardB.addEventListener('mozbrowserloadend', handler);
-    });
+    keyboardB.addEventListener('mozbrowserloadend', handler);
   }
 
   // STEP 2: Set keyboard A active
   function step2() {
     info('step2');
     let req = keyboardA.setInputMethodActive(true);
 
     req.onsuccess = function(){
--- a/dom/inputmethod/mochitest/test_bug1059163.html
+++ b/dom/inputmethod/mochitest/test_bug1059163.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1059163
 -->
 <head>
   <title>Basic test for repeat sendKey events</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1059163">Mozilla Bug 1059163</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 inputmethod_setup(function() {
   runTest();
@@ -41,19 +41,20 @@ function appFrameScript() {
 function runTest() {
   let im = navigator.mozInputMethod;
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   // Create an app frame to recieve keyboard inputs.
   let app = document.createElement('iframe');
-  app.src = 'data:text/html,<html><body><div id="text" contenteditable>Jan Jongboom</div></html>';
+  app.src = 'file_test_bug1066515.html';
   app.setAttribute('mozbrowser', true);
   document.body.appendChild(app);
+
   app.addEventListener('mozbrowserloadend', function() {
     let mm = SpecialPowers.getBrowserFrameMessageManager(app);
     mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
 
     im.oninputcontextchange = function() {
       is(im.inputcontext.type, 'contenteditable', 'type');
       is(im.inputcontext.inputType, 'textarea', 'inputType');
 
--- a/dom/inputmethod/mochitest/test_bug1066515.html
+++ b/dom/inputmethod/mochitest/test_bug1066515.html
@@ -1,19 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1066515
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 1066515</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1066515">Mozilla Bug 1066515</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 // The input context.
--- a/dom/inputmethod/mochitest/test_bug1137557.html
+++ b/dom/inputmethod/mochitest/test_bug1137557.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1137557
 -->
 <head>
   <title>Test for new API arguments accepting D3E properties</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1137557">Mozilla Bug 1137557</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
@@ -1729,17 +1729,17 @@ function runRepeatTests() {
 
 function runTest() {
   let im = navigator.mozInputMethod;
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><textarea rows=30 cols=30></textarea></body></html>';
+  iframe.src = 'file_test_bug1137557.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.addMessageListener('test:eventDetail', function(msg) {
       gEventDetails.push(msg.data);
--- a/dom/inputmethod/mochitest/test_bug1175399.html
+++ b/dom/inputmethod/mochitest/test_bug1175399.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1175399
 -->
 <head>
   <title>Test focus when page unloads</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1175399">Mozilla Bug 1175399</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
@@ -30,17 +30,17 @@ let appFrameScript = function appFrameSc
 
 function runTest() {
   let im = navigator.mozInputMethod;
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><input value="First" readonly></body></html>';
+  iframe.src = 'file_test_bug1175399.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
   im.oninputcontextchange = function() {
     is(false, 'should not receive inputcontextchange event');
   };
 
--- a/dom/inputmethod/mochitest/test_bug944397.html
+++ b/dom/inputmethod/mochitest/test_bug944397.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=944397
 -->
 <head>
   <title>Basic test for InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=944397">Mozilla Bug 944397</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 SimpleTest.requestFlakyTimeout("untriaged");
@@ -68,43 +68,32 @@ function runTest() {
     // STEP 2a: Create a browser frame to load the input method app.
     keyboard = document.createElement('iframe');
     keyboard.setAttribute('mozbrowser', true);
     document.body.appendChild(keyboard);
 
     // STEP 2b: Grant input privileges to the keyboard iframe
     let imeUrl = basePath + '/file_inputmethod.html#data';
 
-    SpecialPowers.pushPermissions([{
-      type: 'input',
-      allow: true,
-      context: {
-        url: imeUrl,
-        originAttributes: {
-          inIsolatedMozBrowser: true
-        }
-      }
-    }], function() {
-      // STEP 2c: Tell Gecko to use this iframe as its keyboard app
-      let req = keyboard.setInputMethodActive(true);
+    // STEP 2c: Tell Gecko to use this iframe as its keyboard app
+    let req = keyboard.setInputMethodActive(true);
+
+    req.onsuccess = function() {
+      ok(true, 'setInputMethodActive succeeded.');
+    };
 
-      req.onsuccess = function() {
-        ok(true, 'setInputMethodActive succeeded.');
-      };
+    req.onerror = function() {
+      ok(false, 'setInputMethodActive failed: ' + this.error.name);
+      inputmethod_cleanup();
+    };
 
-      req.onerror = function() {
-        ok(false, 'setInputMethodActive failed: ' + this.error.name);
-        inputmethod_cleanup();
-      };
-
-      // STEP 3: Loads the input method app to the browser frame after a delay.
-      setTimeout(function() {
-        keyboard.src = imeUrl;
-      }, 100);
-    });
+    // STEP 3: Loads the input method app to the browser frame after a delay.
+    setTimeout(function() {
+      keyboard.src = imeUrl;
+    }, 100);
   }
 
   function step4(val) {
     ok(true, 'Keyboard input was received.');
     is(val, '#dataYuan', 'Input value');
     inputmethod_cleanup();
   }
 
--- a/dom/inputmethod/mochitest/test_bug949059.html
+++ b/dom/inputmethod/mochitest/test_bug949059.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=949059
 -->
 <head>
   <title>Test "mgmt" property of MozInputMethod.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=949059">Mozilla Bug 949059</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
--- a/dom/inputmethod/mochitest/test_bug953044.html
+++ b/dom/inputmethod/mochitest/test_bug953044.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=953044
 -->
 <head>
   <title>Basic test for InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=953044">Mozilla Bug 953044</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
--- a/dom/inputmethod/mochitest/test_bug960946.html
+++ b/dom/inputmethod/mochitest/test_bug960946.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=960946
 -->
 <head>
   <title>Basic test for repeat sendKey events</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=960946">Mozilla Bug 960946</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 // The input context.
--- a/dom/inputmethod/mochitest/test_bug978918.html
+++ b/dom/inputmethod/mochitest/test_bug978918.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=978918
 -->
 <head>
   <title>Basic test for InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=978918">Mozilla Bug 978918</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 // The input context.
--- a/dom/inputmethod/mochitest/test_focus_blur_manage_events.html
+++ b/dom/inputmethod/mochitest/test_focus_blur_manage_events.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1201407
 -->
 <head>
   <title>Test inputcontextfocus and inputcontextblur event</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1201407">Mozilla Bug 1201407</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 let contentFrameMM;
@@ -131,37 +131,26 @@ function setupInputAppFrame() {
                  path.substring(0, path.lastIndexOf('/'));
     let imeUrl = basePath + '/file_blank.html';
 
     let inputAppFrame = document.createElement('iframe');
     inputAppFrame.setAttribute('mozbrowser', true);
     inputAppFrame.src = imeUrl;
     document.body.appendChild(inputAppFrame);
 
-    SpecialPowers.pushPermissions([{
-      type: 'input',
-      allow: true,
-      context: {
-        url: imeUrl,
-        originAttributes: {
-          inIsolatedMozBrowser: true
-        }
-      }
-    }], function() {
-      let mm = SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
-      inputAppFrame.addEventListener('mozbrowserloadend', function() {
-        mm.addMessageListener('text:appEvent', function(msg) {
-          ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
-        });
-        mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
+    let mm = SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
+    inputAppFrame.addEventListener('mozbrowserloadend', function() {
+      mm.addMessageListener('text:appEvent', function(msg) {
+        ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
+      });
+      mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
 
-        // Set the input app frame to be active
-        let req = inputAppFrame.setInputMethodActive(true);
-        resolve(req);
-      });
+      // Set the input app frame to be active
+      let req = inputAppFrame.setInputMethodActive(true);
+      resolve(req);
     });
   });
 }
 
 function setupContentFrame() {
   info('setupContentFrame');
   return new Promise((resolve, reject) => {
     let contentFrameScript = function contentFrameScript() {
@@ -172,38 +161,17 @@ function setupContentFrame() {
       input.focus();
 
       addMessageListener('test:next', function() {
         content.document.body.children[++i].focus();
       });
     };
 
     let iframe = document.createElement('iframe');
-    iframe.src = 'data:text/html,<html><body>' +
-      '<input type="text">' +
-      '<input type="search">' +
-      '<textarea></textarea>' +
-      '<p contenteditable></p>' +
-      '<input type="number">' +
-      '<input type="tel">' +
-      '<input type="url">' +
-      '<input type="email">' +
-      '<input type="password">' +
-      '<input type="datetime">' +
-      '<input type="date" value="2015-08-03" min="1990-01-01" max="2020-01-01">' +
-      '<input type="month">' +
-      '<input type="week">' +
-      '<input type="time">' +
-      '<input type="datetime-local">' +
-      '<input type="color">' +
-      '<select><option selected>foo</option><option disabled>bar</option>' +
-        '<optgroup label="group"><option>baz</option></optgroup></select>' +
-      '<select multiple><option selected>foo</option><option disabled>bar</option>' +
-        '<optgroup label="group"><option>baz</option></optgroup></select>' +
-      '</body></html>';
+    iframe.src = 'file_test_focus_blur_manage_events.html';
     iframe.setAttribute('mozbrowser', true);
     document.body.appendChild(iframe);
 
     let mm = contentFrameMM =
       SpecialPowers.getBrowserFrameMessageManager(iframe);
 
     iframe.addEventListener('mozbrowserloadend', function() {
       mm.loadFrameScript('data:,(' + encodeURIComponent(contentFrameScript.toString()) + ')();', false);
--- a/dom/inputmethod/mochitest/test_forward_hardware_key_to_ime.html
+++ b/dom/inputmethod/mochitest/test_forward_hardware_key_to_ime.html
@@ -1,21 +1,21 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1110030
 -->
 <head>
   <title>Forwarding Hardware Key to InputMethod</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/NativeKeyCodes.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script>
   <script type="text/javascript" src="bug1110030_helper.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=1110030">Mozilla Bug 1110030</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 // The input context.
 var gContext = null;
--- a/dom/inputmethod/mochitest/test_input_registry_events.html
+++ b/dom/inputmethod/mochitest/test_input_registry_events.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1201407
 -->
 <head>
   <title>Test addinputrequest and removeinputrequest event</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1201407">Mozilla Bug 1201407</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 let appFrameMM;
@@ -57,46 +57,37 @@ function setupInputAppFrame() {
 
     let path = location.pathname;
     let basePath = location.protocol + '//' + location.host +
                  path.substring(0, path.lastIndexOf('/'));
     let imeUrl = basePath + '/file_blank.html';
 
     let inputAppFrame = document.createElement('iframe');
     inputAppFrame.setAttribute('mozbrowser', true);
+    // FIXME: Bug 1270790
+    inputAppFrame.setAttribute('remote', true);
     inputAppFrame.src = imeUrl;
     document.body.appendChild(inputAppFrame);
 
-    SpecialPowers.pushPermissions([{
-      type: 'input',
-      allow: true,
-      context: {
-        url: imeUrl,
-        originAttributes: {
-          inIsolatedMozBrowser: true
-        }
-      }
-    }], function() {
-      let mm = appFrameMM =
-        SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
+    let mm = appFrameMM =
+      SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
 
-      inputAppFrame.addEventListener('mozbrowserloadend', function() {
-        mm.addMessageListener('test:appEvent', function(msg) {
-          ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
-        });
-        mm.addMessageListener('test:resolved', function(msg) {
-          nextStep && nextStep(msg.data);
-        });
-        mm.addMessageListener('test:rejected', function(msg) {
-          nextStep && nextStep(msg.data);
-        });
-        mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
+    inputAppFrame.addEventListener('mozbrowserloadend', function() {
+      mm.addMessageListener('test:appEvent', function(msg) {
+        ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
+      });
+      mm.addMessageListener('test:resolved', function(msg) {
+        nextStep && nextStep(msg.data);
+      });
+      mm.addMessageListener('test:rejected', function(msg) {
+        nextStep && nextStep(msg.data);
+      });
+      mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
 
-        resolve();
-      });
+      resolve();
     });
   });
 }
 
 function Deferred() {
   this.promise = new Promise((res, rej) => {
     this.resolve = res;
     this.reject = rej;
--- a/dom/inputmethod/mochitest/test_sendkey_cancel.html
+++ b/dom/inputmethod/mochitest/test_sendkey_cancel.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=952080
 -->
 <head>
   <title>SendKey with canceled keydown test for InputMethod API.</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=952080">Mozilla Bug 952080</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 // The input context.
--- a/dom/inputmethod/mochitest/test_setSupportsSwitching.html
+++ b/dom/inputmethod/mochitest/test_setSupportsSwitching.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1197682
 -->
 <head>
   <title>Test inputcontext#inputType and MozInputMethodManager#supportsSwitching()</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1197682">Mozilla Bug 1197682</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
@@ -108,21 +108,17 @@ function runTest() {
   };
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
   // Set text and password inputs as supports switching (and not supported for number type)
   im.mgmt.setSupportsSwitchingTypes(['text', 'password']);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body>' +
-    '<input type="text">' +
-    '<input type="number">' +
-    '<input type="password">' +
-    '</body></html>';
+  iframe.src = 'file_test_setSupportsSwitching.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
   });
--- a/dom/inputmethod/mochitest/test_simple_manage_events.html
+++ b/dom/inputmethod/mochitest/test_simple_manage_events.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1201407
 -->
 <head>
   <title>Test simple manage notification events on MozInputMethodManager</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1201407">Mozilla Bug 1201407</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 let appFrameMM;
@@ -93,55 +93,44 @@ function setupInputAppFrame() {
                  path.substring(0, path.lastIndexOf('/'));
     let imeUrl = basePath + '/file_blank.html';
 
     let inputAppFrame = document.createElement('iframe');
     inputAppFrame.setAttribute('mozbrowser', true);
     inputAppFrame.src = imeUrl;
     document.body.appendChild(inputAppFrame);
 
-    SpecialPowers.pushPermissions([{
-      type: 'input',
-      allow: true,
-      context: {
-        url: imeUrl,
-        originAttributes: {
-          inIsolatedMozBrowser: true
-        }
-      }
-    }], function() {
-      let mm = appFrameMM =
-        SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
+    let mm = appFrameMM =
+      SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
 
-      inputAppFrame.addEventListener('mozbrowserloadend', function() {
-        mm.addMessageListener('test:appEvent', function(msg) {
-          ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
-        });
-        mm.addMessageListener('test:inputcontextchange', function(msg) {
-          nextStep && nextStep({ type: 'inputcontextchange' });
-        });
-        mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
+    inputAppFrame.addEventListener('mozbrowserloadend', function() {
+      mm.addMessageListener('test:appEvent', function(msg) {
+        ok(false, 'Input app should not receive ' + msg.data.type + ' event.');
+      });
+      mm.addMessageListener('test:inputcontextchange', function(msg) {
+        nextStep && nextStep({ type: 'inputcontextchange' });
+      });
+      mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
 
-        // Set the input app frame to be active
-        let req = inputAppFrame.setInputMethodActive(true);
-        resolve(req);
-      });
+      // Set the input app frame to be active
+      let req = inputAppFrame.setInputMethodActive(true);
+      resolve(req);
     });
   });
 }
 
 function setupContentFrame() {
   let contentFrameScript = function contentFrameScript() {
     let input = content.document.body.firstElementChild;
 
     input.focus();
   };
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><input type="text"></body></html>';
+  iframe.src = 'file_test_simple_manage_events.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.loadFrameScript('data:,(' + encodeURIComponent(contentFrameScript.toString()) + ')();', false);
   });
--- a/dom/inputmethod/mochitest/test_sync_edit.html
+++ b/dom/inputmethod/mochitest/test_sync_edit.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1079455
 -->
 <head>
   <title>Sync edit of an input</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1079455">Mozilla Bug 1079455</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
@@ -59,17 +59,17 @@ function runTest() {
         inputmethod_cleanup();
     }
   };
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><input value="First"></body></html>';
+  iframe.src = 'file_test_sync_edit.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
   });
 }
--- a/dom/inputmethod/mochitest/test_two_inputs.html
+++ b/dom/inputmethod/mochitest/test_two_inputs.html
@@ -1,19 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1057898
 https://bugzilla.mozilla.org/show_bug.cgi?id=952741
 -->
 <head>
   <title>Test switching between two inputs</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1057898">Mozilla Bug 1057898</a>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=952741">Mozilla Bug 952741</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
@@ -161,17 +161,17 @@ function runTest() {
         break;
     }
   };
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><input value="First"><input value="Second"></body></html>';
+  iframe.src = 'file_test_two_inputs.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
   });
--- a/dom/inputmethod/mochitest/test_two_selects.html
+++ b/dom/inputmethod/mochitest/test_two_selects.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1079728
 -->
 <head>
   <title>Test switching between two inputs</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1079728">Mozilla Bug 1079728</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 inputmethod_setup(function() {
@@ -159,17 +159,17 @@ function runTest() {
         break;
     }
   };
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><select><option>First</option></select><select><option>Second</option></select></html>';
+  iframe.src = 'file_test_two_selects.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   iframe.addEventListener('mozbrowserloadend', function() {
     mm.loadFrameScript('data:,(' + encodeURIComponent(appFrameScript.toString()) + ')();', false);
   });
--- a/dom/inputmethod/mochitest/test_unload.html
+++ b/dom/inputmethod/mochitest/test_unload.html
@@ -1,19 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1122463
 https://bugzilla.mozilla.org/show_bug.cgi?id=820057
 -->
 <head>
   <title>Test focus when page unloads</title>
-  <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript;version=1.7" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript;version=1.7" src="inputmethod_common.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=1122463">Mozilla Bug 1122463</a>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=820057">Mozilla Bug 820057</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
@@ -27,17 +27,17 @@ let appFrameScript = function appFrameSc
   let submit1 = form1.lastElementChild;
   let input2;
 
   let cancelSubmit = function(evt) {
     evt.preventDefault();
   };
 
   // Content of the second page.
-  form1.action = 'data:text/html,<html><body><input value="Second"></body></html>';
+  form1.action = 'file_test_unload_action.html';
 
   let i = 1;
 
   input1.focus();
 
   addMessageListener('test:next', function() {
     i++;
     switch (i) {
@@ -137,17 +137,17 @@ function runTest() {
         break;
     }
   }
 
   // Set current page as an input method.
   SpecialPowers.wrap(im).setActive(true);
 
   let iframe = document.createElement('iframe');
-  iframe.src = 'data:text/html,<html><body><form id="form"><input value="First"><input type="submit"></form></body></html>';
+  iframe.src = 'file_test_unload.html';
   iframe.setAttribute('mozbrowser', true);
   document.body.appendChild(iframe);
 
   let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
   im.oninputcontextchange = nextStep;
 
   let frameScriptLoaded = false;
   iframe.addEventListener('mozbrowserloadend', function() {
--- a/dom/inputmethod/moz.build
+++ b/dom/inputmethod/moz.build
@@ -33,9 +33,9 @@ EXTRA_COMPONENTS += [
 ]
 
 EXTRA_PP_JS_MODULES += [
     'Keyboard.jsm',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
-MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['mochitest/chrome.ini']
--- a/dom/mobilemessage/moz.build
+++ b/dom/mobilemessage/moz.build
@@ -1,17 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['interfaces']
 
-MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
 
 EXPORTS.mozilla.dom.mobilemessage += [
     'Constants.h',            # Required by almost all cpp files
     'ipc/SmsChild.h',
     'ipc/SmsParent.h',
     'Types.h',                # Required by IPDL SmsTypes.h
 ]
rename from dom/mobilemessage/tests/mochitest/mochitest.ini
rename to dom/mobilemessage/tests/mochitest/chrome.ini
--- a/dom/mobilemessage/tests/mochitest/test_sms_basics.html
+++ b/dom/mobilemessage/tests/mochitest/test_sms_basics.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for WebSMS</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 <iframe></iframe>
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.8">
@@ -68,47 +68,39 @@ function checkWebidlInterfaceNotInWindow
     ok(!(iface in window), iface + " should not be there");
   }
 }
 
 function test() {
   checkWebidlInterfaceNotInWindow();
 
   // If sms is disabled and permission is removed, sms is disabled.
-  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", false]]}, function() {
-    SpecialPowers.pushPermissions([{'type': 'sms', 'remove': true, 'context': document}], test2);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", false]]}, test2);
 }
 
 function test2() {
   checkSmsDisabled();
 
   // If sms is enabled and permission is removed, sms is disabled.
-  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", true]]}, function() {
-    SpecialPowers.pushPermissions([{'type': 'sms', 'remove': true, 'context': document}], test3);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", true]]}, test3);
 }
 
 function test3() {
   checkSmsDisabled();
 
   // If sms is disabled and permission is granted, sms is disabled.
-  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", false]]}, function() {
-    SpecialPowers.pushPermissions([{'type': 'sms', 'allow': true, 'context': document}], test4);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", false]]}, test4);
 }
 
 function test4() {
   checkSmsDisabled();
 
   // Even if sms is enabled and permission is granted, sms is still disabled due
   // to the webidl check "AvailableIn=CertifiedApps."
-  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", true]]}, function() {
-    SpecialPowers.pushPermissions([{'type': 'sms', 'allow': true, 'context': document}], test5);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", true]]}, test5);
 }
 
 function test5() {
   checkSmsDisabled();
 
   var iframeElt = document.getElementsByTagName('iframe')[0];
   iframeElt.addEventListener("load", function() {
     iframeElt.removeEventListener("load", arguments.callee);
--- a/dom/network/tests/chrome.ini
+++ b/dom/network/tests/chrome.ini
@@ -1,7 +1,13 @@
 [DEFAULT]
 support-files =
   tcpsocket_test.jsm
   test_tcpsocket_client_and_server_basics.js
   add_task.js
+  file_udpsocket_iframe.html
 
-[test_tcpsocket_jsm.html]
\ No newline at end of file
+[test_tcpsocket_jsm.html]
+[test_tcpsocket_client_and_server_basics.html]
+[test_tcpsocket_enabled_with_perm.html]
+skip-if = toolkit == "gonk"
+[test_tcpsocket_legacy.html]
+[test_udpsocket.html]
--- a/dom/network/tests/mochitest.ini
+++ b/dom/network/tests/mochitest.ini
@@ -1,27 +1,20 @@
 [DEFAULT]
 support-files =
   add_task.js
-  file_udpsocket_iframe.html
-  test_tcpsocket_client_and_server_basics.js
 
 [test_network_basics.html]
 skip-if = toolkit == "gonk" || toolkit == 'android'
-[test_tcpsocket_client_and_server_basics.html]
 [test_tcpsocket_default_permissions.html]
 skip-if = toolkit == "gonk"
 [test_tcpsocket_enabled_no_perm.html]
 skip-if = toolkit == "gonk"
-[test_tcpsocket_enabled_with_perm.html]
-skip-if = toolkit == "gonk"
-[test_tcpsocket_legacy.html]
 [test_networkstats_alarms.html]
 skip-if = toolkit != "gonk"
 [test_networkstats_basics.html]
 skip-if = toolkit != "gonk"
 [test_networkstats_disabled.html]
 skip-if = toolkit != "gonk"
 [test_networkstats_enabled_no_perm.html]
 skip-if = toolkit != "gonk"
 [test_networkstats_enabled_perm.html]
 skip-if = toolkit != "gonk"
-[test_udpsocket.html]
\ No newline at end of file
--- a/dom/network/tests/test_tcpsocket_client_and_server_basics.html
+++ b/dom/network/tests/test_tcpsocket_client_and_server_basics.html
@@ -5,18 +5,18 @@ Core tests for TCPSocket and TCPServerSo
 separate xpcshell incarnations.  This migration and cleanup occurred as part
 of bug 1084245 in order to get coverage of the tests from content.
 
 https://bugzilla.mozilla.org/show_bug.cgi?id=1084245
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 1084245</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
   <script type="application/javascript" src="add_task.js"></script>
   <script type="application/javascript">
     function createServer(port, options, backlog) {
       return new TCPServerSocket(port, options, backlog);
     }
 
     function createSocket(host, port, options) {
       return new TCPSocket(host, port, options);
--- a/dom/network/tests/test_tcpsocket_client_and_server_basics.js
+++ b/dom/network/tests/test_tcpsocket_client_and_server_basics.js
@@ -150,31 +150,16 @@ function defer() {
     deferred.resolve = resolve;
     deferred.reject = reject;
   });
   return deferred;
 }
 
 
 function* test_basics() {
-  if (enablePrefsAndPermissions()) {
-    // Enable our use of TCPSocket
-    let prefDeferred = defer();
-    SpecialPowers.pushPrefEnv(
-      { set: [ ['dom.mozTCPSocket.enabled', true] ] },
-      prefDeferred.resolve);
-    yield prefDeferred.promise;
-
-    let permDeferred = defer();
-    SpecialPowers.pushPermissions(
-      [ { type: 'tcp-socket', allow: true, context: document } ],
-      permDeferred.resolve);
-    yield permDeferred.promise;
-  }
-
   // See bug 903830; in e10s mode we never get to find out the localPort if we
   // let it pick a free port by choosing 0.  This is the same port the xpcshell
   // test was using.
   let serverPort = 8085;
 
   // - Start up a listening socket.
   let listeningServer = createServer(serverPort,
                                      { binaryType: 'arraybuffer' },
--- a/dom/network/tests/test_tcpsocket_enabled_no_perm.html
+++ b/dom/network/tests/test_tcpsocket_enabled_no_perm.html
@@ -14,16 +14,17 @@
 
 /** Test to ensure TCPSocket preference being turned on does not enable
   navigator.mozTCPSocket.
 **/
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
 function runTest() {
   is('TCPSocket' in this, false, "TCPSocket should not be accessible if dom.mozTCPSocket.enabled is true");
-  is('mozTCPSocket' in navigator, false, "mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
+  is('TCPServerSocket' in this, false, "TCPServerSocket should not be accessible if dom.mozTCPSocket.enabled is true");
+  is('mozTCPSocket' in navigator, false, "mozTCPSocket should not be accessible if dom.mozTCPSocket.enabled is true");
 
   SimpleTest.finish();
 }
 </script>
 </pre>
 </body>
 </html>
--- a/dom/network/tests/test_tcpsocket_enabled_with_perm.html
+++ b/dom/network/tests/test_tcpsocket_enabled_with_perm.html
@@ -1,30 +1,28 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test to ensure TCPSocket permission enabled and open works with tcp-socket perm</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test to ensure TCPSocket permission being turned on enables 
   navigator.mozTCPSocket, and mozTCPSocket.open works when
   the tcp-socket permission has been granted.
 **/
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, function() {
-  SpecialPowers.pushPermissions([{type: "tcp-socket", allow: true, context: document}], runTest);
-});
+SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
 
 function runTest() {
   ok('TCPSocket' in this, "TCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
 
   ok(new TCPSocket('localhost', 80), "TCPSocket constructor should work for content that has the tcp-socket permission");
   ok(navigator.mozTCPSocket.open('localhost', 80), "navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");
   // This just helps the test harness clean up quickly
   SpecialPowers.forceCC();
--- a/dom/network/tests/test_tcpsocket_legacy.html
+++ b/dom/network/tests/test_tcpsocket_legacy.html
@@ -1,38 +1,32 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Test of legacy navigator interface for opening TCPSocket/TCPServerSocket.
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 885982</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <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=1084245">Mozilla Bug 1084245</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 </pre>
 <script>
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.pushPrefEnv(
     { set: [ ['dom.mozTCPSocket.enabled', true] ] },
-    setPerms);
-
-  function setPerms() {
-    SpecialPowers.pushPermissions(
-      [ { type: 'tcp-socket', allow: true, context: document } ],
-      runTest);
-  }
+    runTest);
 
   function runTest() {
     // See bug 903830; in e10s mode we never get to find out the localPort if we
     // let it pick a free port by choosing 0.  This is the same port the xpcshell
     // test was using.
     var serverPort = 8085;
 
     var listeningServer = navigator.mozTCPSocket.listen(serverPort,
--- a/dom/network/tests/test_udpsocket.html
+++ b/dom/network/tests/test_udpsocket.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test UDPSocket API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <iframe id="iframe"></iframe>
 <pre id="test">
 <script type="application/javascript;version=1.8">
@@ -386,23 +386,20 @@ function runTest() {
   })
   .catch(function(err) {
     ok(false, 'test failed due to: ' + err);
     SimpleTest.finish();
   });
 }
 
 window.addEventListener('load', function () {
-  SpecialPowers.pushPermissions([
-    {type: 'udp-socket', allow: true, context: document}], function() {
-    SpecialPowers.pushPrefEnv({
-      'set': [
-        ['dom.udpsocket.enabled', true],
-        ['browser.sessionhistory.max_total_viewers', 10]
-      ]
-    }, runTest);
-  });
+  SpecialPowers.pushPrefEnv({
+    'set': [
+      ['dom.udpsocket.enabled', true],
+      ['browser.sessionhistory.max_total_viewers', 10]
+    ]
+  }, runTest);
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/permission/tests/mochitest.ini
+++ b/dom/permission/tests/mochitest.ini
@@ -1,30 +1,42 @@
 [DEFAULT]
 support-files =
   file_framework.js
   file_shim.html
 
 [test_alarms.html]
+skip-if = true
 [test_browser.html]
+skip-if = true
 [test_embed-apps.html]
-skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
+skip-if = true || e10s #Bug 931116, b2g desktop specific, initial triage ### Bug 1255339: blacklist because no more mozApps
 [test_idle.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+# skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+skip-if = true
 [test_permission_basics.html]
-skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(https not working, bug 907770) b2g-debug(https not working, bug 907770) b2g-desktop(Bug 907770)
+skip-if = true || buildapp == 'b2g' || buildapp == 'mulet' || toolkit == 'android' || e10s # b2g(https not working, bug 907770) b2g-debug(https not working, bug 907770) b2g-desktop(Bug 907770) ### Bug 1255339: blacklist because no more mozApps
 [test_permissions.html]
+skip-if = true
 [test_permissions_api.html]
 [test_power.html]
+skip-if = true
 [test_presentation-device-manage.html]
+skip-if = true
 [test_systemXHR.html]
 [test_tcp-socket.html]
+skip-if = true
 [test_udp-socket.html]
+skip-if = true
 [test_webapps-manage.html]
-skip-if = buildapp != 'b2g' && buildapp != 'mulet'
+# skip-if = buildapp != 'b2g' && buildapp != 'mulet'
+skip-if = true
 [test_camera.html]
 disabled = disabled until bug 859593 is fixed
 [test_keyboard.html]
-skip-if = toolkit == 'android'
+# skip-if = toolkit == 'android'
+skip-if = true
 [test_input-manage.html]
-skip-if = toolkit == 'android'
+# skip-if = toolkit == 'android'
+skip-if = true
 [test_wifi-manage.html]
-skip-if = (buildapp != 'b2g') || (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
+# skip-if = (buildapp != 'b2g') || (buildapp == 'mulet') || (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
+skip-if = true
--- a/dom/power/moz.build
+++ b/dom/power/moz.build
@@ -27,9 +27,10 @@ UNIFIED_SOURCES += [
     'WakeLock.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
--- a/dom/power/test/browser_wakelocks.js
+++ b/dom/power/test/browser_wakelocks.js
@@ -222,15 +222,11 @@ function runNextStep() {
   if (gCurStepIndex < gSteps.length) {
     gSteps[gCurStepIndex]();
   } else {
     finish();
   }
 }
 
 function test() {
-  SpecialPowers.pushPermissions([
-    {type: "power", allow: true, context: kUrlSource}
-  ], function () {
-    SpecialPowers.pushPrefEnv({"set": [["dom.wakelock.enabled", true]]},
-                              runNextStep);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.wakelock.enabled", true]]},
+                            runNextStep);
 }
new file mode 100644
--- /dev/null
+++ b/dom/power/test/chrome.ini
@@ -0,0 +1,9 @@
+[test_power_basics.html]
+[test_power_set_cpusleepallowed.html]
+skip-if = toolkit != "gonk"
+[test_power_set_screen_brightness.html]
+skip-if = toolkit != "gonk"
+[test_power_set_screen_enabled.html]
+skip-if = toolkit != "gonk"
+[test_power_set_key_light_enabled.html]
+skip-if = toolkit != "gonk"
--- a/dom/power/test/mochitest.ini
+++ b/dom/power/test/mochitest.ini
@@ -1,13 +1,4 @@
 [test_bug957893.html]
 [test_bug957899.html]
 [test_wakelock_not_exposed.html]
 skip-if = appname == "b2g" || buildapp == "mulet"
-[test_power_basics.html]
-[test_power_set_cpusleepallowed.html]
-skip-if = toolkit != "gonk"
-[test_power_set_screen_brightness.html]
-skip-if = toolkit != "gonk"
-[test_power_set_screen_enabled.html]
-skip-if = toolkit != "gonk"
-[test_power_set_key_light_enabled.html]
-skip-if = toolkit != "gonk"
--- a/dom/power/test/test_power_basics.html
+++ b/dom/power/test/test_power_basics.html
@@ -1,45 +1,29 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for Power API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 <script type="application/javascript">
 
 /** Test for Power API **/
 
-/** Test permission **/
-// In b2g, addPermission 'power' is only working after a document reload
-// See bug 802312
-
 SimpleTest.waitForExplicitFinish();
 
 function startTest() {
-  SpecialPowers.pushPermissions([
-    {type: "power", allow: true, context: window.frames[0].document}
-  ], doTest1);
+  doTest1();
 }
 
 function doTest1() {
-  window.frames[0].frameElement.setAttribute('onload', 'doTest2()');
+  window.frames[0].frameElement.setAttribute('onload', 'doTest3()');
   power = window.frames[0].navigator.mozPower;
   ok(power, "Should be able to access power manager with permission.");
 
-  SpecialPowers.removePermission("power", window.frames[0].document);
-  window.frames[0].location.reload();
-}
-
-function doTest2() {
-  window.frames[0].frameElement.setAttribute('onload', 'doTest3()');
-  power = window.frames[0].navigator.mozPower;
-  ok(!power, "Shouldn't be able to access power manager with permission.");
-
-  SpecialPowers.addPermission("power",true, window.frames[0].document);
   window.frames[0].location.reload();
 }
 
 function doTest3() {
   power = window.frames[0].navigator.mozPower;
   ok(power, "Should be able to access power manager with permission.");
   SimpleTest.finish();
 }
--- a/dom/power/test/test_power_set_cpusleepallowed.html
+++ b/dom/power/test/test_power_set_cpusleepallowed.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test Enabling/Disabling CPU Sleep with Power Management API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
   <script type="application/javascript">
 
   "use strict";
@@ -36,26 +36,20 @@
     testDisableSleep();
     testEnableSleep();
 
     SimpleTest.finish();
   }
 
   SimpleTest.expectAssertions(0, 9);
   SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("power", document)) {
-    // Currently only applicable on FxOS
-    if (navigator.userAgent.indexOf("Mobile") != -1 &&
-        navigator.appVersion.indexOf("Android") == -1) {
-      startTests();
-    } else {
-      ok(true, "mozPower on Firefox OS only.");
-      SimpleTest.finish();
-    }
+  // Currently only applicable on FxOS
+  if (navigator.userAgent.indexOf("Mobile") != -1 &&
+      navigator.appVersion.indexOf("Android") == -1) {
+     startTests();
   } else {
-    // Add the permission and reload so it's propogated
-    SpecialPowers.addPermission("power", true, document);
-    window.location.reload();
+    ok(true, "mozPower on Firefox OS only.");
+    SimpleTest.finish();
   }
   </script>
 </pre>
 </body>
 </html>
--- a/dom/power/test/test_power_set_key_light_enabled.html
+++ b/dom/power/test/test_power_set_key_light_enabled.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test Enabling/Disabling Screen with Power Management API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
   <script type="application/javascript">
 
   "use strict";
@@ -39,26 +39,20 @@
 
     testDisableKeyLight();
     testEnableKeyLight();
 
     SimpleTest.finish();
   }
 
   SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("power", document)) {
-    // Currently only applicable on FxOS
-    if (navigator.userAgent.indexOf("Mobile") != -1 &&
-        navigator.appVersion.indexOf("Android") == -1) {
-      startTests();
-    } else {
-      ok(true, "mozPower on Firefox OS only.");
-      SimpleTest.finish();
-    }
+  // Currently only applicable on FxOS
+  if (navigator.userAgent.indexOf("Mobile") != -1 &&
+      navigator.appVersion.indexOf("Android") == -1) {
+    startTests();
   } else {
-    // Add the permission and reload so it's propogated
-    SpecialPowers.addPermission("power", true, document);
-    window.location.reload();
+    ok(true, "mozPower on Firefox OS only.");
+    SimpleTest.finish();
   }
   </script>
 </pre>
 </body>
 </html>
--- a/dom/power/test/test_power_set_screen_brightness.html
+++ b/dom/power/test/test_power_set_screen_brightness.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test Setting Screen Brightness with Power Management API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
   <script type="application/javascript">
 
   "use strict";
@@ -51,26 +51,20 @@
 
   function fuzzyEq(a, b) {
     var epsilon = 0.002;
     return Math.abs(a - b) < epsilon;
   }
 
   SimpleTest.expectAssertions(0, 9);
   SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("power", document)) {
-    // Currently only applicable on FxOS
-    if (navigator.userAgent.indexOf("Mobile") != -1 &&
-        navigator.appVersion.indexOf("Android") == -1) {
-      startTests();
-    } else {
-      ok(true, "mozPower on Firefox OS only.");
-      SimpleTest.finish();
-    }
+  // Currently only applicable on FxOS
+  if (navigator.userAgent.indexOf("Mobile") != -1 &&
+      navigator.appVersion.indexOf("Android") == -1) {
+    startTests();
   } else {
-    // Add the permission and reload so it's propogated
-    SpecialPowers.addPermission("power", true, document);
-    window.location.reload();
+    ok(true, "mozPower on Firefox OS only.");
+    SimpleTest.finish();
   }
   </script>
 </pre>
 </body>
 </html>
--- a/dom/power/test/test_power_set_screen_enabled.html
+++ b/dom/power/test/test_power_set_screen_enabled.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test Enabling/Disabling Screen with Power Management API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
   <script type="application/javascript">
 
   "use strict";
@@ -40,26 +40,20 @@
     testDisableScreen();
     testEnableScreen();
 
     SimpleTest.finish();
   }
 
   SimpleTest.expectAssertions(0, 9);
   SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("power", document)) {
-    // Currently only applicable on FxOS
-    if (navigator.userAgent.indexOf("Mobile") != -1 &&
-        navigator.appVersion.indexOf("Android") == -1) {
-      startTests();
-    } else {
-      ok(true, "mozPower on Firefox OS only.");
-      SimpleTest.finish();
-    }
+  // Currently only applicable on FxOS
+  if (navigator.userAgent.indexOf("Mobile") != -1 &&
+      navigator.appVersion.indexOf("Android") == -1) {
+    startTests();
   } else {
-    // Add the permission and reload so it's propogated
-    SpecialPowers.addPermission("power", true, document);
-    window.location.reload();
+    ok(true, "mozPower on Firefox OS only.");
+    SimpleTest.finish();
   }
   </script>
 </pre>
 </body>
 </html>
--- a/dom/presentation/tests/mochitest/chrome.ini
+++ b/dom/presentation/tests/mochitest/chrome.ini
@@ -1,4 +1,14 @@
 [DEFAULT]
-skip-if = buildapp == 'b2g' || os == 'android'
+support-files =
+  PresentationDeviceInfoChromeScript.js
+  PresentationSessionChromeScript.js
 
 [test_presentation_datachannel_sessiontransport.html]
+skip-if = buildapp == 'b2g' || os == 'android'
+[test_presentation_device_info.html]
+[test_presentation_sender_startWithDevice.html]
+skip-if = toolkit == 'android' # Bug 1129785
+[test_presentation_tcp_sender.html]
+skip-if = toolkit == 'android' # Bug 1129785
+[test_presentation_tcp_sender_default_request.html]
+skip-if = toolkit == 'android' # Bug 1129785
--- a/dom/presentation/tests/mochitest/mochitest.ini
+++ b/dom/presentation/tests/mochitest/mochitest.ini
@@ -23,28 +23,21 @@ skip-if = (e10s || toolkit == 'gonk' || 
 [test_presentation_1ua_sender_and_receiver.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
 [test_presentation_1ua_sender_and_receiver_oop.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
 [test_presentation_1ua_connection_wentaway_inproc.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
 [test_presentation_1ua_connection_wentaway_oop.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
-[test_presentation_device_info.html]
 [test_presentation_device_info_permission.html]
-[test_presentation_sender_startWithDevice.html]
-skip-if = toolkit == 'android' # Bug 1129785
 [test_presentation_tcp_sender_disconnect.html]
 skip-if = toolkit == 'android' # Bug 1129785
 [test_presentation_tcp_sender_establish_connection_error.html]
 skip-if = toolkit == 'android' # Bug 1129785
-[test_presentation_tcp_sender.html]
-skip-if = toolkit == 'android' # Bug 1129785
-[test_presentation_tcp_sender_default_request.html]
-skip-if = toolkit == 'android' # Bug 1129785
 [test_presentation_tcp_receiver_establish_connection_error.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android' || os == 'mac' || os == 'win' || buildapp == 'mulet') # Bug 1129785, Bug 1204709
 [test_presentation_tcp_receiver_establish_connection_timeout.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
 [test_presentation_tcp_receiver.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
 [test_presentation_tcp_receiver_oop.html]
 skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
--- a/dom/presentation/tests/mochitest/test_presentation_device_info.html
+++ b/dom/presentation/tests/mochitest/test_presentation_device_info.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <html>
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 <head>
   <meta charset="utf-8">
   <title>Test for B2G Presentation Device Info API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1080474">Test for B2G Presentation Device Info API</a>
 <script type="application/javascript;version=1.8">
 
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
@@ -126,23 +126,19 @@ function runTests() {
     info('test finished, teardown');
     gScript.sendAsyncMessage('teardown', '');
     gScript.destroy();
     SimpleTest.finish();
   });
 }
 
 window.addEventListener('load', function() {
-  SpecialPowers.pushPermissions([
-    {type: 'presentation-device-manage', allow: true, context: document},
-  ], function() {
-    SpecialPowers.pushPrefEnv({
-      'set': [
-        ['dom.presentation.enabled', true],
-      ]
-    }, runTests);
-  });
+  SpecialPowers.pushPrefEnv({
+    'set': [
+      ['dom.presentation.enabled', true],
+    ]
+  }, runTests);
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/presentation/tests/mochitest/test_presentation_device_info_permission.html
+++ b/dom/presentation/tests/mochitest/test_presentation_device_info_permission.html
@@ -17,23 +17,19 @@
 SimpleTest.waitForExplicitFinish();
 
 function runTests() {
   is(navigator.mozPresentationDeviceInfo, undefined, 'navigator.mozPresentationDeviceInfo is undefined');
   SimpleTest.finish();
 }
 
 window.addEventListener('load', function() {
-  SpecialPowers.pushPermissions([
-    {type: 'presentation-device-manage', allow: false, context: document},
-  ], function() {
-    SpecialPowers.pushPrefEnv({
-      'set': [
-        ['dom.presentation.enabled', true],
-      ]
-    }, runTests);
-  });
+  SpecialPowers.pushPrefEnv({
+    'set': [
+      ['dom.presentation.enabled', true],
+    ]
+  }, runTests);
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html
+++ b/dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <html>
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 <head>
   <meta charset="utf-8">
   <title>Test startWithDevice for B2G Presentation API at sender side</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1239242">Test startWithDevice for B2G Presentation API at sender side</a>
 <script type="application/javascript;version=1.8">
 
 'use strict';
 
 var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript.js'));
@@ -155,22 +155,17 @@ function runTests() {
 
   testSetup().
   then(testStartConnectionWithDevice).
   then(testStartConnectionWithDeviceNotFoundError).
   then(teardown);
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: true, context: document},
-  {type: 'presentation', allow: true, context: document},
-], function() {
-  SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
-                                      ["dom.presentation.session_transport.data_channel.enable", false],
-                                      ["dom.presentation.test.enabled", true],
-                                      ["dom.presentation.test.stage", 0]]},
-                            runTests);
-});
+SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
+                                    ["dom.presentation.session_transport.data_channel.enable", false],
+                                    ["dom.presentation.test.enabled", true],
+                                    ["dom.presentation.test.stage", 0]]},
+                          runTests);
 
 </script>
 </body>
 </html>
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender.html
+++ b/dom/presentation/tests/mochitest/test_presentation_tcp_sender.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <html>
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 <head>
   <meta charset="utf-8">
   <title>Test for B2G Presentation API at sender side</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069230">Test for B2G Presentation API at sender side</a>
 <script type="application/javascript;version=1.8">
 
 'use strict';
 
 var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript.js'));
@@ -185,20 +185,15 @@ function runTests() {
   then(testStartConnection).
   then(testSend).
   then(testIncomingMessage).
   then(testCloseConnection).
   then(teardown);
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: false, context: document},
-  {type: 'presentation', allow: true, context: document},
-], function() {
-  SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
-                                      ["dom.presentation.session_transport.data_channel.enable", false]]},
-                            runTests);
-});
+SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
+                                    ["dom.presentation.session_transport.data_channel.enable", false]]},
+                          runTests);
 
 </script>
 </body>
 </html>
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html
+++ b/dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <html>
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 <head>
   <meta charset="utf-8">
   <title>Test default request for B2G Presentation API at sender side</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069230">Test default request for B2G Presentation API at sender side</a>
 <script type="application/javascript;version=1.8">
 
 'use strict';
 
 var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript.js'));
@@ -134,20 +134,15 @@ function runTests() {
 
   testSetup().
   then(testStartConnection).
   then(testCloseConnection).
   then(teardown);
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: false, context: document},
-  {type: 'presentation', allow: true, context: document},
-], function() {
-  SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
-                                      ["dom.presentation.session_transport.data_channel.enable", false]]},
-                            runTests);
-});
+SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
+                                    ["dom.presentation.session_transport.data_channel.enable", false]]},
+                          runTests);
 
 </script>
 </body>
 </html>
--- a/dom/settings/moz.build
+++ b/dom/settings/moz.build
@@ -13,18 +13,16 @@ EXTRA_PP_COMPONENTS += [
 ]
 
 if CONFIG['MOZ_B2G']:
     EXTRA_COMPONENTS += [
         'SettingsService.js',
         'SettingsService.manifest',
     ]
 
-    MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
-
 EXTRA_JS_MODULES += [
     'SettingsDB.jsm',
     'SettingsRequestManager.jsm'
 ]
 
-MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
--- a/dom/settings/tests/chrome.ini
+++ b/dom/settings/tests/chrome.ini
@@ -1,10 +1,23 @@
 [DEFAULT]
-skip-if = buildapp != 'b2g'
 support-files =
+  file_loadserver.js
+  file_bug1110872.js
+  file_bug1110872.html
   test_settings_service.js
   test_settings_service_callback.js
 
-
 [test_settings_service.xul]
-skip-if= buildapp == 'mulet'
+run-if = buildapp == 'b2g' || buildapp == 'mulet'
 [test_settings_service_callback.xul]
+run-if = buildapp == 'b2g' || buildapp == 'mulet'
+[test_settings_basics.html]
+[test_settings_permissions.html]
+[test_settings_blobs.html]
+[test_settings_data_uris.html]
+[test_settings_events.html]
+[test_settings_navigator_object.html]
+[test_settings_onsettingchange.html]
+[test_settings_bug1110872.html]
+skip-if = !e10s
+[test_settings_observer_killer.html]
+skip-if = !debug
--- a/dom/settings/tests/file_bug1110872.html
+++ b/dom/settings/tests/file_bug1110872.html
@@ -1,20 +1,15 @@
 <!DOCTYPE HTML>
 <html>
     <head>
         <title>Test for Bug {1110872} Settings API Reloads</title>
     </head>
     <body>
         <script type="application/javascript;version=1.7">
-         SpecialPowers.addPermission("settings-read", true, document);
-         SpecialPowers.addPermission("settings-write", true, document);
-         SpecialPowers.addPermission("settings-api-read", true, document);
-         SpecialPowers.addPermission("settings-api-write", true, document);
-         SpecialPowers.addPermission("settings-clear", true, document);
 
          var createLock = function (msg) {
              var lock = navigator.mozSettings.createLock();
              var req = lock.get("wallpaper.image");
              // We don't actually care about success or failure here, we just
              // want to know the queue gets processed at all.
              req.onsuccess = function () {
                  parent.postMessage({name:"done" + msg.data.step}, "*");
deleted file mode 100644
--- a/dom/settings/tests/mochitest.ini
+++ /dev/null
@@ -1,17 +0,0 @@
-[DEFAULT]
-support-files =
-  file_loadserver.js
-  file_bug1110872.js
-  file_bug1110872.html
-
-[test_settings_basics.html]
-[test_settings_permissions.html]
-[test_settings_blobs.html]
-[test_settings_data_uris.html]
-[test_settings_events.html]
-[test_settings_navigator_object.html]
-[test_settings_onsettingchange.html]
-[test_settings_bug1110872.html]
-skip-if = !e10s
-[test_settings_observer_killer.html]
-skip-if = !debug
--- a/dom/settings/tests/test_settings_basics.html
+++ b/dom/settings/tests/test_settings_basics.html
@@ -1,38 +1,33 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
 -->
 <head>
   <title>Test for Bug {678695} Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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={678695}">Mozilla Bug {678695}</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
--- a/dom/settings/tests/test_settings_blobs.html
+++ b/dom/settings/tests/test_settings_blobs.html
@@ -1,38 +1,33 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=821630
 -->
 <head>
   <title>Test for Bug 821630 Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=821630">Mozilla Bug 821630</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 
 "use strict";
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_bug1110872.html
+++ b/dom/settings/tests/test_settings_bug1110872.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
     <head>
         <title>Test for Bug {1110872} Settings API</title>
         <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-        <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+        <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
     </head>
     <body>
         <script type="application/javascript;version=1.7" src="file_bug1110872.js">
         </script>
         <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={1110872}">Mozilla Bug {1110872}</a>
         <p id="display"></p>
         <div id="content" style="display: none">
         </div>
--- a/dom/settings/tests/test_settings_data_uris.html
+++ b/dom/settings/tests/test_settings_data_uris.html
@@ -1,38 +1,33 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=806374
 -->
 <head>
   <title>Test for Bug 806374 Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=821630">Mozilla Bug 821630</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 
 "use strict";
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_events.html
+++ b/dom/settings/tests/test_settings_events.html
@@ -1,30 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=678695
 -->
 <head>
   <title>Test for Bug 678695</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <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=678695">Mozilla Bug 678695</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript">
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
 
 /** Test for Bug 678695 **/
 
 var e = new MozSettingsEvent("settingchanged", {settingName: "a", settingValue: 1});
 ok(e, "Should have settings event!");
 is(e.settingName, "a", "Name should be a.");
 is(e.settingValue, 1, "Value should be 1.");
 
--- a/dom/settings/tests/test_settings_navigator_object.html
+++ b/dom/settings/tests/test_settings_navigator_object.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=898512
 -->
 <head>
   <title>Test for Bug 898512 Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=898512">Mozilla Bug 898512</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 <iframe></iframe>
 </div>
@@ -25,22 +25,13 @@ function testPref() {
   SpecialPowers.pushPrefEnv({
     set: [["dom.mozSettings.enabled", false]]
   }, function() {
     is(navigator.mozSettings, undefined, "navigator.mozSettings is undefined");
     SimpleTest.finish();
   });
 }
 
-SpecialPowers.pushPermissions([
-  {type: "settings-read", allow: 0, context: document},
-  {type: "settings-write", allow: 0, context: document},
-  {type: "settings-api-read", allow: 0, context: document},
-  {type: "settings-api-write", allow: 0, context: document},
-  {type: "settings-clear", allow: 0, context: document}
-], function() {
-  is(frames[0].navigator.mozSettings, undefined, "navigator.mozSettings is undefined when the page doesn't have permissions");
-  testPref();
-});
+testPref();
 </script>
 </pre>
 </body>
 </html>
--- a/dom/settings/tests/test_settings_observer_killer.html
+++ b/dom/settings/tests/test_settings_observer_killer.html
@@ -1,68 +1,60 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1193469
 -->
 <head>
   <title>Test for Bug 1193469 Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=1193469">Mozilla Bug 1193469</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 <iframe></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
 
 SimpleTest.waitForExplicitFinish();
 
-SpecialPowers.pushPermissions([
-  {type: "settings-api-read", allow: 1, context: document},
-  {type: "settings-api-write", allow: 1, context: document},
-  {type: "settings-read", allow: 1, context: document},
-  {type: "settings-write", allow: 1, context: document},
-  {type: "settings-clear", allow: 1, context: document}
-], function() {
-  SpecialPowers.pushPrefEnv({
-    set: [["dom.mozSettings.enabled", true]]
-  },
-    function () {
-      ok(true, "abusing observers");
+SpecialPowers.pushPrefEnv({
+  set: [["dom.mozSettings.enabled", true]]
+},
+  function () {
+    ok(true, "abusing observers");
 
-      var obs;
-      for (obs = 0; obs < 9; obs++) {
-        navigator.mozSettings.addObserver("fake.setting.key", function(v) {
-          // nothing to do for real ...
-          ok(false, "should not be called");
-        });
-        ok(true, "first: added observer #" + obs);
-      }
-      ok(true, "adding first observers, should not have thrown");
+    var obs;
+    for (obs = 0; obs < 9; obs++) {
+      navigator.mozSettings.addObserver("fake.setting.key", function(v) {
+        // nothing to do for real ...
+        ok(false, "should not be called");
+      });
+      ok(true, "first: added observer #" + obs);
+    }
+    ok(true, "adding first observers, should not have thrown");
 
-      try {
-        ok(true, "second: adding new observer");
-        navigator.mozSettings.addObserver("fake.setting.key", function(v) {
-          // nothing to do for real ...
-          ok(false, "should not be called");
-        });
-        ok(false, "adding too many observers should have thrown");
-      } catch (ex) {
-        ok(true, "got exception when trying to add too many observers");
-      }
+    try {
+      ok(true, "second: adding new observer");
+      navigator.mozSettings.addObserver("fake.setting.key", function(v) {
+        // nothing to do for real ...
+        ok(false, "should not be called");
+      });
+      ok(false, "adding too many observers should have thrown");
+    } catch (ex) {
+      ok(true, "got exception when trying to add too many observers");
+    }
 
-      SimpleTest.finish();
-    });
-});
+    SimpleTest.finish();
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/settings/tests/test_settings_onsettingchange.html
+++ b/dom/settings/tests/test_settings_onsettingchange.html
@@ -1,38 +1,33 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=678695
 -->
 <head>
   <title>Test for Bug 678695 Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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=678695">Mozilla Bug 678695</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
-SpecialPowers.addPermission("settings-write", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings-clear", true, document);
 
 var screenBright = {"screen.brightness": 0.7};
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
 
 function observer1(setting) {
--- a/dom/settings/tests/test_settings_permissions.html
+++ b/dom/settings/tests/test_settings_permissions.html
@@ -1,47 +1,42 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
 -->
 <head>
   <title>Test for Bug {678695} Settings API</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <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={900551}">Mozilla Bug {900551}</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 var url = SimpleTest.getTestFileURL("file_loadserver.js");
 var script = SpecialPowers.loadChromeScript(url);
-SpecialPowers.removePermission("settings-read", document);
-SpecialPowers.removePermission("settings-write", document);
-SpecialPowers.addPermission("settings-api-read", true, document);
-SpecialPowers.addPermission("settings-api-write", true, document);
-SpecialPowers.addPermission("settings:wallpaper.image-read", true, document);
-SpecialPowers.addPermission("settings:wallpaper.image-write", true, document);
-SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
+// No more permissions, so failure cannot happen
 function onFailure() {
-  ok(false, "in on Failure!");
+  ok(true, "in on Failure!");
+  next();
 }
 
 const wifi  = {"wifi.enabled": false}
 const wallpaper = {"wallpaper.image": "test-image"};
 
 var combination = {
   "wifi.enabled": false,
   "wallpaper.image": "test-image"
--- a/dom/tests/mochitest/general/chrome.ini
+++ b/dom/tests/mochitest/general/chrome.ini
@@ -1,9 +1,11 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g' || os == 'android'
 
 [test_innerScreen.xul]
 [test_offsets.css]
 [test_offsets.js]
 [test_offsets.xul]
 skip-if = buildapp == 'mulet'
+[test_idleapi_permissions.html]
+skip-if = buildapp == 'b2g' || buildapp == 'mulet'
 [test_spacetopagedown.html]
--- a/dom/tests/mochitest/general/mochitest.ini
+++ b/dom/tests/mochitest/general/mochitest.ini
@@ -78,18 +78,16 @@ skip-if = buildapp == 'mulet'
 [test_focus_legend_noparent.html]
 [test_focusrings.xul]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_for_of.html]
 [test_frameElementWrapping.html]
 [test_pointerPreserves3D.html]
 [test_pointerPreserves3DClip.html]
 [test_framedhistoryframes.html]
-[test_idleapi_permissions.html]
-skip-if = buildapp == 'b2g' || buildapp == 'mulet'
 [test_img_mutations.html]
 [test_interfaces.html]
 skip-if = ((buildapp == 'mulet' || buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 # [test_network_events.html]
 # Disable this test until bug 795711 is fixed.
 [test_offsets.html]
 support-files = test_offsets.js
 [test_outerHTML.html]
--- a/dom/tests/mochitest/general/test_idleapi_permissions.html
+++ b/dom/tests/mochitest/general/test_idleapi_permissions.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for idle api permissions</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
@@ -28,19 +28,16 @@ function doAddIdleObserver(obs) {
   i.remove();
   return added;
 }
 
 function run_test() {
   // addIdleObserver checks whether time is > 0.
   this.idleObserver.time = 100;
 
-  var added = doAddIdleObserver(this.idleObserver, false);
-  ok(!added, "Should not be able to add idle observer without permission");
-
   SpecialPowers.pushPermissions([{type: "idle", allow: true, context: document}], () => {
     added = doAddIdleObserver(this.idleObserver, true);
     ok(added, "Should be able to add idle observer with permission.");
     SimpleTest.finish();
   });
 }
 
 SimpleTest.waitForExplicitFinish();
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/chrome.ini
@@ -0,0 +1,9 @@
+[DEFAULT]
+support-files =
+  geolocation.html
+  geolocation_common.js
+
+[test_mozsettings.html]
+skip-if = buildapp == 'b2g' || toolkit == 'android'
+[test_mozsettingsWatch.html]
+skip-if = buildapp == 'b2g' || toolkit == 'android'
--- a/dom/tests/mochitest/geolocation/mochitest.ini
+++ b/dom/tests/mochitest/geolocation/mochitest.ini
@@ -31,20 +31,16 @@ skip-if = buildapp == 'b2g' || toolkit =
 [test_manyCurrentSerial.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_manyWatchConcurrent.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_manyWatchSerial.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_manyWindows.html]
 skip-if = buildapp == 'b2g'
-[test_mozsettings.html]
-skip-if = buildapp == 'b2g' || toolkit == 'android'
-[test_mozsettingsWatch.html]
-skip-if = buildapp == 'b2g' || toolkit == 'android'
 [test_optional_api_params.html]
 skip-if = buildapp == 'b2g'
 [test_shutdown.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_timeoutCurrent.html]
 [test_timerRestartWatch.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
 [test_windowClose.html]
--- a/dom/tests/mochitest/geolocation/test_mozsettings.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettings.html
@@ -1,49 +1,40 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=478911
 -->
 <head>
   <title>Test for getCurrentPosition </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="geolocation_common.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=777594">Mozilla Bug 777594</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 
 var timeToWaitMs = 1000;
 
 resume_geolocationProvider(function() {
-  force_prompt(true, test1);
+  force_prompt(true, test2);
 });
 
 SpecialPowers.importInMainProcess("resource://gre/modules/SettingsRequestManager.jsm");
 
-function test1() {
-  //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
-  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
-                                 {'type': 'settings-write', 'allow': true, 'context': document},
-                                 {'type': 'settings-api-write', 'allow': true, 'context': document},
-                                 {'type': 'settings-api-read', 'allow': true, 'context': document}
-  ], test2);
-}
-
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");
       setTimeout(function() {
           navigator.geolocation.getCurrentPosition(successCallbackAfterMozsettingOff,
                                                    failureCallbackAfterMozsettingOff);
--- a/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
@@ -1,47 +1,38 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=478911
 -->
 <head>
   <title>Test for getCurrentPosition </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="geolocation_common.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=777594">Mozilla Bug 777594</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 
 resume_geolocationProvider(function() {
-  force_prompt(true, test1);
+  force_prompt(true, test2);
 });
 
 SpecialPowers.importInMainProcess("resource://gre/modules/SettingsRequestManager.jsm");
 
-function test1() {
-  //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
-  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
-                                 {'type': 'settings-write', 'allow': true, 'context': document},
-                                 {'type': 'settings-api-write', 'allow': true, 'context': document},
-                                 {'type': 'settings-api-read', 'allow': true, 'context': document}
-  ], test2);
-}
-
 var watchId;
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");
       setTimeout(function() {
           watchId = navigator.geolocation.watchPosition(successCallbackAfterMozsettingOff,
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/notification/chrome.ini
@@ -0,0 +1,8 @@
+[DEFAULT]
+
+support-files =
+  MockServices.js
+  NotificationTest.js
+
+[test_notification_noresend.html]
+skip-if = (toolkit == 'gonk') # Mochitest on Gonk registers an app manifest that messes with the logic
--- a/dom/tests/mochitest/notification/mochitest.ini
+++ b/dom/tests/mochitest/notification/mochitest.ini
@@ -4,11 +4,9 @@ support-files =
   MockServices.js
   NotificationTest.js
 
 [test_notification_basics.html]
 [test_notification_storage.html]
 [test_bug931307.html]
 skip-if = (os == 'android') # Bug 1258975 on android.
 [test_notification_resend.html]
-skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || e10s # On e10s, faking the app seems to be failing
-[test_notification_noresend.html]
-skip-if = (toolkit == 'gonk') # Mochitest on Gonk registers an app manifest that messes with the logic
+skip-if = true ### Bug 1255339: blacklist because no more mozApps
--- a/dom/tests/mochitest/notification/test_notification_noresend.html
+++ b/dom/tests/mochitest/notification/test_notification_noresend.html
@@ -1,16 +1,16 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Testing mozResendAllNotifications() resend behavior for Pages</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="MockServices.js"></script>
   <script type="text/javascript" src="NotificationTest.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=1159128">Bug 1159128</a>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test"></pre>
 <script type="text/javascript">
   var info = NotificationTest.info;
--- a/dom/tests/moz.build
+++ b/dom/tests/moz.build
@@ -29,17 +29,19 @@ MOCHITEST_MANIFESTS += [
     'mochitest/webcomponents/mochitest.ini',
     'mochitest/whatwg/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += [
     'mochitest/beacon/chrome.ini',
     'mochitest/chrome/chrome.ini',
     'mochitest/general/chrome.ini',
+    'mochitest/geolocation/chrome.ini',
     'mochitest/localstorage/chrome.ini',
+    'mochitest/notification/chrome.ini',
     'mochitest/sessionstorage/chrome.ini',
     'mochitest/whatwg/chrome.ini',
 ]
 
 if CONFIG['MOZ_GAMEPAD']:
     MOCHITEST_MANIFESTS += [
         'mochitest/gamepad/mochitest.ini',
     ]
--- a/dom/tv/moz.build
+++ b/dom/tv/moz.build
@@ -37,15 +37,17 @@ XPIDL_SOURCES += [
 
 EXTRA_COMPONENTS += [
     'TVSimulatorService.js',
     'TVSimulatorService.manifest',
 ]
 
 XPIDL_MODULE = 'dom_tv'
 
-MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
+MOCHITEST_MANIFESTS  += ['test/mochitest/mochitest.ini']
+
+MOCHITEST_CHROME_MANIFESTS  += ['test/mochitest/chrome.ini']
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/tv/test/mochitest/chrome.ini
@@ -0,0 +1,19 @@
+[DEFAULT]
+support-files =
+  head.js
+  mock_data.json
+
+[test_tv_permitted_app.html]
+[test_tv_get_tuners.html]
+[test_tv_get_sources.html]
+[test_tv_get_channels.html]
+[test_tv_get_channels_during_scanning.html]
+[test_tv_get_programs.html]
+[test_tv_get_current_program.html]
+[test_tv_set_current_source.html]
+[test_tv_set_invalid_current_source.html]
+[test_tv_set_current_channel.html]
+[test_tv_set_current_channel_during_scanning.html]
+[test_tv_set_invalid_current_channel.html]
+[test_tv_scan_channels_stopped.html]
+[test_tv_scan_channels_completed.html]
--- a/dom/tv/test/mochitest/head.js
+++ b/dom/tv/test/mochitest/head.js
@@ -1,18 +1,10 @@
 "use strict";
 
-function setupPrefsAndPermissions(callback) {
-  setupPrefs(function() {
-      SpecialPowers.pushPermissions([
-        {"type":"tv", "allow":1, "context":document}
-      ], callback);
-  });
-}
-
 function setupPrefs(callback) {
   let xhr = new XMLHttpRequest;
   let data;
 
   xhr.open("GET", "./mock_data.json", false);
   xhr.send(null);
   if (xhr.status == 200) {
     data = xhr.responseText;
@@ -26,19 +18,17 @@ function setupPrefs(callback) {
                               ["dom.tv.enabled", true],
                               ["dom.ignore_webidl_scope_checks", true],
                               ["dom.testing.tv_mock_data", data]
                             ]}, function() {
     callback();
   });
 }
 
-function removePrefsAndPermissions(callback) {
-  SpecialPowers.popPrefEnv(function() {
-    SpecialPowers.popPermissions(callback);
-  });
+function removePrefs(callback) {
+  SpecialPowers.popPrefEnv(callback);
 }
 
 function prepareTest(callback) {
-  removePrefsAndPermissions(function() {
-    setupPrefsAndPermissions(callback);
+  removePrefs(function() {
+    setupPrefs(callback);
   });
 }
--- a/dom/tv/test/mochitest/mochitest.ini
+++ b/dom/tv/test/mochitest/mochitest.ini
@@ -1,20 +1,6 @@
 [DEFAULT]
 support-files =
   head.js
   mock_data.json
 
 [test_tv_non_permitted_app.html]
-[test_tv_permitted_app.html]
-[test_tv_get_tuners.html]
-[test_tv_get_sources.html]
-[test_tv_get_channels.html]
-[test_tv_get_channels_during_scanning.html]
-[test_tv_get_programs.html]
-[test_tv_get_current_program.html]
-[test_tv_set_current_source.html]
-[test_tv_set_invalid_current_source.html]
-[test_tv_set_current_channel.html]
-[test_tv_set_current_channel_during_scanning.html]
-[test_tv_set_invalid_current_channel.html]
-[test_tv_scan_channels_stopped.html]
-[test_tv_scan_channels_completed.html]
--- a/dom/tv/test/mochitest/test_tv_get_channels.html
+++ b/dom/tv/test/mochitest/test_tv_get_channels.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test GetChannels for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_get_channels_during_scanning.html
+++ b/dom/tv/test/mochitest/test_tv_get_channels_during_scanning.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test an error case for GetChannels during scanning for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_get_current_program.html
+++ b/dom/tv/test/mochitest/test_tv_get_current_program.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test GetCurrentProgram for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_get_programs.html
+++ b/dom/tv/test/mochitest/test_tv_get_programs.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test GetPrograms for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_get_sources.html
+++ b/dom/tv/test/mochitest/test_tv_get_sources.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test GetSources for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_get_tuners.html
+++ b/dom/tv/test/mochitest/test_tv_get_tuners.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test GetTuners for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_permitted_app.html
+++ b/dom/tv/test/mochitest/test_tv_permitted_app.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test Permitted Application for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_scan_channels_completed.html
+++ b/dom/tv/test/mochitest/test_tv_scan_channels_completed.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test channel scanning complete for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_scan_channels_stopped.html
+++ b/dom/tv/test/mochitest/test_tv_scan_channels_stopped.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test StartScanning and StopScanning for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_set_current_channel.html
+++ b/dom/tv/test/mochitest/test_tv_set_current_channel.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test SetCurrentChannel for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_set_current_channel_during_scanning.html
+++ b/dom/tv/test/mochitest/test_tv_set_current_channel_during_scanning.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test an error case for SetCurrentChannel during scanning for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_set_current_source.html
+++ b/dom/tv/test/mochitest/test_tv_set_current_source.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test SetCurrentSource for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_set_invalid_current_channel.html
+++ b/dom/tv/test/mochitest/test_tv_set_invalid_current_channel.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test an error case for SetCurrentChannel for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">
 
--- a/dom/tv/test/mochitest/test_tv_set_invalid_current_source.html
+++ b/dom/tv/test/mochitest/test_tv_set_invalid_current_source.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test an error case for SetCurrentSource for TV API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript" src="./head.js"></script>
 <script type="application/javascript">