diff options
author | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 23:57:05 +0000 |
---|---|---|
committer | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 23:57:05 +0000 |
commit | d7aef10706a8e8b5da86d48113136887b3ca97a1 (patch) | |
tree | f9f85ff357373ce24d5379a29252cf674f944a89 | |
parent | 3ae1e408f443a920b449106e45fa868ce75beae7 (diff) | |
download | chromium_src-d7aef10706a8e8b5da86d48113136887b3ca97a1.zip chromium_src-d7aef10706a8e8b5da86d48113136887b3ca97a1.tar.gz chromium_src-d7aef10706a8e8b5da86d48113136887b3ca97a1.tar.bz2 |
Fix issue where error pages inserted HTML from a template but the
string from the template was used with JST instead of the i18n template
and therefore it did not get recursively processed.
Also make sure we can support recursive handling of setting innerHTML
with the i18n template engine.
BUG=17377
TEST=Navigate to http://ponderer.org/tests/redirect-loop.py The error
page should show: The webpage at http://ponderer.org/tests/redirect-loop.py
has ...
Review URL: http://codereview.chromium.org/155884
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21240 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 10 | ||||
-rw-r--r-- | chrome/browser/resources/i18n_template.js | 33 |
2 files changed, 25 insertions, 18 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index fcae759..d929b0f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -2715,13 +2715,13 @@ each locale. --> </message> <message name="IDS_ERRORPAGES_SUGGESTION_RELOAD" desc="When a page fails to load, we provide a suggestion that the user try reloading the page later"> - <a i18n-values="href:reloadUrl">Reload</a> this web page later. + <a jsvalues="href:reloadUrl">Reload</a> this web page later. </message> <message name="IDS_ERRORPAGES_SUGGESTION_HOMEPAGE" desc="When a page fails to load, sometimes we provide a suggesting of trying just the hostname of the site."> Go to the homepage of the site: </message> <message name="IDS_ERRORPAGES_SUGGESTION_LEARNMORE" desc="When a web page fails to load, we provide a link to the help center to learn more about the failure."> - <ph name="BEGIN_LINK"><a i18n-values="href:learnMoreUrl"></ph>Learn more<ph name="END_LINK"></a></ph> about this problem. + <ph name="BEGIN_LINK"><a jsvalues="href:learnMoreUrl"></ph>Learn more<ph name="END_LINK"></a></ph> about this problem. </message> <message name="IDS_ERRORPAGES_TITLE_NOT_AVAILABLE" desc="Title of the error page when we can't connect to a site."> @@ -2743,13 +2743,13 @@ each locale. --> This webpage has a redirect loop. </message> <message name="IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE" desc="Summary in the error page when we can't connect to a site."> - The webpage at <strong i18n-content="failedUrl"></strong> might be temporarily down or it may have moved permanently to a new web address. + The webpage at <strong jscontent="failedUrl"></strong> might be temporarily down or it may have moved permanently to a new web address. </message> <message name="IDS_ERRORPAGES_SUMMARY_NOT_FOUND" desc="Summary in the error page when the server returns a 404."> - No webpage was found for the web address: <strong i18n-content="failedUrl"></strong> + No webpage was found for the web address: <strong jscontent="failedUrl"></strong> </message> <message name="IDS_ERRORPAGES_SUMMARY_TOO_MANY_REDIRECTS" desc="Summary in the error page when there are too many URL redirects."> - The webpage at <strong i18n-content="failedUrl"></strong> has resulted in + The webpage at <strong jscontent="failedUrl"></strong> has resulted in too many redirects. Clearing your cookies for this site may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. diff --git a/chrome/browser/resources/i18n_template.js b/chrome/browser/resources/i18n_template.js index 7a367f7..00289028 100644 --- a/chrome/browser/resources/i18n_template.js +++ b/chrome/browser/resources/i18n_template.js @@ -56,6 +56,11 @@ var i18nTemplate = (function() { } if (object) { object[path] = value; + // In case we set innerHTML (ignoring others) we need to + // recursively check the content + if (path == 'innerHTML') { + process(element, obj); + } } } else { element.setAttribute(propName, value); @@ -71,21 +76,23 @@ var i18nTemplate = (function() { } var selector = '[' + attributeNames.join('],[') + ']'; - return { - /** - * Processes a DOM tree with the {@code obj} map. - */ - process: function(node, obj) { - var elements = node.querySelectorAll(selector); - for (var element, i = 0; element = elements[i]; i++) { - for (var j = 0; j < attributeNames.length; j++) { - var name = attributeNames[j]; - var att = element.getAttribute(name); - if (att != null) { - handlers[name](element, att, obj); - } + /** + * Processes a DOM tree with the {@code obj} map. + */ + function process(node, obj) { + var elements = node.querySelectorAll(selector); + for (var element, i = 0; element = elements[i]; i++) { + for (var j = 0; j < attributeNames.length; j++) { + var name = attributeNames[j]; + var att = element.getAttribute(name); + if (att != null) { + handlers[name](element, att, obj); } } } + } + + return { + process: process }; })(); |