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

Side by Side Diff: chrome/test/data/extensions/subscribe_page_action/feed_finder.js

Issue 412008: Introduce a new 'all_frames' property to content scripts and (Closed)
Patch Set: responses to comments Created 11 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 if (window == top) { 5 findFeeds();
6 findFeeds(); 6 window.addEventListener("focus", findFeeds);
7 window.addEventListener("focus", findFeeds);
8 }
9 7
10 function findFeeds() { 8 function findFeeds() {
11 // Find all the RSS link elements. 9 // Find all the RSS link elements.
12 var result = document.evaluate( 10 var result = document.evaluate(
13 '//link[@rel="alternate"][contains(@type, "rss") or ' + 11 '//link[@rel="alternate"][contains(@type, "rss") or ' +
14 'contains(@type, "atom") or contains(@type, "rdf")]', 12 'contains(@type, "atom") or contains(@type, "rdf")]',
15 document, null, 0, null); 13 document, null, 0, null);
16 14
17 var feeds = []; 15 var feeds = [];
18 var item; 16 var item;
19 while (item = result.iterateNext()) 17 while (item = result.iterateNext())
20 feeds.push(item.href); 18 feeds.push(item.href);
21 19
22 // Notify the extension of the feed URLs we found. 20 // Notify the extension of the feed URLs we found.
23 chrome.extension.connect().postMessage(feeds); 21 chrome.extension.connect().postMessage(feeds);
24 } 22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698