Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher 2016-01-28 17:50:18 -08:00
commit 969695a086
296 changed files with 872 additions and 4201 deletions

View File

@ -76,7 +76,6 @@ browser/components/translation/**
browser/extensions/pdfjs/**
browser/extensions/pocket/content/panels/js/vendor/**
browser/extensions/shumway/**
browser/fuel/**
browser/locales/**
# Ignore all of loop since it is imported from github and checked at source.

View File

@ -22,5 +22,5 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
to fix another bustage from bug 1069556 landing;
Bug 1237983 - Investigate and remove the Bagheera Client implementation.

View File

@ -247,7 +247,6 @@
@RESPATH@/components/filepicker.xpt
#endif
@RESPATH@/components/find.xpt
@RESPATH@/components/fuel.xpt
@RESPATH@/components/gfx.xpt
@RESPATH@/components/hal.xpt
@RESPATH@/components/html5.xpt
@ -400,8 +399,6 @@
@RESPATH@/components/BrowserFeeds.manifest
@RESPATH@/components/FeedConverter.js
@RESPATH@/components/FeedWriter.js
@RESPATH@/components/fuelApplication.manifest
@RESPATH@/components/fuelApplication.js
@RESPATH@/components/WebContentConverter.js
@RESPATH@/components/BrowserComponents.manifest
@RESPATH@/components/nsBrowserContentHandler.js

View File

@ -1119,6 +1119,9 @@ pref("toolkit.crashreporter.infoURL",
// base URL for web-based support pages
pref("app.support.baseURL", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/");
// a11y conflicts with e10s support page
pref("app.support.e10sAccessibilityUrl", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/accessibility-ppt");
// base url for web-based feedback pages
#ifdef MOZ_DEV_EDITION
pref("app.feedback.baseURL", "https://input.mozilla.org/%LOCALE%/feedback/firefoxdev/%VERSION%/");
@ -1472,7 +1475,7 @@ pref("identity.fxaccounts.remote.webchannel.uri", "https://accounts.firefox.com/
// The URL we take the user to when they opt to "manage" their Firefox Account.
// Note that this will always need to be in the same TLD as the
// "identity.fxaccounts.remote.signup.uri" pref.
pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings");
pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings?service=sync&context=fx_desktop_v3");
// The remote URL of the FxA Profile Server
pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1");
@ -1543,8 +1546,6 @@ pref("browser.translation.engine", "bing");
// Telemetry settings.
// Determines if Telemetry pings can be archived locally.
pref("toolkit.telemetry.archive.enabled", true);
// Whether we enable opt-out Telemetry for a sample of the release population.
pref("toolkit.telemetry.optoutSample", true);
// Telemetry experiments settings.
pref("experiments.enabled", true);

View File

@ -12,11 +12,7 @@ Cu.import("resource://gre/modules/Services.jsm");
const prefs = new Preferences("datareporting.healthreport.");
const PREF_UNIFIED = "toolkit.telemetry.unified";
const PREF_UNIFIED_OPTIN = "toolkit.telemetry.unifiedIsOptIn";
// Whether v4 behavior is enabled, i.e. unified Telemetry features are on by default.
const IS_V4 = Preferences.get(PREF_UNIFIED, false) &&
!Preferences.get(PREF_UNIFIED_OPTIN, false);
const PREF_REPORTING_URL = "datareporting.healthreport.about.reportUrl";
var healthReportWrapper = {
init: function () {
@ -31,9 +27,7 @@ var healthReportWrapper = {
},
_getReportURI: function () {
const pref = IS_V4 ? "datareporting.healthreport.about.reportUrl"
: "datareporting.healthreport.about.reportUrlUnified";
let url = Services.urlFormatter.formatURLPref(pref);
let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
return Services.io.newURI(url, null, null);
},

View File

@ -14,7 +14,6 @@ const TELEMETRY_LOG_PREF = "toolkit.telemetry.log.level";
const telemetryOriginalLogPref = Preferences.get(TELEMETRY_LOG_PREF, null);
const originalReportUrl = Services.prefs.getCharPref("datareporting.healthreport.about.reportUrl");
const originalReportUrlUnified = Services.prefs.getCharPref("datareporting.healthreport.about.reportUrlUnified");
registerCleanupFunction(function() {
// Ensure we don't pollute prefs for next tests.
@ -26,7 +25,6 @@ registerCleanupFunction(function() {
try {
Services.prefs.setCharPref("datareporting.healthreport.about.reportUrl", originalReportUrl);
Services.prefs.setCharPref("datareporting.healthreport.about.reportUrlUnified", originalReportUrlUnified);
Services.prefs.setBoolPref("datareporting.healthreport.uploadEnabled", true);
} catch (ex) {}
});
@ -69,8 +67,6 @@ var gTests = [
yield setupPingArchive();
Preferences.set("datareporting.healthreport.about.reportUrl",
HTTPS_BASE + "healthreport_testRemoteCommands.html");
Preferences.set("datareporting.healthreport.about.reportUrlUnified",
HTTPS_BASE + "healthreport_testRemoteCommands.html");
}),
run: function (iframe)
{

View File

@ -3215,7 +3215,7 @@ var E10SAccessibilityCheck = {
}];
let options = {
popupIconURL: "chrome://browser/skin/e10s-64@2x.png",
learnMoreURL: "https://support.mozilla.org/kb/accessibility-and-ppt",
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.e10sAccessibilityUrl"),
persistWhileVisible: true,
hideNotNow: true,
};

View File

@ -1,823 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Ci = Components.interfaces;
const Cc = Components.classes;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66");
const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1";
//=================================================
// Singleton that holds services and utilities
var Utilities = {
get bookmarks() {
let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
this.__defineGetter__("bookmarks", () => bookmarks);
return this.bookmarks;
},
get bookmarksObserver() {
let bookmarksObserver = new BookmarksObserver();
this.__defineGetter__("bookmarksObserver", () => bookmarksObserver);
return this.bookmarksObserver;
},
get annotations() {
let annotations = Cc["@mozilla.org/browser/annotation-service;1"].
getService(Ci.nsIAnnotationService);
this.__defineGetter__("annotations", () => annotations);
return this.annotations;
},
get history() {
let history = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
this.__defineGetter__("history", () => history);
return this.history;
},
get windowMediator() {
let windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
this.__defineGetter__("windowMediator", () => windowMediator);
return this.windowMediator;
},
makeURI: function fuelutil_makeURI(aSpec) {
if (!aSpec)
return null;
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
return ios.newURI(aSpec, null, null);
},
free: function fuelutil_free() {
delete this.bookmarks;
delete this.bookmarksObserver;
delete this.annotations;
delete this.history;
delete this.windowMediator;
}
};
//=================================================
// Window implementation
var fuelWindowMap = new WeakMap();
function getWindow(aWindow) {
let fuelWindow = fuelWindowMap.get(aWindow);
if (!fuelWindow) {
fuelWindow = new Window(aWindow);
fuelWindowMap.set(aWindow, fuelWindow);
}
return fuelWindow;
}
// Don't call new Window() directly; use getWindow instead.
function Window(aWindow) {
this._window = aWindow;
this._events = new Events();
this._watch("TabOpen");
this._watch("TabMove");
this._watch("TabClose");
this._watch("TabSelect");
}
Window.prototype = {
get events() {
return this._events;
},
get _tabbrowser() {
return this._window.gBrowser;
},
/*
* Helper used to setup event handlers on the XBL element. Note that the events
* are actually dispatched to tabs, so we capture them.
*/
_watch: function win_watch(aType) {
this._tabbrowser.tabContainer.addEventListener(aType, this,
/* useCapture = */ true);
},
handleEvent: function win_handleEvent(aEvent) {
this._events.dispatch(aEvent.type, getBrowserTab(this, aEvent.originalTarget.linkedBrowser));
},
get tabs() {
var tabs = [];
var browsers = this._tabbrowser.browsers;
for (var i=0; i<browsers.length; i++)
tabs.push(getBrowserTab(this, browsers[i]));
return tabs;
},
get activeTab() {
return getBrowserTab(this, this._tabbrowser.selectedBrowser);
},
open: function win_open(aURI) {
return getBrowserTab(this, this._tabbrowser.addTab(aURI.spec).linkedBrowser);
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIWindow])
};
//=================================================
// BrowserTab implementation
var fuelBrowserTabMap = new WeakMap();
function getBrowserTab(aFUELWindow, aBrowser) {
let fuelBrowserTab = fuelBrowserTabMap.get(aBrowser);
if (!fuelBrowserTab) {
fuelBrowserTab = new BrowserTab(aFUELWindow, aBrowser);
fuelBrowserTabMap.set(aBrowser, fuelBrowserTab);
}
else {
// This tab may have moved to another window, so make sure its cached
// window is up-to-date.
fuelBrowserTab._window = aFUELWindow;
}
return fuelBrowserTab;
}
// Don't call new BrowserTab() directly; call getBrowserTab instead.
function BrowserTab(aFUELWindow, aBrowser) {
this._window = aFUELWindow;
this._browser = aBrowser;
this._events = new Events();
this._watch("load");
}
BrowserTab.prototype = {
get _tabbrowser() {
return this._window._tabbrowser;
},
get uri() {
return this._browser.currentURI;
},
get index() {
var tabs = this._tabbrowser.tabs;
for (var i=0; i<tabs.length; i++) {
if (tabs[i].linkedBrowser == this._browser)
return i;
}
return -1;
},
get events() {
return this._events;
},
get window() {
return this._window;
},
get document() {
return this._browser.contentDocument;
},
/*
* Helper used to setup event handlers on the XBL element
*/
_watch: function bt_watch(aType) {
this._browser.addEventListener(aType, this,
/* useCapture = */ true);
},
handleEvent: function bt_handleEvent(aEvent) {
if (aEvent.type == "load") {
if (!(aEvent.originalTarget instanceof Ci.nsIDOMDocument))
return;
if (aEvent.originalTarget.defaultView instanceof Ci.nsIDOMWindow &&
aEvent.originalTarget.defaultView.frameElement)
return;
}
this._events.dispatch(aEvent.type, this);
},
/*
* Helper used to determine the index offset of the browsertab
*/
_getTab: function bt_gettab() {
var tabs = this._tabbrowser.tabs;
return tabs[this.index] || null;
},
load: function bt_load(aURI) {
this._browser.loadURI(aURI.spec, null, null);
},
focus: function bt_focus() {
this._tabbrowser.selectedTab = this._getTab();
this._tabbrowser.focus();
},
close: function bt_close() {
this._tabbrowser.removeTab(this._getTab());
},
moveBefore: function bt_movebefore(aBefore) {
this._tabbrowser.moveTabTo(this._getTab(), aBefore.index);
},
moveToEnd: function bt_moveend() {
this._tabbrowser.moveTabTo(this._getTab(), this._tabbrowser.browsers.length);
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIBrowserTab])
};
//=================================================
// Annotations implementation
function Annotations(aId) {
this._id = aId;
}
Annotations.prototype = {
get names() {
return Utilities.annotations.getItemAnnotationNames(this._id);
},
has: function ann_has(aName) {
return Utilities.annotations.itemHasAnnotation(this._id, aName);
},
get: function ann_get(aName) {
if (this.has(aName))
return Utilities.annotations.getItemAnnotation(this._id, aName);
return null;
},
set: function ann_set(aName, aValue, aExpiration) {
Utilities.annotations.setItemAnnotation(this._id, aName, aValue, 0, aExpiration);
},
remove: function ann_remove(aName) {
if (aName)
Utilities.annotations.removeItemAnnotation(this._id, aName);
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIAnnotations])
};
//=================================================
// BookmarksObserver implementation (internal class)
//
// BookmarksObserver is a global singleton which watches the browser's
// bookmarks and sends you events when things change.
//
// You can register three different kinds of event listeners on
// BookmarksObserver, using addListener, addFolderListener, and
// addRootlistener.
//
// - addListener(aId, aEvent, aListener) lets you listen to a specific
// bookmark. You can listen to the "change", "move", and "remove" events.
//
// - addFolderListener(aId, aEvent, aListener) lets you listen to a specific
// bookmark folder. You can listen to "addchild" and "removechild".
//
// - addRootListener(aEvent, aListener) lets you listen to the root bookmark
// node. This lets you hear "add", "remove", and "change" events on all
// bookmarks.
//
function BookmarksObserver() {
this._eventsDict = {};
this._folderEventsDict = {};
this._rootEvents = new Events();
Utilities.bookmarks.addObserver(this, /* ownsWeak = */ true);
}
BookmarksObserver.prototype = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onItemVisited: function () {},
onItemAdded: function bo_onItemAdded(aId, aFolder, aIndex, aItemType, aURI) {
this._rootEvents.dispatch("add", aId);
this._dispatchToEvents("addchild", aId, this._folderEventsDict[aFolder]);
},
onItemRemoved: function bo_onItemRemoved(aId, aFolder, aIndex) {
this._rootEvents.dispatch("remove", aId);
this._dispatchToEvents("remove", aId, this._eventsDict[aId]);
this._dispatchToEvents("removechild", aId, this._folderEventsDict[aFolder]);
},
onItemChanged: function bo_onItemChanged(aId, aProperty, aIsAnnotationProperty, aValue) {
this._rootEvents.dispatch("change", aProperty);
this._dispatchToEvents("change", aProperty, this._eventsDict[aId]);
},
onItemMoved: function bo_onItemMoved(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
this._dispatchToEvents("move", aId, this._eventsDict[aId]);
},
_dispatchToEvents: function bo_dispatchToEvents(aEvent, aData, aEvents) {
if (aEvents) {
aEvents.dispatch(aEvent, aData);
}
},
_addListenerToDict: function bo_addListenerToDict(aId, aEvent, aListener, aDict) {
var events = aDict[aId];
if (!events) {
events = new Events();
aDict[aId] = events;
}
events.addListener(aEvent, aListener);
},
_removeListenerFromDict: function bo_removeListenerFromDict(aId, aEvent, aListener, aDict) {
var events = aDict[aId];
if (!events) {
return;
}
events.removeListener(aEvent, aListener);
if (events._listeners.length == 0) {
delete aDict[aId];
}
},
addListener: function bo_addListener(aId, aEvent, aListener) {
this._addListenerToDict(aId, aEvent, aListener, this._eventsDict);
},
removeListener: function bo_removeListener(aId, aEvent, aListener) {
this._removeListenerFromDict(aId, aEvent, aListener, this._eventsDict);
},
addFolderListener: function addFolderListener(aId, aEvent, aListener) {
this._addListenerToDict(aId, aEvent, aListener, this._folderEventsDict);
},
removeFolderListener: function removeFolderListener(aId, aEvent, aListener) {
this._removeListenerFromDict(aId, aEvent, aListener, this._folderEventsDict);
},
addRootListener: function addRootListener(aEvent, aListener) {
this._rootEvents.addListener(aEvent, aListener);
},
removeRootListener: function removeRootListener(aEvent, aListener) {
this._rootEvents.removeListener(aEvent, aListener);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver,
Ci.nsISupportsWeakReference])
};
//=================================================
// Bookmark implementation
//
// Bookmark event listeners are stored in BookmarksObserver, not in the
// Bookmark objects themselves. Thus, you don't have to hold on to a Bookmark
// object in order for your event listener to stay valid, and Bookmark objects
// not kept alive by the extension can be GC'ed.
//
// A consequence of this is that if you have two different Bookmark objects x
// and y for the same bookmark (i.e., x != y but x.id == y.id), and you do
//
// x.addListener("foo", fun);
// y.removeListener("foo", fun);
//
// the second line will in fact remove the listener added in the first line.
//
function Bookmark(aId, aParent, aType) {
this._id = aId;
this._parent = aParent;
this._type = aType || "bookmark";
this._annotations = new Annotations(this._id);
// Our _events object forwards to bookmarksObserver.
var self = this;
this._events = {
addListener: function bookmarkevents_al(aEvent, aListener) {
Utilities.bookmarksObserver.addListener(self._id, aEvent, aListener);
},
removeListener: function bookmarkevents_rl(aEvent, aListener) {
Utilities.bookmarksObserver.removeListener(self._id, aEvent, aListener);
},
QueryInterface: XPCOMUtils.generateQI([Ci.extIEvents])
};
// For our onItemMoved listener, which updates this._parent.
Utilities.bookmarks.addObserver(this, /* ownsWeak = */ true);
}
Bookmark.prototype = {
get id() {
return this._id;
},
get title() {
return Utilities.bookmarks.getItemTitle(this._id);
},
set title(aTitle) {
Utilities.bookmarks.setItemTitle(this._id, aTitle);
},
get uri() {
return Utilities.bookmarks.getBookmarkURI(this._id);
},
set uri(aURI) {
return Utilities.bookmarks.changeBookmarkURI(this._id, aURI);
},
get description() {
return this._annotations.get("bookmarkProperties/description");
},
set description(aDesc) {
this._annotations.set("bookmarkProperties/description", aDesc, Ci.nsIAnnotationService.EXPIRE_NEVER);
},
get keyword() {
return Utilities.bookmarks.getKeywordForBookmark(this._id);
},
set keyword(aKeyword) {
Utilities.bookmarks.setKeywordForBookmark(this._id, aKeyword);
},
get type() {
return this._type;
},
get parent() {
return this._parent;
},
set parent(aFolder) {
Utilities.bookmarks.moveItem(this._id, aFolder.id, Utilities.bookmarks.DEFAULT_INDEX);
// this._parent is updated in onItemMoved
},
get annotations() {
return this._annotations;
},
get events() {
return this._events;
},
remove : function bm_remove() {
Utilities.bookmarks.removeItem(this._id);
},
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onItemAdded: function () {},
onItemVisited: function () {},
onItemRemoved: function () {},
onItemChanged: function () {},
onItemMoved: function(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
if (aId == this._id) {
this._parent = new BookmarkFolder(aNewParent, Utilities.bookmarks.getFolderIdForItem(aNewParent));
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIBookmark,
Ci.nsINavBookmarkObserver,
Ci.nsISupportsWeakReference])
};
//=================================================
// BookmarkFolder implementation
//
// As with Bookmark, events on BookmarkFolder are handled by the
// BookmarksObserver singleton.
//
function BookmarkFolder(aId, aParent) {
this._id = aId;
this._parent = aParent;
this._annotations = new Annotations(this._id);
// Our event listeners are handled by the BookmarksObserver singleton. This
// is a bit complicated because there are three different kinds of events we
// might want to listen to here:
//
// - If this._parent is null, we're the root bookmark folder, and all our
// listeners should be root listeners.
//
// - Otherwise, events ending with "child" (addchild, removechild) are
// handled by a folder listener.
//
// - Other events are handled by a vanilla bookmark listener.
var self = this;
this._events = {
addListener: function bmfevents_al(aEvent, aListener) {
if (self._parent) {
if (/child$/.test(aEvent)) {
Utilities.bookmarksObserver.addFolderListener(self._id, aEvent, aListener);
}
else {
Utilities.bookmarksObserver.addListener(self._id, aEvent, aListener);
}
}
else {
Utilities.bookmarksObserver.addRootListener(aEvent, aListener);
}
},
removeListener: function bmfevents_rl(aEvent, aListener) {
if (self._parent) {
if (/child$/.test(aEvent)) {
Utilities.bookmarksObserver.removeFolderListener(self._id, aEvent, aListener);
}
else {
Utilities.bookmarksObserver.removeListener(self._id, aEvent, aListener);
}
}
else {
Utilities.bookmarksObserver.removeRootListener(aEvent, aListener);
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.extIEvents])
};
// For our onItemMoved listener, which updates this._parent.
Utilities.bookmarks.addObserver(this, /* ownsWeak = */ true);
}
BookmarkFolder.prototype = {
get id() {
return this._id;
},
get title() {
return Utilities.bookmarks.getItemTitle(this._id);
},
set title(aTitle) {
Utilities.bookmarks.setItemTitle(this._id, aTitle);
},
get description() {
return this._annotations.get("bookmarkProperties/description");
},
set description(aDesc) {
this._annotations.set("bookmarkProperties/description", aDesc, Ci.nsIAnnotationService.EXPIRE_NEVER);
},
get type() {
return "folder";
},
get parent() {
return this._parent;
},
set parent(aFolder) {
Utilities.bookmarks.moveItem(this._id, aFolder.id, Utilities.bookmarks.DEFAULT_INDEX);
// this._parent is updated in onItemMoved
},
get annotations() {
return this._annotations;
},
get events() {
return this._events;
},
get children() {
var items = [];
var options = Utilities.history.getNewQueryOptions();
var query = Utilities.history.getNewQuery();
query.setFolders([this._id], 1);
var result = Utilities.history.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
for (var i=0; i<cc; ++i) {
var node = rootNode.getChild(i);
if (node.type == node.RESULT_TYPE_FOLDER) {
var folder = new BookmarkFolder(node.itemId, this._id);
items.push(folder);
}
else if (node.type == node.RESULT_TYPE_SEPARATOR) {
var separator = new Bookmark(node.itemId, this._id, "separator");
items.push(separator);
}
else {
var bookmark = new Bookmark(node.itemId, this._id, "bookmark");
items.push(bookmark);
}
}
rootNode.containerOpen = false;
return items;
},
addBookmark: function bmf_addbm(aTitle, aUri) {
var newBookmarkID = Utilities.bookmarks.insertBookmark(this._id, aUri, Utilities.bookmarks.DEFAULT_INDEX, aTitle);
var newBookmark = new Bookmark(newBookmarkID, this, "bookmark");
return newBookmark;
},
addSeparator: function bmf_addsep() {
var newBookmarkID = Utilities.bookmarks.insertSeparator(this._id, Utilities.bookmarks.DEFAULT_INDEX);
var newBookmark = new Bookmark(newBookmarkID, this, "separator");
return newBookmark;
},
addFolder: function bmf_addfolder(aTitle) {
var newFolderID = Utilities.bookmarks.createFolder(this._id, aTitle, Utilities.bookmarks.DEFAULT_INDEX);
var newFolder = new BookmarkFolder(newFolderID, this);
return newFolder;
},
remove: function bmf_remove() {
Utilities.bookmarks.removeItem(this._id);
},
// observer
onBeginUpdateBatch: function () {},
onEndUpdateBatch : function () {},
onItemAdded : function () {},
onItemRemoved : function () {},
onItemChanged : function () {},
onItemMoved: function bf_onItemMoved(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
if (this._id == aId) {
this._parent = new BookmarkFolder(aNewParent, Utilities.bookmarks.getFolderIdForItem(aNewParent));
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIBookmarkFolder,
Ci.nsINavBookmarkObserver,
Ci.nsISupportsWeakReference])
};
//=================================================
// BookmarkRoots implementation
function BookmarkRoots() {
}
BookmarkRoots.prototype = {
get menu() {
if (!this._menu)
this._menu = new BookmarkFolder(Utilities.bookmarks.bookmarksMenuFolder, null);
return this._menu;
},
get toolbar() {
if (!this._toolbar)
this._toolbar = new BookmarkFolder(Utilities.bookmarks.toolbarFolder, null);
return this._toolbar;
},
get tags() {
if (!this._tags)
this._tags = new BookmarkFolder(Utilities.bookmarks.tagsFolder, null);
return this._tags;
},
get unfiled() {
if (!this._unfiled)
this._unfiled = new BookmarkFolder(Utilities.bookmarks.unfiledBookmarksFolder, null);
return this._unfiled;
},
QueryInterface: XPCOMUtils.generateQI([Ci.fuelIBookmarkRoots])
};
//=================================================
// Factory - Treat Application as a singleton
// XXX This is required, because we're registered for the 'JavaScript global
// privileged property' category, whose handler always calls createInstance.
// See bug 386535.
var gSingleton = null;
var ApplicationFactory = {
createInstance: function af_ci(aOuter, aIID) {
if (aOuter != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
if (gSingleton == null) {
gSingleton = new Application();
}
return gSingleton.QueryInterface(aIID);
}
};
#include ../../toolkit/components/exthelper/extApplication.js
//=================================================
// Application constructor
function Application() {
Deprecated.warning("FUEL is deprecated, you should use the add-on SDK instead.",
"https://developer.mozilla.org/Add-ons/SDK/");
this.initToolkitHelpers();
}
//=================================================
// Application implementation
function ApplicationPrototype() {
// for nsIClassInfo + XPCOMUtils
this.classID = APPLICATION_CID;
// redefine the default factory for XPCOMUtils
this._xpcom_factory = ApplicationFactory;
// for nsISupports
this.QueryInterface = XPCOMUtils.generateQI([
Ci.fuelIApplication,
Ci.extIApplication,
Ci.nsIObserver,
Ci.nsISupportsWeakReference
]);
// for nsIClassInfo
this.classInfo = XPCOMUtils.generateCI({
classID: APPLICATION_CID,
contractID: APPLICATION_CONTRACTID,
interfaces: [
Ci.fuelIApplication,
Ci.extIApplication,
Ci.nsIObserver
],
flags: Ci.nsIClassInfo.SINGLETON
});
// for nsIObserver
this.observe = function (aSubject, aTopic, aData) {
// Call the extApplication version of this function first
var superPrototype = Object.getPrototypeOf(Object.getPrototypeOf(this));
superPrototype.observe.call(this, aSubject, aTopic, aData);
if (aTopic == "xpcom-shutdown") {
this._obs.removeObserver(this, "xpcom-shutdown");
Utilities.free();
}
};
Object.defineProperty(this, "bookmarks", {
get: function bookmarks () {
let bookmarks = new BookmarkRoots();
Object.defineProperty(this, "bookmarks", { value: bookmarks });
return this.bookmarks;
},
enumerable: true,
configurable: true
});
Object.defineProperty(this, "windows", {
get: function windows() {
var win = [];
var browserEnum = Utilities.windowMediator.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements())
win.push(getWindow(browserEnum.getNext()));
return win;
},
enumerable: true,
configurable: true
});
Object.defineProperty(this, "activeWindow", {
get: () => getWindow(Utilities.windowMediator.getMostRecentWindow("navigator:browser")),
enumerable: true,
configurable: true
});
};
// set the proto, defined in extApplication.js
ApplicationPrototype.prototype = extApplication.prototype;
Application.prototype = new ApplicationPrototype();
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Application]);

