mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1439713 - Update tests relying on nsIContentPolicy. r=bz
This commit is contained in:
parent
3739c23b85
commit
4197b7d96d
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user