summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-11 05:44:55 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-11 05:44:55 +0000
commita6782ed12d4bd608baf20351ca3527331f41b125 (patch)
tree765d0c667b0b04cb769fc9fd0b89a9bef72f4270
parentf321c5bcee346d6342e3f2d830ffafc77d5fd5f9 (diff)
downloadchromium_src-a6782ed12d4bd608baf20351ca3527331f41b125.zip
chromium_src-a6782ed12d4bd608baf20351ca3527331f41b125.tar.gz
chromium_src-a6782ed12d4bd608baf20351ca3527331f41b125.tar.bz2
[uber] fix lazy load in caching case
the iframe contents can be cached even when src= is not set. The easiest way to tickle this bug is to set chrome to restore session on startup, with chrome://chrome as one of the pages. Workaround: dynamically add the iframe rather than just setting the src attribute (suggested by dbeam) BUG=none TEST=none Review URL: http://codereview.chromium.org/9379031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121641 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/uber/uber.html12
-rw-r--r--chrome/browser/resources/uber/uber.js28
2 files changed, 19 insertions, 21 deletions
diff --git a/chrome/browser/resources/uber/uber.html b/chrome/browser/resources/uber/uber.html
index 1449c0f..5d06832 100644
--- a/chrome/browser/resources/uber/uber.html
+++ b/chrome/browser/resources/uber/uber.html
@@ -21,14 +21,14 @@
<div id="navigation"><iframe src="chrome://uber-frame/"></iframe></div>
<div class="iframe-container" i18n-values="id:settingsHost"
- data-favicon="chrome://theme/IDR_SETTINGS_FAVICON">
- <iframe data-url="chrome://settings-frame/"></iframe></div>
+ data-favicon="chrome://theme/IDR_SETTINGS_FAVICON"
+ data-url="chrome://settings-frame/"></div>
<div class="iframe-container" i18n-values="id:extensionsHost"
- data-favicon="chrome://theme/IDR_EXTENSIONS_FAVICON">
- <iframe data-url="chrome://extensions-frame/"></iframe></div>
+ data-favicon="chrome://theme/IDR_EXTENSIONS_FAVICON"
+ data-url="chrome://extensions-frame/"></div>
<div class="iframe-container" i18n-values="id:helpHost"
- data-favicon="chrome://theme/IDR_PRODUCT_LOGO_16">
- <iframe data-url="chrome://help-frame/"></iframe></div>
+ data-favicon="chrome://theme/IDR_PRODUCT_LOGO_16"
+ data-url="chrome://help-frame/"></div>
<script src="chrome://chrome/strings.js"></script>
<script src="chrome://resources/js/i18n_template.js"></script>
diff --git a/chrome/browser/resources/uber/uber.js b/chrome/browser/resources/uber/uber.js
index d454d0b..ca50825 100644
--- a/chrome/browser/resources/uber/uber.js
+++ b/chrome/browser/resources/uber/uber.js
@@ -181,17 +181,12 @@ cr.define('uber', function() {
// Cache the title for the client iframe, i.e., the iframe setting the
// title. querySelector returns the actual iframe element, so use parentNode
// to get back to the container.
- var iframe = document.querySelector(query);
+ var container = document.querySelector(query).parentNode;
+ container.dataset.title = title;
- // |iframe| may be null if the page has not lazy-loaded yet.
- if (iframe) {
- var container = iframe.parentNode;
- container.title = title;
-
- // Only update the currently displayed title if this is the visible frame.
- if (container == getSelectedIframe())
- document.title = title;
- }
+ // Only update the currently displayed title if this is the visible frame.
+ if (container == getSelectedIframe())
+ document.title = title;
}
/**
@@ -209,17 +204,20 @@ cr.define('uber', function() {
// Lazy load of iframe contents.
var frame = container.querySelector('iframe');
- var sourceURL = frame.dataset.url;
- if (!frame.getAttribute('src'))
- frame.src = sourceURL;
+ var sourceUrl = container.dataset.url;
+ if (!frame) {
+ frame = container.ownerDocument.createElement('iframe');
+ container.appendChild(frame);
+ frame.src = sourceUrl;
+ }
// If there is a non-empty path, alter the location of the frame.
if (path && path.length)
- frame.contentWindow.location.replace(sourceURL + path);
+ frame.contentWindow.location.replace(sourceUrl + path);
if (lastSelected)
lastSelected.classList.remove('selected');
container.classList.add('selected');
- document.title = container.title;
+ document.title = container.dataset.title;
$('favicon').href = container.dataset.favicon;
enableScrollEasing();