Permalink
Browse files

Merge pull request #630 from ZER0/window.tabs/bug804935

Fix Bug 804935 - TypeError: window.tabs is undefined r=@erikvold
  • Loading branch information...
2 parents b205f22 + 08e9d03 commit f2c93bd8cac8c48ff11f6ae2f4ce84d99e037ded @erikvold erikvold committed Jan 3, 2013
Showing with 15 additions and 2 deletions.
  1. +14 −1 lib/sdk/tabs/helpers.js
  2. +1 −1 lib/sdk/tabs/tab-firefox.js
@@ -5,13 +5,26 @@
const { getTabForContentWindow } = require('./utils');
const { Tab } = require('./tab');
+const { getOwnerWindow } = require('./utils');
+const { BrowserWindow } = require('../windows');
function getTabForWindow(win) {
let tab = getTabForContentWindow(win);
// We were unable to find the related tab!
if (!tab)
return null;
- return Tab({ tab: tab });
+ let topWindow = getOwnerWindow(tab);
+
+ return Tab({
+ tab: tab,
+ // Bring back this line for consistency. However it's actually not needed,
+ // as soon as the `windows` module is included - even if it's not used -
+ // the Tab will have the proper browser window assigned. That will be
+ // eventually fixed when deprecated Trackers will be removed.
+ //
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=804935
+ window: BrowserWindow({ window: topWindow })
+ });
}
exports.getTabForWindow = getTabForWindow;
@@ -32,7 +32,7 @@ const TabTrait = Trait.compose(EventEmitter, {
constructor: function Tab(options) {
this._onReady = this._onReady.bind(this);
this._tab = options.tab;
- let window = this.window = options.window || getOwnerWindow(this._tab);
+ let window = this.window = options.window;
// Setting event listener if was passed.
for each (let type in EVENTS) {

0 comments on commit f2c93bd

Please sign in to comment.