This commit is contained in:
Phil Ringnalda 2013-07-05 07:41:30 -07:00
Родитель 6c4f14eea2 5ddc37fef0
Коммит 772fe5502b
13 изменённых файлов: 111 добавлений и 48 удалений

Просмотреть файл

@ -125,12 +125,6 @@ function debug(aMsg) {
Services.console.logStringMessage(aMsg); Services.console.logStringMessage(aMsg);
} }
function notifyAsync(aTopic) {
Services.tm.mainThread.dispatch(() => {
Services.obs.notifyObservers(null, aTopic, "");
}, Ci.nsIThread.DISPATCH_NORMAL);
}
this.SessionStore = { this.SessionStore = {
get promiseInitialized() { get promiseInitialized() {
return SessionStoreInternal.promiseInitialized.promise; return SessionStoreInternal.promiseInitialized.promise;
@ -770,7 +764,7 @@ let SessionStoreInternal = {
this._initialState = null; this._initialState = null;
// Nothing to restore now, notify observers things are complete. // Nothing to restore now, notify observers things are complete.
notifyAsync(NOTIFY_WINDOWS_RESTORED); Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
} else { } else {
TelemetryTimestamps.add("sessionRestoreRestoring"); TelemetryTimestamps.add("sessionRestoreRestoring");
// make sure that the restored tabs are first in the window // make sure that the restored tabs are first in the window
@ -788,7 +782,7 @@ let SessionStoreInternal = {
} }
else { else {
// Nothing to restore, notify observers things are complete. // Nothing to restore, notify observers things are complete.
notifyAsync(NOTIFY_WINDOWS_RESTORED); Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
// the next delayed save request should execute immediately // the next delayed save request should execute immediately
this._lastSaveTime -= this._interval; this._lastSaveTime -= this._interval;
@ -4323,8 +4317,9 @@ let SessionStoreInternal = {
return; return;
// This was the last window restored at startup, notify observers. // This was the last window restored at startup, notify observers.
notifyAsync(this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : Services.obs.notifyObservers(null,
NOTIFY_WINDOWS_RESTORED); this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : NOTIFY_WINDOWS_RESTORED,
"");
this._browserSetState = false; this._browserSetState = false;
this._restoreCount = -1; this._restoreCount = -1;

Просмотреть файл

@ -181,19 +181,15 @@ OptionsPanel.prototype = {
}, },
/** /**
* Hides any label in a box with class "hidden-labels-box" at page load. The * Handles checkbox click inside hbox with class "hidden-labels-box". The
* labels are shown again when the user click on the checkbox in the box. * labels inside the hbox are shown again when the user click on the checkbox
* in the box.
*/ */
prepareRestartPreferences: function() { prepareRestartPreferences: function() {
let labels = this.panelDoc.querySelectorAll(".hidden-labels-box > label");
for (let label of labels) {
label.style.display = "none";
}
let checkboxes = this.panelDoc.querySelectorAll(".hidden-labels-box > checkbox"); let checkboxes = this.panelDoc.querySelectorAll(".hidden-labels-box > checkbox");
for (let checkbox of checkboxes) { for (let checkbox of checkboxes) {
checkbox.addEventListener("command", function(target) { checkbox.addEventListener("command", function(target) {
target.nextSibling.style.display = ""; target.parentNode.classList.toggle("visible");
target.nextSibling.nextSibling.style.display = "";
}.bind(null, checkbox)); }.bind(null, checkbox));
} }
}, },

Просмотреть файл

@ -95,6 +95,7 @@ Highlighter.prototype = {
_init: function Highlighter__init() _init: function Highlighter__init()
{ {
this.toggleLockState = this.toggleLockState.bind(this);
this.unlockAndFocus = this.unlockAndFocus.bind(this); this.unlockAndFocus = this.unlockAndFocus.bind(this);
this.updateInfobar = this.updateInfobar.bind(this); this.updateInfobar = this.updateInfobar.bind(this);
this.highlight = this.highlight.bind(this); this.highlight = this.highlight.bind(this);
@ -318,6 +319,19 @@ Highlighter.prototype = {
this.emit("unlocked"); this.emit("unlocked");
}, },
/**
* Toggle between locked and unlocked
*/
toggleLockState: function() {
if (this.locked) {
this.startNode = this.selection.node;
this.unlockAndFocus();
} else {
this.selection.setNode(this.startNode);
this.lock();
}
},
/** /**
* Focus the browser before unlocking. * Focus the browser before unlocking.
*/ */
@ -417,7 +431,7 @@ Highlighter.prototype = {
this.inspectButton.className = "highlighter-nodeinfobar-button highlighter-nodeinfobar-inspectbutton" this.inspectButton.className = "highlighter-nodeinfobar-button highlighter-nodeinfobar-inspectbutton"
let toolbarInspectButton = this.inspector.panelDoc.getElementById("inspector-inspect-toolbutton"); let toolbarInspectButton = this.inspector.panelDoc.getElementById("inspector-inspect-toolbutton");
this.inspectButton.setAttribute("tooltiptext", toolbarInspectButton.getAttribute("tooltiptext")); this.inspectButton.setAttribute("tooltiptext", toolbarInspectButton.getAttribute("tooltiptext"));
this.inspectButton.addEventListener("command", this.unlockAndFocus); this.inspectButton.addEventListener("command", this.toggleLockState);
let nodemenu = this.chromeDoc.createElement("toolbarbutton"); let nodemenu = this.chromeDoc.createElement("toolbarbutton");
nodemenu.setAttribute("type", "menu"); nodemenu.setAttribute("type", "menu");

Просмотреть файл

@ -72,7 +72,7 @@
tooltiptext="&inspector.selectButton.tooltip;" tooltiptext="&inspector.selectButton.tooltip;"
class="devtools-toolbarbutton" class="devtools-toolbarbutton"
hidden="true" hidden="true"
oncommand="inspector.highlighter.unlockAndFocus()"/> oncommand="inspector.highlighter.toggleLockState()"/>
<arrowscrollbox id="inspector-breadcrumbs" <arrowscrollbox id="inspector-breadcrumbs"
class="breadcrumbs-widget-container" class="breadcrumbs-widget-container"
flex="1" orient="horizontal" flex="1" orient="horizontal"

Просмотреть файл

@ -57,9 +57,30 @@ function setupHighlighterTests()
ok(h1, "we have the header"); ok(h1, "we have the header");
let i = getActiveInspector(); let i = getActiveInspector();
i.selection.setNode(div);
i.highlighter.unlockAndFocus(); i.highlighter.unlockAndFocus();
i.highlighter.outline.setAttribute("disable-transitions", "true"); i.highlighter.outline.setAttribute("disable-transitions", "true");
executeSoon(function() {
i.selection.once("new-node", performToggleComparisons);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
});
}
function performToggleComparisons(evt)
{
let i = getActiveInspector();
i.highlighter.toggleLockState();
ok(i.highlighter.locked, "highlighter locks");
is(i.selection.node, div);
i.highlighter.toggleLockState();
ok(!i.highlighter.locked, "highlighter unlocks");
i.highlighter.toggleLockState();
ok(i.highlighter.locked, "highlighter locks if selection is unchanged");
i.highlighter.toggleLockState();
executeSoon(function() { executeSoon(function() {
i.selection.once("new-node", performTestComparisons); i.selection.once("new-node", performTestComparisons);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content); EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);

Просмотреть файл

@ -312,11 +312,13 @@ MarkupView.prototype = {
} else { } else {
var container = new RootContainer(this, aNode); var container = new RootContainer(this, aNode);
this._elt.appendChild(container.elt); this._elt.appendChild(container.elt);
if (this._rootNode) {
this._rootNode.removeEventListener("load", this, true);
}
this._rootNode = aNode; this._rootNode = aNode;
aNode.addEventListener("load", function MP_watch_contentLoaded(aEvent) { aNode.addEventListener("load", this, true);
// Fake a childList mutation here.
this._mutationObserver([{target: aEvent.target, type: "childList"}]);
}.bind(this), true);
} }
this._containers.set(aNode, container); this._containers.set(aNode, container);
@ -334,6 +336,11 @@ MarkupView.prototype = {
return container; return container;
}, },
handleEvent: function MT_handleEvent(aEvent) {
// Fake a childList mutation here.
this._mutationObserver([{target: aEvent.target, type: "childList"}]);
},
/** /**
* Mutation observer used for included nodes. * Mutation observer used for included nodes.
*/ */
@ -648,7 +655,7 @@ MarkupView.prototype = {
this._frame.contentWindow.removeEventListener("underflow", this._boundResizePreview, true); this._frame.contentWindow.removeEventListener("underflow", this._boundResizePreview, true);
delete this._boundUpdatePreview; delete this._boundUpdatePreview;
this._frame.contentWindow.removeEventListener("keydown", this._boundKeyDown, true); this._frame.contentWindow.removeEventListener("keydown", this._boundKeyDown, false);
delete this._boundKeyDown; delete this._boundKeyDown;
this._inspector.selection.off("new-node", this._boundOnNewSelection); this._inspector.selection.off("new-node", this._boundOnNewSelection);
@ -659,6 +666,11 @@ MarkupView.prototype = {
delete this._containers; delete this._containers;
this._observer.disconnect(); this._observer.disconnect();
delete this._observer; delete this._observer;
if (this._rootNode) {
this._rootNode.removeEventListener("load", this, true);
delete this._rootNode;
}
}, },
/** /**

Просмотреть файл

@ -121,11 +121,17 @@ function test() {
widthBeforeClose = content.innerWidth; widthBeforeClose = content.innerWidth;
heightBeforeClose = content.innerHeight; heightBeforeClose = content.innerHeight;
mgr.once("off", function() {executeSoon(restart)}); info("XXX BUG 851296: instance.closing: " + !!instance.closing);
mgr.once("off", function() {
info("XXX BUG 851296: 'off' received.");
executeSoon(restart);
});
EventUtils.synthesizeKey("VK_ESCAPE", {}); EventUtils.synthesizeKey("VK_ESCAPE", {});
} }
function restart() { function restart() {
info("XXX BUG 851296: restarting.");
mgr.once("on", function() {executeSoon(onUIOpen2)}); mgr.once("on", function() {executeSoon(onUIOpen2)});
synthesizeKeyFromKeyTag("key_responsiveUI"); synthesizeKeyFromKeyTag("key_responsiveUI");
} }

Просмотреть файл

@ -253,20 +253,20 @@
} }
.options-vertical-pane { .options-vertical-pane {
margin: 15px; margin: 5px;
width: calc(50% - 30px); width: calc(50% - 30px);
min-width: 400px; min-width: 400px;
-moz-padding-start: 5px; -moz-padding-start: 5px;
} }
.options-vertical-pane > label { .options-vertical-pane > label {
padding: 5px 0; padding: 2px 0;
font-size: 1.4rem; font-size: 1.4rem;
} }
.options-groupbox { .options-groupbox {
-moz-margin-start: 15px; -moz-margin-start: 15px;
padding: 4px; padding: 2px;
} }
.options-groupbox > * { .options-groupbox > * {
@ -285,3 +285,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */ padding: 3px 0 0 !important; /* To align it with the checkbox */
font-style: italic; font-style: italic;
} }
.hidden-labels-box:not(.visible) > label,
.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
display: none;
}

Просмотреть файл

@ -239,20 +239,20 @@
} }
.options-vertical-pane { .options-vertical-pane {
margin: 15px; margin: 5px;
width: calc(50% - 30px); width: calc(50% - 30px);
min-width: 400px; min-width: 400px;
-moz-padding-start: 5px; -moz-padding-start: 5px;
} }
.options-vertical-pane > label { .options-vertical-pane > label {
padding: 5px 0; padding: 2px 0;
font-size: 1.4rem; font-size: 1.4rem;
} }
.options-groupbox { .options-groupbox {
-moz-margin-start: 15px; -moz-margin-start: 15px;
padding: 4px; padding: 2px;
} }
.options-groupbox > * { .options-groupbox > * {
@ -271,3 +271,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */ padding: 3px 0 0 !important; /* To align it with the checkbox */
font-style: italic; font-style: italic;
} }
.hidden-labels-box:not(.visible) > label,
.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
display: none;
}

Просмотреть файл

@ -248,20 +248,20 @@
} }
.options-vertical-pane { .options-vertical-pane {
margin: 15px; margin: 5px;
width: calc(50% - 30px); width: calc(50% - 30px);
min-width: 400px; min-width: 400px;
-moz-padding-start: 5px; -moz-padding-start: 5px;
} }
.options-vertical-pane > label { .options-vertical-pane > label {
padding: 5px 0; padding: 2px 0;
font-size: 1.4rem; font-size: 1.4rem;
} }
.options-groupbox { .options-groupbox {
-moz-margin-start: 15px; -moz-margin-start: 15px;
padding: 4px; padding: 2px;
} }
.options-groupbox > * { .options-groupbox > * {
@ -280,3 +280,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */ padding: 3px 0 0 !important; /* To align it with the checkbox */
font-style: italic; font-style: italic;
} }
.hidden-labels-box:not(.visible) > label,
.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
display: none;
}

