Bug 1286530 - Clean AvailableIn, CheckAnyPermissions and CheckAllPermissions from WebIDL r=bz,fabrice
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Thu, 21 Apr 2016 15:48:59 +0200
changeset 345098 20a6fd076505809220e031dd594e03029459a664
parent 345097 803d0028289a74df1be4220a61dd88802a3563a9
child 345099 525cfc10534677e164667326632d3cd216809dbc
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, fabrice
bugs1286530
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1286530 - Clean AvailableIn, CheckAnyPermissions and CheckAllPermissions from WebIDL r=bz,fabrice MozReview-Commit-ID: 6EQfBM09xUE
dom/alarm/moz.build
dom/alarm/test/chrome.ini
dom/alarm/test/mochitest.ini
dom/alarm/test/test_alarm_permitted_app.html
dom/base/Navigator.cpp
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/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Codegen.py
dom/bindings/Configuration.py
dom/bindings/DOMJSClass.h
dom/bindings/mozwebidlcodegen/__init__.py
dom/bindings/parser/WebIDL.py
dom/bindings/test/TestCodeGen.webidl
dom/bindings/test/TestJSImplGen.webidl
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/TCPSocket.cpp
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
dom/webidl/AVInputPort.webidl
dom/webidl/AlarmsManager.webidl
dom/webidl/Apps.webidl
dom/webidl/AudioChannelManager.webidl
dom/webidl/BeforeAfterKeyboardEvent.webidl
dom/webidl/BluetoothAdapter.webidl
dom/webidl/BluetoothAdapterEvent.webidl
dom/webidl/BluetoothAttributeEvent.webidl
dom/webidl/BluetoothClassOfDevice.webidl
dom/webidl/BluetoothDevice.webidl
dom/webidl/BluetoothDeviceEvent.webidl
dom/webidl/BluetoothDiscoveryHandle.webidl
dom/webidl/BluetoothGatt.webidl
dom/webidl/BluetoothGattAttributeEvent.webidl
dom/webidl/BluetoothGattCharacteristic.webidl
dom/webidl/BluetoothGattCharacteristicEvent.webidl
dom/webidl/BluetoothGattDescriptor.webidl
dom/webidl/BluetoothGattServer.webidl
dom/webidl/BluetoothGattService.webidl
dom/webidl/BluetoothLeDeviceEvent.webidl
dom/webidl/BluetoothManager.webidl
dom/webidl/BluetoothMapFolderListingEvent.webidl
dom/webidl/BluetoothMapGetMessageEvent.webidl
dom/webidl/BluetoothMapMessageUpdateEvent.webidl
dom/webidl/BluetoothMapMessagesListingEvent.webidl
dom/webidl/BluetoothMapRequestHandle.webidl
dom/webidl/BluetoothMapSendMessageEvent.webidl
dom/webidl/BluetoothMapSetMessageStatusEvent.webidl
dom/webidl/BluetoothObexAuthEvent.webidl
dom/webidl/BluetoothObexAuthHandle.webidl
dom/webidl/BluetoothPairingEvent.webidl
dom/webidl/BluetoothPairingHandle.webidl
dom/webidl/BluetoothPairingListener.webidl
dom/webidl/BluetoothPbapRequestHandle.webidl
dom/webidl/BluetoothPhonebookPullingEvent.webidl
dom/webidl/BluetoothStatusChangedEvent.webidl
dom/webidl/BluetoothUUID.webidl
dom/webidl/BluetoothVCardListingEvent.webidl
dom/webidl/BluetoothVCardPullingEvent.webidl
dom/webidl/BrowserElement.webidl
dom/webidl/BrowserElementAudioChannel.webidl
dom/webidl/BrowserElementProxy.webidl
dom/webidl/ChromeNotifications.webidl
dom/webidl/Contacts.webidl
dom/webidl/DOMMobileMessageError.webidl
dom/webidl/DisplayPortInputPort.webidl
dom/webidl/DownloadEvent.webidl
dom/webidl/Downloads.webidl
dom/webidl/HDMIInputPort.webidl
dom/webidl/IccCardLockError.webidl
dom/webidl/IccChangeEvent.webidl
dom/webidl/InputMethod.webidl
dom/webidl/InputPort.webidl
dom/webidl/InputPortManager.webidl
dom/webidl/MMICall.webidl
dom/webidl/MmsMessage.webidl
dom/webidl/MobileMessageThread.webidl
dom/webidl/MozCellBroadcast.webidl
dom/webidl/MozCellBroadcastEvent.webidl
dom/webidl/MozCellBroadcastMessage.webidl
dom/webidl/MozContactChangeEvent.webidl
dom/webidl/MozIcc.webidl
dom/webidl/MozIccInfo.webidl
dom/webidl/MozIccManager.webidl
dom/webidl/MozIsoDepTech.webidl
dom/webidl/MozMessageDeletedEvent.webidl
dom/webidl/MozMmsEvent.webidl
dom/webidl/MozMobileConnection.webidl
dom/webidl/MozMobileMessageManager.webidl
dom/webidl/MozNFC.webidl
dom/webidl/MozNFCPeer.webidl
dom/webidl/MozNFCPeerEvent.webidl
dom/webidl/MozNFCTag.webidl
dom/webidl/MozNFCTagEvent.webidl
dom/webidl/MozNetworkStats.webidl
dom/webidl/MozNetworkStatsAlarm.webidl
dom/webidl/MozNetworkStatsData.webidl
dom/webidl/MozNetworkStatsInterface.webidl
dom/webidl/MozNetworkStatsManager.webidl
dom/webidl/MozNfcATech.webidl
dom/webidl/MozPowerManager.webidl
dom/webidl/MozSettingsEvent.webidl
dom/webidl/MozSettingsTransactionEvent.webidl
dom/webidl/MozSmsEvent.webidl
dom/webidl/MozStkCommandEvent.webidl
dom/webidl/MozTetheringManager.webidl
dom/webidl/MozVoicemail.webidl
dom/webidl/MozVoicemailEvent.webidl
dom/webidl/MozVoicemailStatus.webidl
dom/webidl/Navigator.webidl
dom/webidl/PermissionSettings.webidl
dom/webidl/PhoneNumberService.webidl
dom/webidl/PresentationDeviceInfoManager.webidl
dom/webidl/PresentationRequest.webidl
dom/webidl/ResourceStats.webidl
dom/webidl/ResourceStatsManager.webidl
dom/webidl/SecureElement.webidl
dom/webidl/SecureElementManager.webidl
dom/webidl/SettingsManager.webidl
dom/webidl/SimplePushManager.webidl
dom/webidl/SmsMessage.webidl
dom/webidl/SystemUpdate.webidl
dom/webidl/TCPSocketErrorEvent.webidl
dom/webidl/TVChannel.webidl
dom/webidl/TVCurrentChannelChangedEvent.webidl
dom/webidl/TVCurrentSourceChangedEvent.webidl
dom/webidl/TVEITBroadcastedEvent.webidl
dom/webidl/TVManager.webidl
dom/webidl/TVProgram.webidl
dom/webidl/TVScanningStateChangedEvent.webidl
dom/webidl/TVSource.webidl
dom/webidl/TVTuner.webidl
dom/webidl/Telephony.webidl
dom/webidl/UDPMessageEvent.webidl
dom/webidl/UDPSocket.webidl
dom/webidl/USSDReceivedEvent.webidl
dom/webidl/USSDSession.webidl
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerScope.cpp
dom/workers/Workers.h
--- 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/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -113,18 +113,16 @@
 #include "WorkerPrivate.h"
 #include "WorkerRunnable.h"
 
 #if defined(XP_LINUX)
 #include "mozilla/Hal.h"
 #endif
 #include "mozilla/dom/ContentChild.h"
 
