From c2f3cfaf1771755a94c38df1d68d8a0816f88eb6 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Thu, 9 Dec 2010 23:33:04 +0900 Subject: [PATCH] can't do search from the web search bar in some webpages --- content/treestyletab/treestyletab.js | 7 +++++-- install.rdf | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index e8bdfa86..a7c78a34 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -157,9 +157,12 @@ var TreeStyleTabService = { w = this.browser.contentWindow; return (function(aWindow) { - if (aWindow.getSelection().toString() == aTerm) + if (!aWindow || !(aWindow instanceof Components.interfaces.nsIDOMWindow)) + return false; + var selection = aWindow.getSelection(); + if (selection && selection.toString() == aTerm) return true; - return Array.slice(aWindow.frames).some(arguments.callee); + return aWindow.frames ? Array.slice(aWindow.frames).some(arguments.callee) : false ; })(w); }, kSEARCH_RESULT_DO_NOT_ATTACH : 0, diff --git a/install.rdf b/install.rdf index 82dacd8e..d53eceb1 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@