Permalink
Browse files

Bug 804935 - TypeError: window.tabs is undefined

It was a regression during fennec implementation of windows and tabs. A `ChromeWindow` was used instead of the expected `BrowserWindow`.
  • Loading branch information...
ZER0 committed Oct 24, 2012
1 parent f4291b6 commit 08e9d03075db683fb7b5ddc617f1076ac0c93f8d
Showing with 15 additions and 2 deletions.
  1. +14 −1 lib/sdk/tabs/helpers.js
  2. +1 −1 lib/sdk/tabs/tab-firefox.js
View
@@ -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 08e9d03

Please sign in to comment.