-#include "mozilla/dom/FeatureList.h"
-
 #ifdef MOZ_EME
 #include "mozilla/EMEUtils.h"
 #include "mozilla/DetailedPromise.h"
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include <cutils/properties.h>
 #endif
@@ -1787,21 +1785,17 @@ Navigator::HasFeature(const nsAString& a
     }
 #endif
 
     if (featureName.EqualsLiteral("XMLHttpRequest.mozSystem")) {
       p->MaybeResolve(true);
       return p.forget();
     }
 
-    if (IsFeatureDetectible(featureName)) {
-      p->MaybeResolve(true);
-    } else {
-      p->MaybeResolve(JS::UndefinedHandleValue);
-    }
+    p->MaybeResolve(JS::UndefinedHandleValue);
     return p.forget();
   }
 
   // resolve with <undefined> because the feature name is not supported
   p->MaybeResolve(JS::UndefinedHandleValue);
 
   return p.forget();
 }
--- 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/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -2497,42 +2497,16 @@ ConvertJSValueToByteString(JSContext* cx
     return false;
   }
 
   JS_EncodeStringToBuffer(cx, s, result.BeginWriting(), length);
 
   return true;
 }
 
-bool
-IsInPrivilegedApp(JSContext* aCx, JSObject* aObj)
-{
-  if (!NS_IsMainThread()) {
-    return GetWorkerPrivateFromContext(aCx)->IsInPrivilegedApp();
-  }
-
-  nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(aObj);
-  uint16_t appStatus = principal->GetAppStatus();
-  return (appStatus == nsIPrincipal::APP_STATUS_CERTIFIED ||
-          appStatus == nsIPrincipal::APP_STATUS_PRIVILEGED) ||
-          Preferences::GetBool("dom.ignore_webidl_scope_checks", false);
-}
-
-bool
-IsInCertifiedApp(JSContext* aCx, JSObject* aObj)
-{
-  if (!NS_IsMainThread()) {
-    return GetWorkerPrivateFromContext(aCx)->IsInCertifiedApp();
-  }
-
-  nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(aObj);
-  return principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED ||
-         Preferences::GetBool("dom.ignore_webidl_scope_checks", false);
-}
-
 void
 FinalizeGlobal(JSFreeOp* aFreeOp, JSObject* aObj)
 {
   MOZ_ASSERT(js::GetObjectClass(aObj)->flags & JSCLASS_DOM_GLOBAL);
   mozilla::dom::DestroyProtoAndIfaceCache(aObj);
 }
 
 bool
@@ -2558,60 +2532,16 @@ EnumerateGlobal(JSContext* aCx, JS::Hand
   MOZ_ASSERT(JS_IsGlobalObject(aObj),
              "Should have a global here, since we plan to enumerate standard "
              "classes!");
 
   return JS_EnumerateStandardClasses(aCx, aObj);
 }
 
 bool
-CheckAnyPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[])
-{
-  JS::Rooted<JSObject*> rootedObj(aCx, aObj);
-  nsPIDOMWindowInner* window = xpc::WindowGlobalOrNull(rootedObj)->AsInner();
-  if (!window) {
-    return false;
-  }
-
-  nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, false);
-
-  do {
-    uint32_t permission = nsIPermissionManager::DENY_ACTION;
-    permMgr->TestPermissionFromWindow(window, *aPermissions, &permission);
-    if (permission == nsIPermissionManager::ALLOW_ACTION) {
-      return true;
-    }
-  } while (*(++aPermissions));
-  return false;
-}
-
-bool
-CheckAllPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[])
-{
-  JS::Rooted<JSObject*> rootedObj(aCx, aObj);
-  nsPIDOMWindowInner* window = xpc::WindowGlobalOrNull(rootedObj)->AsInner();
-  if (!window) {
-    return false;
-  }
-
-  nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, false);
-
-  do {
-    uint32_t permission = nsIPermissionManager::DENY_ACTION;
-    permMgr->TestPermissionFromWindow(window, *aPermissions, &permission);
-    if (permission != nsIPermissionManager::ALLOW_ACTION) {
-      return false;
-    }
-  } while (*(++aPermissions));
-  return true;
-}
-
-bool
 IsNonExposedGlobal(JSContext* aCx, JSObject* aGlobal,
                    uint32_t aNonExposedGlobals)
 {
   MOZ_ASSERT(aNonExposedGlobals, "Why did we get called?");
   MOZ_ASSERT((aNonExposedGlobals &
               ~(GlobalNames::Window |
                 GlobalNames::BackstagePass |
                 GlobalNames::DedicatedWorkerGlobalScope |
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -2987,30 +2987,16 @@ class GetCCParticipant<T, true>
 public:
   static constexpr nsCycleCollectionParticipant*
   Get()
   {
     return nullptr;
   }
 };
 
-/*
- * Helper function for testing whether the given object comes from a
- * privileged app.
- */
-bool
-IsInPrivilegedApp(JSContext* aCx, JSObject* aObj);
-
-/*
- * Helper function for testing whether the given object comes from a
- * certified app.
- */
-bool
-IsInCertifiedApp(JSContext* aCx, JSObject* aObj);
-
 void
 FinalizeGlobal(JSFreeOp* aFop, JSObject* aObj);
 
 bool
 ResolveGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
               JS::Handle<jsid> aId, bool* aResolvedp);
 
 bool
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -1864,97 +1864,63 @@ class CGClassHasInstanceHook(CGAbstractS
         hasInstanceCode += "return true;\n"
         return header + hasInstanceCode
 
 
 def isChromeOnly(m):
     return m.getExtendedAttribute("ChromeOnly")
 
 
-def getAvailableInTestFunc(obj):
-    availableIn = obj.getExtendedAttribute("AvailableIn")
-    if availableIn is None:
-        return None
-    assert isinstance(availableIn, list) and len(availableIn) == 1
-    if availableIn[0] == "PrivilegedApps":
-        return "IsInPrivilegedApp"
-    if availableIn[0] == "CertifiedApps":
-        return "IsInCertifiedApp"
-    raise TypeError("Unknown AvailableIn value '%s'" % availableIn[0])
-
-
 class MemberCondition:
     """
     An object representing the condition for a member to actually be
     exposed.  Any of the arguments can be None.  If not
     None, they should have the following types:
 
     pref: The name of the preference.
     func: The name of the function.
     secureContext: A bool indicating whether a secure context is required.
-    available: A string indicating where we should be available.
-    checkAnyPermissions: An integer index for the anypermissions_* to use.
-    checkAllPermissions: An integer index for the allpermissions_* to use.
     nonExposedGlobals: A set of names of globals.  Can be empty, in which case
                        it's treated the same way as None.
     """
-    def __init__(self, pref=None, func=None, secureContext=False, available=None,
-                 checkAnyPermissions=None, checkAllPermissions=None,
+    def __init__(self, pref=None, func=None, secureContext=False,
                  nonExposedGlobals=None):
         assert pref is None or isinstance(pref, str)
         assert func is None or isinstance(func, str)
         assert isinstance(secureContext, bool)
-        assert available is None or isinstance(available, str)
-        assert checkAnyPermissions is None or isinstance(checkAnyPermissions, int)
-        assert checkAllPermissions is None or isinstance(checkAllPermissions, int)
         assert nonExposedGlobals is None or isinstance(nonExposedGlobals, set)
         self.pref = pref
         self.secureContext = secureContext
 
         def toFuncPtr(val):
             if val is None:
                 return "nullptr"
             return "&" + val
         self.func = toFuncPtr(func)
-        self.available = toFuncPtr(available)
-        if checkAnyPermissions is None:
-            self.checkAnyPermissions = "nullptr"
-        else:
-            self.checkAnyPermissions = "anypermissions_%i" % checkAnyPermissions
-        if checkAllPermissions is None:
-            self.checkAllPermissions = "nullptr"
-        else:
-            self.checkAllPermissions = "allpermissions_%i" % checkAllPermissions
 
         if nonExposedGlobals:
             # Nonempty set
             self.nonExposedGlobals = " | ".join(
                 map(lambda g: "GlobalNames::%s" % g,
                     sorted(nonExposedGlobals)))
         else:
             self.nonExposedGlobals = "0"
 
     def __eq__(self, other):
         return (self.pref == other.pref and self.func == other.func and
                 self.secureContext == other.secureContext and
-                self.available == other.available and
-                self.checkAnyPermissions == other.checkAnyPermissions and
-                self.checkAllPermissions == other.checkAllPermissions and
                 self.nonExposedGlobals == other.nonExposedGlobals)
 
     def __ne__(self, other):
         return not self.__eq__(other)
 
     def hasDisablers(self):
         return (self.pref is not None or
                 self.secureContext or
                 self.func != "nullptr" or
-                self.available != "nullptr" or
-                self.checkAnyPermissions != "nullptr" or
-                self.checkAllPermissions != "nullptr" or
                 self.nonExposedGlobals != "0")
 
 
 class PropertyDefiner:
     """
     A common superclass for defining things on prototype objects.
 
     Subclasses should implement generateArray to generate the actual arrays of
@@ -2014,19 +1980,16 @@ class PropertyDefiner:
         nonExposureSet = interface.exposureSet - interfaceMember.exposureSet
 
         return MemberCondition(
             PropertyDefiner.getStringAttr(interfaceMember,
                                           "Pref"),
             PropertyDefiner.getStringAttr(interfaceMember,
                                           "Func"),
             interfaceMember.getExtendedAttribute("SecureContext") is not None,
-            getAvailableInTestFunc(interfaceMember),
-            descriptor.checkAnyPermissionsIndicesForMembers.get(interfaceMember.identifier.name),
-            descriptor.checkAllPermissionsIndicesForMembers.get(interfaceMember.identifier.name),
             nonExposureSet)
 
     def generatePrefableArray(self, array, name, specFormatter, specTerminator,
                               specType, getCondition, getDataTuple, doIdArrays):
         """
         This method generates our various arrays.
 
         array is an array of interface members as passed to generateArray
@@ -2060,17 +2023,17 @@ class PropertyDefiner:
 
         specs = []
         disablers = []
         prefableSpecs = []
 
         disablersTemplate = dedent(
             """
             static PrefableDisablers %s_disablers%d = {
-              true, %s, %s, %s, %s, %s, %s
+              true, %s, %s, %s
             };
             """)
         prefableWithDisablersTemplate = '  { &%s_disablers%d, &%s_specs[%d] }'
         prefableWithoutDisablersTemplate = '  { nullptr, &%s_specs[%d] }'
         prefCacheTemplate = '&%s[%d].disablers->enabled'
 
         def switchToCondition(props, condition):
             # Remember the info about where our pref-controlled
@@ -2082,20 +2045,17 @@ class PropertyDefiner:
             # Set up pointers to the new sets of specs inside prefableSpecs
             if condition.hasDisablers():
                 prefableSpecs.append(prefableWithDisablersTemplate %
                                      (name, len(specs), name, len(specs)))
                 disablers.append(disablersTemplate %
                                  (name, len(specs),
                                   toStringBool(condition.secureContext),
                                   condition.nonExposedGlobals,
-                                  condition.func,
-                                  condition.available,
-                                  condition.checkAnyPermissions,
-                                  condition.checkAllPermissions))
+                                  condition.func))
             else:
                 prefableSpecs.append(prefableWithoutDisablersTemplate %
                                      (name, len(specs)))
 
         switchToCondition(self, lastCondition)
 
         for member in array:
             curCondition = getCondition(member, self.descriptor)
@@ -3329,25 +3289,16 @@ class CGConstructorEnabled(CGAbstractMet
                 """, workerCondition=workerCondition.define())
             exposedInWorkerCheck = CGGeneric(exposedInWorkerCheck)
             if iface.isExposedOnMainThread():
                 exposedInWorkerCheck = CGIfWrapper(exposedInWorkerCheck,
                                                    "!NS_IsMainThread()")
             body.append(exposedInWorkerCheck)
 
         conditions = getConditionList(iface, "aCx", "aObj")
-        availableIn = getAvailableInTestFunc(iface)
-        if availableIn:
-            conditions.append(CGGeneric("%s(aCx, aObj)" % availableIn))
-        checkAnyPermissions = self.descriptor.checkAnyPermissionsIndex
-        if checkAnyPermissions is not None:
-            conditions.append(CGGeneric("CheckAnyPermissions(aCx, aObj, anypermissions_%i)" % checkAnyPermissions))
-        checkAllPermissions = self.descriptor.checkAllPermissionsIndex
-        if checkAllPermissions is not None:
-            conditions.append(CGGeneric("CheckAllPermissions(aCx, aObj, allpermissions_%i)" % checkAllPermissions))
 
         # We should really have some conditions
         assert len(body) or len(conditions)
 
         conditionsWrapper = ""
         if len(conditions):
             conditionsWrapper = CGWrapper(conditions,
                                           pre="return ",
@@ -12008,27 +11959,16 @@ class CGDescriptor(CGThing):
 
             # Always have a finalize hook, regardless of whether the class
             # wants a custom hook.
             cgThings.append(CGClassFinalizeHook(descriptor))
 
         if descriptor.concrete and descriptor.wrapperCache:
             cgThings.append(CGClassObjectMovedHook(descriptor))
 
-        for name in ["anypermissions", "allpermissions"]:
-            permissions = getattr(descriptor, name)
-            if len(permissions):
-                for (k, v) in sorted(permissions.items()):
-                    perms = CGList((CGGeneric('"%s",' % p) for p in k), joiner="\n")
-                    perms.append(CGGeneric("nullptr"))
-                    cgThings.append(CGWrapper(CGIndenter(perms),
-                                              pre="static const char* const %s_%i[] = {\n" % (name, v),
-                                              post="\n};\n",
-                                              defineOnly=True))
-
         # Generate the _ClearCachedFooValue methods before the property arrays that use them.
         if descriptor.interface.isJSImplemented():
             for m in clearableCachedAttrs(descriptor):
                 cgThings.append(CGJSImplClearCachedValueMethod(descriptor, m))
 
         properties = PropertyArrays(descriptor)
         cgThings.append(CGGeneric(define=str(properties)))
         cgThings.append(CGNativeProperties(descriptor, properties))
@@ -16404,50 +16344,16 @@ class GlobalGenRoots():
         curr = CGHeaders([], [], [], [], headers, [], 'UnionConversions', curr)
 
         # Add include guards.
         curr = CGIncludeGuard('UnionConversions', curr)
 
         # Done.
         return curr
 
-    @staticmethod
-    def FeatureList(config):
-        things = set()
-        for d in config.getDescriptors():
-            if not d.interface.isExternal() and d.featureDetectibleThings is not None:
-                things.update(d.featureDetectibleThings)
-        things = CGList((CGGeneric(declare='"%s",' % t) for t in sorted(things)), joiner="\n")
-        things.append(CGGeneric(declare="nullptr"))
-        things = CGWrapper(CGIndenter(things),
-                           pre="static const char* const FeatureList[] = {\n",
-                           post="\n};\n")
-
-        helper_pre = "bool IsFeatureDetectible(const nsAString& aFeature) {\n"
-        helper = CGWrapper(CGIndenter(things),
-                           pre=helper_pre,
-                           post=dedent("""
-              const char* const* feature = FeatureList;
-              while (*feature) {
-                if (aFeature.EqualsASCII(*feature)) {
-                  return true;
-                }
-                ++feature;
-              }
-
-              return false;
-            }
-        """))
-
-        curr = CGNamespace.build(['mozilla', 'dom'], helper)
-        curr = CGHeaders([], [], [], [], ["nsString.h"], [], 'FeatureList', curr)
-        curr = CGIncludeGuard('FeatureList', curr)
-
-        return curr
-
 
 # Code generator for simple events
 class CGEventGetter(CGNativeMember):
     def __init__(self, descriptor, attr):
         ea = descriptor.getExtendedAttributes(attr, getter=True)
         CGNativeMember.__init__(self, descriptor, attr,
                                 CGSpecializedGetter.makeNativeName(descriptor,
                                                                    attr),
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -503,74 +503,21 @@ class Descriptor(DescriptorProvider):
                     # the value, and ConstructNavigatorObject needs a JSContext.
                     self.extendedAttributes['all'].setdefault(m.identifier.name, []).append('implicitJSContext')
 
         self._binaryNames = desc.get('binaryNames', {})
         self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
         self._binaryNames.setdefault('__stringifier', 'Stringify')
 
         if not self.interface.isExternal():
-            self.anypermissions = dict()
-            self.allpermissions = dict()
-
-            # Adds a permission list to this descriptor and returns the index to use.
-            def addPermissions(ifaceOrMember, attribute):
-                if attribute == "CheckAllPermissions":
-                    permissions = self.allpermissions
-                else:
-                    permissions = self.anypermissions
-
-                checkPermissions = ifaceOrMember.getExtendedAttribute(attribute)
-                if checkPermissions is None:
-                    return None
-
-                # It's a list of whitespace-separated strings
-                assert(len(checkPermissions) is 1)
-                assert(checkPermissions[0] is not None)
-                checkPermissions = checkPermissions[0]
-                permissionsList = checkPermissions.split()
-                if len(permissionsList) == 0:
-                    raise TypeError("Need at least one permission name for %s" % attribute)
-
-                permissionsList = tuple(sorted(set(permissionsList)))
-                return permissions.setdefault(permissionsList, len(permissions))
-
-            self.checkAnyPermissionsIndex = addPermissions(self.interface, "CheckAnyPermissions")
-            self.checkAnyPermissionsIndicesForMembers = dict()
-            self.checkAllPermissionsIndex = addPermissions(self.interface, "CheckAllPermissions")
-            self.checkAllPermissionsIndicesForMembers = dict()
-            for m in self.interface.members:
-                permissionsIndex = addPermissions(m, "CheckAnyPermissions")
-                if permissionsIndex is not None:
-                    self.checkAnyPermissionsIndicesForMembers[m.identifier.name] = permissionsIndex
-                allpermissionsIndex = addPermissions(m, "CheckAllPermissions")
-                if allpermissionsIndex is not None:
-                    self.checkAllPermissionsIndicesForMembers[m.identifier.name] = allpermissionsIndex
-
             def isTestInterface(iface):
                 return (iface.identifier.name in ["TestInterface",
                                                   "TestJSImplInterface",
                                                   "TestRenamedInterface"])
 
-            self.featureDetectibleThings = set()
-            if not isTestInterface(self.interface):
-                if (self.interface.getExtendedAttribute("CheckAnyPermissions") or
-                    self.interface.getExtendedAttribute("CheckAllPermissions") or
-                    self.interface.getExtendedAttribute("AvailableIn") == "PrivilegedApps"):
-                    iface = self.interface.identifier.name
-                    self.featureDetectibleThings.add(iface)
-                    for m in self.interface.members:
-                        self.featureDetectibleThings.add("%s.%s" % (iface, m.identifier.name))
-
-                for m in self.interface.members:
-                    if (m.getExtendedAttribute("CheckAnyPermissions") or
-                        m.getExtendedAttribute("CheckAllPermissions") or
-                        m.getExtendedAttribute("AvailableIn") == "PrivilegedApps"):
-                        self.featureDetectibleThings.add("%s.%s" % (self.interface.identifier.name, m.identifier.name))
-
             for member in self.interface.members:
                 if not member.isAttr() and not member.isMethod():
                     continue
                 binaryName = member.getExtendedAttribute("BinaryName")
                 if binaryName:
                     assert isinstance(binaryName, list)
                     assert len(binaryName) == 1
                     self._binaryNames.setdefault(member.identifier.name,
--- a/dom/bindings/DOMJSClass.h
+++ b/dom/bindings/DOMJSClass.h
@@ -69,28 +69,16 @@ typedef bool
                        JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                        JS::MutableHandle<JS::PropertyDescriptor> desc);
 
 typedef bool
 (* EnumerateOwnProperties)(JSContext* cx, JS::Handle<JSObject*> wrapper,
                            JS::Handle<JSObject*> obj,
                            JS::AutoIdVector& props);
 
-// Returns true if aObj's global has any of the permissions named in
-// aPermissions set to nsIPermissionManager::ALLOW_ACTION. aPermissions must be
-// null-terminated.
-bool
-CheckAnyPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[]);
-
-// Returns true if aObj's global has all of the permissions named in
-// aPermissions set to nsIPermissionManager::ALLOW_ACTION. aPermissions must be
-// null-terminated.
-bool
-CheckAllPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[]);
-
 // Returns true if the given global is of a type whose bit is set in
 // aNonExposedGlobals.
 bool
 IsNonExposedGlobal(JSContext* aCx, JSObject* aGlobal,
                    uint32_t aNonExposedGlobals);
 
 struct ConstantSpec
 {
@@ -133,55 +121,33 @@ struct PrefableDisablers {
     }
     if (secureContext && !IsSecureContextOrObjectIsFromSecureContext(cx, obj)) {
       return false;
     }
     if (enabledFunc &&
         !enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
       return false;
     }
-    if (availableFunc &&
-        !availableFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
-      return false;
-    }
-    if (checkAnyPermissions &&
-        !CheckAnyPermissions(cx, js::GetGlobalForObjectCrossCompartment(obj),
-                             checkAnyPermissions)) {
-      return false;
-    }
-    if (checkAllPermissions &&
-        !CheckAllPermissions(cx, js::GetGlobalForObjectCrossCompartment(obj),
-                             checkAllPermissions)) {
-      return false;
-    }
     return true;
   }
 
   // A boolean indicating whether this set of specs is enabled. Not const
   // because it will change at runtime if the corresponding pref is changed.
   bool enabled;
 
   // A boolean indicating whether a Secure Context is required.
   const bool secureContext;
 
   // Bitmask of global names that we should not be exposed in.
   const uint16_t nonExposedGlobals;
 
   // A function pointer to a function that can say the property is disabled
   // even if "enabled" is set to true.  If the pointer is null the value of
-  // "enabled" is used as-is unless availableFunc overrides.
+  // "enabled" is used as-is.
   const PropertyEnabled enabledFunc;
-
-  // A function pointer to a function that can be used to disable a
-  // property even if "enabled" is true and enabledFunc allowed.  This
-  // is basically a hack to avoid having to codegen PropertyEnabled
-  // implementations in case when we need to do two separate checks.
-  const PropertyEnabled availableFunc;
-  const char* const* const checkAnyPermissions;
-  const char* const* const checkAllPermissions;
 };
 
 template<typename T>
 struct Prefable {
   inline bool isEnabled(JSContext* cx, JS::Handle<JSObject*> obj) const {
     if (MOZ_LIKELY(!disablers)) {
       return true;
     }
--- a/dom/bindings/mozwebidlcodegen/__init__.py
+++ b/dom/bindings/mozwebidlcodegen/__init__.py
@@ -122,17 +122,16 @@ class WebIDLCodegenManager(LoggingMixin)
     """Manages all code generation around WebIDL.
 
     To facilitate testing, this object is meant to be generic and reusable.
     Paths, etc should be parameters and not hardcoded.
     """
 
     # Global parser derived declaration files.
     GLOBAL_DECLARE_FILES = {
-        'FeatureList.h',
         'GeneratedAtomList.h',
         'GeneratedEventList.h',
         'PrototypeList.h',
         'RegisterBindings.h',
         'RegisterWorkerBindings.h',
         'RegisterWorkerDebuggerBindings.h',
         'ResolveSystemBinding.h',
         'UnionConversions.h',
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1256,20 +1256,17 @@ class IDLInterfaceOrNamespace(IDLObjectW
                     if self.isOnGlobalProtoChain():
                         raise WebIDLError("[Alias] must not be used on a "
                                           "[Global] interface operation",
                                           [member.location])
                     if (member.getExtendedAttribute("Exposed") or
                         member.getExtendedAttribute("ChromeOnly") or
                         member.getExtendedAttribute("Pref") or
                         member.getExtendedAttribute("Func") or
-                        member.getExtendedAttribute("SecureContext") or
-                        member.getExtendedAttribute("AvailableIn") or
-                        member.getExtendedAttribute("CheckAnyPermissions") or
-                        member.getExtendedAttribute("CheckAllPermissions")):
+                        member.getExtendedAttribute("SecureContext")):
                         raise WebIDLError("[Alias] must not be used on a "
                                           "conditionally exposed operation",
                                           [member.location])
                     if member.isStatic():
                         raise WebIDLError("[Alias] must not be used on a "
                                           "static operation",
                                           [member.location])
                     if member.isIdentifierLess():
@@ -1291,24 +1288,16 @@ class IDLInterfaceOrNamespace(IDLObjectW
                                               [member.location, m.location])
 
         if (self.getExtendedAttribute("Pref") and
             self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])):
             raise WebIDLError("[Pref] used on an interface that is not %s-only" %
                               self.parentScope.primaryGlobalName,
                               [self.location])
 
-        for attribute in ["CheckAnyPermissions", "CheckAllPermissions"]:
-            if (self.getExtendedAttribute(attribute) and
-                self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])):
-                raise WebIDLError("[%s] used on an interface that is "
-                                  "not %s-only" %
-                                  (attribute, self.parentScope.primaryGlobalName),
-                                  [self.location])
-
         # Conditional exposure makes no sense for interfaces with no
         # interface object, unless they're navigator properties.
         if (self.isExposedConditionally() and
             not self.hasInterfaceObject() and
             not self.isNavigatorProperty()):
             raise WebIDLError("Interface with no interface object is "
                               "exposed conditionally",
                               [self.location])
@@ -1715,20 +1704,17 @@ class IDLInterface(IDLInterfaceOrNamespa
                                       [attr.location])
             elif identifier == "Exposed":
                 convertExposedAttrToGlobalNameSet(attr,
                                                   self._exposureGlobalNames)
             elif (identifier == "Pref" or
                   identifier == "JSImplementation" or
                   identifier == "HeaderFile" or
                   identifier == "NavigatorProperty" or
-                  identifier == "AvailableIn" or
                   identifier == "Func" or
-                  identifier == "CheckAnyPermissions" or
-                  identifier == "CheckAllPermissions" or
                   identifier == "Deprecated"):
                 # Known extended attributes that take a string value
                 if not attr.hasValue():
                     raise WebIDLError("[%s] must have a value" % identifier,
                                       [attr.location])
             else:
                 raise WebIDLError("Unknown extended attribute %s on interface" % identifier,
                                   [attr.location])
@@ -3545,24 +3531,16 @@ class IDLInterfaceMember(IDLObjectWithId
 
     def validate(self):
         if (self.getExtendedAttribute("Pref") and
             self.exposureSet != set([self._globalScope.primaryGlobalName])):
             raise WebIDLError("[Pref] used on an interface member that is not "
                               "%s-only" % self._globalScope.primaryGlobalName,
                               [self.location])
 
-        for attribute in ["CheckAnyPermissions", "CheckAllPermissions"]:
-            if (self.getExtendedAttribute(attribute) and
-                self.exposureSet != set([self._globalScope.primaryGlobalName])):
-                raise WebIDLError("[%s] used on an interface member that is "
-                                  "not %s-only" %
-                                  (attribute, self.parentScope.primaryGlobalName),
-                                  [self.location])
-
         if self.isAttr() or self.isMethod():
             if self.affects == "Everything" and self.dependsOn != "Everything":
                 raise WebIDLError("Interface member is flagged as affecting "
                                   "everything but not depending on everything. "
                                   "That seems rather unlikely.",
                                   [self.location])
 
         if self.getExtendedAttribute("NewObject"):
@@ -3969,20 +3947,17 @@ class IDLConst(IDLInterfaceMember):
 
     def handleExtendedAttribute(self, attr):
         identifier = attr.identifier()
         if identifier == "Exposed":
             convertExposedAttrToGlobalNameSet(attr, self._exposureGlobalNames)
         elif (identifier == "Pref" or
               identifier == "ChromeOnly" or
               identifier == "Func" or
-              identifier == "SecureContext" or
-              identifier == "AvailableIn" or
-              identifier == "CheckAnyPermissions" or
-              identifier == "CheckAllPermissions"):
+              identifier == "SecureContext"):
             # Known attributes that we don't need to do anything with here
             pass
         else:
             raise WebIDLError("Unknown extended attribute %s on constant" % identifier,
                               [attr.location])
         IDLInterfaceMember.handleExtendedAttribute(self, attr)
 
     def _getDependentObjects(self):
@@ -4312,21 +4287,18 @@ class IDLAttribute(IDLInterfaceMember):
               identifier == "Deprecated" or
               identifier == "SetterThrows" or
               identifier == "Throws" or
               identifier == "GetterThrows" or
               identifier == "ChromeOnly" or
               identifier == "Func" or
               identifier == "SecureContext" or
               identifier == "Frozen" or
-              identifier == "AvailableIn" or
               identifier == "NewObject" or
               identifier == "UnsafeInPrerendering" or
-              identifier == "CheckAnyPermissions" or
-              identifier == "CheckAllPermissions" or
               identifier == "BinaryName"):
             # Known attributes that we don't need to do anything with here
             pass
         else:
             raise WebIDLError("Unknown extended attribute %s on attribute" % identifier,
                               [attr.location])
         IDLInterfaceMember.handleExtendedAttribute(self, attr)
 
@@ -5038,19 +5010,16 @@ class IDLMethod(IDLInterfaceMember, IDLS
         elif (identifier == "Throws" or
               identifier == "NewObject" or
               identifier == "ChromeOnly" or
               identifier == "UnsafeInPrerendering" or
               identifier == "Pref" or
               identifier == "Deprecated" or
               identifier == "Func" or
               identifier == "SecureContext" or
-              identifier == "AvailableIn" or
-              identifier == "CheckAnyPermissions" or
-              identifier == "CheckAllPermissions" or
               identifier == "BinaryName" or
               identifier == "StaticClassOverride"):
             # Known attributes that we don't need to do anything with here
             pass
         else:
             raise WebIDLError("Unknown extended attribute %s on method" % identifier,
                               [attr.location])
         IDLInterfaceMember.handleExtendedAttribute(self, attr)
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -6,17 +6,17 @@
 
 typedef long myLong;
 typedef TestInterface AnotherNameForTestInterface;
 typedef TestInterface? NullableTestInterface;
 typedef CustomEventInit TestDictionaryTypedef;
 
 interface TestExternalInterface;
 
-[AvailableIn=PrivilegedApps, Pref="xyz"]
+[Pref="xyz"]
 interface TestRenamedInterface {
 };
 
 callback interface TestCallbackInterface {
   readonly attribute long foo;
   attribute DOMString bar;
   void doSomething();
   long doSomethingElse(DOMString arg, TestInterface otherArg);
@@ -130,17 +130,16 @@ interface OnlyForUseInConstructor {
  Constructor(DOMString str),
  Constructor(unsigned long num, boolean? boolArg),
  Constructor(TestInterface? iface),
  Constructor(long arg1, IndirectlyImplementedInterface iface),
  Constructor(Date arg1),
  Constructor(ArrayBuffer arrayBuf),
  Constructor(Uint8Array typedArr),
  // Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3),
- AvailableIn=CertifiedApps,
  NamedConstructor=Test,
  NamedConstructor=Test(DOMString str),
  NamedConstructor=Test2(DictForConstructor dict, any any1, object obj1,
                         object? obj2, sequence<Dict> seq, optional any any2,
                         optional object obj3, optional object? obj4),
  NamedConstructor=Test3((long or MozMap<any>) arg1)
  ]
 interface TestInterface {
@@ -882,24 +881,16 @@ interface TestInterface {
   [Pref="abc.def", Func="TestFuncControlledMember"]
   void prefable17();
   [Func="TestFuncControlledMember"]
   void prefable18();
   [Func="TestFuncControlledMember"]
   void prefable19();
   [Pref="abc.def", Func="TestFuncControlledMember", ChromeOnly]
   void prefable20();
-  [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable21();
-  [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable22();
-  [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable23();
-  [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=PrivilegedApps]
-  void prefable24();
 
   // Conditionally exposed methods/attributes involving [SecureContext]
   [SecureContext]
   readonly attribute boolean conditionalOnSecureContext1;
   [SecureContext, Pref="abc.def"]
   readonly attribute boolean conditionalOnSecureContext2;
   [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
   readonly attribute boolean conditionalOnSecureContext3;
--- a/dom/bindings/test/TestJSImplGen.webidl
+++ b/dom/bindings/test/TestJSImplGen.webidl
@@ -728,24 +728,16 @@ interface TestJSImplInterface {
   [Pref="abc.def", Func="TestFuncControlledMember"]
   void prefable17();
   [Func="TestFuncControlledMember"]
   void prefable18();
   [Func="TestFuncControlledMember"]
   void prefable19();
   [Pref="abc.def", Func="TestFuncControlledMember", ChromeOnly]
   void prefable20();
-  [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable21();
-  [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable22();
-  [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
-  void prefable23();
-  [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=PrivilegedApps]
-  void prefable24();
 
   // Conditionally exposed methods/attributes involving [SecureContext]
   [SecureContext]
   readonly attribute boolean conditionalOnSecureContext1;
   [SecureContext, Pref="abc.def"]
   readonly attribute boolean conditionalOnSecureContext2;
   [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
   readonly attribute boolean conditionalOnSecureContext3;
--- 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/TCPSocket.cpp
+++ b/dom/network/TCPSocket.cpp
@@ -1230,16 +1230,10 @@ TCPSocket::Observe(nsISupports* aSubject
   return NS_OK;
 }
 
 /* static */
 bool
 TCPSocket::ShouldTCPSocketExist(JSContext* aCx, JSObject* aGlobal)
 {
   JS::Rooted<JSObject*> global(aCx, aGlobal);
-  if (nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(global))) {
-    return true;
-  }
-
-  const char* const perms[] = { "tcp-socket", nullptr };
-  return Preferences::GetBool("dom.mozTCPSocket.enabled") &&
-      CheckAnyPermissions(aCx, global, perms);
+  return nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(global));
 }
--- 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
 -->