# HG changeset patch # User Henri Sivonen # Date 1304512165 -10800 # Node ID 031d6dbb90e462d2c185bdbc18c66aeb424b05b7 # Parent ed4274bc8fed5e2ff46f35ba75b84b4c2498c0dc Test for bug 651441 - Make sure the HTML5 application cache selection algorithm runs properly when there is no manifest attribute. r=NOT_REVIEWED. diff --git a/parser/htmlparser/tests/mochitest/Makefile.in b/parser/htmlparser/tests/mochitest/Makefile.in --- a/parser/htmlparser/tests/mochitest/Makefile.in +++ b/parser/htmlparser/tests/mochitest/Makefile.in @@ -82,16 +82,22 @@ _TEST_FILES = parser_datreader.js \ file_bug594730-7.html \ file_bug594730-8.html \ file_bug594730-9.html \ test_bug599584.html \ iframe_bug599584.html \ test_bug642908.html \ file_bug642908.sjs \ test_bug645115.html \ + test_651441.html \ + file_651441-1.html \ + file_651441-2.html \ + file_651441-script.js \ + file_651441.cacheManifest \ + file_651441.cacheManifest^headers^ \ $(NULL) # Disabled test due to orange on Linux # test_bug568470.html \ # file_bug568470.sjs \ # file_bug568470-script.sjs \ # Disable test due to frequent orange on Mac diff --git a/parser/htmlparser/tests/mochitest/file_651441-1.html b/parser/htmlparser/tests/mochitest/file_651441-1.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-1.html @@ -0,0 +1,9 @@ + + +Manifest loader page + + diff --git a/parser/htmlparser/tests/mochitest/file_651441-2.html b/parser/htmlparser/tests/mochitest/file_651441-2.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-2.html @@ -0,0 +1,4 @@ + +This page and its script are supposed to come from the app cache + + diff --git a/parser/htmlparser/tests/mochitest/file_651441-script.js b/parser/htmlparser/tests/mochitest/file_651441-script.js new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-script.js @@ -0,0 +1,1 @@ +opener.finish(); diff --git a/parser/htmlparser/tests/mochitest/file_651441.cacheManifest b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest @@ -0,0 +1,4 @@ +CACHE MANIFEST +CACHE: +file_651441-script.js +file_651441-2.html diff --git a/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/parser/htmlparser/tests/mochitest/test_651441.html b/parser/htmlparser/tests/mochitest/test_651441.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/test_651441.html @@ -0,0 +1,57 @@ + + + + + Test for Bug 651441 + + + + + +Mozilla Bug 651441 +

+ +
+
+
+ + diff --git a/testing/mochitest/specialpowers/content/specialpowers.js b/testing/mochitest/specialpowers/content/specialpowers.js --- a/testing/mochitest/specialpowers/content/specialpowers.js +++ b/testing/mochitest/specialpowers/content/specialpowers.js @@ -197,16 +197,45 @@ SpecialPowers.prototype = { this._getMUDV(window).textZoom = zoom; }, createSystemXHR: function() { return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] .createInstance(Ci.nsIXMLHttpRequest); }, + pressNotificationButton: function(window, notificationValue, buttonIndex) { + this._getTopChromeWindow(window) + .gBrowser + .getNotificationBox() + .getNotificationWithValue(notificationValue) + .childNodes[buttonIndex] + .click(); + }, + + setOfflineMode: function(mode) { + Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + .offline = mode; + }, + + getOfflineMode: function() { + return Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + .offline; + }, + + doomHTTPCacheEntry: function(url) { + Cc["@mozilla.org/network/cache-service;1"] + .getService(Ci.nsICacheService) + .createSession("HTTP", Ci.nsICache.STORE_ANYWHERE, Ci.nsICache.STREAM_BASED) + .openCacheEntry(url, Ci.nsICache.ACCESS_WRITE, false) + .doom(); + }, + gc: function() { this.DOMWindowUtils.garbageCollect(); } }; // Expose everything but internal APIs (starting with underscores) to // web content. SpecialPowers.prototype.__exposedProps__ = {};