Open Bug 1525354 Opened 5 years ago Updated 2 years ago

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

Categories

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

enhancement

Tracking

()

Tracking Status
firefox67 --- affected

People

(Reporter: bzbarsky, Assigned: mccr8)

Details

Attachments

(1 file)

Consider a testcase like so:

  <script>
  var win;
  var func;
  function openWin() {
    win = window.open("some-cross-origin-url");
  }

  function saveFunc() {
    func = win.close;
  }

  function checkFunc() {
    alert(func == win.close);
  }
  </script>
  <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:

  <script>
    var x = 5;

    function setx() { x = 7; }
    function alertx() { alert(x); }
  </script>
  <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 bfache 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

Andrew, do you think you could take over driving this in?

Flags: needinfo?(continuation)

(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #2)

Andrew, do you think you could take over driving this in?

Sure. It looks straight forward enough. Is "my changes to cross-origin stuff" in comment 0 referring to bug 1363208?

Assignee: nobody → continuation
Flags: needinfo?(continuation) → needinfo?(bzbarsky)

I think so, yes.

Flags: needinfo?(bzbarsky)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: