| OLD | NEW | 
|    1 /* This Source Code Form is subject to the terms of the Mozilla Public |    1 /* This Source Code Form is subject to the terms of the Mozilla Public | 
|    2  * License, v. 2.0. If a copy of the MPL was not distributed with this file, |    2  * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 
|    3  * You can obtain one at http://mozilla.org/MPL/2.0/. */ |    3  * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 
|    4  |    4  | 
|    5 let {hook} = require("hooks"); |    5 let {hook} = require("hooks"); | 
|    6 let functionHooks = new WeakMap(); |    6 let functionHooks = new WeakMap(); | 
|    7  |    7  | 
|    8 exports.removeFromWindow = function(window) |    8 exports.removeFromWindow = function(window) | 
|    9 { |    9 { | 
|   10   if (functionHooks.has(window)) |   10   if (functionHooks.has(window)) | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  264           } |  264           } | 
|  265         }, cleanup); |  265         }, cleanup); | 
|  266         functionHooks.set(window, unhook); |  266         functionHooks.set(window, unhook); | 
|  267       } |  267       } | 
|  268     }; |  268     }; | 
|  269  |  269  | 
|  270     exports.openInfobar = function(window, id, message, buttons, persistence) |  270     exports.openInfobar = function(window, id, message, buttons, persistence) | 
|  271     { |  271     { | 
|  272       if ("BrowserApp" in window && "selectedTab" in window.BrowserApp) |  272       if ("BrowserApp" in window && "selectedTab" in window.BrowserApp) | 
|  273       { |  273       { | 
|  274         window.NativeWindow.doorhanger.show(message, id, buttons, window.Browser
     App.selectedTab.id, |  274         let tabId = window.BrowserApp.selectedTab.id; | 
 |  275         window.NativeWindow.doorhanger.show(message, id, buttons, tabId, | 
|  275           { |  276           { | 
|  276             persistence: persistence |  277             // No navigation is happening after doorhanger is shown | 
 |  278             // so persistence needs to be reduced by one | 
 |  279             persistence: persistence-1 | 
|  277           } |  280           } | 
|  278         ); |  281         ); | 
 |  282         let surveyTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
     ; | 
 |  283         surveyTimer.initWithCallback(function() | 
 |  284         { | 
 |  285           window.NativeWindow.doorhanger.hide(id, tabId); | 
 |  286         }, 5000, Ci.nsITimer.TYPE_ONE_SHOT); | 
|  279       } |  287       } | 
|  280     }; |  288     }; | 
|  281  |  289  | 
|  282     exports.loadURI = function(window, uri) |  290     exports.loadURI = function(window, uri) | 
|  283     { |  291     { | 
|  284       if ("BrowserApp" in window && "loadURI" in window.BrowserApp) |  292       if ("BrowserApp" in window && "loadURI" in window.BrowserApp) | 
|  285         window.BrowserApp.loadURI(uri); |  293         window.BrowserApp.loadURI(uri); | 
|  286     }; |  294     }; | 
|  287  |  295  | 
|  288     break; |  296     break; | 
|  289   } |  297   } | 
|  290   default: |  298   default: | 
|  291   { |  299   { | 
|  292     exports.isKnownWindow = function(window) false; |  300     exports.isKnownWindow = function(window) false; | 
|  293     break; |  301     break; | 
|  294   } |  302   } | 
|  295 } |  303 } | 
| OLD | NEW |