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

Unified Diff: chrome/renderer/resources/extensions/tag_watcher.js

Issue 12465019: Fix the bug webviews can not be loaded (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Change queryTags to findChildTags Created 7 years, 8 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/renderer/resources/extensions/tag_watcher.js
diff --git a/chrome/renderer/resources/extensions/tag_watcher.js b/chrome/renderer/resources/extensions/tag_watcher.js
index 99bfce6d55b0c522cbef62a1faa33bbb54f7ff2d..815eb604b7e7f90e8b1687b6fe4cbc37c0e775fd 100644
--- a/chrome/renderer/resources/extensions/tag_watcher.js
+++ b/chrome/renderer/resources/extensions/tag_watcher.js
@@ -9,20 +9,23 @@ function watchForTag(tagName, cb) {
if (!document.body)
return;
- // Query tags already in the document.
- var nodes = document.body.querySelectorAll(tagName);
- for (var i = 0, node; node = nodes[i]; i++) {
- cb(node);
+ function findChildTags(queryNode) {
+ forEach(queryNode.querySelectorAll(tagName), function(i, node) {
+ cb(node);
+ });
}
+ // Query tags already in the document.
+ findChildTags(document.body);
// Observe the tags added later.
var documentObserver = new WebKitMutationObserver(function(mutations) {
forEach(mutations, function(i, mutation) {
- for (var i = 0, addedNode; addedNode = mutation.addedNodes[i]; i++) {
+ forEach(mutation.addedNodes, function(i, addedNode) {
if (addedNode.tagName == tagName) {
cb(addedNode);
}
- }
+ findChildTags(addedNode);
+ });
});
});
documentObserver.observe(document, {subtree: true, childList: true});
« 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