diff --git a/docshell/test/navigation/test_contentpolicy_block_window.html b/docshell/test/navigation/test_contentpolicy_block_window.html index 651be825cfb9..c597a4529044 100644 --- a/docshell/test/navigation/test_contentpolicy_block_window.html +++ b/docshell/test/navigation/test_contentpolicy_block_window.html @@ -51,7 +51,9 @@ var policy = { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { + let contentType = loadInfo.externalContentPolicyType; + let context = loadInfo.loadingContext; if (SpecialPowers.wrap(contentLocation).spec !== document.getElementById("testlink").href) { // not the URI we are looking for, allow the load @@ -77,7 +79,7 @@ var policy = { return Ci.nsIContentPolicy.REJECT_REQUEST; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } } diff --git a/dom/base/test/test_bug375314.html b/dom/base/test/test_bug375314.html index 4858f806392d..47c41cd02d51 100644 --- a/dom/base/test/test_bug375314.html +++ b/dom/base/test/test_bug375314.html @@ -46,8 +46,8 @@ var policy = { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { - + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { + let contentType = loadInfo.externalContentPolicyType; // Remember last content type seen for the test url if (SpecialPowers.wrap(contentLocation).spec == testURL) { lastContentType = contentType; @@ -57,7 +57,7 @@ var policy = { return Ci.nsIContentPolicy.ACCEPT; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } diff --git a/dom/base/test/test_bug498897.html b/dom/base/test/test_bug498897.html index c45c0421eae4..acf0b37fab95 100644 --- a/dom/base/test/test_bug498897.html +++ b/dom/base/test/test_bug498897.html @@ -44,9 +44,12 @@ var policy = { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, context, - mimeTypeGuess, extra) { + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { var url = window.location.href.substr(0, window.location.href.indexOf('test_bug498897')); + let loadingPrincipal = loadInfo.loadingPrincipal; + if (loadingPrincipal) { + requestOrigin = loadingPrincipal.URI; + } if (contentLocation.spec == url + "file_bug498897.css" && requestOrigin.spec == url + "file_bug498897.html") { checkedLoad = true; @@ -55,8 +58,7 @@ var policy = { return Ci.nsIContentPolicy.ACCEPT; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, context, - mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } } diff --git a/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html b/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html index 3ef2438240a5..ded5a031d123 100644 --- a/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html +++ b/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html @@ -51,8 +51,8 @@ var policy = { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, - context, mimeTypeGuess, extra) { + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { + let contentType = loadInfo.externalContentPolicyType; // make sure we get the right amount of content policy calls // e.g. about:blank also gets chrcked by content policies @@ -60,14 +60,14 @@ var policy = { is(contentType, EXPECTED_CONTENT_TYPE, "content policy type should TYPESUBDOCUMENT"); categoryManager.deleteCategoryEntry("content-policy", POLICYNAME, false); + componentManager.unregisterFactory(POLICYID, policy); SimpleTest.finish(); return Ci.nsIContentPolicy.REJECT_REQUEST; } return Ci.nsIContentPolicy.ACCEPT; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, - context, mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } } diff --git a/dom/tests/mochitest/beacon/test_beaconContentPolicy.html b/dom/tests/mochitest/beacon/test_beaconContentPolicy.html index 87e44ae644ca..c77e51fb1d4f 100644 --- a/dom/tests/mochitest/beacon/test_beaconContentPolicy.html +++ b/dom/tests/mochitest/beacon/test_beaconContentPolicy.html @@ -49,8 +49,9 @@ function setupPolicy() { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { // Remember last content type seen for the test url + let contentType = loadInfo.externalContentPolicyType; if (SpecialPowers.wrap(contentLocation).spec == beaconUrl) { is(contentType, Ci.nsIContentPolicy.TYPE_BEACON, "Beacon content type should match expected. is: " + contentType + " should be: " + Ci.nsIContentPolicy.TYPE_BEACON); @@ -61,7 +62,7 @@ function setupPolicy() { return Ci.nsIContentPolicy.ACCEPT; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } } diff --git a/layout/style/test/test_crash_with_content_policy.html b/layout/style/test/test_crash_with_content_policy.html index 9f40bb1ef5be..d5e003acb04c 100644 --- a/layout/style/test/test_crash_with_content_policy.html +++ b/layout/style/test/test_crash_with_content_policy.html @@ -36,11 +36,11 @@ var policy = { }, // nsIContentPolicy implementation - shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) { info(`shouldLoad is invoked for ${SpecialPowers.wrap(contentLocation).spec}`); return Ci.nsIContentPolicy.ACCEPT; }, - shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) { + shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) { return Ci.nsIContentPolicy.ACCEPT; } } @@ -65,6 +65,8 @@ async function runTests() { }); ok(true, `${test} doesn't crash`); } + categoryManager.deleteCategoryEntry("content-policy", policyName, false); + componentManager.unregisterFactory(policyID, policy); SimpleTest.finish(); } runTests();