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 /chrome/browser/resources | |
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
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/i18n_template.js | 33 |
1 files changed, 20 insertions, 13 deletions
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 }; })(); |