Bug 1054572 - Reload iframe in test_classifier.html to test cache API calls in nsChannelClassifier.cpp r=gcp

This commit is contained in:
Steve Workman 2014-08-22 10:49:29 -07:00
parent dd1d112130
commit 197fb2b272
2 changed files with 15 additions and 4 deletions

View File

@ -15,6 +15,15 @@ function checkLoads() {
var style = document.defaultView.getComputedStyle(elt, "");
window.parent.isnot(style.visibility, "hidden", "Should not load bad css");
// Call parent.loadTestFrame again to test classification metadata in HTTP
// cache entries.
if (window.parent.firstLoad) {
window.parent.info("Reloading from cache...");
window.parent.firstLoad = false;
window.parent.loadTestFrame();
return;
}
// End (parent) test.
window.parent.SimpleTest.finish();
}

View File

@ -15,6 +15,7 @@
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var firstLoad = true;
// Add some URLs to the malware database.
var testData = "malware.example.com/";
@ -26,6 +27,10 @@ var testUpdate =
var dbService = Cc["@mozilla.org/url-classifier/dbservice;1"]
.getService(Ci.nsIUrlClassifierDBService);
function loadTestFrame() {
document.getElementById("testFrame").src = "classifierFrame.html";
}
function doUpdate(update) {
var listener = {
QueryInterface: function(iid)
@ -46,10 +51,7 @@ function doUpdate(update) {
updateSuccess: function(requestedTimeout) {
SpecialPowers.pushPrefEnv(
{"set" : [["browser.safebrowsing.malware.enabled", true]]},
function loadTestFrame() {
document.getElementById("testFrame").src = "classifierFrame.html";
}
);
loadTestFrame);
}
};