merge m-c to fx-team

This commit is contained in:
Tim Taubert 2013-02-19 10:39:49 +01:00
commit 5fd3369425
7 changed files with 100 additions and 37 deletions

View File

@ -4717,12 +4717,16 @@ var TabsProgressListener = {
#endif
// Collect telemetry data about tab load times.
if (aWebProgress.DOMWindow == aWebProgress.DOMWindow.top &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
TelemetryStopwatch.start("FX_PAGE_LOAD_MS", aBrowser);
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
TelemetryStopwatch.finish("FX_PAGE_LOAD_MS", aBrowser);
if (aWebProgress.DOMWindow == aWebProgress.DOMWindow.top) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
TelemetryStopwatch.start("FX_PAGE_LOAD_MS", aBrowser);
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
TelemetryStopwatch.finish("FX_PAGE_LOAD_MS", aBrowser);
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStatus == Cr.NS_BINDING_ABORTED) {
TelemetryStopwatch.cancel("FX_PAGE_LOAD_MS", aBrowser);
}
}
// Attach a listener to watch for "click" events bubbling up from error

View File

@ -292,6 +292,11 @@ let SessionStoreInternal = {
// session
_lastSessionState: null,
// When starting Firefox with a single private window, this is the place
// where we keep the session we actually wanted to restore in case the user
// decides to later open a non-private window as well.
_deferredInitialState: null,
// A promise resolved once initialization is complete
_promiseInitialization: Promise.defer(),
@ -682,8 +687,9 @@ let SessionStoreInternal = {
// and create its internal data object
this._internalWindows[aWindow.__SSi] = { hosts: {} }
let isPrivateWindow = false;
if (PrivateBrowsingUtils.isWindowPrivate(aWindow))
this._windows[aWindow.__SSi].isPrivate = true;
this._windows[aWindow.__SSi].isPrivate = isPrivateWindow = true;
if (!this._isWindowLoaded(aWindow))
this._windows[aWindow.__SSi]._restoring = true;
if (!aWindow.toolbar.visible)
@ -696,17 +702,28 @@ let SessionStoreInternal = {
// restore a crashed session resp. resume the last session if requested
if (this._initialState) {
TelemetryTimestamps.add("sessionRestoreRestoring");
// make sure that the restored tabs are first in the window
this._initialState._firstTabs = true;
this._restoreCount = this._initialState.windows ? this._initialState.windows.length : 0;
this.restoreWindow(aWindow, this._initialState,
this._isCmdLineEmpty(aWindow, this._initialState));
delete this._initialState;
if (isPrivateWindow) {
// We're starting with a single private window. Save the state we
// actually wanted to restore so that we can do it later in case
// the user opens another, non-private window.
this._deferredInitialState = this._initialState;
delete this._initialState;
// _loadState changed from "stopped" to "running"
// force a save operation so that crashes happening during startup are correctly counted
this.saveState(true);
// Nothing to restore now, notify observers things are complete.
Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
} else {
TelemetryTimestamps.add("sessionRestoreRestoring");
// make sure that the restored tabs are first in the window
this._initialState._firstTabs = true;
this._restoreCount = this._initialState.windows ? this._initialState.windows.length : 0;
this.restoreWindow(aWindow, this._initialState,
this._isCmdLineEmpty(aWindow, this._initialState));
delete this._initialState;
// _loadState changed from "stopped" to "running"
// force a save operation so that crashes happening during startup are correctly counted
this.saveState(true);
}
}
else {
// Nothing to restore, notify observers things are complete.
@ -721,9 +738,20 @@ let SessionStoreInternal = {
let followUp = this._statesToRestore[aWindow.__SS_restoreID].windows.length == 1;
this.restoreWindow(aWindow, this._statesToRestore[aWindow.__SS_restoreID], true, followUp);
}
// The user opened another, non-private window after starting up with
// a single private one. Let's restore the session we actually wanted to
// restore at startup.
else if (this._deferredInitialState && !isPrivateWindow &&
aWindow.toolbar.visible) {
this._deferredInitialState._firstTabs = true;
this._restoreCount = this._deferredInitialState.windows ?
this._deferredInitialState.windows.length : 0;
this.restoreWindow(aWindow, this._deferredInitialState, true);
this._deferredInitialState = null;
}
else if (this._restoreLastWindow && aWindow.toolbar.visible &&
this._closedWindows.length &&
!PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
this._closedWindows.length && !isPrivateWindow) {
// default to the most-recently closed window
// don't use popup windows
@ -3631,6 +3659,15 @@ let SessionStoreInternal = {
}
}
}
// Don't save invalid states.
// Looks we currently have private windows, only.
if (oState.windows.length == 0) {
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_COLLECT_DATA_MS");
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_COLLECT_DATA_LONGEST_OP_MS");
return;
}
for (let i = oState._closedWindows.length - 1; i >= 0; i--) {
if (oState._closedWindows[i].isPrivate) {
oState._closedWindows.splice(i, 1);

View File

@ -470,8 +470,10 @@ ProfilerPanel.prototype = {
panelWin = dbg.panelWin;
let view = dbg.panelWin.DebuggerView;
if (view.Source && view.Sources.selectedValue === data.uri) {
return void view.editor.setCaretPosition(data.line - 1);
if (view.Sources.selectedValue === data.uri) {
view.editor.setCaretPosition(data.line - 1);
onOpen();
return;
}
panelWin.addEventListener("Debugger:SourceShown", onSourceShown, false);

View File

@ -18,9 +18,18 @@ function test() {
let view = dbg.panelWin.DebuggerView;
is(view.Sources.selectedValue, data.uri, "URI is different");
is(view.editor.getCaretPosition().line, data.line - 1, "Line is different");
is(view.editor.getCaretPosition().line, data.line - 1,
"Line is different");
tearDown(tab);
// Test the case where script is already loaded.
view.editor.setCaretPosition(1);
gDevTools.showToolbox(target, "jsprofiler").then(function () {
panel.displaySource(data, function onOpenAgain() {
is(view.editor.getCaretPosition().line, data.line - 1,
"Line is different");
tearDown(tab);
});
});
});
});

View File

@ -626,17 +626,16 @@ function DT__updateErrorsCount(aChangedTabId)
let btn = this._errorCounterButton;
if (errors) {
let errorsText = toolboxStrings
.GetStringFromName("toolboxToggleButton.errorsCount");
errorsText = PluralForm.get(errors, errorsText);
.GetStringFromName("toolboxToggleButton.errors");
errorsText = PluralForm.get(errors, errorsText).replace("#1", errors);
let warningsText = toolboxStrings
.GetStringFromName("toolboxToggleButton.warningsCount");
warningsText = PluralForm.get(warnings, warningsText);
.GetStringFromName("toolboxToggleButton.warnings");
warningsText = PluralForm.get(warnings, warningsText).replace("#1", warnings);
let tooltiptext = toolboxStrings
.formatStringFromName("toolboxToggleButton.tooltiptext",
[errors, errorsText, warnings,
warningsText], 4);
.formatStringFromName("toolboxToggleButton.tooltip",
[errorsText, warningsText], 2);
btn.setAttribute("error-count", errors);
btn.setAttribute("tooltiptext", tooltiptext);

View File

@ -2,9 +2,21 @@ toolboxDockButtons.bottom.tooltip=Dock to bottom of browser window
toolboxDockButtons.side.tooltip=Dock to side of browser window
toolboxDockButtons.window.tooltip=Show in separate window
# LOCALIZATION NOTE (toolboxToggleButton): These strings are used for the button
# that allows users to open/close the developer tools. You can find this button
# on the developer toolbar.
toolboxToggleButton.errorsCount=error;errors
toolboxToggleButton.warningsCount=warning;warnings
toolboxToggleButton.tooltiptext=%S %S, %S %S.\nClick to toggle the developer tools.
# LOCALIZATION NOTE (toolboxToggleButton.errors): Semi-colon list of plural
# forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 number of errors in the current web page
toolboxToggleButton.errors=#1 error;#1 errors
# LOCALIZATION NOTE (toolboxToggleButton.warnings): Semi-colon list of plural
# forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 number of warnings in the current web page
toolboxToggleButton.warnings=#1 warning;#1 warnings
# LOCALIZATION NOTE (toolboxToggleButton.tooltip): This string is shown
# as tooltip in the developer toolbar to open/close the developer tools.
# It's using toolboxToggleButton.errors as first and
# toolboxToggleButton.warnings as second argument to show the number of errors
# and warnings.
toolboxToggleButton.tooltip=%1$S, %2$S\nClick to toggle the developer tools.

View File

@ -1451,7 +1451,7 @@ nsDOMWindowUtils::GetScrollbarWidth(bool aFlushLayout, int32_t* aResult)
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
NS_ENSURE_STATE(doc);
if (aFlushLayout) {