View File

@ -1,3 +0,0 @@
component {fe74cf80-aa2d-11db-abbd-0800200c9a66} fuelApplication.js
contract @mozilla.org/fuel/application;1 {fe74cf80-aa2d-11db-abbd-0800200c9a66}
category JavaScript-global-privileged-property Application @mozilla.org/fuel/application;1

View File

@ -1,347 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "extIApplication.idl"
interface nsIVariant;
interface nsIURI;
interface nsIDOMHTMLDocument;
interface fuelIBookmarkFolder;
interface fuelIBrowserTab;
/**
* Interface representing a collection of annotations associated
* with a bookmark or bookmark folder.
*/
[scriptable, uuid(335c9292-91a1-4ca0-ad0b-07d5f63ed6cd)]
interface fuelIAnnotations : nsISupports
{
/**
* Array of the annotation names associated with the owning item
*/
readonly attribute nsIVariant names;
/**
* Determines if an annotation exists with the given name.
* @param aName
* The name of the annotation
* @returns true if an annotation exists with the given name,
* false otherwise.
*/
boolean has(in AString aName);
/**
* Gets the value of an annotation with the given name.
* @param aName
* The name of the annotation
* @returns A variant containing the value of the annotation. Supports
* string, boolean and number.
*/
nsIVariant get(in AString aName);
/**
* Sets the value of an annotation with the given name.
* @param aName
* The name of the annotation
* @param aValue
* The new value of the annotation. Supports string, boolean
* and number
* @param aExpiration
* The expiration policy for the annotation.
* See nsIAnnotationService.
*/
void set(in AString aName, in nsIVariant aValue, in int32_t aExpiration);
/**
* Removes the named annotation from the owner item.
* @param aName
* The name of annotation.
*/
void remove(in AString aName);
};
/**
* Interface representing a bookmark item.
*/
[scriptable, uuid(808585b6-7568-4b26-8c62-545221bf2b8c)]
interface fuelIBookmark : nsISupports
{
/**
* The id of the bookmark.
*/
readonly attribute long long id;
/**
* The title of the bookmark.
*/
attribute AString title;
/**
* The uri of the bookmark.
*/
attribute nsIURI uri;
/**
* The description of the bookmark.
*/
attribute AString description;
/**
* The keyword associated with the bookmark.
*/
attribute AString keyword;
/**
* The type of the bookmark.
* values: "bookmark", "separator"
*/
readonly attribute AString type;
/**
* The parent folder of the bookmark.
*/
attribute fuelIBookmarkFolder parent;
/**
* The annotations object for the bookmark.
*/
readonly attribute fuelIAnnotations annotations;
/**
* The events object for the bookmark.
* supports: "remove", "change", "visit", "move"
*/
readonly attribute extIEvents events;
/**
* Removes the item from the parent folder. Used to
* delete a bookmark or separator
*/
void remove();
};
/**
* Interface representing a bookmark folder. Folders
* can hold bookmarks, separators and other folders.
*/
[scriptable, uuid(9f42fe20-52de-4a55-8632-a459c7716aa0)]
interface fuelIBookmarkFolder : nsISupports
{
/**
* The id of the folder.
*/
readonly attribute long long id;
/**
* The title of the folder.
*/
attribute AString title;
/**
* The description of the folder.
*/
attribute AString description;
/**
* The type of the folder.
* values: "folder"
*/
readonly attribute AString type;
/**
* The parent folder of the folder.
*/
attribute fuelIBookmarkFolder parent;
/**
* The annotations object for the folder.
*/
readonly attribute fuelIAnnotations annotations;
/**
* The events object for the folder.
* supports: "add", "addchild", "remove", "removechild", "change", "move"
*/
readonly attribute extIEvents events;
/**
* Array of all bookmarks, separators and folders contained
* in this folder.
*/
readonly attribute nsIVariant children;
/**
* Adds a new child bookmark to this folder.
* @param aTitle
* The title of bookmark.
* @param aURI
* The uri of bookmark.
*/
fuelIBookmark addBookmark(in AString aTitle, in nsIURI aURI);
/**
* Adds a new child separator to this folder.
*/
fuelIBookmark addSeparator();
/**
* Adds a new child folder to this folder.
* @param aTitle
* The title of folder.
*/
fuelIBookmarkFolder addFolder(in AString aTitle);
/**
* Removes the folder from the parent folder.
*/
void remove();
};
/**
* Interface representing a container for bookmark roots. Roots
* are the top level parents for the various types of bookmarks in the system.
*/
[scriptable, uuid(c9a80870-eb3c-11dc-95ff-0800200c9a66)]
interface fuelIBookmarkRoots : nsISupports
{
/**
* The folder for the 'bookmarks menu' root.
*/
readonly attribute fuelIBookmarkFolder menu;
/**
* The folder for the 'personal toolbar' root.
*/
readonly attribute fuelIBookmarkFolder toolbar;
/**
* The folder for the 'tags' root.
*/
readonly attribute fuelIBookmarkFolder tags;
/**
* The folder for the 'unfiled bookmarks' root.
*/
readonly attribute fuelIBookmarkFolder unfiled;
};
/**
* Interface representing a browser window.
*/
[scriptable, uuid(207edb28-eb5e-424e-a862-b0e97C8de866)]
interface fuelIWindow : nsISupports
{
/**
* A collection of browser tabs within the browser window.
*/
readonly attribute nsIVariant tabs;
/**
* The currently-active tab within the browser window.
*/
readonly attribute fuelIBrowserTab activeTab;
/**
* Open a new browser tab, pointing to the specified URI.
* @param aURI
* The uri to open the browser tab to
*/
fuelIBrowserTab open(in nsIURI aURI);
/**
* The events object for the browser window.
* supports: "TabOpen", "TabClose", "TabMove", "TabSelect"
*/
readonly attribute extIEvents events;
};
/**
* Interface representing a browser tab.
*/
[scriptable, uuid(3073ceff-777c-41ce-9ace-ab37268147c1)]
interface fuelIBrowserTab : nsISupports
{
/**
* The current uri of this tab.
*/
readonly attribute nsIURI uri;
/**
* The current index of this tab in the browser window.
*/
readonly attribute int32_t index;
/**
* The browser window that is holding the tab.
*/
readonly attribute fuelIWindow window;
/**
* The content document of the browser tab.
*/
readonly attribute nsIDOMHTMLDocument document;
/**
* The events object for the browser tab.
* supports: "load"
*/
readonly attribute extIEvents events;
/**
* Load a new URI into this browser tab.
* @param aURI
* The uri to load into the browser tab
*/
void load(in nsIURI aURI);
/**
* Give focus to this browser tab, and bring it to the front.
*/
void focus();
/**
* Close the browser tab. This may not actually close the tab
* as script may abort the close operation.
*/
void close();
/**
* Moves this browser tab before another browser tab within the window.
* @param aBefore
* The tab before which the target tab will be moved
*/
void moveBefore(in fuelIBrowserTab aBefore);
/**
* Move this browser tab to the last tab within the window.
*/
void moveToEnd();
};
/**
* Interface for managing and accessing the applications systems
*/
[scriptable, uuid(fe74cf80-aa2d-11db-abbd-0800200c9a66)]
interface fuelIApplication : extIApplication
{
/**
* The root bookmarks object for the application.
* Contains all the bookmark roots in the system.
*/
readonly attribute fuelIBookmarkRoots bookmarks;
/**
* An array of browser windows within the application.
*/
readonly attribute nsIVariant windows;
/**
* The currently active browser window.
*/
readonly attribute fuelIWindow activeWindow;
};

