Bug 1336308: Part 1 - Fix the capitalization of innerWindowID properties. r?aswan
MozReview-Commit-ID: 1qp49K9zc40
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
@@ -1,15 +1,17 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
let scriptPage = url => `<html><head><meta charset="utf-8"><script src="${url}"></script></head><body>${url}</body></html>`;
add_task(function* testBrowserActionClickCanceled() {
+ let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
+
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"browser_action": {
"default_popup": "popup.html",
"browser_style": true,
},
"permissions": ["activeTab"],
},
@@ -22,17 +24,16 @@ add_task(function* testBrowserActionClic
yield extension.startup();
const {GlobalManager, Management: {global: {browserActionFor}}} = Cu.import("resource://gre/modules/Extension.jsm", {});
let ext = GlobalManager.extensionMap.get(extension.id);
let browserAction = browserActionFor(ext);
let widget = getBrowserActionWidget(extension).forWindow(window);
- let tab = window.gBrowser.selectedTab;
// Test canceled click.
EventUtils.synthesizeMouseAtCenter(widget.node, {type: "mousedown", button: 0}, window);
isnot(browserAction.pendingPopup, null, "Have pending popup");
is(browserAction.pendingPopup.window, window, "Have pending popup for the correct window");
is(browserAction.pendingPopupTimeout, null, "Have no pending popup timeout");
@@ -71,16 +72,18 @@ add_task(function* testBrowserActionClic
is(browserAction.pendingPopup, null, "Pending popup was cleared");
is(browserAction.pendingPopupTimeout, null, "Pending popup timeout was cleared");
yield promisePopupShown(getBrowserActionPopup(extension));
yield closeBrowserAction(extension);
yield extension.unload();
+
+ yield BrowserTestUtils.removeTab(tab);
});
add_task(function* testBrowserActionDisabled() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"browser_action": {
"default_popup": "popup.html",
"browser_style": true,
--- a/toolkit/components/extensions/ExtensionTabs.jsm
+++ b/toolkit/components/extensions/ExtensionTabs.jsm
@@ -28,31 +28,31 @@ const {
} = ExtensionUtils;
class TabBase {
constructor(extension, tab, id) {
this.extension = extension;
this.tabManager = extension.tabManager;
this.id = id;
this.tab = tab;
- this.activeTabWindowId = null;
+ this.activeTabWindowID = null;
}
- get innerWindowId() {
- return this.browser.innerWindowId;
+ get innerWindowID() {
+ return this.browser.innerWindowID;
}
get hasTabPermission() {
return this.extension.hasPermission("tabs") || this.hasActiveTabPermission;
}
get hasActiveTabPermission() {
return (this.extension.hasPermission("activeTab") &&
- this.activeTabWindowId !== null &&
- this.activeTabWindowId === this.innerWindowId);
+ this.activeTabWindowID != null &&
+ this.activeTabWindowID === this.innerWindowID);
}
get incognito() {
return PrivateBrowsingUtils.isBrowserPrivate(this.browser);
}
get _url() {
return this.browser.currentURI.spec;
@@ -599,22 +599,22 @@ class TabManagerBase {
addActiveTabPermission(tab) {
if (this.extension.hasPermission("activeTab")) {
// Note that, unlike Chrome, we don't currently clear this permission with
// the tab navigates. If the inner window is revived from BFCache before
// we've granted this permission to a new inner window, the extension
// maintains its permissions for it.
tab = this.getWrapper(tab);
- tab.activeTabWindowId = tab.innerWindowId;
+ tab.activeTabWindowID = tab.innerWindowID;
}
}
revokeActiveTabPermission(tab) {
- this.getWrapper(tab).activeTabWindowId = null;
+ this.getWrapper(tab).activeTabWindowID = null;
}
// Returns true if the extension has the "activeTab" permission for this tab.
// This is somewhat more permissive than the generic "tabs" permission, as
// checked by |hasTabPermission|, in that it also allows programmatic script
// injection without an explicit host permission.
hasActiveTabPermission(tab) {
return this.getWrapper(tab).hasActiveTabPermission;