Bug 1940741 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Here's the list of objects with `nsISupportsWeakReference` interface, stored into global `var`.
All of those variables are closed over, so they're not affected by the `deoptimizeModuleGlobalVars` option, but still risky.

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/browser/actors/RefreshBlockerChild.sys.mjs#15,127-132
```js
var progressListener = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIWebProgressListener2",
    "nsIWebProgressListener",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/browser/components/downloads/DownloadsCommon.sys.mjs#93-97
```js
var PrefObserver = {
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/dom/media/PeerConnection.sys.mjs#209-213,215-217
```js
setupPrototype(GlobalPCList, {
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
...
});

var _globalPCList = new GlobalPCList();
```

var _globalPCList = new GlobalPCList();
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/satchel/FormHistory.sys.mjs#104,175-179
```js
var Prefs = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/telemetry/app/TelemetryControllerParent.sys.mjs#283,1115
```js
var Impl = {
...
  QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs#85,88,1047,1315,2169
```js
var gGlobalEnvironment;
...
    gGlobalEnvironment = new EnvironmentCache();
...
EnvironmentCache.prototype = {
...
  QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
...
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/modules/NewTabUtils.sys.mjs#207,308-312
```js
var AllPages = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/modules/NewTabUtils.sys.mjs#1637,2137-2141
```js
var Links = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```
Here's the list of objects with `nsISupportsWeakReference` interface, stored into global `var`.
All of those variables are closed over, so they're not affected by the `deoptimizeModuleGlobalVars` option, but still risky.

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/browser/actors/RefreshBlockerChild.sys.mjs#15,127-132
```js
var progressListener = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIWebProgressListener2",
    "nsIWebProgressListener",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/browser/components/downloads/DownloadsCommon.sys.mjs#93-97
```js
var PrefObserver = {
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/dom/media/PeerConnection.sys.mjs#209-213,215-217
```js
setupPrototype(GlobalPCList, {
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
...
});

var _globalPCList = new GlobalPCList();
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/satchel/FormHistory.sys.mjs#104,175-179
```js
var Prefs = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/telemetry/app/TelemetryControllerParent.sys.mjs#283,1115
```js
var Impl = {
...
  QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs#85,88,1047,1315,2169
```js
var gGlobalEnvironment;
...
    gGlobalEnvironment = new EnvironmentCache();
...
EnvironmentCache.prototype = {
...
  QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
...
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/modules/NewTabUtils.sys.mjs#207,308-312
```js
var AllPages = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```

https://searchfox.org/mozilla-central/rev/6d06ffc186ac356648f1feeadd52cc61b2ad6737/toolkit/modules/NewTabUtils.sys.mjs#1637,2137-2141
```js
var Links = {
...
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
};
```

Back to Bug 1940741 Comment 8