Bug 1315905 - Cleanup Necko http security check - part 2 - tests, r=valentin

This commit is contained in:
Andrea Marchesini 2016-11-17 14:53:30 +01:00
parent d5b0cbe35a
commit 3120de1ea7
40 changed files with 57 additions and 15 deletions

View File

@ -95,7 +95,8 @@ Test swapFrameLoaders with different frame types and remoteness
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{ "set": [["dom.mozBrowserFramesEnabled", true]] },
{ "set": [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]] },
resolve);
});
});

View File

@ -24,6 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1022229
chunk in iframe_main as well. */
/*
SpecialPowers.Services.prefs.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.Services.prefs.setBoolPref("network.disable.ipc.security", true);
SpecialPowers.Services.prefs.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.wrap(ifr).mozbrowser = true;

View File

@ -133,6 +133,7 @@
"set": [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);

View File

@ -85,6 +85,7 @@
SpecialPowers.pushPrefEnv({
"set": [
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);

View File

@ -121,6 +121,7 @@
SpecialPowers.pushPrefEnv({
"set": [
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);

View File

@ -115,6 +115,7 @@
SpecialPowers.pushPrefEnv({
set: [
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.browser_frames.oop_by_default", false],
]
}, runTests);

View File

@ -13,7 +13,8 @@
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{ "set": [["dom.mozBrowserFramesEnabled", true]] },
{ "set": [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]] },
resolve);
});
});

View File

@ -13,7 +13,8 @@
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{ "set": [["dom.mozBrowserFramesEnabled", true]] },
{ "set": [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]] },
resolve);
});
});

View File

@ -10,6 +10,12 @@
<body>
<iframe id="target-iframe"></iframe>
<script type="application/javascript">
add_task(function*() {
yield SpecialPowers.pushPrefEnv(
{ "set": [["network.disable.ipc.security", true]] });
});
add_task(function*() {
let iframe = document.querySelector("#target-iframe");

View File

@ -62,7 +62,8 @@ const browserElementTestHelpers = {
},
setEnabledPref: function(value) {
this._setPref('dom.mozBrowserFramesEnabled', value);
this._setPrefs(['dom.mozBrowserFramesEnabled', value],
['network.disable.ipc.security', value]);
},
setupAccessibleCaretPref: function() {

View File

@ -52,7 +52,8 @@
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.pushPrefEnv({set: [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true]
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]
]}, runTest);
});
</script>

View File

@ -469,6 +469,7 @@ var gTestRunner = runTest();
SpecialPowers.addPermission("browser", true, gTestUri);
SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["device.storage.enabled", true],
["device.storage.testing", true],
["device.storage.prompt.testing", false]]},

View File

@ -586,6 +586,7 @@ let gTestRunner = runTest();
SpecialPowers.addPermission("browser", true, gTestUri);
SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["device.storage.enabled", true],
["device.storage.testing", true],
["device.storage.prompt.testing", false]]},

View File

@ -152,7 +152,8 @@ var tests = [
SpecialPowers.pushPrefEnv(
{ "set": [["dom.beforeAfterKeyboardEvent.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["dom.ipc.tabs.disabled", false]] },
["dom.ipc.tabs.disabled", false],
["network.disable.ipc.security", true]] },
runTests);
},

View File

@ -107,6 +107,7 @@ var tests = [
SpecialPowers.pushPrefEnv(
{ "set": [["dom.beforeAfterKeyboardEvent.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.tabs.disabled", false]] },
runTests);
},

View File

@ -166,6 +166,7 @@ var tests = [
SpecialPowers.pushPrefEnv(
{ "set": [["dom.beforeAfterKeyboardEvent.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.tabs.disabled", false]] },
runTests);
},

View File

@ -145,7 +145,8 @@
function() {
SpecialPowers.pushPrefEnv({
"set": [
["dom.mozBrowserFramesEnabled", true]
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
]
}, function() {
SimpleTest.waitForFocus(runTest);

View File

@ -307,6 +307,7 @@ function setup() {
SpecialPowers.pushPrefEnv(
{ set: [ ["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true] ] },
function() {
info("Prefs set");

View File

@ -9,6 +9,7 @@ function inputmethod_setup(callback) {
let prefs = [
['dom.mozBrowserFramesEnabled', true],
['network.disable.ipc.security', true],
// Enable navigator.mozInputMethod.
['dom.mozInputMethod.enabled', true]
];

View File

@ -18,6 +18,7 @@ SimpleTest.requestFlakyTimeout("untriaged");
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.pushPrefEnv({'set':[
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.tabs.disabled", false]
]}, function () {

View File

@ -149,6 +149,7 @@ function setup() {
SpecialPowers.pushPrefEnv(
{ set: [ ["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true] ] },
function() {
info("Prefs set");

View File

@ -177,6 +177,7 @@ function setup() {
SpecialPowers.pushPrefEnv(
{ set: [ ["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true] ] },
function() {
info("Prefs set");

View File

@ -97,6 +97,7 @@
"set": [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);

View File

@ -15,6 +15,7 @@ SimpleTest.waitForExplicitFinish();
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.pushPrefEnv({'set':[
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.tabs.disabled", false]
]}, function () {

View File

@ -80,6 +80,7 @@
"set": [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);

View File

@ -37,7 +37,8 @@ var gData = [
{
perm: ["browser"],
needParentPerm: true,
settings: [["dom.mozBrowserFramesEnabled", true]],
settings: [["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]],
verifier: verifier.toSource(),
}
]

View File

@ -57,7 +57,8 @@ var gData = [
obj: "mozInputMethod",
webidl: "MozInputMethod",
settings: [["dom.mozInputMethod.enabled", true],
["dom.mozBrowserFramesEnabled", true]],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]],
verifier: verifier.toSource()
}
]

View File

@ -169,6 +169,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.test.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["dom.ipc.tabs.disabled", false],
["network.disable.ipc.security", true],
["dom.presentation.test.stage", 0]]},
runTests);
});

View File

@ -364,6 +364,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.test.enabled", true],
["dom.presentation.test.stage", 0],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["media.navigator.permission.disabled", true]]},
runTests);
});

View File

@ -131,7 +131,8 @@ SpecialPowers.pushPermissions([
["dom.presentation.controller.enabled", false],
["dom.presentation.receiver.enabled", true],
["dom.presentation.session_transport.data_channel.enable", true],
["dom.mozBrowserFramesEnabled", true]]},
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]]},
runTests);
});

View File

@ -202,6 +202,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.receiver.enabled", true],
["dom.presentation.session_transport.data_channel.enable", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.browser_frames.oop_by_default", true],
["presentation.receiver.loading.timeout", 5000000]]},
runTests);

View File

@ -71,6 +71,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.controller.enabled", true],
["dom.presentation.receiver.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.presentation.session_transport.data_channel.enable", false]]},
runTests);
});

View File

@ -127,6 +127,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.controller.enabled", false],
["dom.presentation.receiver.enabled", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.presentation.session_transport.data_channel.enable", false]]},
runTests);
});

View File

@ -100,7 +100,8 @@ SpecialPowers.pushPermissions([
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
["dom.presentation.receiver.enabled", true],
["dom.presentation.session_transport.data_channel.enable", false],
["dom.mozBrowserFramesEnabled", true]]},
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]]},
runTests);
});

View File

@ -82,6 +82,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.receiver.enabled", true],
['dom.presentation.session_transport.data_channel.enable', false],
['dom.mozBrowserFramesEnabled', true],
["network.disable.ipc.security", true],
['dom.ipc.tabs.disabled', false]]},
runTests);
});

View File

@ -168,6 +168,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.receiver.enabled", true],
["dom.presentation.session_transport.data_channel.enable", false],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true],
["dom.ipc.browser_frames.oop_by_default", true]]},
runTests);
});

View File

@ -236,6 +236,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.receiver.enabled", true],
['dom.presentation.test.enabled', true],
['dom.mozBrowserFramesEnabled', true],
["network.disable.ipc.security", true],
['dom.ipc.tabs.disabled', false],
['dom.presentation.test.stage', 0]]},
runTests);

View File

@ -190,6 +190,7 @@ SpecialPowers.pushPermissions([
["dom.presentation.receiver.enabled", true],
['dom.presentation.test.enabled', true],
['dom.mozBrowserFramesEnabled', true],
["network.disable.ipc.security", true],
['dom.ipc.tabs.disabled', false],
['dom.presentation.test.stage', 0]]},
runTests);

View File

@ -69,6 +69,7 @@ function* mozBrowserTests(browser) {
info("Granting special powers for mozbrowser");
SpecialPowers.addPermission("browser", true, TEST_URI);
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
SpecialPowers.setBoolPref('network.disable.ipc.security', true);
yield ContentTask.spawn(browser, null, function() {
info("Checking mozbrowser iframe");
@ -82,6 +83,7 @@ function* mozBrowserTests(browser) {
});
info("Revoking special powers for mozbrowser");
SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled')
SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled');
SpecialPowers.clearUserPref('network.disable.ipc.security');
SpecialPowers.removePermission("browser", TEST_URI);
}

View File

@ -205,9 +205,6 @@ NeckoParent::GetValidatedOriginAttributes(const SerializedLoadContext& aSerializ
// that time we probably don't have any valid tabcontext, but still, we want
// to support http channel requests coming from that ServiceWorker.
if (aRequestingPrincipal) {
MOZ_ASSERT(BasePrincipal::Cast(aRequestingPrincipal)->OriginAttributesRef() ==
aSerialized.mOriginAttributes);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm &&
swm->MayHaveActiveServiceWorkerInstance(static_cast<ContentParent*>(aContent),