Merge fx-team to m-c

This commit is contained in:
Wes Kocher 2014-02-18 18:40:11 -08:00
commit b3d651d7bd
20 changed files with 244 additions and 85 deletions

View File

@ -41,7 +41,6 @@ let CustomizationHandler = {
CombinedStopReload.uninit();
CombinedBackForward.uninit();
PlacesToolbarHelper.customizeStart();
BookmarkingUI.customizeStart();
DownloadsButton.customizeStart();
// The additional padding on the sides of the browser
@ -55,7 +54,6 @@ let CustomizationHandler = {
_customizationChange: function() {
gHomeButton.updatePersonalToolbarStyle();
BookmarkingUI.customizeChange();
PlacesToolbarHelper.customizeChange();
},
@ -84,7 +82,6 @@ let CustomizationHandler = {
}
PlacesToolbarHelper.customizeDone();
BookmarkingUI.customizeDone();
DownloadsButton.customizeDone();
// The url bar splitter state is dependent on whether stop/reload

View File

@ -1153,24 +1153,54 @@ let BookmarkingUI = {
this.button._placesView.uninit();
},
customizeStart: function BUI_customizeStart() {
this._uninitView();
onCustomizeStart: function BUI_customizeStart(aWindow) {
if (aWindow == window) {
this._uninitView();
this._isCustomizing = true;
}
},
customizeChange: function BUI_customizeChange() {
onWidgetAdded: function BUI_widgetAdded(aWidgetId) {
if (aWidgetId != "bookmarks-menu-button") {
return;
}
let usedToUpdateStarState = this._shouldUpdateStarState();
this._updateCustomizationState();
if (usedToUpdateStarState != this._shouldUpdateStarState()) {
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
this.updateStarState();
} else if (usedToUpdateStarState && !this._shouldUpdateStarState()) {
this._updateStar();
}
// If we're moved outside of customize mode, we need to uninit
// our view so it gets reconstructed.
if (!this._isCustomizing) {
this._uninitView();
}
this._updateToolbarStyle();
},
customizeDone: function BUI_customizeDone() {
this.onToolbarVisibilityChange();
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
if (aWidgetId != "bookmarks-menu-button") {
return;
}
// If we're moved outside of customize mode, we need to uninit
// our view so it gets reconstructed.
if (!this._isCustomizing) {
this._uninitView();
}
this._updateCustomizationState();
this._updateToolbarStyle();
},
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
if (aWindow == window) {
this._isCustomizing = false;
this.onToolbarVisibilityChange();
this._updateToolbarStyle();
}
},
init: function() {
CustomizableUI.addListener(this);
this._updateCustomizationState();
@ -1194,11 +1224,14 @@ let BookmarkingUI = {
}
},
updateStarState: function BUI_updateStarState() {
onLocationChange: function BUI_onLocationChange() {
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
return;
}
this.updateStarState();
},
updateStarState: function BUI_updateStarState() {
// Reset tracked values.
this._uri = gBrowser.currentURI;
this._itemIds = [];
@ -1487,10 +1520,9 @@ let BookmarkingUI = {
if (aNode.id != "bookmarks-menu-button" || win != window)
return;
// If the button hasn't been in the overflow panel before, we may ignore
// this event.
if (!this._starButtonLabel)
return;
// The view gets broken by being removed and reinserted. Uninit
// here so popupshowing will generate a new one:
this._uninitView();
if (aNode.getAttribute("label") != this._starButtonLabel)
aNode.setAttribute("label", this._starButtonLabel);

View File

@ -3610,8 +3610,7 @@ var XULBrowserWindow = {
if (gURLBar) {
URLBarSetURI(aLocationURI);
// Update starring UI
BookmarkingUI.updateStarState();
BookmarkingUI.onLocationChange();
SocialUI.updateState();
}

View File

@ -727,7 +727,7 @@ let CustomizableUIInternal = {
let widgetNode = window.document.getElementById(aWidgetId);
if (!widgetNode) {
ERROR("Widget not found, unable to remove");
INFO("Widget not found, unable to remove");
continue;
}
let container = areaNode.customizationTarget;

View File

@ -23,3 +23,9 @@ function ERROR(...args) {
args.unshift(gModuleName);
console.error.apply(console, args);
}
function INFO(...args) {
args.unshift(gModuleName);
console.info.apply(console, args);
}

View File

@ -721,8 +721,16 @@ PlacesViewBase.prototype = {
if (this._controller) {
this._controller.terminate();
this._viewElt.controllers.removeController(this._controller);
this._controller = null;
// Removing the controller will fail if it is already no longer there.
// This can happen if the view element was removed/reinserted without
// our knowledge. There is no way to check for that having happened
// without the possibility of an exception. :-(
try {
this._viewElt.controllers.removeController(this._controller);
} catch (ex) {
} finally {
this._controller = null;
}
}
delete this._viewElt._placesView;

View File

@ -45,3 +45,4 @@ skip-if = true
[browser_416459_cut.js]
[browser_library_downloads.js]
[browser_library_left_pane_select_hierarchy.js]
[browser_toolbarbutton_menu_context.js]

View File

@ -0,0 +1,51 @@
let bookmarksMenuButton = document.getElementById("bookmarks-menu-button");
let BMB_menuPopup = document.getElementById("BMB_bookmarksPopup");
let BMB_showAllBookmarks = document.getElementById("BMB_bookmarksShowAll");
let contextMenu = document.getElementById("placesContext");
let newBookmarkItem = document.getElementById("placesContext_new:bookmark");
waitForExplicitFinish();
add_task(function testPopup() {
info("Checking popup context menu before moving the bookmarks button");
yield checkPopupContextMenu();
let pos = CustomizableUI.getPlacementOfWidget("bookmarks-menu-button").position;
CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_PANEL);
CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_NAVBAR, pos);
info("Checking popup context menu after moving the bookmarks button");
yield checkPopupContextMenu();
});
function* checkPopupContextMenu() {
let dropmarker = document.getAnonymousElementByAttribute(bookmarksMenuButton, "anonid", "dropmarker");
let popupShownPromise = onPopupEvent(BMB_menuPopup, "shown");
EventUtils.synthesizeMouseAtCenter(dropmarker, {});
info("Waiting for bookmarks menu to be shown.");
yield popupShownPromise;
let contextMenuShownPromise = onPopupEvent(contextMenu, "shown");
EventUtils.synthesizeMouseAtCenter(BMB_showAllBookmarks, {type: "contextmenu", button: 2 });
info("Waiting for context menu on bookmarks menu to be shown.");
yield contextMenuShownPromise;
ok(!newBookmarkItem.hasAttribute("disabled"), "New bookmark item shouldn't be disabled");
let contextMenuHiddenPromise = onPopupEvent(contextMenu, "hidden");
contextMenu.hidePopup();
info("Waiting for context menu on bookmarks menu to be hidden.");
yield contextMenuHiddenPromise;
let popupHiddenPromise = onPopupEvent(BMB_menuPopup, "hidden");
// Can't use synthesizeMouseAtCenter because the dropdown panel is in the way
EventUtils.synthesizeMouse(dropmarker, 2, 2, {});
info("Waiting for bookmarks menu to be hidden.");
yield popupHiddenPromise;
}
function onPopupEvent(popup, evt) {
let fullEvent = "popup" + evt;
let deferred = new Promise.defer();
let onPopupHandler = (e) => {
if (e.target == popup) {
popup.removeEventListener(fullEvent, onPopupHandler);
deferred.resolve();
}
};
popup.addEventListener(fullEvent, onPopupHandler);
return deferred.promise;
}

View File

@ -2011,6 +2011,7 @@ let SessionStoreInternal = {
var activeWindow = this._getMostRecentBrowserWindow();
TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
if (this._loadState == STATE_RUNNING) {
// update the data for all windows with activities since the last save operation
this._forEachBrowserWindow(function(aWindow) {
@ -2025,6 +2026,7 @@ let SessionStoreInternal = {
});
DirtyWindows.clear();
}
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
// An array that at the end will hold all current window data.
var total = [];
@ -2043,7 +2045,10 @@ let SessionStoreInternal = {
if (!this._windows[ix].isPopup)
nonPopupCount++;
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
SessionCookies.update(total);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
// collect the data for all windows yet to be restored
for (ix in this._statesToRestore) {
@ -2089,7 +2094,7 @@ let SessionStoreInternal = {
};
// get open Scratchpad window states too
var scratchpads = ScratchpadManager.getSessionState();
let scratchpads = ScratchpadManager.getSessionState();
let state = {
windows: total,
@ -2138,6 +2143,7 @@ let SessionStoreInternal = {
_collectWindowData: function ssi_collectWindowData(aWindow) {
if (!this._isWindowLoaded(aWindow))
return;
TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
let tabbrowser = aWindow.gBrowser;
let tabs = tabbrowser.tabs;
@ -2159,6 +2165,7 @@ let SessionStoreInternal = {
aWindow.__SS_lastSessionWindowID;
DirtyWindows.remove(aWindow);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
},
/* ........ Restoring Functionality .............. */

View File

@ -497,6 +497,10 @@ StyleSheetEditor.prototype = {
markLinkedFileBroken: function(error) {
this.linkedCSSFileError = error || true;
this.emit("linked-css-file-error");
error += " querying " + this.linkedCSSFile +
" original source location: " + this.savedFile.path
Cu.reportError(error);
},
/**
@ -616,10 +620,20 @@ function prettifyCSS(text)
* Find a path on disk for a file given it's hosted uri, the uri of the
* original resource that generated it (e.g. Sass file), and the location of the
* local file for that source.
*
* @param {nsIURI} uri
* The uri of the resource
* @param {nsIURI} origUri
* The uri of the original source for the resource
* @param {nsIFile} file
* The local file for the resource on disk
*
* @return {string}
* The path of original file on disk
*/
function findLinkedFilePath(uri, origUri, file) {
let project = findProjectPath(origUri, file);
let branch = findUnsharedBranch(origUri, uri);
let { origBranch, branch } = findUnsharedBranches(origUri, uri);
let project = findProjectPath(file, origBranch);
let parts = project.concat(branch);
let path = OS.Path.join.apply(this, parts);
@ -628,57 +642,58 @@ function findLinkedFilePath(uri, origUri, file) {
}
/**
* Find the path of a project given a file in the project and the uri
* of that resource. e.g.:
* "http://localhost/src/a.css" and "/Users/moz/proj/src/a.css"
* would yeild ["Users", "moz", "proj"]
* Find the path of a project given a file in the project and its branch
* off the root. e.g.:
* /Users/moz/proj/src/a.css" and "src/a.css"
* would yield ["Users", "moz", "proj"]
*
* @param {nsIURI} uri
* uri of hosted resource
* @param {nsIFile} file
* file for that resource on disk
* @param {array} branch
* path parts for branch to chop off file path.
* @return {array}
* array of path parts
*/
function findProjectPath(uri, file) {
let uri = OS.Path.split(uri.path).components;
function findProjectPath(file, branch) {
let path = OS.Path.split(file.path).components;
// don't care about differing leaf names
uri.pop();
path.pop();
let dir = path.pop();
while(dir) {
let serverDir = uri.pop();
if (serverDir != dir) {
return path.concat([dir]);
for (let i = 2; i <= branch.length; i++) {
// work backwards until we find a differing directory name
if (path[path.length - i] != branch[branch.length - i]) {
return path.slice(0, path.length - i + 1);
}
dir = path.pop();
}
return [];
// if we don't find a differing directory, just chop off the branch
return path.slice(0, path.length - branch.length);
}
/**
* Find the part of a uri past the root it shares with another uri. e.g:
* Find the parts of a uri past the root it shares with another uri. e.g:
* "http://localhost/built/a.scss" and "http://localhost/src/a.css"
* would yeild ["built", "a.scss"];
* would yield ["built", "a.scss"] and ["src", "a.css"]
*
* @param {nsIURI} origUri
* uri to find unshared branch of
* @param {nsIURI} origUri
* uri to find unshared branch of. Usually is uri for original source.
* @param {nsIURI} uri
* uri to compare against to get a shared root
* @return {array}
* array of path parts for branch
* @return {object}
* object with 'branch' and 'origBranch' array of path parts for branch
*/
function findUnsharedBranch(origUri, uri) {
function findUnsharedBranches(origUri, uri) {
origUri = OS.Path.split(origUri.path).components;
uri = OS.Path.split(uri.path).components;
for (var i = 0; i < uri.length - 1; i++) {
for (let i = 0; i < uri.length - 1; i++) {
if (uri[i] != origUri[i]) {
return uri.slice(i);
return {
branch: uri.slice(i),
origBranch: origUri.slice(i)
};
}
}
return uri;
return {
branch: uri,
origBranch: origUri
};
}

View File

@ -22,9 +22,9 @@ support-files =
simple.css.gz^headers^
simple.gz.html
simple.html
sourcemaps.css
sourcemaps.css.map
sourcemaps.scss
sourcemap-css/sourcemaps.css
sourcemap-css/sourcemaps.css.map
sourcemap-sass/sourcemaps.scss
sourcemaps.html
test_private.css
test_private.html

View File

@ -7,10 +7,10 @@ let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let promise = devtools.require("sdk/core/promise");
const TESTCASE_URI_HTML = TEST_BASE + "sourcemaps.html";
const TESTCASE_URI_CSS = TEST_BASE + "sourcemaps.css";
const TESTCASE_URI_CSS = TEST_BASE + "sourcemap-css/sourcemaps.css";
const TESTCASE_URI_REG_CSS = TEST_BASE + "simple.css";
const TESTCASE_URI_SCSS = TEST_BASE + "sourcemaps.scss";
const TESTCASE_URI_MAP = TEST_BASE + "sourcemaps.css.map";
const TESTCASE_URI_SCSS = TEST_BASE + "sourcemap-sass/sourcemaps.scss";
const TESTCASE_URI_MAP = TEST_BASE + "sourcemap-css/sourcemaps.css.map";
const PREF = "devtools.styleeditor.source-maps-enabled";
@ -33,11 +33,11 @@ function test()
Task.spawn(function() {
// copy all our files over so we don't screw them up for other tests
let HTMLFile = yield copy(TESTCASE_URI_HTML, "sourcemaps.html");
let CSSFile = yield copy(TESTCASE_URI_CSS, "sourcemaps.css");
yield copy(TESTCASE_URI_SCSS, "sourcemaps.scss");
yield copy(TESTCASE_URI_MAP, "sourcemaps.css.map");
yield copy(TESTCASE_URI_REG_CSS, "simple.css");
let HTMLFile = yield copy(TESTCASE_URI_HTML, ["sourcemaps.html"]);
let CSSFile = yield copy(TESTCASE_URI_CSS, ["sourcemap-css", "sourcemaps.css"]);
yield copy(TESTCASE_URI_SCSS, ["sourcemap-sass", "sourcemaps.scss"]);
yield copy(TESTCASE_URI_MAP, ["sourcemap-css", "sourcemaps.css.map"]);
yield copy(TESTCASE_URI_REG_CSS, ["simple.css"]);
let uri = Services.io.newFileURI(HTMLFile);
let testcaseURI = uri.resolve("");
@ -136,9 +136,9 @@ function getStylesheetNameLinkFor(editor) {
return editor.summary.querySelector(".stylesheet-name");
}
function copy(aSrcChromeURL, aDestFileName)
function copy(aSrcChromeURL, aDestFilePath)
{
let destFile = FileUtils.getFile("ProfD", [aDestFileName]);
let destFile = FileUtils.getFile("ProfD", aDestFilePath);
return write(read(aSrcChromeURL), destFile);
}

View File

@ -1,7 +1,6 @@
{
"version": 3,
"mappings": "AAGA,GAAI;EACF,KAAK,EAHU,OAAI;;AAMrB,IAAK;EACH,gBAAgB,EAAE,IAAI",
"sources": ["sourcemaps.scss"],
"names": [],
"sources": ["../sourcemap-sass/sourcemaps.scss"],
"file": "sourcemaps.css"
}

View File

@ -3,7 +3,7 @@
<head>
<title>testcase for testing CSS source maps</title>
<link rel="stylesheet" type="text/css" href="simple.css"/>
<link rel="stylesheet" type="text/css" href="sourcemaps.css"/>
<link rel="stylesheet" type="text/css" href="sourcemap-css/sourcemaps.css"/>
</head>
<body>
<div>source maps <span>testcase</span></div>

View File

@ -73,7 +73,7 @@
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application android:label="@MOZ_APP_DISPLAYNAME@"
<application android:label="@string/moz_app_displayname"
android:icon="@drawable/icon"
android:name="org.mozilla.gecko.GeckoApplication"
android:hardwareAccelerated="true"
@ -86,7 +86,7 @@
<!-- If the windowSoftInputMode adjust* flag changes below, the
setSoftInputMode call in BrowserSearch#onStop must also be updated. -->
<activity android:name=".App"
android:label="@MOZ_APP_DISPLAYNAME@"
android:label="@string/moz_app_displayname"
android:taskAffinity="@ANDROID_PACKAGE_NAME@.BROWSER"
android:alwaysRetainTaskState="true"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"

View File

@ -2774,6 +2774,10 @@ public abstract class GeckoApp
}
private void setSystemUiVisible(final boolean visible) {
if (Build.VERSION.SDK_INT < 14) {
return;
}
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {

View File

@ -3293,6 +3293,30 @@
"extended_statistics_ok": true,
"description": "Widget: Time it takes for the message before a UI message (ms)"
},
"FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS": {
"expires_in_version": "never",
"kind": "exponential",
"high": "30000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Session restore: Time to collect all window data (ms)"
},
"FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS": {
"expires_in_version": "never",
"kind": "exponential",
"high": "30000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Session restore: Time to collect the data of a single window (ms)"
},
"FX_SESSION_RESTORE_COLLECT_COOKIES_MS": {
"expires_in_version": "never",
"kind": "exponential",
"high": "30000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Session restore: Time to collect cookies (ms)"
},
"FX_SESSION_RESTORE_COLLECT_DATA_MS": {
"expires_in_version": "never",
"kind": "exponential",

View File

@ -20,6 +20,8 @@ let OBJECT_PREVIEW_MAX_ITEMS = 10;
* as after a refresh).
*/
function BreakpointStore() {
this._size = 0;
// If we have a whole-line breakpoint set at LINE in URL, then
//
// this._wholeLineBreakpoints[URL][LINE]
@ -44,6 +46,8 @@ function BreakpointStore() {
}
BreakpointStore.prototype = {
_size: null,
get size() { return this._size; },
/**
* Add a breakpoint to the breakpoint store.
@ -75,6 +79,8 @@ BreakpointStore.prototype = {
}
this._wholeLineBreakpoints[url][line] = aBreakpoint;
}
this._size++;
},
/**
@ -91,23 +97,29 @@ BreakpointStore.prototype = {
if (column != null) {
if (this._breakpoints[url]) {
if (this._breakpoints[url][line]) {
delete this._breakpoints[url][line][column];
if (this._breakpoints[url][line][column]) {
delete this._breakpoints[url][line][column];
this._size--;
// If this was the last breakpoint on this line, delete the line from
// `this._breakpoints[url]` as well. Otherwise `_iterLines` will yield
// this line even though we no longer have breakpoints on
// it. Furthermore, we use Object.keys() instead of just checking
// `this._breakpoints[url].length` directly, because deleting
// properties from sparse arrays doesn't update the `length` property
// like adding them does.
if (Object.keys(this._breakpoints[url][line]).length === 0) {
delete this._breakpoints[url][line];
// If this was the last breakpoint on this line, delete the line from
// `this._breakpoints[url]` as well. Otherwise `_iterLines` will yield
// this line even though we no longer have breakpoints on
// it. Furthermore, we use Object.keys() instead of just checking
// `this._breakpoints[url].length` directly, because deleting
// properties from sparse arrays doesn't update the `length` property
// like adding them does.
if (Object.keys(this._breakpoints[url][line]).length === 0) {
delete this._breakpoints[url][line];
}
}
}
}
} else {
if (this._wholeLineBreakpoints[url]) {
delete this._wholeLineBreakpoints[url][line];
if (this._wholeLineBreakpoints[url][line]) {
delete this._wholeLineBreakpoints[url][line];
this._size--;
}
}
}
},
@ -175,7 +187,7 @@ BreakpointStore.prototype = {
* - line (optional; requires the url property)
* - column (optional; requires the line property)
*/
findBreakpoints: function (aSearchParams={}) {
findBreakpoints: function* (aSearchParams={}) {
if (aSearchParams.column != null) {
dbg_assert(aSearchParams.line != null);
}
@ -199,7 +211,7 @@ BreakpointStore.prototype = {
}
},
_iterUrls: function (aUrl) {
_iterUrls: function* (aUrl) {
if (aUrl) {
if (this._breakpoints[aUrl] || this._wholeLineBreakpoints[aUrl]) {
yield aUrl;
@ -217,7 +229,7 @@ BreakpointStore.prototype = {
}
},
_iterLines: function (aUrl, aLine) {
_iterLines: function* (aUrl, aLine) {
if (aLine != null) {
if ((this._wholeLineBreakpoints[aUrl]
&& this._wholeLineBreakpoints[aUrl][aLine])
@ -245,7 +257,7 @@ BreakpointStore.prototype = {
}
},
_iterColumns: function (aUrl, aLine, aColumn) {
_iterColumns: function* (aUrl, aLine, aColumn) {
if (!this._breakpoints[aUrl] || !this._breakpoints[aUrl][aLine]) {
return;
}
@ -2220,6 +2232,10 @@ ThreadActor.prototype = {
* Restore any pre-existing breakpoints to the scripts that we have access to.
*/
_restoreBreakpoints: function () {
if (this.breakpointStore.size === 0) {
return;
}
for (let s of this.dbg.findScripts()) {
this._addScript(s);
}
@ -4822,7 +4838,7 @@ ThreadSources.prototype = {
return base.spec;
},
iter: function () {
iter: function* () {
for (let url in this._sourceActors) {
yield this._sourceActors[url];
}