| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 let tabId = window.BrowserApp.selectedTab.id; | 274 let tabId = window.BrowserApp.selectedTab.id; |
| 275 window.NativeWindow.doorhanger.show(message, id, buttons, tabId, | 275 window.NativeWindow.doorhanger.show(message, id, buttons, tabId, |
| 276 { | 276 { |
| 277 // No navigation is happening after doorhanger is shown | 277 // No navigation is happening after doorhanger is shown |
| 278 // so persistence needs to be reduced by one | 278 // so persistence needs to be reduced by one |
| 279 persistence: persistence-1 | 279 persistence: persistence-1, |
| 280 timeout: 5000 | |
|
Wladimir Palant
2012/10/02 13:03:45
As discussed on IRC - looks like doorhanger notifi
| |
| 280 } | 281 } |
| 281 ); | 282 ); |
| 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); | |
|
Wladimir Palant
2012/10/01 20:36:33
https://developer.mozilla.org/en-US/docs/Extension
| |
| 287 } | 283 } |
| 288 }; | 284 }; |
| 289 | 285 |
| 290 exports.loadURI = function(window, uri) | 286 exports.loadURI = function(window, uri) |
| 291 { | 287 { |
| 292 if ("BrowserApp" in window && "loadURI" in window.BrowserApp) | 288 if ("BrowserApp" in window && "loadURI" in window.BrowserApp) |
| 293 window.BrowserApp.loadURI(uri); | 289 window.BrowserApp.loadURI(uri); |
| 294 }; | 290 }; |
| 295 | 291 |
| 296 break; | 292 break; |
| 297 } | 293 } |
| 298 default: | 294 default: |
| 299 { | 295 { |
| 300 exports.isKnownWindow = function(window) false; | 296 exports.isKnownWindow = function(window) false; |
| 301 break; | 297 break; |
| 302 } | 298 } |
| 303 } | 299 } |
| LEFT | RIGHT |