I am developing a Chrome Extension. When a chrome extension is updated---via a user…
- User
I am developing a Chrome Extension. When a chrome extension is updated---via a user pressing the "Update" button at the chrome://extensions/ extensions management page---does this update event create a new (and separate) javascript execution environment for an already-open web page that my extension targets and into which injects a content script?
For example, say I have a content script (CS) (injected via a chrome.scripting.executeScript call invoked by my extension service worker) consisting of the following...
(function () { if (window[chrome.runtime.id + "initialized"]) { console.log(
Content script already initialized, so halt any further execution of this script.); return; } else { console.log(else stmt running); window[chrome.runtime.id + "initialized"] = true; } })();Before the update event, I would expect the CS to print "else stmt running" to the console. But after the update event, I'm not sure if the "if" block will run or if the "else" block will run. If, because of the update event, Chrome creates an entirely new JS execution environment, then I would expect the "else" to run. But if Chrome doesn't create an entirely new JS execution environment (because of the update event), then I would expect the "if" block to run.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.