Open Bug 1525354 Opened 8 months ago Updated 6 months ago

Decide how the cached cross-origin function weakmap should interact with bfcache


(Core :: DOM: Core & HTML, enhancement, P3)




Tracking Status
firefox67 --- affected


(Reporter: bzbarsky, Unassigned)



(1 file)

Consider a testcase like so:

  var win;
  var func;
  function openWin() {
    win ="some-cross-origin-url");

  function saveFunc() {
    func = win.close;

  function checkFunc() {
    alert(func == win.close);
  <input type="button" onclick="openWin()" value="Open window">
  <input type="button" onclick="saveFunc()" value="Save function">
  <input type="button" onclick="checkFunc()" value="Check function">

where some-cross-origin-url looks like this:

    var x = 5;

    function setx() { x = 7; }
    function alertx() { alert(x); }
  <input type="button" onclick="setx()" value="Change value">
  <input type="button" onclick="alertx()" value="Examine value">
  <a href="other.html">Go to other page</a>

(so you can tell whether it's doing bfcache). If the "Open window" button is clicked, then "Save function", then the "Change value", then the link to "other.html", then the browser's back button, then the following should be true when bfacce is in use:

  1. "Examine value" alerts 7.
  2. "Check function" alerts true.

In Gecko release, and with my changes to cross-origin stuff, #1 holds, but #2 alerts false. In release, because the Xray where caching state lives goes away during the various transplanting that happens during navigation. With my changes because the cached-function weakmap likewise goes away while transplanting.

This is not that hard to fix: store the weakmap in the windowstate. But I need to write a non-manual test, and I have other things to worry about right now.

Attachment #9041543 - Attachment description: imported patch fix-bfcache-interaction → Patch that fixes my manual testcase.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.