View File

@ -1,21 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPIDL_SOURCES += [
'fuelIApplication.idl',
]
XPIDL_MODULE = 'fuel'
EXTRA_COMPONENTS += [
'fuelApplication.manifest',
]
EXTRA_PP_COMPONENTS += [
'fuelApplication.js',
]

View File

@ -1,5 +0,0 @@
{
"extends": [
"../../../testing/mochitest/browser.eslintrc"
]
}

View File

@ -1,12 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Content Page A</title>
</head>
<body>
<h1>Content Page A</h1>
<div id="desc">This is a simple content page used for testing FUEL Browser API</div>
<div id="test1">A</div>
<div id="test2">B</div>
</body>
</html>

View File

@ -1,12 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Content Page B</title>
</head>
<body>
<h1>Content Page B</h1>
<div id="desc">This is a simple content page used for testing FUEL Browser API</div>
<div id="test1">1</div>
<div id="test2">2</div>
</body>
</html>

View File

@ -1,12 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Content Page with Frames</title>
</head>
<body>
<h1>Content Page with Frames</h1>
<div id="desc">This is a simple framed content page used for testing FUEL Browser API</div>
<iframe src="ContentA.html"></iframe>
<iframe src="ContentB.html"></iframe>
</body>
</html>

View File

@ -1,12 +0,0 @@
[DEFAULT]
support-files =
ContentA.html
ContentB.html
ContentWithFrames.html
[browser_Application.js]
[browser_ApplicationPrefs.js]
[browser_ApplicationQuitting.js]
[browser_ApplicationStorage.js]
[browser_Bookmarks.js]
[browser_Browser.js]

View File

