Source code

Revision control

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: !is_fennec
  • This test was skipped 314 times in the preceding 7 days.
<meta charset="utf-8">
<title>Tabs executeScript bypassCache Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
"use strict";
add_task(async function() {
const extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs", "<all_urls>"],
async background() {
const URL = BASE + "file_bypass_cache.sjs";
function awaitLoad(tabId) {
return new Promise(resolve => {
browser.tabs.onUpdated.addListener(function listener(tabId_, changed, tab) {
if (tabId == tabId_ && changed.status == "complete" && tab.url == URL) {
try {
const tab = await browser.tabs.create({url: URL});
await awaitLoad(;
await browser.tabs.reload(, {bypassCache: false});
await awaitLoad(;
let [textContent] = await browser.tabs.executeScript(, {code: "document.body.textContent"});
browser.test.assertEq("", textContent, "`textContent` should be empty when bypassCache=false");
await browser.tabs.reload(, {bypassCache: true});
await awaitLoad(;
[textContent] = await browser.tabs.executeScript(, {code: "document.body.textContent"});
const [pragma, cacheControl] = textContent.split(":");
browser.test.assertEq("no-cache", pragma, "`pragma` should be set to `no-cache` when bypassCache is true");
browser.test.assertEq("no-cache", cacheControl, "`cacheControl` should be set to `no-cache` when bypassCache is true");
await browser.tabs.remove(;
} catch (error) {`${error} :: ${error.stack}`);
await extension.startup();
await extension.awaitFinish("tabs.reload_bypass_cache");
await extension.unload();