Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: chrome/browser/resources/uber/uber.js

Issue 306043002: uber: use the URL to resolve the subpage in popstate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/uber/uber.js
diff --git a/chrome/browser/resources/uber/uber.js b/chrome/browser/resources/uber/uber.js
index 1599882c03a905da1452abdd18868ba285cce55b..a872d6e18128b778df1c64aa40e7d20216a720de 100644
--- a/chrome/browser/resources/uber/uber.js
+++ b/chrome/browser/resources/uber/uber.js
@@ -101,24 +101,22 @@ cr.define('uber', function() {
* @param {Event} e The history event.
*/
function onPopHistoryState(e) {
Dan Beam 2014/05/29 20:42:10 what happens in the case of !e.state? should we p
Dan Beam 2014/05/29 20:45:52 nevermind, I see what's happening here (and in ube
- if (e.state && e.state.pageId) {
- 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
- // already loaded, it may have state not reflected in the URL, such as the
- // history page's "Remove selected items" overlay. http://crbug.com/377386
- if (getRequiredElement(params.id) !== getSelectedIframe())
- showPage(params.id, HISTORY_STATE_OPTION.NONE, params.path);
-
- // Either way, send the state down to it.
- //
- // Note: This assumes that the state and path parameters for every page
- // under this origin are compatible. All of the downstream pages which
- // navigate use pushState and replaceState.
- invokeMethodOnPage(e.state.pageId, 'popState',
- {state: e.state.pageState, path: params.path});
- }
+ // Use the URL to determine which page to route to.
+ var params = resolvePageInfo();
+
+ // 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
+ // history page's "Remove selected items" overlay. http://crbug.com/377386
+ if (getRequiredElement(params.id) !== getSelectedIframe())
+ showPage(params.id, HISTORY_STATE_OPTION.NONE, params.path);
+
+ // Either way, send the state down to it.
+ //
+ // Note: This assumes that the state and path parameters for every page
+ // under this origin are compatible. All of the downstream pages which
+ // navigate use pushState and replaceState.
+ invokeMethodOnPage(params.id, 'popState',
+ {state: e.state, path: params.path});
}
/**
@@ -239,9 +237,7 @@ cr.define('uber', function() {
assert(histFunc, 'invalid historyOption given ' + historyOption);
var pageId = getSelectedIframe().id;
- var args = [{pageId: pageId, pageState: state},
- '',
- '/' + pageId + '/' + (path || '')];
+ var args = [state, '', '/' + pageId + '/' + (path || '')];
histFunc.apply(window.history, args);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698