Permalink
Browse files

Issue 5962: Panel for CSS Selector Queries (allow searching in frames)

  • Loading branch information...
1 parent ee53f4a commit 58e762595a3a2014b678b57d158f063617d1712b @janodvarko janodvarko committed Oct 10, 2012
Showing with 27 additions and 17 deletions.
  1. +4 −3 extension/content/firebug/bti/inProcess/browser.js
  2. +23 −14 extension/content/firebug/css/selectorPanel.js
@@ -272,9 +272,10 @@ Browser.prototype.getOrCreateContextByWebApp = function(webApp)
// TEMP; Watch also all iframes. Firebug has been initialized when the page is already
// loaded and so, we can't rely on auto-registration done by FrameProgressListener.
- var iframes = topWindow.document.getElementsByTagName("iframe");
- for (var i=0; i<iframes.length; i++)
- TabWatcher.watchWindow(iframes[i].contentWindow, null, false);
+ Win.iterateWindows(context.window, function (win)
+ {
+ TabWatcher.watchWindow(win, context, false);
+ });
browser.showFirebug = true;
@@ -187,23 +187,32 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
*/
getSelectedElements: function(selectorText)
{
- var selections = Firebug.currentContext.window.document.querySelectorAll(selectorText);
+ var elements = [];
- // For some reason the return value of querySelectorAll()
- // is not recognized as a NodeList anymore since Firefox 10.0.
- // See issue 5442.
- if (selections)
+ // Execute the query also in all iframes (see issue 5962)
+ var windows = this.context.windows;
+ for (var i=0; i<windows.length; i++)
{
- var elements = [];
- for (var i=0; i<selections.length; i++)
- elements.push(selections[i]);
-
- return elements;
- }
- else
- {
- throw new Error("Selection Failed: " + selections);
+ var win = windows[i];
+ var selections = win.document.querySelectorAll(selectorText);
+
+ // For some reason the return value of querySelectorAll()
+ // is not recognized as a NodeList anymore since Firefox 10.0.
+ // See issue 5442.
+ // But since there can be more iframes we need to collect all matching
+ // elements in an extra array anyway.
+ if (selections)
+ {
+ for (var j=0; j<selections.length; j++)
+ elements.push(selections[j]);
+ }
+ else
+ {
+ throw new Error("Selection Failed: " + selections);
+ }
}
+
+ return elements;
},
/**

0 comments on commit 58e7625

Please sign in to comment.