Bug 1214007: Follow-up: Fix ESLint errors. r=trivial

This commit is contained in:
Kris Maglione 2016-01-05 15:10:39 -08:00
parent 28af2a9668
commit f00c4fb9f7
3 changed files with 90 additions and 92 deletions

View File

@ -546,11 +546,11 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
let destinationWindow = null;
if (moveProperties.windowId !== null) {
destinationWindow = WindowManager.getWindow(moveProperties.windowId);
// Ignore invalid window.
if (!destinationWindow) {
return;
}
destinationWindow = WindowManager.getWindow(moveProperties.windowId);
// Ignore invalid window.
if (!destinationWindow) {
return;
}
}
/*
@ -587,11 +587,12 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
if (WindowManager.getId(tab.ownerDocument.defaultView) !== windowId) {
// If the window we are moving the tab in is different, then move the tab
// to the new window.
let newTab = gBrowser.addTab('about:blank');
let newTab = gBrowser.addTab("about:blank");
let newBrowser = gBrowser.getBrowserForTab(newTab);
gBrowser.updateBrowserRemotenessByURL(newBrowser, tab.linkedBrowser.currentURI.spec);
newBrowser.stop();
newBrowser.docShell;
// This is necessary for getter side-effects.
void newBrowser.docShell;
if (tab.pinned) {
gBrowser.pinTab(newTab);

View File

@ -6,26 +6,25 @@ add_task(function* () {
let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots");
let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:config");
gBrowser.selectedTab = tab1
gBrowser.selectedTab = tab1;
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
browser.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
var tab = tabs[0];
chrome.tabs.move(tab.id, {index: 0});
browser.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
let tab = tabs[0];
browser.tabs.move(tab.id, {index: 0});
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
browser.test.assertEq(tabs[0].url, tab.url, "should be first tab");
browser.test.notifyPass("tabs.move.single");
});
});
});
},
});
@ -36,24 +35,24 @@ add_task(function* () {
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
browser.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
tabs.sort(function(a, b) { return a.url > b.url; });
chrome.tabs.move(tabs.map(tab => tab.id), {index: 0});
chrome.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
browser.tabs.move(tabs.map(tab => tab.id), {index: 0});
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
browser.test.assertEq(tabs[0].url, "about:blank", "should be first tab");
browser.test.assertEq(tabs[1].url, "about:config", "should be second tab");
browser.test.assertEq(tabs[2].url, "about:robots", "should be third tab");
browser.test.notifyPass("tabs.move.multiple");
});
});
});
},
});
@ -63,23 +62,23 @@ add_task(function* () {
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
browser.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
var tab = tabs[0];
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
let tab = tabs[0];
// Assuming that tab.id of 12345 does not exist.
chrome.tabs.move([12345, tab.id], {index: 0});
chrome.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
browser.tabs.move([12345, tab.id], {index: 0});
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
browser.test.assertEq(tabs[0].url, tab.url, "should be first tab");
browser.test.notifyPass("tabs.move.invalid");
});
});
});
},
});
@ -89,22 +88,22 @@ add_task(function* () {
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
browser.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
var tab = tabs[0];
chrome.tabs.move(tab.id, {index: -1});
chrome.tabs.query({
lastFocusedWindow: true,
}, function(tabs) {
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
let tab = tabs[0];
browser.tabs.move(tab.id, {index: -1});
browser.tabs.query(
{ lastFocusedWindow: true },
tabs => {
browser.test.assertEq(tabs[2].url, tab.url, "should be last tab");
browser.test.notifyPass("tabs.move.last");
});
});
});
},
});

View File

@ -3,31 +3,30 @@
"use strict";
add_task(function* () {
let tab0 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
let window1 = yield BrowserTestUtils.openNewBrowserWindow();
let tab1 = yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.com/");
yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.com/");
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
chrome.tabs.query({
url: '<all_urls>',
browser.tabs.query({
url: "<all_urls>",
}, function(tabs) {
let destination = tabs[0];
let source = tabs[1]; // skip over about:blank in window1
chrome.tabs.move(source.id, {windowId: destination.windowId, index: 0});
chrome.tabs.query({
url: '<all_urls>',
}, function(tabs) {
browser.test.assertEq(tabs[0].url, "http://example.com/");
browser.test.assertEq(tabs[0].windowId, destination.windowId);
browser.test.notifyPass("tabs.move.window");
});
browser.tabs.move(source.id, {windowId: destination.windowId, index: 0});
browser.tabs.query(
{ url: "<all_urls>" },
tabs => {
browser.test.assertEq(tabs[0].url, "http://example.com/");
browser.test.assertEq(tabs[0].windowId, destination.windowId);
browser.test.notifyPass("tabs.move.window");
});
});
},
});
@ -43,31 +42,31 @@ add_task(function* () {
});
add_task(function* () {
let tab0 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
let window1 = yield BrowserTestUtils.openNewBrowserWindow();
let tab1 = yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.com/");
window1.gBrowser.pinTab(tab1);
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
chrome.tabs.query({
url: '<all_urls>',
}, function(tabs) {
let destination = tabs[0];
let source = tabs[1]; // remember, pinning moves it to the left.
chrome.tabs.move(source.id, {windowId: destination.windowId, index: 0});
browser.tabs.query(
{ url: "<all_urls>" },
tabs => {
let destination = tabs[0];
let source = tabs[1]; // remember, pinning moves it to the left.
browser.tabs.move(source.id, {windowId: destination.windowId, index: 0});
chrome.tabs.query({
url: '<all_urls>',
}, function(tabs) {
browser.test.assertEq(true, tabs[0].pinned);
browser.test.notifyPass("tabs.move.pin");
browser.tabs.query(
{ url: "<all_urls>" },
tabs => {
browser.test.assertEq(true, tabs[0].pinned);
browser.test.notifyPass("tabs.move.pin");
});
});
});
},
});
@ -83,32 +82,31 @@ add_task(function* () {
add_task(function* () {
let window1 = yield BrowserTestUtils.openNewBrowserWindow();
let tab0 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, "http://example.net/");
let tab1 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, "http://example.com/");
let tab2 = yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.net/");
let tab3 = yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.com/");
yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, "http://example.net/");
yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, "http://example.com/");
yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.net/");
yield BrowserTestUtils.openNewForegroundTab(window1.gBrowser, "http://example.com/");
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
"permissions": ["tabs"],
},
background: function() {
chrome.tabs.query({
url: '<all_urls>',
}, function(tabs) {
let move1 = tabs[1];
let move3 = tabs[3];
chrome.tabs.move([move1.id, move3.id], {index: 0});
chrome.tabs.query({
url: '<all_urls>',
}, function(tabs) {
browser.test.assertEq(tabs[0].url, move1.url);
browser.test.assertEq(tabs[2].url, move3.url);
browser.test.notifyPass("tabs.move.multiple");
browser.tabs.query(
{ url: "<all_urls>" },
tabs => {
let move1 = tabs[1];
let move3 = tabs[3];
browser.tabs.move([move1.id, move3.id], {index: 0});
browser.tabs.query(
{ url: "<all_urls>" },
tabs => {
browser.test.assertEq(tabs[0].url, move1.url);
browser.test.assertEq(tabs[2].url, move3.url);
browser.test.notifyPass("tabs.move.multiple");
});
});
});
},
});