@ -1,79 +0,0 @@
// This listens for the next opened window and checks it is of the right url.
// opencallback is called when the new window is fully loaded
// closecallback is called when the window is closed
function WindowOpenListener(url, opencallback, closecallback) {
this.url = url;
this.opencallback = opencallback;
this.closecallback = closecallback;
Services.wm.addListener(this);
}
WindowOpenListener.prototype = {
url: null,
opencallback: null,
closecallback: null,
window: null,
domwindow: null,
handleEvent: function(event) {
is(this.domwindow.document.location.href, this.url, "Should have opened the correct window");
this.domwindow.removeEventListener("load", this, false);
// Allow any other load handlers to execute
var self = this;
executeSoon(function() { self.opencallback(self.domwindow); } );
},
onWindowTitleChange: function(window, title) {
},
onOpenWindow: function(window) {
if (this.window)
return;
this.window = window;
this.domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
this.domwindow.addEventListener("load", this, false);
},
onCloseWindow: function(window) {
if (this.window != window)
return;
Services.wm.removeListener(this);
this.opencallback = null;
this.window = null;
this.domwindow = null;
// Let the window close complete
executeSoon(this.closecallback);
this.closecallback = null;
}
};
function test() {
ok(Application, "Check global access to Application");
// I'd test these against a specific value, but that is bound to flucuate
ok(Application.id, "Check to see if an ID exists for the Application");
ok(Application.name, "Check to see if a name exists for the Application");
ok(Application.version, "Check to see if a version exists for the Application");
var wMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var console = wMediator.getMostRecentWindow("global:console");
waitForExplicitFinish();
ok(!console, "Console should not already be open");
new WindowOpenListener("chrome://global/content/console.xul", consoleOpened, consoleClosed);
Application.console.open();
}
function consoleOpened(win) {
win.close();
}
function consoleClosed() {
finish();
}

View File

@ -1,179 +0,0 @@
// The various properties that we'll be testing
var testdata = {
missing: "fuel.fuel-test-missing",
dummy: "fuel.fuel-test",
string: "browser.active_color",
integer: "permissions.default.image",
boolean: "browser.underline_anchors"
};
function test() {
// test getting nonexistent values
var itemValue = Application.prefs.getValue(testdata.missing, "default");
is(itemValue, "default", "Check 'Application.prefs.getValue' for nonexistent item");
is(Application.prefs.get(testdata.missing), null, "Check 'Application.prefs.get' for nonexistent item");
// test setting and getting a value
Application.prefs.setValue(testdata.dummy, "dummy");
itemValue = Application.prefs.getValue(testdata.dummy, "default");
is(itemValue, "dummy", "Check 'Application.prefs.getValue' for existing item");
// test for overwriting an existing value
Application.prefs.setValue(testdata.dummy, "smarty");
itemValue = Application.prefs.getValue(testdata.dummy, "default");
is(itemValue, "smarty", "Check 'Application.prefs.getValue' for overwritten item");
// test setting and getting a value
Application.prefs.get(testdata.dummy).value = "dummy2";
itemValue = Application.prefs.get(testdata.dummy).value;
is(itemValue, "dummy2", "Check 'Application.prefs.get().value' for existing item");
// test resetting a pref [since there is no default value, the pref should disappear]
Application.prefs.get(testdata.dummy).reset();
itemValue = Application.prefs.getValue(testdata.dummy, "default");
is(itemValue, "default", "Check 'Application.prefs.getValue' for reset pref");
// test to see if a non-existant property exists
ok(!Application.prefs.has(testdata.dummy), "Check non-existant property for existence");
// PREF: string browser.active_color == #EE0000
// test to see if an existing string property exists
ok(Application.prefs.has(testdata.string), "Check existing string property for existence");
// test accessing a non-existant string property
var val = Application.prefs.getValue(testdata.dummy, "default");
is(val, "default", "Check non-existant string property for expected value");
// test accessing an existing string property
var val = Application.prefs.getValue(testdata.string, "default");
is(val, "#EE0000", "Check existing string property for expected value");
// test manipulating an existing string property
Application.prefs.setValue(testdata.string, "#EF0000");
var val = Application.prefs.getValue(testdata.string, "default");
is(val, "#EF0000", "Set existing string property");
// test getting the type of an existing string property
var type = Application.prefs.get(testdata.string).type;
is(type, "String", "Check 'Application.prefs.get().type' for string pref");
// test resetting an existing string property
Application.prefs.get(testdata.string).reset();
var val = Application.prefs.getValue(testdata.string, "default");
is(val, "#EE0000", "Reset existing string property");
// PREF: integer permissions.default.image == 1
// test to see if an existing integer property exists
ok(Application.prefs.has(testdata.integer), "Check existing integer property for existence");
// test accessing a non-existant integer property
var val = Application.prefs.getValue(testdata.dummy, 0);
is(val, 0, "Check non-existant integer property for expected value");
// test accessing an existing integer property
var val = Application.prefs.getValue(testdata.integer, 0);
is(val, 1, "Check existing integer property for expected value");
// test manipulating an existing integer property
Application.prefs.setValue(testdata.integer, 0);
var val = Application.prefs.getValue(testdata.integer, 1);
is(val, 0, "Set existing integer property");
// test getting the type of an existing integer property
var type = Application.prefs.get(testdata.integer).type;
is(type, "Number", "Check 'Application.prefs.get().type' for integer pref");
// test resetting an existing integer property
Application.prefs.get(testdata.integer).reset();
var val = Application.prefs.getValue(testdata.integer, 0);
is(val, 1, "Reset existing integer property");
// PREF: boolean browser.underline_anchors == true
// test to see if an existing boolean property exists
ok(Application.prefs.has(testdata.boolean), "Check existing boolean property for existence");
// test accessing a non-existant boolean property
var val = Application.prefs.getValue(testdata.dummy, true);
ok(val, "Check non-existant boolean property for expected value");
// test accessing an existing boolean property
var val = Application.prefs.getValue(testdata.boolean, false);
ok(val, "Check existing boolean property for expected value");
// test manipulating an existing boolean property
Application.prefs.setValue(testdata.boolean, false);
var val = Application.prefs.getValue(testdata.boolean, true);
ok(!val, "Set existing boolean property");
// test getting the type of an existing boolean property
var type = Application.prefs.get(testdata.boolean).type;
is(type, "Boolean", "Check 'Application.prefs.get().type' for boolean pref");
// test resetting an existing boolean property
Application.prefs.get(testdata.boolean).reset();
var val = Application.prefs.getValue(testdata.boolean, false);
ok(val, "Reset existing string property for expected value");
// test getting all preferences
var allPrefs = Application.prefs.all;
ok(allPrefs.length >= 800, "Check 'Application.prefs.all' for the right number of preferences");
ok(allPrefs[0].name.length > 0, "Check 'Application.prefs.all' for a valid name in the starting preference");
// test the value of the preference root
is(Application.prefs.root, "", "Check the Application preference root");
// test for user changed preferences
ok(Application.prefs.get("browser.dom.window.dump.enabled").modified, "A single preference is marked as modified.");
ok(!Application.prefs.get(testdata.string).modified, "A single preference is marked as not modified.");
// test for a locked preference
var pref = Application.prefs.get(testdata.string);
ok(!pref.locked, "A single preference should not be locked.");
pref.locked = true;
ok(pref.locked, "A single preference should be locked.");
try {
prev.value = "test value";
ok(false, "A locked preference could be modified.");
} catch(e){
ok(true, "A locked preference should not be able to be modified.");
}
pref.locked = false;
ok(!pref.locked, "A single preference is unlocked.");
// check for change event when setting a value
waitForExplicitFinish();
Application.prefs.events.addListener("change", onPrefChange);
Application.prefs.setValue("fuel.fuel-test", "change event");
}
function onPrefChange(evt) {
is(evt.data, testdata.dummy, "Check 'Application.prefs.setValue' fired a change event");
Application.prefs.events.removeListener("change", onPrefChange);
// We are removing the old listener after adding the new listener so we can test that
// removing a listener does not remove all listeners
Application.prefs.get("fuel.fuel-test").events.addListener("change", onPrefChangeDummy);
Application.prefs.get("fuel.fuel-test").events.addListener("change", onPrefChange2);
Application.prefs.get("fuel.fuel-test").events.removeListener("change", onPrefChangeDummy);
Application.prefs.setValue("fuel.fuel-test", "change event2");
}
function onPrefChange2(evt) {
is(evt.data, testdata.dummy, "Check 'Application.prefs.setValue' fired a change event for a single preference");
Application.prefs.events.removeListener("change", onPrefChange2);
finish();
}
function onPrefChangeDummy(evt) {
ok(false, "onPrefChangeDummy shouldn't be invoked!");
}

View File

@ -1,17 +0,0 @@
function test() {
function quitRequestObserver(aSubject, aTopic, aData) {
ok(aTopic == "quit-application-requested" &&
aSubject instanceof Components.interfaces.nsISupportsPRBool,
"Received a quit request we're going to deny");
aSubject.data = true;
}
// ensure that we don't accidentally quit
Services.obs.addObserver(quitRequestObserver, "quit-application-requested", false);
ok(!Application.quit(), "Tried to quit - and didn't succeed");
ok(!Application.restart(), "Tried to restart - and didn't succeed");
// clean up
Services.obs.removeObserver(quitRequestObserver, "quit-application-requested");
}

View File

@ -1,30 +0,0 @@
function test() {
// test for existence of values
var hasItem = Application.storage.has("fuel-test-missing");
is(hasItem, false, "Check 'Application.storage.has' for nonexistent item");
Application.storage.set("fuel-test", "dummy");
hasItem = Application.storage.has("fuel-test");
is(hasItem, true, "Check 'Application.storage.has' for existing item");
// test getting nonexistent and existing values
var itemValue = Application.storage.get("fuel-test-missing", "default");
is(itemValue, "default", "Check 'Application.storage.get' for nonexistent item");
itemValue = Application.storage.get("fuel-test", "default");
is(itemValue, "dummy", "Check 'Application.storage.get' for existing item");
// test for overwriting an existing value
Application.storage.set("fuel-test", "smarty");
itemValue = Application.storage.get("fuel-test", "default");
is(itemValue, "smarty", "Check 'Application.storage.get' for overwritten item");
// check for change event when setting a value
waitForExplicitFinish();
Application.storage.events.addListener("change", onStorageChange);
Application.storage.set("fuel-test", "change event");
}
function onStorageChange(evt) {
is(evt.data, "fuel-test", "Check 'Application.storage.set' fired a change event");
Application.storage.events.removeListener("change", onStorageChange);
finish();
}

View File

@ -1,253 +0,0 @@
var gLastFolderAction = "";
var gLastBookmarkAction = "";
var gLastRootAction = "";
function url(spec) {
return Services.io.newURI(spec, null, null);
}
function test() {
// Some very basic tests on the tags root
var tags = Application.bookmarks.tags;
ok(tags, "Check access to bookmark tags root");
ok(!tags.parent, "Check tags parent (should be null)");
//----------------------------------------------
// Some very basic tests on the unfiled root
var unfiled = Application.bookmarks.unfiled;
ok(unfiled, "Check access to bookmark unfiled root");
ok(!unfiled.parent, "Check unfiled parent (should be null)");
//----------------------------------------------
// Some basic tests on the toolbar root
var toolbar = Application.bookmarks.toolbar;
ok(toolbar, "Check access to bookmark toolbar root");
ok(!toolbar.parent, "Check toolbar parent (should be null)");
var toolbarKidCount = toolbar.children.length;
// test adding folders
var testFolderToolbar = toolbar.addFolder("FUEL in Toolbar");
ok(testFolderToolbar, "Check folder creation");
is(testFolderToolbar.type, "folder", "Check 'folder.type' after creation");
ok(testFolderToolbar.parent, "Check parent after folder creation");
toolbarKidCount++;
is(toolbar.children.length, toolbarKidCount, "Check toolbar folder child count after adding a child folder");
//----------------------------------------------
// Main testing is done on the bookmarks menu root
var root = Application.bookmarks.menu;
ok(root, "Check access to bookmark root");
ok(!root.parent, "Check root parent (should be null)");
var rootKidCount = root.children.length;
// test adding folders
var testFolder = root.addFolder("FUEL");
ok(testFolder, "Check folder creation");
is(testFolder.type, "folder", "Check 'folder.type' after creation");
ok(testFolder.parent, "Check parent after folder creation");
rootKidCount++;
is(root.children.length, rootKidCount, "Check root folder child count after adding a child folder");
// test modifying a folder
testFolder.events.addListener("change", onFolderChange);
testFolder.description = "FUEL folder";
is(testFolder.description, "FUEL folder", "Check setting 'folder.description'");
is(gLastFolderAction, "bookmarkProperties/description", "Check event handler for setting 'folder.description'");
testFolder.title = "fuel-is-cool";
is(testFolder.title, "fuel-is-cool", "Check setting 'folder.title'");
is(gLastFolderAction, "title", "Check event handler for setting 'folder.title'");
testFolder.annotations.set("testing/folder", "annotate-this", 0);
ok(testFolder.annotations.has("testing/folder"), "Checking existence of added annotation");
is(gLastFolderAction, "testing/folder", "Check event handler for setting annotation");
gLastFolderAction = "";
is(testFolder.annotations.get("testing/folder"), "annotate-this", "Checking existence of added annotation");
testFolder.annotations.remove("testing/folder");
ok(!testFolder.annotations.has("testing/folder"), "Checking existence of removed annotation");
is(gLastFolderAction, "testing/folder", "Check event handler for removing annotation");
testFolder.events.addListener("addchild", onFolderAddChild);
testFolder.events.addListener("removechild", onFolderRemoveChild);
// test adding a bookmark
var testBookmark = testFolder.addBookmark("Mozilla", url("https://www.mozilla.org/"));
ok(testBookmark, "Check bookmark creation");
ok(testBookmark.parent, "Check parent after bookmark creation");
is(gLastFolderAction, "addchild", "Check event handler for adding a child to a folder");
is(testBookmark.type, "bookmark", "Check 'bookmark.type' after creation");
is(testBookmark.title, "Mozilla", "Check 'bookmark.title' after creation");
is(testBookmark.uri.spec, "https://www.mozilla.org/", "Check 'bookmark.uri' after creation");
is(testFolder.children.length, 1, "Check test folder child count after adding a child bookmark");
// test modifying a bookmark
testBookmark.events.addListener("change", onBookmarkChange);
testBookmark.description = "mozcorp";
is(testBookmark.description, "mozcorp", "Check setting 'bookmark.description'");
is(gLastBookmarkAction, "bookmarkProperties/description", "Check event handler for setting 'bookmark.description'");
testBookmark.keyword = "moz"
is(testBookmark.keyword, "moz", "Check setting 'bookmark.keyword'");
is(gLastBookmarkAction, "keyword", "Check event handler for setting 'bookmark.keyword'");
testBookmark.title = "MozCorp"
is(testBookmark.title, "MozCorp", "Check setting 'bookmark.title'");
is(gLastBookmarkAction, "title", "Check event handler for setting 'bookmark.title'");
testBookmark.uri = url("http://www.mozilla.org/");
is(testBookmark.uri.spec, "http://www.mozilla.org/", "Check setting 'bookmark.uri'");
is(gLastBookmarkAction, "uri", "Check event handler for setting 'bookmark.uri'");
// test adding and removing a bookmark annotation
testBookmark.annotations.set("testing/bookmark", "annotate-this", 0);
ok(testBookmark.annotations.has("testing/bookmark"), "Checking existence of added annotation");
is(gLastBookmarkAction, "testing/bookmark", "Check event handler for setting annotation");
gLastBookmarkAction = "";
is(testBookmark.annotations.get("testing/bookmark"), "annotate-this", "Checking existence of added annotation");
testBookmark.annotations.remove("testing/bookmark");
ok(!testBookmark.annotations.has("testing/bookmark"), "Checking existence of removed annotation");
is(gLastBookmarkAction, "testing/bookmark", "Check event handler for removing annotation");
is(testBookmark.annotations.get("testing/bookmark"), null, "Check existence of a missing annotation");
// quick annotation type tests
testBookmark.annotations.set("testing/bookmark/string", "annotate-this", 0);
ok(testBookmark.annotations.has("testing/bookmark/string"), "Checking existence of added string annotation");
is(testBookmark.annotations.get("testing/bookmark/string"), "annotate-this", "Checking value of added string annotation");
is(gLastBookmarkAction, "testing/bookmark/string", "Check event handler for setting annotation");
gLastBookmarkAction = "";
testBookmark.annotations.set("testing/bookmark/int", 100, 0);
ok(testBookmark.annotations.has("testing/bookmark/int"), "Checking existence of added integer annotation");
is(testBookmark.annotations.get("testing/bookmark/int"), 100, "Checking value of added integer annotation");
is(gLastBookmarkAction, "testing/bookmark/int", "Check event handler for setting annotation");
gLastBookmarkAction = "";
testBookmark.annotations.set("testing/bookmark/double", 3.333, 0);
ok(testBookmark.annotations.has("testing/bookmark/double"), "Checking existence of added double annotation");
is(testBookmark.annotations.get("testing/bookmark/double"), 3.333, "Checking value of added double annotation");
is(gLastBookmarkAction, "testing/bookmark/double", "Check event handler for setting annotation");
gLastBookmarkAction = "";
// test names array - NOTE: "bookmarkProperties/description" is an annotation too
var names = testBookmark.annotations.names;
ok(names.some(f => f == "bookmarkProperties/description"), "Checking for description annotation");
ok(names.some(f => f == "testing/bookmark/string"), "Checking for string test annotation");
ok(names.some(f => f == "testing/bookmark/int"), "Checking for int test annotation");
ok(names.some(f => f == "testing/bookmark/double"), "Checking for double test annotation");
// test adding a separator
var testSeparator = testFolder.addSeparator();
ok(testSeparator, "Check bookmark creation");
ok(testSeparator.parent, "Check parent after separator creation");
is(gLastFolderAction, "addchild", "Check event handler for adding a child separator to a folder");
is(testSeparator.type, "separator", "Check 'bookmark.type' after separator creation");
is(testFolder.children.length, 2, "Check test folder child count after adding a child separator");
// test removing separator
testSeparator.events.addListener("remove", onBookmarkRemove);
testSeparator.remove();
is(gLastBookmarkAction, "remove", "Check event handler for removing separator");
is(gLastFolderAction, "removechild", "Check event handler for removing a child separator from a folder");
is(testFolder.children.length, 1, "Check test folder child count after removing a child separator");
// test removing bookmark
testBookmark.events.addListener("remove", onBookmarkRemove);
testBookmark.remove();
is(gLastBookmarkAction, "remove", "Check event handler for removing bookmark");
is(gLastFolderAction, "removechild", "Check event handler for removing a child from a folder");
is(testFolder.children.length, 0, "Check test folder child count after removing a child bookmark");
// test removing a folder
testFolder.events.addListener("remove", onFolderRemove);
testFolder.remove();
is(gLastFolderAction, "remove", "Check event handler for removing child folder");
rootKidCount--;
is(root.children.length, rootKidCount, "Check root folder child count after removing a child folder");
// test moving between folders
var testFolderA = root.addFolder("folder-a");
var testFolderB = root.addFolder("folder-b");
var testMove = testFolderA.addBookmark("Mozilla", url("https://www.mozilla.org/"));
testMove.events.addListener("move", onBookmarkMove);
is(testMove.parent.title, "folder-a", "Checking for new parent before moving bookmark");
testMove.parent = testFolderB;
is(testMove.parent.title, "folder-b", "Checking for new parent after moving bookmark");
is(gLastBookmarkAction, "move", "Checking for event handler after moving bookmark");
// test moving a folder
testFolderA.events.addListener("move", onFolderMove);
testFolderA.parent = testFolderB;
is(testFolderA.parent.title, "folder-b", "Checking for new parent after moving folder");
is(gLastFolderAction, "move", "Checking for event handler after moving folder");
// test events on the root
root.events.addListener("add", onRootAdd);
root.events.addListener("remove", onRootRemove);
root.events.addListener("change", onRootChange);
var testFolderC = root.addFolder("folder-c");
is(gLastRootAction, "add");
root.events.removeListener("add", onRootAdd);
gLastRootAction = "";
var testFolderD = root.addFolder("folder-d");
is(gLastRootAction, "");
testFolderC.remove();
is(gLastRootAction, "remove");
testFolderD.description = "Foo";
is(gLastRootAction, "bookmarkProperties/description");
}
function onFolderChange(evt) {
gLastFolderAction = evt.data;
}
function onFolderRemove(evt) {
gLastFolderAction = evt.type;
}
function onFolderAddChild(evt) {
gLastFolderAction = evt.type;
}
function onFolderRemoveChild(evt) {
gLastFolderAction = evt.type;
}
function onFolderMove(evt) {
gLastFolderAction = evt.type;
}
function onBookmarkChange(evt) {
gLastBookmarkAction = evt.data;
}
function onBookmarkRemove(evt) {
gLastBookmarkAction = evt.type;
}
function onBookmarkMove(evt) {
gLastBookmarkAction = evt.type;
}
function onRootAdd(evt) {
gLastRootAction = evt.type;
}
function onRootRemove(evt) {
gLastRootAction = evt.type;
}
function onRootChange(evt) {
gLastRootAction = evt.data;
}

View File

@ -1,148 +0,0 @@
var gPageA = null;
var gPageB = null;
// cached data from events
var gTabOpenPageA = null;
var gTabOpenPageB = null;
var gTabOpenCount = 0;
var gTabCloseCount = 0;
var gTabMoveCount = 0;
var gPageLoadCount = 0;
var rootDir = getRootDirectory(gTestPath);
const CHROMEROOT = rootDir;
function test() {
waitForExplicitFinish();
var windows = Application.windows;
ok(windows, "Check access to browser windows");
is(windows.length, 1, "There should be one browser window open");
var activeWin = Application.activeWindow;
activeWin.events.addListener("TabOpen", onTabOpen);
activeWin.events.addListener("TabClose", onTabClose);
activeWin.events.addListener("TabMove", onTabMove);
gPageA = activeWin.open(makeURI(CHROMEROOT + "ContentA.html"));
gPageA.events.addListener("load", onPageAFirstLoad);
is(activeWin.tabs.length, 2, "Checking length of 'Browser.tabs' after opening 1 additional tab");
function onPageAFirstLoad(event) {
gPageA.events.removeListener("load", onPageAFirstLoad);
is(gPageA.uri.spec, event.data.uri.spec, "Checking event browser tab is equal to page A");
gPageB = activeWin.open(makeURI(CHROMEROOT + "ContentB.html"));
gPageB.events.addListener("load", delayAfterOpen);
gPageB.focus();
is(activeWin.tabs.length, 3, "Checking length of 'Browser.tabs' after opening a second additional tab");
is(activeWin.activeTab.index, gPageB.index, "Checking 'Browser.activeTab' after setting focus");
}
function delayAfterOpen() {
executeSoon(afterOpen);
}
// need to wait for the url's to be refreshed during the load
function afterOpen(event) {
gPageB.events.removeListener("load", delayAfterOpen);
// check actuals
is(gPageA.uri.spec, CHROMEROOT + "ContentA.html", "Checking 'BrowserTab.uri' after opening");
is(gPageB.uri.spec, CHROMEROOT + "ContentB.html", "Checking 'BrowserTab.uri' after opening");
// check event
is(gTabOpenCount, 2, "Checking event handler for tab open");
// check cached values from TabOpen event
is(gPageA.uri.spec, gTabOpenPageA.uri.spec, "Checking first browser tab open is equal to page A");
is(gPageB.uri.spec, gTabOpenPageB.uri.spec, "Checking second browser tab open is equal to page B");
// test document access
var test1 = gPageA.document.getElementById("test1");
ok(test1, "Checking existence of element in content DOM");
is(test1.innerHTML, "A", "Checking content of element in content DOM");
// test moving tab
is(gTabMoveCount, 0, "Checking initial tab move count");
// move the tab
gPageA.moveToEnd();
is(gPageA.index, 2, "Checking index after moving tab");
// check event
is(gTabMoveCount, 1, "Checking event handler for tab move");
gBrowser.addProgressListener({
onStateChange: function (webProgress, request, stateFlags, status) {
info("onStateChange: " + stateFlags);
const complete = Ci.nsIWebProgressListener.STATE_IS_WINDOW +
Ci.nsIWebProgressListener.STATE_IS_NETWORK +
Ci.nsIWebProgressListener.STATE_STOP;
if ((stateFlags & complete) == complete) {
gBrowser.removeProgressListener(this);
onPageBLoadComplete();
}
},
onLocationChange: () => 0,
onProgressChange: () => 0,
onStatusChange: () => 0,
onSecurityChange: () => 0
});
// test loading new content with a frame into a tab
// the event will be checked in onPageBLoadComplete
gPageB.events.addListener("load", onPageBLoadWithFrames);
gPageB.load(makeURI(CHROMEROOT + "ContentWithFrames.html"));
}
function onPageBLoadWithFrames(event) {
gPageLoadCount++;
info("onPageBLoadWithFrames: " + gPageLoadCount);
}
function onPageBLoadComplete() {
gPageB.events.removeListener("load", onPageBLoadWithFrames);
// check page load with frame event
is(gPageLoadCount, 1, "Checking load count after loading new content with a frame");
// test loading new content into a tab
// the event will be checked in onPageASecondLoad
gPageA.events.addListener("load", onPageASecondLoad);
gPageA.load(makeURI(CHROMEROOT + "ContentB.html"));
}
function onPageASecondLoad(event) {
gPageA.events.removeListener("load", onPageASecondLoad);
is(gPageA.uri.spec, CHROMEROOT + "ContentB.html", "Checking 'BrowserTab.uri' after loading new content");
// start testing closing tabs
// the event will be checked in afterClose
// use executeSoon so the onPageASecondLoad
// has a chance to finish first
gPageA.close();
gPageB.close();
is(gTabCloseCount, 2, "Checking that tabs closed");
is(activeWin.tabs.length, 1, "Checking length of 'Browser.tabs' after closing 2 tabs");
finish();
}
}
function onTabOpen(event) {
gTabOpenCount++;
// cache these values so we can check them later (after loading completes)
if (gTabOpenCount == 1)
gTabOpenPageA = event.data;
if (gTabOpenCount == 2)
gTabOpenPageB = event.data;
}
function onTabClose(event) {
gTabCloseCount++;
}
function onTabMove(event) {
gTabMoveCount++;
}

View File

@ -248,7 +248,6 @@
@RESPATH@/components/filepicker.xpt
#endif
@RESPATH@/components/find.xpt
@RESPATH@/browser/components/fuel.xpt
@RESPATH@/components/gfx.xpt
@RESPATH@/components/html5.xpt
@RESPATH@/components/htmlparser.xpt
@ -373,8 +372,6 @@
@RESPATH@/browser/components/BrowserFeeds.manifest
@RESPATH@/browser/components/FeedConverter.js
@RESPATH@/browser/components/FeedWriter.js
@RESPATH@/browser/components/fuelApplication.manifest
@RESPATH@/browser/components/fuelApplication.js
@RESPATH@/browser/components/WebContentConverter.js
@RESPATH@/browser/components/BrowserComponents.manifest
@RESPATH@/browser/components/nsBrowserContentHandler.js

View File

@ -12,7 +12,6 @@ DIRS += [
'base',
'components',
'experiments',
'fuel',
'locales',
'modules',
'themes',

View File

@ -629,6 +629,42 @@ EqualOrSubdomain(nsIURI* aProbeArg, nsIURI* aBase)
}
}
static bool
AllSchemesMatch(nsIURI* aURI, nsIURI* aOtherURI)
{
nsCOMPtr<nsINestedURI> nestedURI = do_QueryInterface(aURI);
nsCOMPtr<nsINestedURI> nestedOtherURI = do_QueryInterface(aOtherURI);
auto stringComparator = nsCaseInsensitiveCStringComparator();
if (!nestedURI && !nestedOtherURI) {
// Neither of the URIs is nested, compare their schemes directly:
nsAutoCString scheme, otherScheme;
aURI->GetScheme(scheme);
aOtherURI->GetScheme(otherScheme);
return scheme.Equals(otherScheme, stringComparator);
}
while (nestedURI && nestedOtherURI) {
nsCOMPtr<nsIURI> currentURI = do_QueryInterface(nestedURI);
nsCOMPtr<nsIURI> currentOtherURI = do_QueryInterface(nestedOtherURI);
nsAutoCString scheme, otherScheme;
currentURI->GetScheme(scheme);
currentOtherURI->GetScheme(otherScheme);
if (!scheme.Equals(otherScheme, stringComparator)) {
return false;
}
nestedURI->GetInnerURI(getter_AddRefs(currentURI));
nestedOtherURI->GetInnerURI(getter_AddRefs(currentOtherURI));
nestedURI = do_QueryInterface(currentURI);
nestedOtherURI = do_QueryInterface(currentOtherURI);
}
if (!!nestedURI != !!nestedOtherURI) {
// If only one of the scheme chains runs out at one point, clearly the chains
// aren't of the same length, so we bail:
return false;
}
return true;
}
NS_IMETHODIMP
nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
nsIURI *aTargetURI,
@ -729,14 +765,30 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
rv = sourceBaseURI->GetScheme(sourceScheme);
if (NS_FAILED(rv)) return rv;
// When comparing schemes, if the relevant pref is set, view-source URIs
// are reachable from same-protocol (so e.g. file: can link to
// view-source:file). This is required for reftests.
static bool sViewSourceReachableFromInner = false;
static bool sCachedViewSourcePref = false;
if (!sCachedViewSourcePref) {
sCachedViewSourcePref = true;
mozilla::Preferences::AddBoolVarCache(&sViewSourceReachableFromInner,
"security.view-source.reachable-from-inner-protocol");
}
bool targetIsViewSource = false;
if (sourceScheme.LowerCaseEqualsLiteral(NS_NULLPRINCIPAL_SCHEME)) {
// A null principal can target its own URI.
if (sourceURI == aTargetURI) {
return NS_OK;
}
}
else if (targetScheme.Equals(sourceScheme,
nsCaseInsensitiveCStringComparator()))
else if (AllSchemesMatch(sourceURI, aTargetURI) ||
(sViewSourceReachableFromInner &&
sourceScheme.EqualsIgnoreCase(targetScheme.get()) &&
NS_SUCCEEDED(aTargetURI->SchemeIs("view-source", &targetIsViewSource)) &&
targetIsViewSource))
{
// every scheme can access another URI from the same scheme,
// as long as they don't represent null principals...
@ -785,7 +837,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
// at the flags for our one URI.
// Check for system target URI
rv = DenyAccessIfURIHasFlags(targetBaseURI,
rv = DenyAccessIfURIHasFlags(aTargetURI,
nsIProtocolHandler::URI_DANGEROUS_TO_LOAD);
if (NS_FAILED(rv)) {
// Deny access, since the origin principal is not system
@ -853,7 +905,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
}
// Check for target URI pointing to a file
rv = NS_URIChainHasFlags(targetBaseURI,
rv = NS_URIChainHasFlags(aTargetURI,
nsIProtocolHandler::URI_IS_LOCAL_FILE,
&hasFlags);
NS_ENSURE_SUCCESS(rv, rv);
@ -1639,3 +1691,4 @@ nsScriptSecurityManager::PolicyAllowsScript(nsIURI* aURI, bool *aRv)
return NS_OK;
}

View File

@ -105,7 +105,7 @@ var AboutDebugging = {
DebuggerServer.allowChromeProcess = true;
this.client = new DebuggerClient(DebuggerServer.connectPipe());
this.client.connect(() => {
this.client.connect().then(() => {
// Show the first available tab.
this.showTab();
window.addEventListener("hashchange", () => this.showTab());

View File

@ -16,7 +16,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -17,7 +17,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -18,7 +18,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -17,7 +17,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -27,7 +27,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -18,7 +18,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -18,7 +18,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -19,7 +19,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -19,7 +19,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -20,7 +20,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -17,7 +17,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -18,7 +18,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -17,7 +17,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect(Task.async(function*(aType, aTraits) {
gClient.connect().then(Task.async(function*([aType, aTraits]) {
is(aType, "browser",
"Root actor should identify itself as a browser.");
let tab = yield addTab(TAB1_URL);

View File

@ -20,7 +20,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -18,7 +18,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -21,7 +21,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -21,7 +21,7 @@ function test() {
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect((aType, aTraits) => {
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");

View File

@ -564,9 +564,7 @@ AddonDebugger.prototype = {
let transport = DebuggerServer.connectPipe();
this.client = new DebuggerClient(transport);
let connected = promise.defer();
this.client.connect(connected.resolve);
yield connected.promise;
yield this.client.connect();
let addonActor = yield getAddonActorForUrl(this.client, aUrl);
@ -1005,11 +1003,7 @@ function generateMouseClickInTab(tab, path) {
function connect(client) {
info("Connecting client.");
return new Promise(function (resolve) {
client.connect(function () {
resolve();
});
});
return client.connect();
}
function close(client) {

View File

@ -74,20 +74,14 @@ var submit = Task.async(function*() {
gClient = new DebuggerClient(transport);
let delay = Services.prefs.getIntPref("devtools.debugger.remote-timeout");
gConnectionTimeout = setTimeout(handleConnectionTimeout, delay);
let response = yield clientConnect();
let response = yield gClient.connect();
yield onConnectionReady(...response);
});
function clientConnect() {
let deferred = promise.defer();
gClient.connect((...args) => deferred.resolve(args));
return deferred.promise;
}
/**
* Connection is ready. List actors and build buttons.
*/
var onConnectionReady = Task.async(function*(aType, aTraits) {
var onConnectionReady = Task.async(function*([aType, aTraits]) {
clearTimeout(gConnectionTimeout);
let response = yield gClient.listAddons();

View File

@ -731,7 +731,7 @@ var gDevToolsBrowser = {
let client = new DebuggerClient(transport);
let deferred = promise.defer();
client.connect(() => {
client.connect().then(() => {
client.mainRoot.listProcesses(response => {
// Do nothing if there is only one process, the parent process.
let contentProcesses = response.processes.filter(p => (!p.parent));

View File

@ -414,12 +414,12 @@ TabTarget.prototype = {
};
if (this.isLocalTab) {
this._client.connect(() => {
this._client.getTab({ tab: this.tab }).then(response => {
this._client.connect()
.then(() => this._client.getTab({ tab: this.tab }))
.then(response => {
this._form = response.tab;
attachTab();
});
});
} else if (this.isTabActor) {
// In the remote debugging case, the protocol connection will have been
// already initialized in the connection screen code.
@ -593,6 +593,7 @@ TabTarget.prototype = {
this._tab = null;
this._form = null;
this._remote = null;
this._root = null;
},
toString: function() {

View File

@ -60,6 +60,9 @@ function testPreferenceAndUIStateIsConsistent() {
toolboxButtonNodes.push(doc.getElementById("command-button-frames"));
let toggleableTools = toolbox.toolboxButtons;
// The noautohide button is only displayed in the browser toolbox
toggleableTools = toggleableTools.filter(tool => tool.id != "command-button-noautohide");
for (let tool of toggleableTools) {
let isVisible = getBoolPref(tool.visibilityswitch);
@ -82,6 +85,10 @@ function testToggleToolboxButtons() {
toolboxButtonNodes = [...doc.querySelectorAll(".command-button:not(#command-button-tilt)")];
}
// The noautohide button is only displayed in the browser toolbox
toggleableTools = toggleableTools.filter(tool => tool.id != "command-button-noautohide");
toolboxButtonNodes = toolboxButtonNodes.filter(btn => btn.id != "command-button-noautohide");
is (checkNodes.length, toggleableTools.length, "All of the buttons are toggleable." );
is (checkNodes.length, toolboxButtonNodes.length, "All of the DOM buttons are toggleable." );
@ -89,9 +96,9 @@ function testToggleToolboxButtons() {
let id = tool.id;
let matchedCheckboxes = checkNodes.filter(node=>node.id === id);
let matchedButtons = toolboxButtonNodes.filter(button=>button.id === id);
ok (matchedCheckboxes.length === 1,
is (matchedCheckboxes.length, 1,
"There should be a single toggle checkbox for: " + id);
ok (matchedButtons.length === 1,
is (matchedButtons.length, 1,
"There should be a DOM button for: " + id);
is (matchedButtons[0], tool.button,
"DOM buttons should match for: " + id);

View File

@ -73,11 +73,7 @@ function getClient() {
let transport = DebuggerServer.connectPipe();
let client = new DebuggerClient(transport);
client.connect(() => {
deferred.resolve(client);
});
return deferred.promise;
return client.connect().then(() => client);
}
function getTarget(client) {

View File

@ -44,15 +44,15 @@ function openTabs() {
function connect() {
// Connect to debugger server to fetch the two tab actors
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(() => {
gClient.listTabs(response => {
gClient.connect()
.then(() => gClient.listTabs())
.then(response => {
// Fetch the tab actors for each tab
gTabActor1 = response.tabs.filter(a => a.url === TAB_URL_1)[0];
gTabActor2 = response.tabs.filter(a => a.url === TAB_URL_2)[0];
checkGetTab();
});
});
}
function checkGetTab() {

View File

@ -29,11 +29,11 @@ function getChromeActors(callback)
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.getProcess().then(response => {
client.connect()
.then(() => client.getProcess())
.then(response => {
callback(client, response.form);
});
});
SimpleTest.registerCleanupFunction(() => {
DebuggerServer.destroy();

View File

@ -175,6 +175,9 @@ OptionsPanel.prototype = {
if (this.toolbox.target.isMultiProcess && tool.id === "command-button-tilt") {
continue;
}
if (!tool.isTargetSupported(this.toolbox.target)) {
continue;
}
enabledToolbarButtonsBox.appendChild(createCommandCheckbox(tool));
}

View File

@ -33,7 +33,7 @@ var connect = Task.async(function*() {
port: Prefs.chromeDebuggingPort
});
gClient = new DebuggerClient(transport);
gClient.connect(() => {
gClient.connect().then(() => {
let addonID = getParameterByName("addonID");
if (addonID) {
@ -55,6 +55,7 @@ function setPrefDefaults() {
Services.prefs.setBoolPref("devtools.performance.ui.show-platform-data", true);
Services.prefs.setBoolPref("devtools.inspector.showAllAnonymousContent", true);
Services.prefs.setBoolPref("browser.dom.window.dump.enabled", true);
Services.prefs.setBoolPref("devtools.command-button-noautohide.enabled", true);
}
window.addEventListener("load", function() {

View File

@ -61,6 +61,8 @@ loader.lazyRequireGetter(this, "createPerformanceFront",
"devtools/server/actors/performance", true);
loader.lazyRequireGetter(this, "system",
"devtools/shared/system");
loader.lazyRequireGetter(this, "getPreferenceFront",
"devtools/server/actors/preference", true);
loader.lazyGetter(this, "osString", () => {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
});
@ -91,7 +93,9 @@ const ToolboxButtons = exports.ToolboxButtons = [
{ id: "command-button-eyedropper" },
{ id: "command-button-screenshot" },
{ id: "command-button-rulers" },
{ id: "command-button-measure" }
{ id: "command-button-measure" },
{ id: "command-button-noautohide",
isTargetSupported: target => target.chrome },
];
/**
@ -119,6 +123,7 @@ function Toolbox(target, selectedTool, hostType, hostOptions) {
this._toolRegistered = this._toolRegistered.bind(this);
this._toolUnregistered = this._toolUnregistered.bind(this);
this._refreshHostTitle = this._refreshHostTitle.bind(this);
this._toggleAutohide = this._toggleAutohide.bind(this);
this.selectFrame = this.selectFrame.bind(this);
this._updateFrames = this._updateFrames.bind(this);
this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this);
@ -378,6 +383,9 @@ Toolbox.prototype = {
let framesMenu = this.doc.getElementById("command-button-frames");
framesMenu.addEventListener("command", this.selectFrame, true);
let noautohideMenu = this.doc.getElementById("command-button-noautohide");
noautohideMenu.addEventListener("command", this._toggleAutohide, true);
this.textboxContextMenuPopup =
this.doc.getElementById("toolbox-textbox-context-popup");
this.textboxContextMenuPopup.addEventListener("popupshowing",
@ -1012,7 +1020,7 @@ Toolbox.prototype = {
visibilityswitch: "devtools." + options.id + ".enabled",
isTargetSupported: options.isTargetSupported
? options.isTargetSupported
: target => target.isLocalTab
: target => target.isLocalTab,
};
}).filter(button=>button);
},
@ -1040,6 +1048,8 @@ Toolbox.prototype = {
}
});
this._updateNoautohideButton();
// Tilt is handled separately because it is disabled in E10S mode. Because
// we have removed tilt from toolboxButtons we have to deal with it here.
let tiltEnabled = !this.target.isMultiProcess &&
@ -1541,6 +1551,40 @@ Toolbox.prototype = {
this._host.setTitle(title);
},
// Returns an instance of the preference actor
get _preferenceFront() {
return this.target.root.then(rootForm => {
return new getPreferenceFront(this.target.client, rootForm);
});
},
_toggleAutohide: Task.async(function*() {
let prefName = "ui.popup.disable_autohide";
let front = yield this._preferenceFront;
let current = yield front.getBoolPref(prefName);
yield front.setBoolPref(prefName, !current);
this._updateNoautohideButton();
}),
_updateNoautohideButton: Task.async(function*() {
let menu = this.doc.getElementById("command-button-noautohide");
if (menu.getAttribute("hidden") === "true") {
return;
}
if (!this.target.root) {
return;
}
let prefName = "ui.popup.disable_autohide";
let front = yield this._preferenceFront;
let current = yield front.getBoolPref(prefName);
if (current) {
menu.setAttribute("checked", "true");
} else {
menu.removeAttribute("checked");
}
}),
_listFrames: function(event) {
if (!this._target.activeTab || !this._target.activeTab.traits.frames) {
// We are not targetting a regular TabActor

View File

@ -126,6 +126,10 @@
hidden="true">
<menupopup position="bottomright topright"></menupopup>
</toolbarbutton>
<toolbarbutton id="command-button-noautohide"
class="command-button command-button-invertable"
tooltiptext="&toolboxNoAutoHideTooltip;"
hidden="true" />
</hbox>
<vbox id="toolbox-controls-separator" class="devtools-separator"/>
<hbox id="toolbox-option-container"/>

View File

@ -188,6 +188,7 @@ devtools.jar:
skin/images/command-console@2x.png (themes/images/command-console@2x.png)
skin/images/command-eyedropper.png (themes/images/command-eyedropper.png)
skin/images/command-eyedropper@2x.png (themes/images/command-eyedropper@2x.png)
skin/images/command-noautohide.svg (themes/images/command-noautohide.svg)
skin/images/command-rulers.png (themes/images/command-rulers.png)
skin/images/command-rulers@2x.png (themes/images/command-rulers@2x.png)
skin/images/command-measure.png (themes/images/command-measure.png)

View File

@ -41,6 +41,12 @@ values from browser.dtd. -->
- It allows you to switch the context of the whole toolbox. -->
<!ENTITY toolboxFramesTooltip "Select an iframe as the currently targeted document">
<!-- LOCALIZATION NOTE (toolboxNoAutoHideButton): This is the label for
- the button to force the popups/panels to stay visible on blur.
- This is only visible in the browser toolbox as it is meant for
- addon developers and Firefox contributors. -->
<!ENTITY toolboxNoAutoHideTooltip "Disable popup auto hide">
<!-- LOCALIZATION NOTE (browserToolboxErrorMessage): This is the label
- shown next to error details when the Browser Toolbox is unable to open. -->
<!ENTITY browserToolboxErrorMessage "Error opening Browser Toolbox:">

View File

@ -31,6 +31,7 @@ const DominatorTreeItem = module.exports = createClass({
shouldComponentUpdate(nextProps, nextState) {
return this.props.item != nextProps.item
|| this.props.depth != nextProps.depth
|| this.props.expanded != nextProps.expanded
|| this.props.focused != nextProps.focused;
},

View File

@ -201,6 +201,7 @@ const DominatorTree = module.exports = createClass({
depth,
focused,
arrow,
expanded,
getPercentSize: size => (size / dominatorTree.root.retainedSize) * 100,
onViewSourceInDebugger,
})

View File

@ -12,6 +12,7 @@ support-files =
[browser_memory_diff_01.js]
skip-if = debug # bug 1219554
[browser_memory_dominator_trees_01.js]
[browser_memory_dominator_trees_02.js]
[browser_memory_filter_01.js]
skip-if = debug # bug 1219554
[browser_memory_no_allocation_stacks.js]

View File

@ -0,0 +1,64 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Integration test for mouse interaction in the dominator tree
"use strict";
const {
dominatorTreeState,
viewState,
} = require("devtools/client/memory/constants");
const { changeView } = require("devtools/client/memory/actions/view");
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
function clickOnNodeArrow(node, panel) {
EventUtils.synthesizeMouseAtCenter(node.querySelector(".arrow"),
{}, panel.panelWin);
}
this.test = makeMemoryTest(TEST_URL, function* ({ panel }) {
// Taking snapshots and computing dominator trees is slow :-/
requestLongerTimeout(4);
const store = panel.panelWin.gStore;
const { getState, dispatch } = store;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.DOMINATOR_TREE));
// Take a snapshot.
const takeSnapshotButton = doc.getElementById("take-snapshot");
EventUtils.synthesizeMouseAtCenter(takeSnapshotButton, {}, panel.panelWin);
// Wait for the dominator tree to be computed and fetched.
yield waitUntilState(store, state =>
state.snapshots[0] &&
state.snapshots[0].dominatorTree &&
state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED);
ok(true, "Computed and fetched the dominator tree.");
const root = getState().snapshots[0].dominatorTree.root;
ok(getState().snapshots[0].dominatorTree.expanded.has(root.nodeId),
"Root node is expanded by default");
// Click on root arrow to collapse the root element
const rootNode = doc.querySelector(`.node-${root.nodeId}`);
clickOnNodeArrow(rootNode, panel);
yield waitUntilState(store, state =>
state.snapshots[0] &&
state.snapshots[0].dominatorTree &&
!state.snapshots[0].dominatorTree.expanded.has(root.nodeId));
ok(true, "Root node collapsed");
// Click on root arrow to expand it again
clickOnNodeArrow(rootNode, panel);
yield waitUntilState(store, state =>
state.snapshots[0] &&
state.snapshots[0].dominatorTree &&
state.snapshots[0].dominatorTree.expanded.has(root.nodeId));
ok(true, "Root node is expanded again");
});

View File

@ -4,6 +4,7 @@ support-files =
[test_DominatorTree_01.html]
[test_DominatorTree_02.html]
[test_DominatorTree_03.html]
[test_DominatorTreeItem_01.html]
[test_Heap_01.html]
[test_Heap_02.html]

View File

@ -174,12 +174,18 @@ function onNextAnimationFrame(fn) {
requestAnimationFrame(fn));
}
function renderComponent(component, container) {
/**
* Render the provided ReactElement in the provided HTML container.
* Returns a Promise that will resolve the rendered element as a React
* component.
*/
function renderComponent(element, container) {
return new Promise(resolve => {
ReactDOM.render(component, container, onNextAnimationFrame(() => {
dumpn("Rendered = " + container.innerHTML);
resolve();
}));
let component = ReactDOM.render(element, container,
onNextAnimationFrame(() => {
dumpn("Rendered = " + container.innerHTML);
resolve(component);
}));
});
}

View File

@ -0,0 +1,75 @@
<!DOCTYPE HTML>
<html>
<!--
Test that expanded DominatorTreeItems are correctly rendered and updated
-->
<head>
<meta charset="utf-8">
<title>Tree component test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<!-- Give the container height so that the whole tree is rendered. -->
<div id="container" style="height: 900px;"></div>
<pre id="test">
<script src="head.js" type="application/javascript;version=1.8"></script>
<script type="application/javascript;version=1.8">
window.onload = Task.async(function* () {
try {
const container = document.getElementById("container");
// simple tree with one root and one child
const root = makeTestDominatorTreeNode(
{ moreChildrenAvailable: false },
[
makeTestDominatorTreeNode({ moreChildrenAvailable: false }),
]);
ok(root.children);
// root node is expanded
const expanded = new Set();
expanded.add(root.nodeId);
let component = yield renderComponent(
DominatorTreeComponent(immutableUpdate(
TEST_DOMINATOR_TREE_PROPS,
{
dominatorTree: immutableUpdate(
TEST_DOMINATOR_TREE_PROPS.dominatorTree,
{ expanded, root }
),
})), container);
ok(true, "Dominator tree rendered");
is(container.querySelectorAll(".tree-node").length, 2,
"Should display two rows");
is(container.querySelectorAll(".arrow.open").length, 1,
"Should display one expanded arrow");
yield setProps(component, immutableUpdate(
TEST_DOMINATOR_TREE_PROPS,
{
dominatorTree: immutableUpdate(
TEST_DOMINATOR_TREE_PROPS.dominatorTree,
{ expanded: new Set(), root }
)
}));
ok(true, "Dominator tree props updated to collapse all nodes");
is(container.querySelectorAll(".tree-node").length, 1,
"Should display only one row");
is(container.querySelectorAll(".arrow.open").length, 0,
"Should display no expanded arrow");
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
});
</script>
</pre>
</body>
</html>

View File

@ -5,6 +5,7 @@
* Tests that the overview graphs cannot be selected during recording
* and that they're cleared upon rerecording.
*/
const TIMES_TO_UPDATE = 2;
function* spawnTest() {
// This test seems to take a long time to cleanup on Ubuntu VMs.
requestLongerTimeout(2);
@ -51,7 +52,7 @@ function* spawnTest() {
let updated = 0;
OverviewView.on(EVENTS.OVERVIEW_RENDERED, () => updated++);
ok((yield waitUntil(() => updated > 10)),
ok((yield waitUntil(() => updated > TIMES_TO_UPDATE)),
"The overviews were updated several times.");
ok("selectionEnabled" in framerate,

View File

@ -4,6 +4,7 @@
/**
* Tests that the overview graphs share the exact same width and scaling.
*/
const TIMES_TO_UPDATE = 2;
function* spawnTest() {
// This test seems to take a long time to cleanup on Ubuntu VMs.
requestLongerTimeout(2);
@ -23,7 +24,7 @@ function* spawnTest() {
yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length);
yield waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length);
yield waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length);
yield waitUntil(() => updated > 10);
yield waitUntil(() => updated > TIMES_TO_UPDATE);
yield stopRecording(panel);

View File

@ -51,6 +51,7 @@ pref("devtools.command-button-eyedropper.enabled", false);
pref("devtools.command-button-screenshot.enabled", false);
pref("devtools.command-button-rulers.enabled", false);
pref("devtools.command-button-measure.enabled", false);
pref("devtools.command-button-noautohide.enabled", false);
// Inspector preferences
// Enable the Inspector

View File

@ -2193,8 +2193,6 @@ ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, {
*/
_attach: function SW__attach()
{
let deferred = promise.defer();
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
@ -2202,19 +2200,11 @@ ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, {
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.getProcess().then(aResponse => {
if (aResponse.error) {
reportError("listTabs", aResponse);
deferred.reject(aResponse);
}
else {
deferred.resolve({ form: aResponse.form, client: client });
}
return client.connect()
.then(() => client.getProcess())
.then(aResponse => {
return { form: aResponse.form, client: client };
});
});
return deferred.promise;
}
});

View File

@ -78,9 +78,7 @@ exports.getTestActorWithoutToolbox = Task.async(function* (tab) {
}
let client = new DebuggerClient(DebuggerServer.connectPipe());
let deferred = promise.defer();
client.connect(deferred.resolve);
yield deferred.promise;
yield client.connect();
// We also need to make sure the test actor is registered on the server.
yield registerTestActor(client);

View File

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 30 29" xmlns="http://www.w3.org/2000/svg" fill="whitesmoke">
<g fill-rule="evenodd">
<path d="M3 1v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V1c0 1.104.896 2 2 2H1c1.104 0 2-.896 2-2zM0 1c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H1c-.553 0-1-.447-1-1V1zM20 1v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V1c0 1.104.896 2 2 2H18c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H18c-.553 0-1-.447-1-1V1zM20 17v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V17c0 1.104.896 2 2 2H18c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H18c-.553 0-1-.447-1-1V17zM3 17v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V17c0 1.104.896 2 2 2H1c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H1c-.553 0-1-.447-1-1V17z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -744,6 +744,10 @@
background-image: url("chrome://devtools/skin/images/command-console.png");
}
#command-button-noautohide > image {
background-image: url("chrome://devtools/skin/images/command-noautohide.svg");
}
#command-button-eyedropper > image {
background-image: url("chrome://devtools/skin/images/command-eyedropper.png");
}

View File

@ -192,15 +192,13 @@ HUD_SERVICE.prototype =
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.getProcess().then(aResponse => {
return client.connect()
.then(() => client.getProcess())
.then(aResponse => {
// Set chrome:false in order to attach to the target
// (i.e. send an `attach` request to the chrome actor)
deferred.resolve({ form: aResponse.form, client: client, chrome: false });
}, deferred.reject);
});
return deferred.promise;
return { form: aResponse.form, client: client, chrome: false };
});
}
let target;

View File

@ -11,8 +11,9 @@ function test() {
}
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function onConnect() {
gClient.listTabs(function onListTabs(aResponse) {
gClient.connect()
.then(() => gClient.listTabs())
.then(aResponse => {
var options = {
prefix: "helloActor",
@ -41,7 +42,6 @@ function test() {
});
});
});
});
}
function checkActorState(helloActor, callback) {

View File

@ -81,13 +81,11 @@ function initDebuggerServer() {
* connected.
*/
function connectDebuggerClient(client) {
return new Promise(resolve => {
client.connect(() => {
client.listTabs(tabs => {
resolve(tabs.tabs[tabs.selected]);
});
return client.connect()
.then(() => client.listTabs())
.then(tabs => {
return tabs.tabs[tabs.selected];
});
});
}
/**

View File

@ -13,8 +13,6 @@ SimpleTest.registerCleanupFunction(function() {
Services.prefs.clearUserPref("dom.mozBrowserFramesEnabled");
});
const {promiseInvoke} = require("devtools/shared/async-utils");
const { DirectorRegistry,
DirectorRegistryFront } = require("devtools/server/actors/director-registry");
@ -30,7 +28,7 @@ function* newConnectedDebuggerClient(opts) {
var transport = DebuggerServer.connectPipe();
var client = new DebuggerClient(transport);
yield promiseInvoke(client, client.connect);
yield client.connect();
var root = yield client.listTabs();

View File

@ -58,7 +58,7 @@ function attachURL(url, callback) {
window.addEventListener("message", function loadListener(event) {
if (event.data === "ready") {
client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect((applicationType, traits) => {
client.connect().then(([applicationType, traits]) => {
client.listTabs(response => {
for (let tab of response.tabs) {
if (tab.url === url) {

View File

@ -22,26 +22,14 @@ function startServerAndGetSelectedTabMemory() {
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
return new Promise((resolve, reject) => {
client.connect(response => {
if (response.error) {
reject(new Error(response.error + ": " + response.message));
return;
}
return client.connect()
.then(() => client.listTabs())
.then(response => {
var form = response.tabs[response.selected];
var memory = MemoryFront(client, form, response);
client.listTabs(response => {
if (response.error) {
reject(new Error(response.error + ": " + response.message));
return;
}
var form = response.tabs[response.selected];
var memory = MemoryFront(client, form, response);
resolve({ memory, client });
});
return { memory, client };
});
});
}
function destroyServerAndFinish(client) {

View File

@ -23,26 +23,14 @@ function startServerAndGetSelectedTabMemprof() {
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
return new Promise((resolve, reject) => {
client.connect(response => {
if (response.error) {
reject(new Error(response.error + ": " + response.message));
return;
}
return client.connect()
.then(() => client.listTabs())
.then(response => {
var form = response.tabs[response.selected];
var memprof = MemprofFront(client, form);
client.listTabs(response => {
if (response.error) {
reject(new Error(response.error + ": " + response.message));
return;
}
var form = response.tabs[response.selected];
var memprof = MemprofFront(client, form);
resolve({ memprof, client });
});
return { memprof, client };
});
});
}
function destroyServerAndFinish(client) {

View File

@ -34,7 +34,7 @@ window.onload = function() {
}
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var d = getDeviceFront(client, aResponse);

View File

@ -75,7 +75,7 @@ window.onload = function() {
}
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var form = aResponse.tabs[aResponse.selected];
var front = FramerateFront(client, form);

View File

@ -75,7 +75,7 @@ window.onload = function() {
}
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var form = aResponse.tabs[aResponse.selected];
var front = FramerateFront(client, form);

View File

@ -43,7 +43,7 @@ window.onload = function() {
}
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var form = aResponse.tabs[aResponse.selected];
var front = FramerateFront(client, form);

View File

@ -38,7 +38,7 @@ window.onload = function() {
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var form = aResponse.tabs[aResponse.selected];
var front = FramerateFront(client, form);

View File

@ -52,7 +52,7 @@ function runTests() {
// Fake a first connection to the content process
let transport = DebuggerServer.connectPipe();
client = new DebuggerClient(transport);
client.connect(listProcess);
client.connect().then(listProcess);
}
function listProcess() {

View File

@ -31,7 +31,7 @@ function runTests() {
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var p = getPreferenceFront(client, aResponse);

View File

@ -35,7 +35,7 @@ function runTests() {
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var s = getSettingsFront(client, aResponse);

View File

@ -130,11 +130,7 @@ function createTestGlobal(name) {
function connect(client) {
dump("Connecting client.\n");
return new Promise(function (resolve) {
client.connect(function () {
resolve();
});
});
return client.connect();
}
function close(client) {
@ -423,11 +419,11 @@ function get_chrome_actors(callback)
DebuggerServer.allowChromeProcess = true;
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.getProcess().then(response => {
client.connect()
.then(() => client.getProcess())
.then(response => {
callback(client, response.form);
});
});
}
function getChromeActors(client, server = DebuggerServer) {

View File

@ -19,7 +19,7 @@ function run_test()
initTestDebuggerServer();
DebuggerServer.addBrowserActors();
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(getRegistry);
gClient.connect().then(getRegistry);
do_test_pending();
}

View File

@ -35,12 +35,12 @@ function run_test()
function init()
{
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function onConnect() {
gClient.listTabs(function onListTabs(aResponse) {
gClient.connect()
.then(() => gClient.listTabs())
.then(aResponse => {
gActors = aResponse;
run_next_test();
});
});
}
function test_pre_init_global_actor()

View File

@ -12,7 +12,7 @@ function run_test()
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect(function(aType, aTraits) {
gClient.connect().then(function([aType, aTraits]) {
attachTestTab(gClient, "test-1", function(aReply, aTabClient) {
test_attach(aTabClient);
});

View File

@ -14,7 +14,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
testBlackBox();

View File

@ -16,7 +16,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_black_box();

View File

@ -15,7 +15,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_black_box();

View File

@ -14,7 +14,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_black_box();

View File

@ -14,7 +14,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
// XXX: We have to do an executeSoon so that the error isn't caught and

View File

@ -16,7 +16,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;

View File

@ -15,7 +15,7 @@ function run_test()
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-black-box");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
gClient.connect().then(function() {
attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
testBlackBox();

View File

@ -23,7 +23,7 @@ function run_test_with_server(aServer, aCallback)
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
gClient.connect().then(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_simple_breakpoint();

View File

@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback)
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
gClient.connect().then(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_breakpoint_running();

View File

@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback)
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
gClient.connect().then(function () {
attachTestTabAndResume(gClient,
"test-stack",
function (aResponse, aTabClient, aThreadClient) {

Some files were not shown because too many files have changed in this diff Show More