Commit b2cfd20a authored by davidben@chromium.org's avatar davidben@chromium.org

uber: use the URL to resolve the subpage in popstate.

Otherwise if the initial load does not induce a replaceState, there is not
pageId in the history state to route to. Instead, always route from the URL.
This allows us to just pass-through the page state.

BUG=348948
TEST=See bug

Review URL: https://codereview.chromium.org/306043002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273934 0039d316-1c4b-4281-b951-d872f2087c98
parent 93f2175b
...@@ -101,9 +101,8 @@ cr.define('uber', function() { ...@@ -101,9 +101,8 @@ cr.define('uber', function() {
* @param {Event} e The history event. * @param {Event} e The history event.
*/ */
function onPopHistoryState(e) { function onPopHistoryState(e) {
if (e.state && e.state.pageId) { // Use the URL to determine which page to route to.
var params = resolvePageInfo(); var params = resolvePageInfo();
assert(params.id === e.state.pageId);
// If the page isn't the current page, load it fresh. Even if the page is // If the page isn't the current page, load it fresh. Even if the page is
// already loaded, it may have state not reflected in the URL, such as the // already loaded, it may have state not reflected in the URL, such as the
...@@ -116,9 +115,8 @@ cr.define('uber', function() { ...@@ -116,9 +115,8 @@ cr.define('uber', function() {
// Note: This assumes that the state and path parameters for every page // Note: This assumes that the state and path parameters for every page
// under this origin are compatible. All of the downstream pages which // under this origin are compatible. All of the downstream pages which
// navigate use pushState and replaceState. // navigate use pushState and replaceState.
invokeMethodOnPage(e.state.pageId, 'popState', invokeMethodOnPage(params.id, 'popState',
{state: e.state.pageState, path: params.path}); {state: e.state, path: params.path});
}
} }
/** /**
...@@ -239,9 +237,7 @@ cr.define('uber', function() { ...@@ -239,9 +237,7 @@ cr.define('uber', function() {
assert(histFunc, 'invalid historyOption given ' + historyOption); assert(histFunc, 'invalid historyOption given ' + historyOption);
var pageId = getSelectedIframe().id; var pageId = getSelectedIframe().id;
var args = [{pageId: pageId, pageState: state}, var args = [state, '', '/' + pageId + '/' + (path || '')];
'',
'/' + pageId + '/' + (path || '')];
histFunc.apply(window.history, args); histFunc.apply(window.history, args);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment