зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c into m-i.
This commit is contained in:
Коммит
d86d2598b0
|
@ -45,6 +45,7 @@
|
|||
# Justin Dolske <dolske@mozilla.com>
|
||||
# Kathleen Brade <brade@pearlcrescent.com>
|
||||
# Mark Smith <mcs@pearlcrescent.com>
|
||||
# Kailas Patil <patilkr24@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -879,17 +880,12 @@ nsContextMenu.prototype = {
|
|||
saveDocument(this.target.ownerDocument);
|
||||
},
|
||||
|
||||
// Save URL of clicked-on link.
|
||||
saveLink: function() {
|
||||
// Helper function to wait for appropriate MIME-type headers and
|
||||
// then prompt the user with a file picker
|
||||
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc) {
|
||||
// canonical def in nsURILoader.h
|
||||
const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020;
|
||||
|
||||
var doc = this.target.ownerDocument;
|
||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||
var linkText = this.linkText();
|
||||
var linkURL = this.linkURL;
|
||||
|
||||
|
||||
// an object to proxy the data through to
|
||||
// nsIExternalHelperAppService.doContent, which will wait for the
|
||||
// appropriate MIME-type headers and then prompt the user with a
|
||||
|
@ -941,7 +937,7 @@ nsContextMenu.prototype = {
|
|||
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
||||
// do it the old fashioned way, which will pick the best filename
|
||||
// it can without waiting.
|
||||
saveURL(linkURL, linkText, null, true, false, doc.documentURIObject);
|
||||
saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject);
|
||||
}
|
||||
if (this.extListener)
|
||||
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
||||
|
@ -985,10 +981,19 @@ nsContextMenu.prototype = {
|
|||
// set up a channel to do the saving
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var channel = ioService.newChannelFromURI(this.getLinkURI());
|
||||
var channel = ioService.newChannelFromURI(makeURI(linkURL));
|
||||
channel.notificationCallbacks = new callbacks();
|
||||
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE |
|
||||
Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
|
||||
|
||||
let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
|
||||
|
||||
if (bypassCache)
|
||||
flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
|
||||
if (channel instanceof Ci.nsICachingChannel)
|
||||
flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY;
|
||||
|
||||
channel.loadFlags |= flags;
|
||||
|
||||
if (channel instanceof Ci.nsIHttpChannel) {
|
||||
channel.referrer = doc.documentURIObject;
|
||||
if (channel instanceof Ci.nsIHttpChannelInternal)
|
||||
|
@ -1006,6 +1011,14 @@ nsContextMenu.prototype = {
|
|||
channel.asyncOpen(new saveAsListener(), null);
|
||||
},
|
||||
|
||||
// Save URL of clicked-on link.
|
||||
saveLink: function() {
|
||||
var doc = this.target.ownerDocument;
|
||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||
|
||||
this.saveHelper(this.linkURL, this.linkText(), null, true, doc);
|
||||
},
|
||||
|
||||
sendLink: function() {
|
||||
// we don't know the title of the link so pass in an empty string
|
||||
MailIntegration.sendMessage( this.linkURL, "" );
|
||||
|
@ -1033,8 +1046,7 @@ nsContextMenu.prototype = {
|
|||
else if (this.onVideo || this.onAudio) {
|
||||
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
|
||||
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
|
||||
saveURL(this.mediaURL, null, dialogTitle, false,
|
||||
false, doc.documentURIObject);
|
||||
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ function GroupItem(listOfEls, options) {
|
|||
this.keepProportional = false;
|
||||
this._frozenItemSizeData = {};
|
||||
|
||||
this._onChildClose = this._onChildClose.bind(this);
|
||||
|
||||
// Variable: _activeTab
|
||||
// The <TabItem> for the groupItem's active tab.
|
||||
this._activeTab = null;
|
||||
|
@ -818,7 +820,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
let shouldRemoveTabItems = [];
|
||||
let toClose = this._children.concat();
|
||||
toClose.forEach(function(child) {
|
||||
child.removeSubscriber(self, "close");
|
||||
child.removeSubscriber("close", self._onChildClose);
|
||||
|
||||
let removed = child.close(true);
|
||||
if (removed) {
|
||||
|
@ -826,7 +828,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
} else {
|
||||
// child.removeSubscriber() must be called before child.close(),
|
||||
// therefore we call child.addSubscriber() if the tab is not removed.
|
||||
child.addSubscriber(self, "close", self._onChildClose.bind(self));
|
||||
child.addSubscriber("close", self._onChildClose);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1009,7 +1011,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
item.droppable(false);
|
||||
item.groupItemData = {};
|
||||
|
||||
item.addSubscriber(this, "close", this._onChildClose.bind(this));
|
||||
item.addSubscriber("close", this._onChildClose);
|
||||
item.setParent(this);
|
||||
|
||||
if (typeof item.setResizable == 'function')
|
||||
|
@ -1110,7 +1112,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
item.setBounds(item.getBounds(), true, {force: true});
|
||||
|
||||
item.droppable(true);
|
||||
item.removeSubscriber(this, "close");
|
||||
item.removeSubscriber("close", this._onChildClose);
|
||||
|
||||
if (typeof item.setResizable == 'function')
|
||||
item.setResizable(true, options.immediately);
|
||||
|
|
|
@ -405,10 +405,8 @@ Subscribable.prototype = {
|
|||
// ----------
|
||||
// Function: addSubscriber
|
||||
// The given callback will be called when the Subscribable fires the given event.
|
||||
// The refObject is used to facilitate removal if necessary.
|
||||
addSubscriber: function Subscribable_addSubscriber(refObject, eventName, callback) {
|
||||
addSubscriber: function Subscribable_addSubscriber(eventName, callback) {
|
||||
try {
|
||||
Utils.assertThrow(refObject, "refObject");
|
||||
Utils.assertThrow(typeof callback == "function", "callback must be a function");
|
||||
Utils.assertThrow(eventName && typeof eventName == "string",
|
||||
"eventName must be a non-empty string");
|
||||
|
@ -423,28 +421,17 @@ Subscribable.prototype = {
|
|||
if (!this.subscribers[eventName])
|
||||
this.subscribers[eventName] = [];
|
||||
|
||||
var subs = this.subscribers[eventName];
|
||||
var existing = subs.filter(function(element) {
|
||||
return element.refObject == refObject;
|
||||
});
|
||||
|
||||
if (existing.length) {
|
||||
Utils.assert(existing.length == 1, 'should only ever be one');
|
||||
existing[0].callback = callback;
|
||||
} else {
|
||||
subs.push({
|
||||
refObject: refObject,
|
||||
callback: callback
|
||||
});
|
||||
}
|
||||
let subscribers = this.subscribers[eventName];
|
||||
if (subscribers.indexOf(callback) == -1)
|
||||
subscribers.push(callback);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: removeSubscriber
|
||||
// Removes the callback associated with refObject for the given event.
|
||||
removeSubscriber: function Subscribable_removeSubscriber(refObject, eventName) {
|
||||
// Removes the subscriber associated with the event for the given callback.
|
||||
removeSubscriber: function Subscribable_removeSubscriber(eventName, callback) {
|
||||
try {
|
||||
Utils.assertThrow(refObject, "refObject");
|
||||
Utils.assertThrow(typeof callback == "function", "callback must be a function");
|
||||
Utils.assertThrow(eventName && typeof eventName == "string",
|
||||
"eventName must be a non-empty string");
|
||||
} catch(e) {
|
||||
|
@ -455,9 +442,11 @@ Subscribable.prototype = {
|
|||
if (!this.subscribers || !this.subscribers[eventName])
|
||||
return;
|
||||
|
||||
this.subscribers[eventName] = this.subscribers[eventName].filter(function(element) {
|
||||
return element.refObject != refObject;
|
||||
});
|
||||
let subscribers = this.subscribers[eventName];
|
||||
let index = subscribers.indexOf(callback);
|
||||
|
||||
if (index > -1)
|
||||
subscribers.splice(index, 1);
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -475,10 +464,10 @@ Subscribable.prototype = {
|
|||
if (!this.subscribers || !this.subscribers[eventName])
|
||||
return;
|
||||
|
||||
var subsCopy = this.subscribers[eventName].concat();
|
||||
subsCopy.forEach(function(object) {
|
||||
let subsCopy = this.subscribers[eventName].concat();
|
||||
subsCopy.forEach(function (callback) {
|
||||
try {
|
||||
object.callback(this, eventInfo);
|
||||
callback(this, eventInfo);
|
||||
} catch(e) {
|
||||
Utils.log(e);
|
||||
}
|
||||
|
|
|
@ -400,21 +400,28 @@ let UI = {
|
|||
|
||||
if (this._activeTab) {
|
||||
this._activeTab.makeDeactive();
|
||||
this._activeTab.removeSubscriber(this, "close");
|
||||
this._activeTab.removeSubscriber("close", this._onActiveTabClosed);
|
||||
}
|
||||
|
||||
this._activeTab = tabItem;
|
||||
|
||||
if (this._activeTab) {
|
||||
let self = this;
|
||||
this._activeTab.addSubscriber(this, "close", function(closedTabItem) {
|
||||
if (self._activeTab == closedTabItem)
|
||||
self._setActiveTab(null);
|
||||
});
|
||||
|
||||
this._activeTab.addSubscriber("close", this._onActiveTabClosed);
|
||||
this._activeTab.makeActive();
|
||||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: _onActiveTabClosed
|
||||
// Handles when the currently active tab gets closed.
|
||||
//
|
||||
// Parameters:
|
||||
// - the <TabItem> that is closed
|
||||
_onActiveTabClosed: function UI__onActiveTabClosed(tabItem){
|
||||
if (UI._activeTab == tabItem)
|
||||
UI._setActiveTab(null);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: setActive
|
||||
// Sets the active tab item or group item
|
||||
|
@ -438,6 +445,13 @@ let UI = {
|
|||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: clearActiveTab
|
||||
// Sets the active tab to 'null'.
|
||||
clearActiveTab: function UI_clearActiveTab() {
|
||||
this._setActiveTab(null);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: isTabViewVisible
|
||||
// Returns true if the TabView UI is currently shown.
|
||||
|
@ -470,7 +484,6 @@ let UI = {
|
|||
|
||||
var self = this;
|
||||
var currentTab = this._currentTab;
|
||||
var item = null;
|
||||
|
||||
this._reorderTabItemsOnShow.forEach(function(groupItem) {
|
||||
groupItem.reorderTabItemsBasedOnTabOrder();
|
||||
|
@ -495,7 +508,7 @@ let UI = {
|
|||
Storage.saveVisibilityData(gWindow, "true");
|
||||
|
||||
if (zoomOut && currentTab && currentTab._tabViewTabItem) {
|
||||
item = currentTab._tabViewTabItem;
|
||||
let item = currentTab._tabViewTabItem;
|
||||
// If there was a previous currentTab we want to animate
|
||||
// its thumbnail (canvas) for the zoom out.
|
||||
// Note that we start the animation on the chrome thread.
|
||||
|
@ -516,6 +529,7 @@ let UI = {
|
|||
TabItems.resumePainting();
|
||||
});
|
||||
} else {
|
||||
self.clearActiveTab();
|
||||
dispatchEvent(event);
|
||||
|
||||
// Flush pending updates
|
||||
|
|
|
@ -212,6 +212,10 @@ _BROWSER_FILES = \
|
|||
browser_clearplugindata_noage.html \
|
||||
browser_popupUI.js \
|
||||
browser_sanitizeDialog.js \
|
||||
browser_save_video.js \
|
||||
bug564387.html \
|
||||
bug564387_video1.ogv \
|
||||
bug564387_video1.ogv^headers^ \
|
||||
browser_scope.js \
|
||||
browser_selectTabAtIndex.js \
|
||||
browser_tab_dragdrop.js \
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* TestCase for bug 564387
|
||||
* <https://bugzilla.mozilla.org/show_bug.cgi?id=564387>
|
||||
*/
|
||||
function test() {
|
||||
|
||||
// --- Testing support library ---
|
||||
|
||||
// Import the toolkit test support library in the scope of the current test.
|
||||
// This operation also defines the common constants Cc, Ci, Cu, Cr and Cm.
|
||||
Components.classes["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript(
|
||||
"chrome://mochitests/content/browser/toolkit/content/tests/browser/common/_loadAll.js",
|
||||
this);
|
||||
|
||||
// --- Test implementation ---
|
||||
|
||||
const kBaseUrl =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/";
|
||||
|
||||
function pageShown(event) {
|
||||
if (event.target.location != "about:blank")
|
||||
testRunner.continueTest();
|
||||
}
|
||||
|
||||
function saveVideoAs_TestGenerator() {
|
||||
// Load Test page
|
||||
gBrowser.addEventListener("pageshow", pageShown, false);
|
||||
gBrowser.loadURI(kBaseUrl + "bug564387.html");
|
||||
yield;
|
||||
gBrowser.removeEventListener("pageshow", pageShown, false);
|
||||
|
||||
// Ensure that the window is focused.
|
||||
SimpleTest.waitForFocus(testRunner.continueTest);
|
||||
yield;
|
||||
|
||||
try {
|
||||
// get the video element
|
||||
var video1 = gBrowser.contentDocument.getElementById("video1");
|
||||
|
||||
// Synthesize the right click on the context menu, and
|
||||
// wait for it to be shown
|
||||
document.addEventListener("popupshown", testRunner.continueTest, false);
|
||||
EventUtils.synthesizeMouseAtCenter(video1,
|
||||
{ type: "contextmenu", button: 2 },
|
||||
gBrowser.contentWindow);
|
||||
yield;
|
||||
|
||||
// Create the folder the video will be saved into.
|
||||
var destDir = createTemporarySaveDirectory();
|
||||
try {
|
||||
// Call the appropriate save function defined in contentAreaUtils.js.
|
||||
mockFilePickerSettings.destDir = destDir;
|
||||
mockFilePickerSettings.filterIndex = 1; // kSaveAsType_URL
|
||||
|
||||
// register mock file picker object
|
||||
mockFilePickerRegisterer.register();
|
||||
try {
|
||||
// register mock download progress listener
|
||||
mockTransferForContinuingRegisterer.register();
|
||||
try {
|
||||
// Select "Save Video As" option from context menu
|
||||
var saveVideoCommand = document.getElementById("context-savevideo");
|
||||
saveVideoCommand.doCommand();
|
||||
|
||||
// Unregister the popupshown listener
|
||||
document.removeEventListener("popupshown",
|
||||
testRunner.continueTest, false);
|
||||
// Close the context menu
|
||||
document.getElementById("placesContext").hidePopup();
|
||||
|
||||
// Wait for the download to finish, and exit if it wasn't successful.
|
||||
var downloadSuccess = yield;
|
||||
if (!downloadSuccess)
|
||||
throw "Unexpected failure in downloading Video file!";
|
||||
}
|
||||
finally {
|
||||
// unregister download progress listener
|
||||
mockTransferForContinuingRegisterer.unregister();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// unregister mock file picker object
|
||||
mockFilePickerRegisterer.unregister();
|
||||
}
|
||||
|
||||
// Read the name of the saved file.
|
||||
var fileName = mockFilePickerResults.selectedFile.leafName;
|
||||
|
||||
is(fileName, "Bug564387-expectedName.ogv",
|
||||
"Video File Name is correctly retrieved from Content-Disposition http header");
|
||||
}
|
||||
finally {
|
||||
// Clean up the saved file.
|
||||
destDir.remove(true);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// Replace the current tab with a clean one.
|
||||
gBrowser.addTab().linkedBrowser.stop();
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
}
|
||||
|
||||
// --- Run the test ---
|
||||
testRunner.runTest(saveVideoAs_TestGenerator);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<html>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=564387 -->
|
||||
<head>
|
||||
<title> Bug 564387 test</title>
|
||||
</head>
|
||||
<body>
|
||||
Testing for Mozilla Bug: 564387
|
||||
<br>
|
||||
<video src="bug564387_video1.ogv" id="video1"> </video>
|
||||
</body>
|
||||
</html>
|
Двоичный файл не отображается.
|
@ -0,0 +1,3 @@
|
|||
Content-Disposition: filename="Bug564387-expectedName.ogv"
|
||||
Content-Type: video/ogg
|
||||
|
|
@ -149,6 +149,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug662266.js \
|
||||
browser_tabview_bug663421.js \
|
||||
browser_tabview_bug665502.js \
|
||||
browser_tabview_bug669694.js \
|
||||
browser_tabview_dragdrop.js \
|
||||
browser_tabview_exit_button.js \
|
||||
browser_tabview_expander.js \
|
||||
|
|
|
@ -58,8 +58,8 @@ function testGroups(groupItemOne, groupItemTwo, contentWindow) {
|
|||
"The first tab item in group two is active");
|
||||
|
||||
let tabItem = groupItemOne.getChild(1);
|
||||
tabItem.addSubscriber(tabItem, "tabRemoved", function() {
|
||||
tabItem.removeSubscriber(tabItem, "tabRemoved");
|
||||
tabItem.addSubscriber("tabRemoved", function onTabRemoved() {
|
||||
tabItem.removeSubscriber("tabRemoved", onTabRemoved);
|
||||
|
||||
is(groupItemOne.getChildren().length, 1,
|
||||
"The num of childen in group one is 1");
|
||||
|
@ -76,8 +76,8 @@ function testGroups(groupItemOne, groupItemTwo, contentWindow) {
|
|||
"The num of childen in group one is 2");
|
||||
|
||||
// clean up and finish
|
||||
groupItemTwo.addSubscriber(groupItemTwo, "close", function() {
|
||||
groupItemTwo.removeSubscriber(groupItemTwo, "close");
|
||||
groupItemTwo.addSubscriber("close", function onClose() {
|
||||
groupItemTwo.removeSubscriber("close", onClose);
|
||||
|
||||
gBrowser.removeTab(groupItemOne.getChild(1).tab);
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, "Has only one group");
|
||||
|
|
|
@ -46,8 +46,8 @@ function onTabViewWindowLoaded() {
|
|||
is(group.getChildren()[0].tab.linkedBrowser.contentWindow.location, secondTab.linkedBrowser.contentWindow.location, "The second tab was there first");
|
||||
is(group.getChildren()[1].tab.linkedBrowser.contentWindow.location, firstTab.linkedBrowser.contentWindow.location, "The first tab was just added and went to the end of the line");
|
||||
|
||||
group.addSubscriber(group, "close", function() {
|
||||
group.removeSubscriber(group, "close");
|
||||
group.addSubscriber("close", function onClose() {
|
||||
group.removeSubscriber("close", onClose);
|
||||
|
||||
ok(group.isEmpty(), "The group is empty again");
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ function testCloseLastGroup() {
|
|||
{ type: "click" }, groupItem.$undoContainer[0], contentWindow);
|
||||
};
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
groupItem.addSubscriber("groupHidden", function onHidden() {
|
||||
groupItem.removeSubscriber("groupHidden", onHidden);
|
||||
// it should still stay after 3 ms.
|
||||
setTimeout(checkExistence, 3);
|
||||
});
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupShown", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupShown");
|
||||
groupItem.addSubscriber("groupShown", function onShown() {
|
||||
groupItem.removeSubscriber("groupShown", onShown);
|
||||
|
||||
let endGame = function() {
|
||||
window.removeEventListener("tabviewhidden", endGame, false);
|
||||
|
|
|
@ -26,8 +26,8 @@ function onTabViewWindowLoaded() {
|
|||
ok(group1.getChildren().some(function(child) child == tab1Item), "The tab was made in our new group");
|
||||
is(group1.getChildren().length, 1, "Only one tab in the first group");
|
||||
|
||||
group1.addSubscriber(group1, "close", function() {
|
||||
group1.removeSubscriber(group1, "close");
|
||||
group1.addSubscriber("close", function onClose() {
|
||||
group1.removeSubscriber("close", onClose);
|
||||
|
||||
let onTabViewHidden = function() {
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
|
@ -45,16 +45,11 @@ function onTabViewWindowLoaded() {
|
|||
});
|
||||
});
|
||||
|
||||
group1.addSubscriber(group1, "groupHidden", function() {
|
||||
group1.removeSubscriber(group1, "groupHidden");
|
||||
|
||||
hideGroupItem(group1, function () {
|
||||
// close undo group
|
||||
let closeButton = group1.$undoContainer.find(".close");
|
||||
EventUtils.sendMouseEvent(
|
||||
{ type: "click" }, closeButton[0], contentWindow);
|
||||
});
|
||||
|
||||
// Get rid of the group and its children
|
||||
group1.closeAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ function setupTwo(win) {
|
|||
// force all canvases to update, and hook in imageData save detection
|
||||
tabItems.forEach(function(tabItem) {
|
||||
contentWindow.TabItems.update(tabItem.tab);
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function(item) {
|
||||
item.removeSubscriber(item, "savedCachedImageData");
|
||||
tabItem.addSubscriber("savedCachedImageData", function onSaved(item) {
|
||||
item.removeSubscriber("savedCachedImageData", onSaved);
|
||||
--numTabsToSave;
|
||||
});
|
||||
});
|
||||
|
@ -87,8 +87,8 @@ function setupTwo(win) {
|
|||
let count = tabItems.length;
|
||||
|
||||
tabItems.forEach(function(tabItem) {
|
||||
tabItem.addSubscriber(tabItem, "loadedCachedImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "loadedCachedImageData");
|
||||
tabItem.addSubscriber("loadedCachedImageData", function onLoaded() {
|
||||
tabItem.removeSubscriber("loadedCachedImageData", onLoaded);
|
||||
ok(tabItem.isShowingCachedData(),
|
||||
"Tab item is showing cached data and is just connected. " +
|
||||
tabItem.tab.linkedBrowser.currentURI.spec);
|
||||
|
|
|
@ -36,8 +36,8 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
function testStayOnPage(contentWindow, groupItemOne, groupItemTwo) {
|
||||
setupAndRun(contentWindow, groupItemOne, groupItemTwo, function(doc) {
|
||||
groupItemTwo.addSubscriber(groupItemTwo, "groupShown", function() {
|
||||
groupItemTwo.removeSubscriber(groupItemTwo, "groupShown");
|
||||
groupItemTwo.addSubscriber("groupShown", function onShown() {
|
||||
groupItemTwo.removeSubscriber("groupShown", onShown);
|
||||
|
||||
is(gBrowser.tabs.length, 2,
|
||||
"The total number of tab is 2 when staying on the page");
|
||||
|
@ -61,8 +61,8 @@ function testStayOnPage(contentWindow, groupItemOne, groupItemTwo) {
|
|||
function testLeavePage(contentWindow, groupItemOne, groupItemTwo) {
|
||||
setupAndRun(contentWindow, groupItemOne, groupItemTwo, function(doc) {
|
||||
// clean up and finish the test
|
||||
groupItemTwo.addSubscriber(groupItemTwo, "close", function() {
|
||||
groupItemTwo.removeSubscriber(groupItemTwo, "close");
|
||||
groupItemTwo.addSubscriber("close", function onClose() {
|
||||
groupItemTwo.removeSubscriber("close", onClose);
|
||||
|
||||
is(gBrowser.tabs.length, 1,
|
||||
"The total number of tab is 1 after leaving the page");
|
||||
|
|
|
@ -26,8 +26,8 @@ function test() {
|
|||
cw.TabItems.pausePainting();
|
||||
|
||||
groupItem.getChildren().forEach(function (tabItem) {
|
||||
tabItem.addSubscriber(tabItem, "updated", function () {
|
||||
tabItem.removeSubscriber(tabItem, "updated");
|
||||
tabItem.addSubscriber("updated", function onUpdated() {
|
||||
tabItem.removeSubscriber("updated", onUpdated);
|
||||
tabItem._testLastTabUpdateTime = tabItem._lastTabUpdateTime;
|
||||
|
||||
if (--numTabsToUpdate)
|
||||
|
|
|
@ -36,12 +36,7 @@ function test() {
|
|||
let groupItem = cw.GroupItems.groupItems[1];
|
||||
is(groupItem.getTitle(), "t", "new groupItem's title is correct");
|
||||
|
||||
groupItem.addSubscriber(groupItem, "close", function () {
|
||||
groupItem.removeSubscriber(groupItem, "close");
|
||||
executeSoon(callback);
|
||||
});
|
||||
|
||||
groupItem.closeAll();
|
||||
closeGroupItem(groupItem, callback);
|
||||
};
|
||||
|
||||
let testDragOutOfGroup = function (callback) {
|
||||
|
|
|
@ -28,8 +28,7 @@ function onTabViewWindowLoaded() {
|
|||
ok(TabView.isVisible(), "Tab View is still visible after removing a tab");
|
||||
is(groupItems[0].getChildren().length, 2, "The group has two tab items");
|
||||
|
||||
tabTwo = undoCloseTab(0);
|
||||
whenTabIsReconnected(tabTwo, function() {
|
||||
restoreTab(function (tabTwo) {
|
||||
ok(TabView.isVisible(), "Tab View is still visible after restoring a tab");
|
||||
is(groupItems[0].getChildren().length, 3, "The group still has three tab items");
|
||||
|
||||
|
@ -41,18 +40,3 @@ function onTabViewWindowLoaded() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function whenTabIsReconnected(tab, callback) {
|
||||
let tabItem = tab._tabViewTabItem;
|
||||
|
||||
if (tabItem._reconnected) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
tabItem.addSubscriber(tabItem, "reconnected", function () {
|
||||
tabItem.removeSubscriber(tabItem, "reconnected");
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -18,9 +18,7 @@ function onTabViewWindowLoaded() {
|
|||
is(gBrowser.tabs.length, 1, "There is one tab on startup");
|
||||
let groupItem = contentWindow.GroupItems.groupItems[0];
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
|
||||
hideGroupItem(groupItem, function () {
|
||||
let onTabViewHidden = function() {
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
|
@ -35,5 +33,4 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
TabView.hide();
|
||||
});
|
||||
groupItem.closeAll();
|
||||
}
|
||||
|
|
|
@ -160,13 +160,13 @@ function test() {
|
|||
|
||||
ok(groupItem.isStacked(), 'testExpandedMode: group is stacked');
|
||||
|
||||
groupItem.addSubscriber(groupItem, 'expanded', function () {
|
||||
groupItem.removeSubscriber(groupItem, 'expanded');
|
||||
groupItem.addSubscriber('expanded', function onGroupExpanded() {
|
||||
groupItem.removeSubscriber('expanded', onGroupExpanded);
|
||||
onExpanded();
|
||||
});
|
||||
|
||||
groupItem.addSubscriber(groupItem, 'collapsed', function () {
|
||||
groupItem.removeSubscriber(groupItem, 'collapsed');
|
||||
groupItem.addSubscriber('collapsed', function onGroupCollapsed() {
|
||||
groupItem.removeSubscriber('collapsed', onGroupCollapsed);
|
||||
onCollapsed();
|
||||
});
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ function onTabViewWindowLoaded(win) {
|
|||
ok(!group.shouldStack(group._children.length), "Group should not stack.");
|
||||
|
||||
// PREPARE FINISH:
|
||||
group.addSubscriber(group, "close", function() {
|
||||
group.removeSubscriber(group, "close");
|
||||
group.addSubscriber("close", function onClose() {
|
||||
group.removeSubscriber("close", onClose);
|
||||
|
||||
ok(group.isEmpty(), "The group is empty again");
|
||||
|
||||
|
@ -78,11 +78,7 @@ function onTabViewWindowLoaded(win) {
|
|||
|
||||
// Get rid of the group and its children
|
||||
// The group close will trigger a finish().
|
||||
group.addSubscriber(group, "groupHidden", function() {
|
||||
group.removeSubscriber(group, "groupHidden");
|
||||
group.closeHidden();
|
||||
});
|
||||
group.closeAll();
|
||||
closeGroupItem(group);
|
||||
}, win);
|
||||
}, win);
|
||||
}
|
||||
|
|
|
@ -20,23 +20,6 @@ function test() {
|
|||
return groupItem;
|
||||
}
|
||||
|
||||
let hideGroupItem = function (groupItem, callback) {
|
||||
groupItem.addSubscriber(groupItem, 'groupHidden', function () {
|
||||
groupItem.removeSubscriber(groupItem, 'groupHidden');
|
||||
callback();
|
||||
});
|
||||
groupItem.closeAll();
|
||||
}
|
||||
|
||||
let closeGroupItem = function (groupItem, callback) {
|
||||
afterAllTabsLoaded(function () {
|
||||
hideGroupItem(groupItem, function () {
|
||||
groupItem.closeHidden();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let tests = [];
|
||||
|
||||
let next = function () {
|
||||
|
|
|
@ -41,20 +41,6 @@ function test() {
|
|||
return createTab('about:blank');
|
||||
}
|
||||
|
||||
let restoreTab = function (callback) {
|
||||
let tab = undoCloseTab(0);
|
||||
|
||||
if (tab._tabViewTabItem._reconnected) {
|
||||
afterAllTabsLoaded(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
|
||||
afterAllTabsLoaded(callback);
|
||||
});
|
||||
}
|
||||
|
||||
let finishTest = function () {
|
||||
prefix = 'finish';
|
||||
assertValidPrerequisites();
|
||||
|
|
|
@ -39,10 +39,7 @@ function test1() {
|
|||
ok(!contentWindow.ThumbnailStorage._shouldSaveThumbnail(newTab),
|
||||
"Should not save the thumbnail for tab");
|
||||
|
||||
tabItem.addSubscriber(tabItem, "deniedToCacheImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "deniedToCacheImageData");
|
||||
test2();
|
||||
});
|
||||
whenDeniedToCacheImageData(tabItem, test2);
|
||||
tabItem.save(true);
|
||||
HttpRequestObserver.cacheControlValue = null;
|
||||
});
|
||||
|
@ -59,10 +56,7 @@ function test2() {
|
|||
ok(contentWindow.ThumbnailStorage._shouldSaveThumbnail(newTab),
|
||||
"Should save the thumbnail for tab");
|
||||
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "savedCachedImageData");
|
||||
test3();
|
||||
});
|
||||
whenSavedCachedImageData(tabItem, test3);
|
||||
tabItem.save(true);
|
||||
});
|
||||
}
|
||||
|
@ -82,11 +76,7 @@ function test3() {
|
|||
ok(contentWindow.ThumbnailStorage._shouldSaveThumbnail(newTab),
|
||||
"Should save the thumbnail for tab");
|
||||
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "savedCachedImageData");
|
||||
|
||||
test4();
|
||||
});
|
||||
whenSavedCachedImageData(tabItem, test4);
|
||||
tabItem.save(true);
|
||||
});
|
||||
}
|
||||
|
@ -104,11 +94,7 @@ function test4() {
|
|||
ok(contentWindow.ThumbnailStorage._shouldSaveThumbnail(newTab),
|
||||
"Should save the thumbnail for tab");
|
||||
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "savedCachedImageData");
|
||||
|
||||
test5();
|
||||
});
|
||||
whenSavedCachedImageData(tabItem, test5);
|
||||
tabItem.save(true);
|
||||
});
|
||||
}
|
||||
|
@ -124,9 +110,7 @@ function test5() {
|
|||
ok(!contentWindow.ThumbnailStorage._shouldSaveThumbnail(newTab),
|
||||
"Should not the thumbnail for tab");
|
||||
|
||||
tabItem.addSubscriber(tabItem, "deniedToCacheImageData", function() {
|
||||
tabItem.removeSubscriber(tabItem, "deniedToCacheImageData");
|
||||
|
||||
whenDeniedToCacheImageData(tabItem, function () {
|
||||
hideTabView(function () {
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
finish();
|
||||
|
@ -154,3 +138,17 @@ let HttpRequestObserver = {
|
|||
Services.obs.removeObserver(this, "http-on-examine-response");
|
||||
}
|
||||
};
|
||||
|
||||
function whenSavedCachedImageData(tabItem, callback) {
|
||||
tabItem.addSubscriber("savedCachedImageData", function onSaved() {
|
||||
tabItem.removeSubscriber("savedCachedImageData", onSaved);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
function whenDeniedToCacheImageData(tabItem, callback) {
|
||||
tabItem.addSubscriber("deniedToCacheImageData", function onDenied() {
|
||||
tabItem.removeSubscriber("deniedToCacheImageData", onDenied);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ function test() {
|
|||
afterAllTabsLoaded(function () {
|
||||
tabItem = tab._tabViewTabItem;
|
||||
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function () {
|
||||
tabItem.removeSubscriber(tabItem, "savedCachedImageData");
|
||||
tabItem.addSubscriber("savedCachedImageData", function onSaved() {
|
||||
tabItem.removeSubscriber("savedCachedImageData", onSaved);
|
||||
|
||||
tabItem.addSubscriber(tabItem, "loadedCachedImageData", function () {
|
||||
tabItem.removeSubscriber(tabItem, "loadedCachedImageData");
|
||||
tabItem.addSubscriber("loadedCachedImageData", function onLoaded() {
|
||||
tabItem.removeSubscriber("loadedCachedImageData", onLoaded);
|
||||
|
||||
ok(tabItem.isShowingCachedData(), 'tabItem shows cached data');
|
||||
testChangeUrlAfterReconnect();
|
||||
|
|
|
@ -28,10 +28,10 @@ function onTabViewWindowLoaded(win) {
|
|||
|
||||
function check() {
|
||||
if (groupOrTab == 'group') {
|
||||
group.removeSubscriber(group, "groupHidden", check);
|
||||
group.removeSubscriber("groupHidden", check);
|
||||
group.closeHidden();
|
||||
} else
|
||||
tab.removeSubscriber(tab, "tabRemoved", check);
|
||||
tab.removeSubscriber("tabRemoved", check);
|
||||
|
||||
is(contentWindow.GroupItems.getActiveGroupItem(), originalGroup,
|
||||
"The original group is active.");
|
||||
|
@ -42,10 +42,10 @@ function onTabViewWindowLoaded(win) {
|
|||
}
|
||||
|
||||
if (groupOrTab == 'group') {
|
||||
group.addSubscriber(group, "groupHidden", check);
|
||||
group.addSubscriber("groupHidden", check);
|
||||
group.closeAll();
|
||||
} else {
|
||||
tab.addSubscriber(tab, "tabRemoved", check);
|
||||
tab.addSubscriber("tabRemoved", check);
|
||||
tab.close();
|
||||
}
|
||||
}
|
||||
|
@ -58,4 +58,4 @@ function onTabViewWindowLoaded(win) {
|
|||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,20 +25,6 @@ function test() {
|
|||
return cw.GroupItems.groupItems[index];
|
||||
}
|
||||
|
||||
let restoreTab = function (callback) {
|
||||
let tab = undoCloseTab(0);
|
||||
|
||||
if (tab._tabViewTabItem._reconnected) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
|
||||
afterAllTabsLoaded(callback);
|
||||
});
|
||||
}
|
||||
|
||||
let activateFirstGroupItem = function () {
|
||||
let activeTabItem = getGroupItem(0).getChild(0);
|
||||
cw.GroupItems.updateActiveGroupItemAndTabBar(activeTabItem);
|
||||
|
|
|
@ -19,12 +19,7 @@ function test() {
|
|||
|
||||
// show the undo close group button
|
||||
let group = contentWindow.GroupItems.groupItems[0];
|
||||
group.closeAll();
|
||||
|
||||
group.addSubscriber(group, "groupHidden", function() {
|
||||
group.removeSubscriber(group, "groupHidden");
|
||||
restore(group.id);
|
||||
});
|
||||
hideGroupItem(group, function () restore(group.id));
|
||||
},
|
||||
function(newWin) {
|
||||
win = newWin;
|
||||
|
|
|
@ -43,13 +43,13 @@ function test() {
|
|||
}
|
||||
|
||||
let testDragOutOfExpandedStackedGroup = function () {
|
||||
groupItem.addSubscriber(groupItem, "expanded", function () {
|
||||
groupItem.removeSubscriber(groupItem, "expanded");
|
||||
groupItem.addSubscriber("expanded", function onExpanded() {
|
||||
groupItem.removeSubscriber("expanded", onExpanded);
|
||||
dragTabItem();
|
||||
});
|
||||
|
||||
groupItem.addSubscriber(groupItem, "collapsed", function () {
|
||||
groupItem.removeSubscriber(groupItem, "collapsed");
|
||||
groupItem.addSubscriber("collapsed", function onCollapsed() {
|
||||
groupItem.removeSubscriber("collapsed", onCollapsed);
|
||||
|
||||
let secondGroup = cw.GroupItems.groupItems[1];
|
||||
closeGroupItem(secondGroup, function () hideTabView(finishTest));
|
||||
|
|
|
@ -71,8 +71,8 @@ function testCreateTabAndThen(callback) {
|
|||
|
||||
registerCleanupFunction(function () gBrowser.removeTab(tab))
|
||||
|
||||
tabItem.addSubscriber(tabItem, "zoomedIn", function() {
|
||||
tabItem.removeSubscriber(tabItem, "zoomedIn");
|
||||
tabItem.addSubscriber("zoomedIn", function onZoomedIn() {
|
||||
tabItem.removeSubscriber("zoomedIn", onZoomedIn);
|
||||
|
||||
is(gBrowser.selectedTab, tab,
|
||||
"The selected tab is the same as the newly opened tab");
|
||||
|
|
|
@ -21,8 +21,8 @@ function test() {
|
|||
|
||||
cw.TabItems.pausePainting();
|
||||
|
||||
tabItem.addSubscriber(tabItem, "updated", function () {
|
||||
tabItem.removeSubscriber(tabItem, "updated");
|
||||
tabItem.addSubscriber("updated", function onUpdated() {
|
||||
tabItem.removeSubscriber("updated", onUpdated);
|
||||
ok(isIdle, "tabItem is updated only when UI is idle");
|
||||
finish();
|
||||
});
|
||||
|
|
|
@ -8,8 +8,8 @@ function test() {
|
|||
let cw = win.TabView.getContentWindow();
|
||||
let tabItem = win.gBrowser.tabs[0]._tabViewTabItem;
|
||||
|
||||
tabItem.addSubscriber(tabItem, "savedCachedImageData", function () {
|
||||
tabItem.removeSubscriber(tabItem, "savedCachedImageData");
|
||||
tabItem.addSubscriber("savedCachedImageData", function onSaved() {
|
||||
tabItem.removeSubscriber("savedCachedImageData", onSaved);
|
||||
|
||||
ok(cw.UI.isDOMWindowClosing, "dom window is closing");
|
||||
waitForFocus(finish);
|
||||
|
|
|
@ -18,8 +18,8 @@ function test() {
|
|||
ok(groupItem.isStacked(), "groupItem is now stacked");
|
||||
is(win.gBrowser.tabs.length, 5, "we have five tabs");
|
||||
|
||||
groupItem.addSubscriber(groupItem, "expanded", function onExpanded() {
|
||||
groupItem.removeSubscriber(groupItem, "expanded");
|
||||
groupItem.addSubscriber("expanded", function onExpanded() {
|
||||
groupItem.removeSubscriber("expanded", onExpanded);
|
||||
|
||||
ok(groupItem.expanded, "groupItem is expanded");
|
||||
let bounds = children[1].getBounds();
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
function onLoad(win) {
|
||||
registerCleanupFunction(function () win.close());
|
||||
|
||||
let tab = win.gBrowser.addTab();
|
||||
win.gBrowser.pinTab(tab);
|
||||
}
|
||||
|
||||
function onShow(win) {
|
||||
let tabs = win.gBrowser.tabs;
|
||||
|
||||
// zoom into normal tab
|
||||
zoomIn(tabs[1], function () {
|
||||
is(win.gBrowser.selectedTab, tabs[1], "normal tab is selected");
|
||||
|
||||
// select app tab
|
||||
win.gBrowser.selectedTab = tabs[0];
|
||||
|
||||
toggleTabView(win, function () {
|
||||
is(win.gBrowser.selectedTab, tabs[0], "app tab is selected");
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
newWindowWithTabView(onShow, onLoad);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function zoomIn(tab, callback) {
|
||||
whenTabViewIsHidden(function () {
|
||||
executeSoon(callback);
|
||||
}, tab.ownerDocument.defaultView);
|
||||
|
||||
tab._tabViewTabItem.zoomIn();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function toggleTabView(win, callback) {
|
||||
showTabView(function () {
|
||||
hideTabView(callback, win);
|
||||
}, win);
|
||||
}
|
|
@ -24,8 +24,8 @@ function onTabViewWindowLoaded() {
|
|||
let boxTwo = new contentWindow.Rect(20, 400, 300, 300);
|
||||
let groupTwo = new contentWindow.GroupItem([], { bounds: boxTwo });
|
||||
|
||||
groupOne.addSubscriber(groupOne, "childAdded", function() {
|
||||
groupOne.removeSubscriber(groupOne, "childAdded");
|
||||
groupOne.addSubscriber("childAdded", function onChildAdded() {
|
||||
groupOne.removeSubscriber("childAdded", onChildAdded);
|
||||
groupTwo.newTab();
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
|
|||
Math.round(groupTwoRectCenter.y - tabItemRectCenter.y);
|
||||
|
||||
function endGame() {
|
||||
groupTwo.removeSubscriber(groupTwo, "childAdded");
|
||||
groupTwo.removeSubscriber("childAdded", endGame);
|
||||
|
||||
is(groupOne.getChildren().length, --groupOneTabItemCount,
|
||||
"The number of children in group one is decreased by 1");
|
||||
|
@ -83,14 +83,14 @@ function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
|
|||
EventUtils.sendMouseEvent(
|
||||
{ type: "click" }, closeButton[0], contentWindow);
|
||||
};
|
||||
groupTwo.addSubscriber(groupTwo, "close", function() {
|
||||
groupTwo.removeSubscriber(groupTwo, "close");
|
||||
finish();
|
||||
groupTwo.addSubscriber("close", function onClose() {
|
||||
groupTwo.removeSubscriber("close", onClose);
|
||||
finish();
|
||||
});
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
gBrowser.selectedTab = originalTab;
|
||||
}
|
||||
groupTwo.addSubscriber(groupTwo, "childAdded", endGame);
|
||||
groupTwo.addSubscriber("childAdded", endGame);
|
||||
|
||||
simulateDragDrop(tabItem.container, offsetX, offsetY, contentWindow);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ function onTabViewWindowLoaded(win) {
|
|||
// Here, we just expand the group, click elsewhere, and make sure
|
||||
// it collapsed.
|
||||
let stage1expanded = function() {
|
||||
group.removeSubscriber("test stage 1", "expanded", stage1expanded);
|
||||
group.removeSubscriber("expanded", stage1expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
is(expander[0].style.display, "none", "The expander is hidden!");
|
||||
|
@ -60,14 +60,14 @@ function onTabViewWindowLoaded(win) {
|
|||
ok(overlay, "The expanded tray exists.");
|
||||
let $overlay = contentWindow.iQ(overlay);
|
||||
|
||||
group.addSubscriber("test stage 1", "collapsed", stage1collapsed);
|
||||
group.addSubscriber("collapsed", stage1collapsed);
|
||||
// null type means "click", for some reason...
|
||||
EventUtils.synthesizeMouse(contentWindow.document.body, 10, $overlay.bounds().bottom + 5,
|
||||
{type: null}, contentWindow);
|
||||
};
|
||||
|
||||
let stage1collapsed = function() {
|
||||
group.removeSubscriber("test stage 1", "collapsed", stage1collapsed);
|
||||
group.removeSubscriber("collapsed", stage1collapsed);
|
||||
ok(!group.expanded, "The group is no longer expanded.");
|
||||
isnot(expander[0].style.display, "none", "The expander is visible!");
|
||||
let expanderBounds = expander.bounds();
|
||||
|
@ -76,7 +76,7 @@ function onTabViewWindowLoaded(win) {
|
|||
ok(stackCenter.y < expanderBounds.center().y, "The expander is below the stack.");
|
||||
|
||||
// now, try opening it up again.
|
||||
group.addSubscriber("test stage 2", "expanded", stage2expanded);
|
||||
group.addSubscriber("expanded", stage2expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ function onTabViewWindowLoaded(win) {
|
|||
// Now make sure every child of the group shows up within this "tray", and
|
||||
// click on one of them and make sure we go into the tab and the tray collapses.
|
||||
let stage2expanded = function() {
|
||||
group.removeSubscriber("test stage 2", "expanded", stage2expanded);
|
||||
group.removeSubscriber("expanded", stage2expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
is(expander[0].style.display, "none", "The expander is hidden!");
|
||||
|
@ -132,27 +132,27 @@ function onTabViewWindowLoaded(win) {
|
|||
}
|
||||
|
||||
// okay, expand this group one last time
|
||||
group.addSubscriber("test stage 3", "expanded", stage3expanded);
|
||||
group.addSubscriber("expanded", stage3expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
}
|
||||
|
||||
// STAGE 3:
|
||||
// Ensure that stack still shows the same top item after a expand and a collapse.
|
||||
let stage3expanded = function() {
|
||||
group.removeSubscriber("test stage 3", "expanded", stage3expanded);
|
||||
group.removeSubscriber("expanded", stage3expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
let overlay = contentWindow.document.getElementById("expandedTray");
|
||||
let $overlay = contentWindow.iQ(overlay);
|
||||
|
||||
group.addSubscriber("test stage 3", "collapsed", stage3collapsed);
|
||||
group.addSubscriber("collapsed", stage3collapsed);
|
||||
// null type means "click", for some reason...
|
||||
EventUtils.synthesizeMouse(contentWindow.document.body, 10, $overlay.bounds().bottom + 5,
|
||||
{type: null}, contentWindow);
|
||||
};
|
||||
|
||||
let stage3collapsed = function() {
|
||||
group.removeSubscriber("test stage 3", "collapsed", stage3collapsed);
|
||||
group.removeSubscriber("collapsed", stage3collapsed);
|
||||
|
||||
ok(!group.expanded, "The group is no longer expanded.");
|
||||
isnot(expander[0].style.display, "none", "The expander is visible!");
|
||||
|
@ -176,7 +176,7 @@ function onTabViewWindowLoaded(win) {
|
|||
contentWindow.UI.setActive(originalTabItem);
|
||||
|
||||
// now, try opening it up again.
|
||||
group.addSubscriber("test stage 4", "expanded", stage4expanded);
|
||||
group.addSubscriber("expanded", stage4expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
};
|
||||
|
||||
|
@ -185,7 +185,7 @@ function onTabViewWindowLoaded(win) {
|
|||
// enter Panorama (i.e., zoom into this other group), and make sure we can go to
|
||||
// it and that the tray gets collapsed.
|
||||
let stage4expanded = function() {
|
||||
group.removeSubscriber("test stage 4", "expanded", stage4expanded);
|
||||
group.removeSubscriber("expanded", stage4expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
is(expander[0].style.display, "none", "The expander is hidden!");
|
||||
|
@ -231,7 +231,7 @@ function onTabViewWindowLoaded(win) {
|
|||
}
|
||||
|
||||
// get the ball rolling
|
||||
group.addSubscriber("test stage 1", "expanded", stage1expanded);
|
||||
group.addSubscriber("expanded", stage1expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
}, win);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ function testEmptyGroupItem(contentWindow) {
|
|||
is(contentWindow.GroupItems.groupItems.length, ++groupItemCount,
|
||||
"The number of groups is increased by 1");
|
||||
|
||||
emptyGroupItem.addSubscriber(emptyGroupItem, "close", function() {
|
||||
emptyGroupItem.removeSubscriber(emptyGroupItem, "close");
|
||||
emptyGroupItem.addSubscriber("close", function onClose() {
|
||||
emptyGroupItem.removeSubscriber("close", onClose);
|
||||
|
||||
// check the number of groups.
|
||||
is(contentWindow.GroupItems.groupItems.length, --groupItemCount,
|
||||
|
@ -75,12 +75,12 @@ function testGroupItemWithTabItem(contentWindow) {
|
|||
ok(tabItem, "Tab item exists");
|
||||
|
||||
let tabItemClosed = false;
|
||||
tabItem.addSubscriber(tabItem, "close", function() {
|
||||
tabItem.removeSubscriber(tabItem, "close");
|
||||
tabItem.addSubscriber("close", function onClose() {
|
||||
tabItem.removeSubscriber("close", onClose);
|
||||
tabItemClosed = true;
|
||||
});
|
||||
tabItem.addSubscriber(tabItem, "tabRemoved", function() {
|
||||
tabItem.removeSubscriber(tabItem, "tabRemoved");
|
||||
tabItem.addSubscriber("tabRemoved", function onTabRemoved() {
|
||||
tabItem.removeSubscriber("tabRemoved", onTabRemoved);
|
||||
|
||||
ok(tabItemClosed, "The tab item is closed");
|
||||
is(groupItem.getChildren().length, --tabItemCount,
|
||||
|
|
|
@ -82,8 +82,8 @@ function testEmptyGroupItem(contentWindow) {
|
|||
}
|
||||
|
||||
// Shut down
|
||||
emptyGroupItem.addSubscriber(emptyGroupItem, "close", function() {
|
||||
emptyGroupItem.removeSubscriber(emptyGroupItem, "close");
|
||||
emptyGroupItem.addSubscriber("close", function onClose() {
|
||||
emptyGroupItem.removeSubscriber("close", onClose);
|
||||
|
||||
// check the number of groups.
|
||||
is(contentWindow.GroupItems.groupItems.length, --groupItemCount,
|
||||
|
|
|
@ -46,8 +46,8 @@ function onTabViewWindowLoaded() {
|
|||
}
|
||||
|
||||
function testUndoGroup(contentWindow, groupItem) {
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
groupItem.addSubscriber("groupHidden", function onHidden() {
|
||||
groupItem.removeSubscriber("groupHidden", onHidden);
|
||||
|
||||
// check the data of the group
|
||||
let theGroupItem = contentWindow.GroupItems.groupItem(groupItem.id);
|
||||
|
@ -64,8 +64,8 @@ function testUndoGroup(contentWindow, groupItem) {
|
|||
{ type: "click" }, theGroupItem.$undoContainer[0], contentWindow);
|
||||
});
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupShown", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupShown");
|
||||
groupItem.addSubscriber("groupShown", function onShown() {
|
||||
groupItem.removeSubscriber("groupShown", onShown);
|
||||
|
||||
// check the data of the group
|
||||
let theGroupItem = contentWindow.GroupItems.groupItem(groupItem.id);
|
||||
|
@ -87,8 +87,8 @@ function testUndoGroup(contentWindow, groupItem) {
|
|||
}
|
||||
|
||||
function testCloseUndoGroup(contentWindow, groupItem) {
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function() {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
groupItem.addSubscriber("groupHidden", function onHidden() {
|
||||
groupItem.removeSubscriber("groupHidden", onHidden);
|
||||
|
||||
// check the data of the group
|
||||
let theGroupItem = contentWindow.GroupItems.groupItem(groupItem.id);
|
||||
|
@ -107,8 +107,8 @@ function testCloseUndoGroup(contentWindow, groupItem) {
|
|||
{ type: "click" }, closeButton[0], contentWindow);
|
||||
});
|
||||
|
||||
groupItem.addSubscriber(groupItem, "close", function() {
|
||||
groupItem.removeSubscriber(groupItem, "close");
|
||||
groupItem.addSubscriber("close", function onClose() {
|
||||
groupItem.removeSubscriber("close", onClose);
|
||||
|
||||
let theGroupItem = contentWindow.GroupItems.groupItem(groupItem.id);
|
||||
ok(!theGroupItem, "The group item doesn't exists");
|
||||
|
|
|
@ -45,15 +45,15 @@ function createGroupItemWithBlankTabs(win, width, height, padding, numNewTabs, a
|
|||
|
||||
// ----------
|
||||
function closeGroupItem(groupItem, callback) {
|
||||
groupItem.addSubscriber(groupItem, "close", function () {
|
||||
groupItem.removeSubscriber(groupItem, "close");
|
||||
groupItem.addSubscriber("close", function onClose() {
|
||||
groupItem.removeSubscriber("close", onClose);
|
||||
if ("function" == typeof callback)
|
||||
executeSoon(callback);
|
||||
});
|
||||
|
||||
if (groupItem.getChildren().length) {
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function () {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
groupItem.addSubscriber("groupHidden", function onHide() {
|
||||
groupItem.removeSubscriber("groupHidden", onHide);
|
||||
groupItem.closeHidden();
|
||||
});
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ function whenSearchIsEnabled(callback, win) {
|
|||
return;
|
||||
}
|
||||
|
||||
contentWindow.addEventListener("tabviewsearchenabled", function () {
|
||||
contentWindow.removeEventListener("tabviewsearchenabled", arguments.callee, false);
|
||||
contentWindow.addEventListener("tabviewsearchenabled", function onSearchEnabled() {
|
||||
contentWindow.removeEventListener("tabviewsearchenabled", onSearchEnabled, false);
|
||||
callback();
|
||||
}, false);
|
||||
}
|
||||
|
@ -238,8 +238,8 @@ function whenSearchIsDisabled(callback, win) {
|
|||
return;
|
||||
}
|
||||
|
||||
contentWindow.addEventListener("tabviewsearchdisabled", function () {
|
||||
contentWindow.removeEventListener("tabviewsearchdisabled", arguments.callee, false);
|
||||
contentWindow.addEventListener("tabviewsearchdisabled", function onSearchDisabled() {
|
||||
contentWindow.removeEventListener("tabviewsearchdisabled", onSearchDisabled, false);
|
||||
callback();
|
||||
}, false);
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ function hideGroupItem(groupItem, callback) {
|
|||
return;
|
||||
}
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupHidden", function () {
|
||||
groupItem.removeSubscriber(groupItem, "groupHidden");
|
||||
groupItem.addSubscriber("groupHidden", function onHide() {
|
||||
groupItem.removeSubscriber("groupHidden", onHide);
|
||||
callback();
|
||||
});
|
||||
groupItem.closeAll();
|
||||
|
@ -266,8 +266,8 @@ function unhideGroupItem(groupItem, callback) {
|
|||
return;
|
||||
}
|
||||
|
||||
groupItem.addSubscriber(groupItem, "groupShown", function () {
|
||||
groupItem.removeSubscriber(groupItem, "groupShown");
|
||||
groupItem.addSubscriber("groupShown", function onShown() {
|
||||
groupItem.removeSubscriber("groupShown", onShown);
|
||||
callback();
|
||||
});
|
||||
groupItem._unhide();
|
||||
|
@ -342,8 +342,8 @@ function restoreTab(callback, index, win) {
|
|||
return;
|
||||
}
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, "reconnected", function onReconnected() {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, "reconnected");
|
||||
tab._tabViewTabItem.addSubscriber("reconnected", function onReconnected() {
|
||||
tab._tabViewTabItem.removeSubscriber("reconnected", onReconnected);
|
||||
finalize();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7477,7 +7477,7 @@ else
|
|||
dnl Look for a broken crtdll.obj
|
||||
WIN32_CRTDLL_FULLPATH=`lib -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
|
||||
lib -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
|
||||
if grep -q '__imp__?free' crtdll.obj; then
|
||||
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
|
||||
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
|
||||
else
|
||||
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
|
||||
|
|
|
@ -46,4 +46,4 @@ asserts(1) load 578604-1.html # bug 584564
|
|||
asserts(3-5) load 590302-1.xhtml # bug 584564
|
||||
load 626014.xhtml
|
||||
load 639733.xhtml
|
||||
load 669767.html
|
||||
asserts(0-1) load 669767.html
|
||||
|
|
|
@ -49,10 +49,9 @@ function test() {
|
|||
|
||||
// Import the toolkit test support library in the scope of the current test.
|
||||
// This operation also defines the common constants Cc, Ci, Cu, Cr and Cm.
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
Components.classes["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript(
|
||||
rootDir + "common/_loadAll.js",
|
||||
"chrome://mochitests/content/browser/toolkit/content/tests/browser/common/_loadAll.js",
|
||||
this);
|
||||
|
||||
// --- Test implementation ---
|
||||
|
|
|
@ -47,8 +47,7 @@ const Cm = Components.manager;
|
|||
|
||||
// Execute the following code while keeping the current scope clean.
|
||||
void(function (scriptScope) {
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
const kBaseUrl = rootDir + "common/";
|
||||
const kBaseUrl = "chrome://mochitests/content/browser/toolkit/content/tests/browser/common/";
|
||||
|
||||
// If you add files here, add them to "Makefile.in" too.
|
||||
var scriptNames = [
|
||||
|
|
|
@ -158,7 +158,7 @@ nsWebHandlerApp.prototype = {
|
|||
// openURI
|
||||
browserDOMWin.openURI(uriToSend,
|
||||
null, // no window.opener
|
||||
Ci.nsIBrowserDOMWindow.OPEN_DEFAULT_WINDOW,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEW);
|
||||
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче