diff --git a/toolkit/components/extensions/ExtensionContent.jsm b/toolkit/components/extensions/ExtensionContent.jsm index 8f8ae723d755..b01091640dad 100644 --- a/toolkit/components/extensions/ExtensionContent.jsm +++ b/toolkit/components/extensions/ExtensionContent.jsm @@ -114,6 +114,8 @@ class ScriptCache extends DefaultMap { constructor(options) { super(url => ChromeUtils.compileScript(url, options)); + this.expiryTimeout = SCRIPT_EXPIRY_TIMEOUT_MS; + scriptCaches.add(this); } @@ -125,7 +127,7 @@ class ScriptCache extends DefaultMap { script.timer.cancel(); } script.timer = Timer(this.delete.bind(this, url), - SCRIPT_EXPIRY_TIMEOUT_MS, + this.expiryTimeout, Ci.nsITimer.TYPE_ONE_SHOT); return script; diff --git a/toolkit/components/extensions/test/mochitest/mochitest-common.ini b/toolkit/components/extensions/test/mochitest/mochitest-common.ini index 6940c2403da2..c6bd82d903c0 100644 --- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini +++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini @@ -54,6 +54,7 @@ skip-if = os == 'android' # Android does not support multiple windows. [test_ext_background_canvas.html] [test_ext_content_security_policy.html] [test_ext_contentscript_api_injection.html] +[test_ext_contentscript_cache.html] [test_ext_contentscript_context.html] [test_ext_contentscript_create_iframe.html] [test_ext_contentscript_devtools_metadata.html] diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html b/toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html new file mode 100644 index 000000000000..7aacb90cfbf6 --- /dev/null +++ b/toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html @@ -0,0 +1,103 @@ + + + + Test for content script caching + + + + + + + + + + + +