Changeset 642

Show
Ignore:
Timestamp:
01/20/08 18:25:55 (11 months ago)
Author:
boo..@youngpup.net
Message:

Merge changeset 606 from trunk to 0.7 branch: Make sure that the install
dialog is only shown when user scripts are loaded in a top-level content
window.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.7/src/chrome/chromeFiles/content/browser.js

    r435 r642  
    118118 */ 
    119119GM_BrowserUI.contentLoad = function(e) { 
     120  var safeWin; 
    120121  var unsafeWin; 
    121122  var href; 
     
    126127  } 
    127128 
    128   unsafeWin = e.target.defaultView.wrappedJSObject; 
    129   href = e.target.location.href; 
     129  safeWin = e.target.defaultView; 
     130  unsafeWin = safeWin.wrappedJSObject; 
     131  href = safeWin.location.href; 
    130132 
    131133  if (GM_isGreasemonkeyable(href)) { 
     
    143145  } 
    144146 
    145   if (!href.match(/\.user\.js$/)) { 
    146     return; 
    147   } 
    148  
    149   var browser = this.tabBrowser.getBrowserForDocument(e.target); 
     147  // Show the greasemonkey install banner if we are navigating to a .user.js 
     148  // file in a top-level tab. 
     149  if (href.match(/\.user\.js$/) && safeWin == safeWin.top) { 
     150    var browser = this.tabBrowser.getBrowserForDocument(safeWin.document); 
     151    this.showInstallBanner(browser); 
     152  } 
     153}; 
     154 
     155 
     156/** 
     157 * Shows the install banner across the top of the tab that is displayed when 
     158 * a user selects "show script source" in the install dialog. 
     159 */ 
     160GM_BrowserUI.showInstallBanner = function(browser) { 
    150161  var greeting = this.bundle.getString("greeting.msg"); 
    151162