зеркало из https://github.com/mozilla/gecko-dev.git
Bug 898743 - ensure Cache-Control: no-store for all thumbnail_update tests. r=adw
This commit is contained in:
Родитель
51e5cefd5e
Коммит
3a6a1f534a
|
@ -43,7 +43,7 @@ function getThumbnailModifiedTime(url) {
|
||||||
/* Check functionality of a normal "captureIfStale" request */
|
/* Check functionality of a normal "captureIfStale" request */
|
||||||
function simpleCaptureTest() {
|
function simpleCaptureTest() {
|
||||||
let numNotifications = 0;
|
let numNotifications = 0;
|
||||||
const URL = "data:text/html;charset=utf-8,<body%20bgcolor=ff0000></body>";
|
const URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/test/thumbnails_update.sjs?simple";
|
||||||
|
|
||||||
function observe(subject, topic, data) {
|
function observe(subject, topic, data) {
|
||||||
is(topic, "page-thumbnail:create", "got expected topic");
|
is(topic, "page-thumbnail:create", "got expected topic");
|
||||||
|
@ -56,7 +56,7 @@ function simpleCaptureTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.obs.addObserver(observe, "page-thumbnail:create", false);
|
Services.obs.addObserver(observe, "page-thumbnail:create", false);
|
||||||
// Create a tab with a red background.
|
// Create a tab - we don't care what the content is.
|
||||||
yield addTab(URL);
|
yield addTab(URL);
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
// This server-side script primarily must return different *content* for the
|
// This server-side script is used for browser_thumbnails_update. One of the
|
||||||
|
// main things it must do in all cases is ensure a Cache-Control: no-store
|
||||||
|
// header, so the foreground capture doesn't interfere with the testing.
|
||||||
|
|
||||||
|
// If the querystring is "simple", then all it does it return some content -
|
||||||
|
// it doesn't really matter what that content is.
|
||||||
|
|
||||||
|
// Otherwise, its main role is that it must return different *content* for the
|
||||||
// second request than it did for the first.
|
// second request than it did for the first.
|
||||||
// Also, it should be able to return an error response when requested for the
|
// Also, it should be able to return an error response when requested for the
|
||||||
// second response.
|
// second response.
|
||||||
|
@ -16,6 +23,16 @@ function handleRequest(aRequest, aResponse) {
|
||||||
// so set as a "no-store" response.
|
// so set as a "no-store" response.
|
||||||
aResponse.setHeader("Cache-Control", "no-store");
|
aResponse.setHeader("Cache-Control", "no-store");
|
||||||
|
|
||||||
|
// for the simple test - just return some content.
|
||||||
|
if (aRequest.queryString == "simple") {
|
||||||
|
aResponse.write("<html><body></body></html>");
|
||||||
|
aResponse.setStatusLine(aRequest.httpVersion, 200, "Its simply OK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// it's one of the more complex tests where the first request for the given
|
||||||
|
// URL must return different content than the second, and possibly an error
|
||||||
|
// response for the second
|
||||||
let doneError = getState(aRequest.queryString);
|
let doneError = getState(aRequest.queryString);
|
||||||
if (!doneError) {
|
if (!doneError) {
|
||||||
// first request - return a response with a green body and 200 response.
|
// first request - return a response with a green body and 200 response.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче