[Webkit-unassigned] [Bug 76035] Add state attribute to history's dom interface.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 11 13:00:29 PST 2012


--- Comment #7 from Brady Eidson <beidson at apple.com>  2012-01-11 13:00:29 PST ---
(In reply to comment #5)
> I think it's even more complicated than this.  In addition to the requirement that "history.state == history.state" I think the identity has to match with the object in the pop state event.  I think the following JS code is valid:

Here's an updated snippet of code with slight tweaks:

// Create a new object.
var stateObject = new Array;

// Use it as the state object in a replaceState.  This clones the object.
history.replaceState(stateObject, null, null);

// Since the actual history.state is a structured clone, it should not match our original object.
ASSERT(history.state != stateObject);

// Now let's refetch a copy of history.state to store;
stateObject = history.state;

// Our reference and the history.state itself should be the same.  This is now Adam's original assertion.
ASSERT(stateObject == history.state);

// Now let's do a pushstate to add a history entry.
history.pushState(null, null, null);

// Now add a handler for the popstate event.
onpopstate = function(event) {
    // Our stored reference to stateObject should match the current state object.
    ASSERT(history.state == stateObject);
    // AND our stored reference to stateObject should match the state object in this popstate event.
    ASSERT(event.state == stateObject);
    // For good measure, the event's state object and the current state object should also both match.
    ASSERT(event.state == history.state);

// Now let's go back to our original history entry which has a state object that we've stored a reference to already.
// This will fire our popstate event handler above.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list