Просмотреть файл

@ -1746,6 +1746,8 @@ nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
nsRefPtr<nsIPresShell> targetShell = targetDoc->GetShell(); nsRefPtr<nsIPresShell> targetShell = targetDoc->GetShell();
NS_ENSURE_STATE(targetShell); NS_ENSURE_STATE(targetShell);
targetDoc->FlushPendingNotifications(Flush_Layout);
nsEventStatus status = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status); targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status);
*aRetVal = (status != nsEventStatus_eConsumeNoDefault); *aRetVal = (status != nsEventStatus_eConsumeNoDefault);

Просмотреть файл

@ -718,6 +718,9 @@ let DirectoryIterator = function DirectoryIterator(path, options) {
this._isClosed = false; this._isClosed = false;
}; };
DirectoryIterator.prototype = { DirectoryIterator.prototype = {
iterator: function () this,
__iterator__: function () this,
/** /**
* Determine whether the directory exists. * Determine whether the directory exists.
* *

Просмотреть файл

@ -280,10 +280,7 @@ ThreadActor.prototype = {
resolve(onPacket(packet)).then(this.conn.send.bind(this.conn)); resolve(onPacket(packet)).then(this.conn.send.bind(this.conn));
return this._nest(); return this._nest();
} catch(e) { } catch(e) {
let msg = "Got an exception during TA__pauseAndRespond: " + e + reportError(e, "Got an exception during TA__pauseAndRespond: ");
": " + e.stack;
Cu.reportError(msg);
dumpn(msg);
return undefined; return undefined;
} }
}, },
@ -1241,8 +1238,7 @@ ThreadActor.prototype = {
this.conn.send(packet); this.conn.send(packet);
return this._nest(); return this._nest();
} catch(e) { } catch(e) {
Cu.reportError("Got an exception during TA_onExceptionUnwind: " + e + reportError(e, "Got an exception during TA_onExceptionUnwind: ");
": " + e.stack);
return undefined; return undefined;
} }
}, },
@ -1490,10 +1486,7 @@ SourceActor.prototype = {
source: aSourceGrip source: aSourceGrip
}; };
}, (aError) => { }, (aError) => {
let msg = "Got an exception during SA_onSource: " + aError + reportError(aError, "Got an exception during SA_onSource: ");
"\n" + aError.stack;
Cu.reportError(msg);
dumpn(msg);
return { return {
"from": this.actorID, "from": this.actorID,
"error": "loadSourceError", "error": "loadSourceError",
@ -2924,8 +2917,14 @@ function convertToUnicode(aString, aCharset=null) {
/** /**
* Report the given error in the error console and to stdout. * Report the given error in the error console and to stdout.
*
* @param Error aError
* The error object you wish to report.
* @param String aPrefix
* An optional prefix for the reported error message.
*/ */
function reportError(aError) { function reportError(aError, aPrefix="") {
Cu.reportError(aError); let msg = prefix + aError.message + ":\n" + aError.stack;
dumpn(aError.message + ":\n" + aError.stack); Cu.reportError(msg);
dumpn(msg);
} }