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

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

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

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

@ -95,6 +95,7 @@ Highlighter.prototype = {
_init: function Highlighter__init()
{
this.toggleLockState = this.toggleLockState.bind(this);
this.unlockAndFocus = this.unlockAndFocus.bind(this);
this.updateInfobar = this.updateInfobar.bind(this);
this.highlight = this.highlight.bind(this);
@ -318,6 +319,19 @@ Highlighter.prototype = {
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.
*/
@ -417,7 +431,7 @@ Highlighter.prototype = {
this.inspectButton.className = "highlighter-nodeinfobar-button highlighter-nodeinfobar-inspectbutton"
let toolbarInspectButton = this.inspector.panelDoc.getElementById("inspector-inspect-toolbutton");
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");
nodemenu.setAttribute("type", "menu");

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

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

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

@ -57,9 +57,30 @@ function setupHighlighterTests()
ok(h1, "we have the header");
let i = getActiveInspector();
i.selection.setNode(div);
i.highlighter.unlockAndFocus();
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() {
i.selection.once("new-node", performTestComparisons);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);

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

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

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

@ -121,11 +121,17 @@ function test() {
widthBeforeClose = content.innerWidth;
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", {});
}
function restart() {
info("XXX BUG 851296: restarting.");
mgr.once("on", function() {executeSoon(onUIOpen2)});
synthesizeKeyFromKeyTag("key_responsiveUI");
}

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

@ -253,20 +253,20 @@
}
.options-vertical-pane {
margin: 15px;
margin: 5px;
width: calc(50% - 30px);
min-width: 400px;
-moz-padding-start: 5px;
}
.options-vertical-pane > label {
padding: 5px 0;
padding: 2px 0;
font-size: 1.4rem;
}
.options-groupbox {
-moz-margin-start: 15px;
padding: 4px;
padding: 2px;
}
.options-groupbox > * {
@ -285,3 +285,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */
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 {
margin: 15px;
margin: 5px;
width: calc(50% - 30px);
min-width: 400px;
-moz-padding-start: 5px;
}
.options-vertical-pane > label {
padding: 5px 0;
padding: 2px 0;
font-size: 1.4rem;
}
.options-groupbox {
-moz-margin-start: 15px;
padding: 4px;
padding: 2px;
}
.options-groupbox > * {
@ -271,3 +271,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */
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 {
margin: 15px;
margin: 5px;
width: calc(50% - 30px);
min-width: 400px;
-moz-padding-start: 5px;
}
.options-vertical-pane > label {
padding: 5px 0;
padding: 2px 0;
font-size: 1.4rem;
}
.options-groupbox {
-moz-margin-start: 15px;
padding: 4px;
padding: 2px;
}
.options-groupbox > * {
@ -280,3 +280,8 @@
padding: 3px 0 0 !important; /* To align it with the checkbox */
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();
NS_ENSURE_STATE(targetShell);
targetDoc->FlushPendingNotifications(Flush_Layout);
nsEventStatus status = nsEventStatus_eIgnore;
targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status);
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);

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

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

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

@ -280,10 +280,7 @@ ThreadActor.prototype = {
resolve(onPacket(packet)).then(this.conn.send.bind(this.conn));
return this._nest();
} catch(e) {
let msg = "Got an exception during TA__pauseAndRespond: " + e +
": " + e.stack;
Cu.reportError(msg);
dumpn(msg);
reportError(e, "Got an exception during TA__pauseAndRespond: ");
return undefined;
}
},
@ -1241,8 +1238,7 @@ ThreadActor.prototype = {
this.conn.send(packet);
return this._nest();
} catch(e) {
Cu.reportError("Got an exception during TA_onExceptionUnwind: " + e +
": " + e.stack);
reportError(e, "Got an exception during TA_onExceptionUnwind: ");
return undefined;
}
},
@ -1490,10 +1486,7 @@ SourceActor.prototype = {
source: aSourceGrip
};
}, (aError) => {
let msg = "Got an exception during SA_onSource: " + aError +
"\n" + aError.stack;
Cu.reportError(msg);
dumpn(msg);
reportError(aError, "Got an exception during SA_onSource: ");
return {
"from": this.actorID,
"error": "loadSourceError",
@ -2924,8 +2917,14 @@ function convertToUnicode(aString, aCharset=null) {
/**
* 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) {
Cu.reportError(aError);
dumpn(aError.message + ":\n" + aError.stack);
function reportError(aError, aPrefix="") {
let msg = prefix + aError.message + ":\n" + aError.stack;
Cu.reportError(msg);
dumpn(msg);
}