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, |
| 280 timeout: 5000 |
277 } | 281 } |
278 ); | 282 ); |
279 } | 283 } |
280 }; | 284 }; |
281 | 285 |
282 exports.loadURI = function(window, uri) | 286 exports.loadURI = function(window, uri) |
283 { | 287 { |
284 if ("BrowserApp" in window && "loadURI" in window.BrowserApp) | 288 if ("BrowserApp" in window && "loadURI" in window.BrowserApp) |
285 window.BrowserApp.loadURI(uri); | 289 window.BrowserApp.loadURI(uri); |
286 }; | 290 }; |
287 | 291 |
288 break; | 292 break; |
289 } | 293 } |
290 default: | 294 default: |
291 { | 295 { |
292 exports.isKnownWindow = function(window) false; | 296 exports.isKnownWindow = function(window) false; |
293 break; | 297 break; |
294 } | 298 } |
295 } | 299 } |
OLD | NEW |