Bug 1243378 - Enable the browser_devices_get_user_media_about_urls.js test for e10s, r=mconley.
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -315,17 +315,17 @@ skip-if = toolkit == "gtk2" || toolkit =
skip-if = toolkit == "gtk2" || toolkit == "gtk3" # disabled on Linux due to bug 513558
[browser_ctrlTab.js]
[browser_datachoices_notification.js]
skip-if = !datareporting
[browser_devedition.js]
[browser_devices_get_user_media.js]
skip-if = buildapp == 'mulet' || (os == "linux" && debug) # linux: bug 976544
[browser_devices_get_user_media_about_urls.js]
-skip-if = e10s # Bug 1071623
+skip-if = e10s && debug
[browser_devices_get_user_media_in_frame.js]
[browser_discovery.js]
[browser_double_close_tab.js]
[browser_documentnavigation.js]
[browser_duplicateIDs.js]
[browser_drag.js]
skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
[browser_favicon_change.js]
--- a/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js
+++ b/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js
@@ -53,47 +53,18 @@ function loadPage(aUrl) {
"should start the test without any prior popup notification");
deferred.resolve();
}, true);
content.location = aUrl;
return deferred.promise;
}
-// A fake about module to map get_user_media.html to different about urls.
-function fakeLoopAboutModule() {
-}
-
-fakeLoopAboutModule.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
- newChannel: function (aURI, aLoadInfo) {
- let rootDir = getRootDirectory(gTestPath);
- let uri = Services.io.newURI(rootDir + "get_user_media.html", null, null);
- let chan = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
-
- chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
- return chan;
- },
- getURIFlags: function (aURI) {
- return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
- Ci.nsIAboutModule.ALLOW_SCRIPT |
- Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD |
- Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT;
- }
-};
-
-var factory = XPCOMUtils._getFactory(fakeLoopAboutModule);
-var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
-
-var classIDLoopconversation, classIDEvil;
-
registerCleanupFunction(function() {
gBrowser.removeCurrentTab();
- registrar.unregisterFactory(classIDLoopconversation, factory);
- registrar.unregisterFactory(classIDEvil, factory);
});
const permissionError = "error: SecurityError: The operation is insecure.";
var gTests = [
{
desc: "getUserMedia about:loopconversation shouldn't prompt",
@@ -176,38 +147,78 @@ var gTests = [
function test() {
waitForExplicitFinish();
gTab = gBrowser.addTab();
gBrowser.selectedTab = gTab;
gTab.linkedBrowser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
- classIDLoopconversation = Cc["@mozilla.org/uuid-generator;1"]
- .getService(Ci.nsIUUIDGenerator).generateUUID();
- registrar.registerFactory(classIDLoopconversation, "",
- "@mozilla.org/network/protocol/about;1?what=loopconversation",
- factory);
+ Task.spawn(function () {
+ yield ContentTask.spawn(gBrowser.selectedBrowser,
+ getRootDirectory(gTestPath) + "get_user_media.html",
+ function* (url) {
+ const Ci = Components.interfaces;
+ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ Components.utils.import("resource://gre/modules/Services.jsm");
+
+ /* A fake about module to map get_user_media.html to different about urls. */
+ function fakeLoopAboutModule() {
+ }
- classIDEvil = Cc["@mozilla.org/uuid-generator;1"]
- .getService(Ci.nsIUUIDGenerator).generateUUID();
- registrar.registerFactory(classIDEvil, "",
- "@mozilla.org/network/protocol/about;1?what=evil",
- factory);
+ fakeLoopAboutModule.prototype = {
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
+ newChannel: function (aURI, aLoadInfo) {
+ let uri = Services.io.newURI(url, null, null);
+ let chan = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
+ chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
+ return chan;
+ },
+ getURIFlags: function (aURI) {
+ return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ Ci.nsIAboutModule.ALLOW_SCRIPT |
+ Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD |
+ Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT;
+ }
+ };
- Task.spawn(function () {
+ var factory = XPCOMUtils._getFactory(fakeLoopAboutModule);
+ var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+ let UUIDGenerator = Components.classes["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator);
+ registrar.registerFactory(UUIDGenerator.generateUUID(), "",
+ "@mozilla.org/network/protocol/about;1?what=loopconversation",
+ factory);
+ registrar.registerFactory(UUIDGenerator.generateUUID(), "",
+ "@mozilla.org/network/protocol/about;1?what=evil",
+ factory);
+ });
+
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
"set": [[PREF_PERMISSION_FAKE, true],
["media.getusermedia.screensharing.enabled", true]],
}, resolve));
for (let test of gTests) {
info(test.desc);
yield test.run();
// Cleanup before the next test
expectNoObserverCalled();
}
+
+ yield ContentTask.spawn(gBrowser.selectedBrowser, null,
+ function* () {
+ const Ci = Components.interfaces;
+ const Cc = Components.classes;
+ var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+ let cid = Cc["@mozilla.org/network/protocol/about;1?what=loopconversation"];
+ registrar.unregisterFactory(cid,
+ registrar.getClassObject(cid, Ci.nsIFactory));
+ cid = Cc["@mozilla.org/network/protocol/about;1?what=evil"];
+ registrar.unregisterFactory(cid,
+ registrar.getClassObject(cid, Ci.nsIFactory));
+ });
}).then(finish, ex => {
ok(false, "Unexpected Exception: " + ex);
finish();
});
}