mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team
This commit is contained in:
commit
e1aecc824d
@ -396,6 +396,11 @@ ThreadState.prototype = {
|
||||
*/
|
||||
_update: function TS__update(aEvent) {
|
||||
DebuggerView.Toolbar.toggleResumeButtonState(this.activeThread.state);
|
||||
|
||||
if (DebuggerController._target &&
|
||||
(aEvent == "paused" || aEvent == "resumed")) {
|
||||
DebuggerController._target.emit("thread-" + aEvent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -69,6 +69,7 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_scripts-searching-files_ui.js \
|
||||
browser_dbg_scripts-searching-popup.js \
|
||||
browser_dbg_pause-resume.js \
|
||||
browser_dbg_pause-warning.js \
|
||||
browser_dbg_update-editor-mode.js \
|
||||
$(filter temporarily-disabled-due-to-oranges--bug-726609, browser_dbg_select-line.js) \
|
||||
browser_dbg_clean-exit.js \
|
||||
|
103
browser/devtools/debugger/test/browser_dbg_pause-warning.js
Normal file
103
browser/devtools/debugger/test/browser_dbg_pause-warning.js
Normal file
@ -0,0 +1,103 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebugger = null;
|
||||
var gView = null;
|
||||
var gLH = null;
|
||||
var gL10N = null;
|
||||
var gToolbox = null;
|
||||
var gTarget = null;
|
||||
|
||||
function test() {
|
||||
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gView = gDebugger.DebuggerView;
|
||||
gLH = gDebugger.LayoutHelpers;
|
||||
gL10N = gDebugger.L10N;
|
||||
|
||||
gTarget = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gToolbox = gDevTools.getToolbox(gTarget);
|
||||
|
||||
testPause();
|
||||
});
|
||||
}
|
||||
|
||||
function testPause() {
|
||||
let button = gDebugger.document.getElementById("resume");
|
||||
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
is(gDebugger.DebuggerController.activeThread.paused, true,
|
||||
"Debugger is paused.");
|
||||
|
||||
ok(gTarget.isThreadPaused, "target.isThreadPaused has been updated");
|
||||
|
||||
gToolbox.once("inspector-selected", testNotificationIsUp1);
|
||||
gToolbox.selectTool("inspector");
|
||||
}}, 0);
|
||||
});
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
gDebugger.document.getElementById("resume"),
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
function testNotificationIsUp1() {
|
||||
let notificationBox = gToolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
||||
ok(notification, "Notification is present");
|
||||
gToolbox.once("jsdebugger-selected", testNotificationIsHidden);
|
||||
gToolbox.selectTool("jsdebugger");
|
||||
}
|
||||
|
||||
function testNotificationIsHidden() {
|
||||
let notificationBox = gToolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
||||
ok(!notification, "Notification is hidden");
|
||||
gToolbox.once("inspector-selected", testNotificationIsUp2);
|
||||
gToolbox.selectTool("inspector");
|
||||
}
|
||||
|
||||
function testNotificationIsUp2() {
|
||||
let notificationBox = gToolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
||||
ok(notification, "Notification is present");
|
||||
testResume();
|
||||
}
|
||||
|
||||
function testResume() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
ok(!gTarget.isThreadPaused, "target.isThreadPaused has been updated");
|
||||
let notificationBox = gToolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
||||
ok(!notification, "No notification once debugger resumed");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
}}, 0);
|
||||
});
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
gDebugger.document.getElementById("resume"),
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebugger = null;
|
||||
gView = null;
|
||||
gLH = null;
|
||||
gL10N = null;
|
||||
gToolbox = null;
|
||||
gTarget = null;
|
||||
});
|
@ -205,14 +205,21 @@ TabTarget.prototype = {
|
||||
return true;
|
||||
},
|
||||
|
||||
get isThreadPaused() {
|
||||
return !!this._isThreadPaused;
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen to the different tabs events.
|
||||
* Listen to the different events.
|
||||
*/
|
||||
_setupListeners: function TabTarget__setupListeners() {
|
||||
this._webProgressListener = new TabWebProgressListener(this);
|
||||
this.tab.linkedBrowser.addProgressListener(this._webProgressListener);
|
||||
this.tab.addEventListener("TabClose", this);
|
||||
this.tab.parentNode.addEventListener("TabSelect", this);
|
||||
this._handleThreadState = this._handleThreadState.bind(this);
|
||||
this.on("thread-resumed", this._handleThreadState);
|
||||
this.on("thread-paused", this._handleThreadState);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -233,6 +240,20 @@ TabTarget.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle script status.
|
||||
*/
|
||||
_handleThreadState: function(event) {
|
||||
switch (event) {
|
||||
case "thread-resumed":
|
||||
this._isThreadPaused = false;
|
||||
break;
|
||||
case "thread-paused":
|
||||
this._isThreadPaused = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Target is not alive anymore.
|
||||
*/
|
||||
@ -245,6 +266,8 @@ TabTarget.prototype = {
|
||||
this._webProgressListener = null;
|
||||
this.tab.removeEventListener("TabClose", this);
|
||||
this.tab.parentNode.removeEventListener("TabSelect", this);
|
||||
this.off("thread-resumed", this._handleThreadState);
|
||||
this.off("thread-paused", this._handleThreadState);
|
||||
this.emit("close");
|
||||
|
||||
targets.delete(this._tab);
|
||||
@ -313,6 +336,7 @@ TabWebProgressListener.prototype = {
|
||||
function WindowTarget(window) {
|
||||
EventEmitter.decorate(this);
|
||||
this._window = window;
|
||||
this._setupListeners();
|
||||
}
|
||||
|
||||
WindowTarget.prototype = {
|
||||
@ -339,6 +363,30 @@ WindowTarget.prototype = {
|
||||
return false;
|
||||
},
|
||||
|
||||
get isThreadPaused() {
|
||||
return !!this._isThreadPaused;
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen to the different events.
|
||||
*/
|
||||
_setupListeners: function() {
|
||||
this._handleThreadState = this._handleThreadState.bind(this);
|
||||
this.on("thread-paused", this._handleThreadState);
|
||||
this.on("thread-resumed", this._handleThreadState);
|
||||
},
|
||||
|
||||
_handleThreadState: function(event) {
|
||||
switch (event) {
|
||||
case "thread-resumed":
|
||||
this._isThreadPaused = false;
|
||||
break;
|
||||
case "thread-paused":
|
||||
this._isThreadPaused = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Target is not alive anymore.
|
||||
*/
|
||||
@ -346,6 +394,8 @@ WindowTarget.prototype = {
|
||||
if (!this._destroyed) {
|
||||
this._destroyed = true;
|
||||
|
||||
this.off("thread-paused", this._handleThreadState);
|
||||
this.off("thread-resumed", this._handleThreadState);
|
||||
this.emit("close");
|
||||
|
||||
targets.delete(this._window);
|
||||
@ -368,18 +418,7 @@ function RemoteTarget(form, client, chrome) {
|
||||
this._client = client;
|
||||
this._form = form;
|
||||
this._chrome = chrome;
|
||||
|
||||
this.destroy = this.destroy.bind(this);
|
||||
this.client.addListener("tabDetached", this.destroy);
|
||||
|
||||
this._onTabNavigated = function onRemoteTabNavigated(aType, aPacket) {
|
||||
if (aPacket.state == "start") {
|
||||
this.emit("will-navigate", aPacket);
|
||||
} else {
|
||||
this.emit("navigate", aPacket);
|
||||
}
|
||||
}.bind(this);
|
||||
this.client.addListener("tabNavigated", this._onTabNavigated);
|
||||
this._setupListeners();
|
||||
}
|
||||
|
||||
RemoteTarget.prototype = {
|
||||
@ -400,6 +439,43 @@ RemoteTarget.prototype = {
|
||||
|
||||
get isLocalTab() false,
|
||||
|
||||
get isThreadPaused() !!this._isThreadPaused,
|
||||
|
||||
/**
|
||||
* Listen to the different events.
|
||||
*/
|
||||
_setupListeners: function() {
|
||||
this.destroy = this.destroy.bind(this);
|
||||
this.client.addListener("tabDetached", this.destroy);
|
||||
|
||||
this._onTabNavigated = function onRemoteTabNavigated(aType, aPacket) {
|
||||
if (aPacket.state == "start") {
|
||||
this.emit("will-navigate", aPacket);
|
||||
} else {
|
||||
this.emit("navigate", aPacket);
|
||||
}
|
||||
}.bind(this);
|
||||
this.client.addListener("tabNavigated", this._onTabNavigated);
|
||||
|
||||
this._handleThreadState = this._handleThreadState.bind(this);
|
||||
this.on("thread-resumed", this._handleThreadState);
|
||||
this.on("thread-paused", this._handleThreadState);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle script status.
|
||||
*/
|
||||
_handleThreadState: function(event) {
|
||||
switch (event) {
|
||||
case "thread-resumed":
|
||||
this._isThreadPaused = false;
|
||||
break;
|
||||
case "thread-paused":
|
||||
this._isThreadPaused = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Target is not alive anymore.
|
||||
*/
|
||||
@ -417,6 +493,8 @@ RemoteTarget.prototype = {
|
||||
|
||||
this._client.close(function onClosed() {
|
||||
this._client = null;
|
||||
this.off("thread-resumed", this._handleThreadState);
|
||||
this.off("thread-paused", this._handleThreadState);
|
||||
this.emit("close");
|
||||
|
||||
this._destroyer.resolve(null);
|
||||
|
@ -390,6 +390,10 @@ Toolbox.prototype = {
|
||||
* The id of the tool to switch to
|
||||
*/
|
||||
selectTool: function TBOX_selectTool(id) {
|
||||
if (this._currentToolId == id) {
|
||||
return;
|
||||
}
|
||||
|
||||
let deferred = Promise.defer();
|
||||
|
||||
if (!this.isReady) {
|
||||
@ -420,6 +424,8 @@ Toolbox.prototype = {
|
||||
|
||||
let definition = gDevTools.getToolDefinitions().get(id);
|
||||
|
||||
this._currentToolId = id;
|
||||
|
||||
let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id);
|
||||
if (!iframe) {
|
||||
iframe = this.doc.createElement("iframe");
|
||||
@ -459,11 +465,16 @@ Toolbox.prototype = {
|
||||
|
||||
Services.prefs.setCharPref(this._prefs.LAST_TOOL, id);
|
||||
|
||||
this._currentToolId = id;
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Raise the toolbox host.
|
||||
*/
|
||||
raise: function TBOX_raise() {
|
||||
this._host.raise();
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a host object based on the given host type.
|
||||
*
|
||||
@ -545,20 +556,19 @@ Toolbox.prototype = {
|
||||
let radio = this.doc.getElementById("toolbox-tab-" + toolId);
|
||||
let panel = this.doc.getElementById("toolbox-panel-" + toolId);
|
||||
|
||||
if (this._currentToolId == toolId) {
|
||||
let nextToolName = null;
|
||||
if (radio.nextSibling) {
|
||||
nextToolName = radio.nextSibling.getAttribute("toolid");
|
||||
}
|
||||
if (radio.previousSibling) {
|
||||
nextToolName = radio.previousSibling.getAttribute("toolid");
|
||||
}
|
||||
if (nextToolName) {
|
||||
this.selectTool(nextToolName);
|
||||
}
|
||||
}
|
||||
|
||||
if (radio) {
|
||||
if (this._currentToolId == toolId) {
|
||||
let nextToolName = null;
|
||||
if (radio.nextSibling) {
|
||||
nextToolName = radio.nextSibling.getAttribute("toolid");
|
||||
}
|
||||
if (radio.previousSibling) {
|
||||
nextToolName = radio.previousSibling.getAttribute("toolid");
|
||||
}
|
||||
if (nextToolName) {
|
||||
this.selectTool(nextToolName);
|
||||
}
|
||||
}
|
||||
radio.parentNode.removeChild(radio);
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,13 @@ BottomHost.prototype = {
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Raise the host.
|
||||
*/
|
||||
raise: function BH_raise() {
|
||||
focusTab(this.hostTab);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the bottom dock.
|
||||
*/
|
||||
@ -144,6 +151,13 @@ SidebarHost.prototype = {
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Raise the host.
|
||||
*/
|
||||
raise: function SH_raise() {
|
||||
focusTab(this.hostTab);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the sidebar.
|
||||
*/
|
||||
@ -214,6 +228,13 @@ WindowHost.prototype = {
|
||||
this.emit("window-closed");
|
||||
},
|
||||
|
||||
/**
|
||||
* Raise the host.
|
||||
*/
|
||||
raise: function RH_raise() {
|
||||
this._window.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the window.
|
||||
*/
|
||||
|
@ -153,6 +153,7 @@ DevTools.prototype = {
|
||||
}
|
||||
|
||||
return promise.then(function() {
|
||||
toolbox.raise();
|
||||
return toolbox;
|
||||
});
|
||||
}
|
||||
@ -243,17 +244,44 @@ let gDevToolsBrowser = {
|
||||
_trackedBrowserWindows: new Set(),
|
||||
|
||||
/**
|
||||
* This function is for the benefit of command#Tools:DevToolbox in
|
||||
* This function is for the benefit of Tools:DevToolbox in
|
||||
* browser/base/content/browser-sets.inc and should not be used outside
|
||||
* of there
|
||||
*/
|
||||
toggleToolboxCommand: function(gBrowser, toolId=null) {
|
||||
toggleToolboxCommand: function(gBrowser) {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
|
||||
return toolbox && (toolId == null || toolId == toolbox.currentToolId) ?
|
||||
toolbox.destroy() :
|
||||
gDevTools.showToolbox(target, toolId);
|
||||
toolbox ? toolbox.destroy() : gDevTools.showToolbox(target);
|
||||
},
|
||||
|
||||
/**
|
||||
* This function is for the benefit of Tools:{toolId} commands,
|
||||
* triggered from the WebDeveloper menu and keyboard shortcuts.
|
||||
*
|
||||
* selectToolCommand's behavior:
|
||||
* - if the toolbox is closed,
|
||||
* we open the toolbox and select the tool
|
||||
* - if the toolbox is open, and the targetted tool is not selected,
|
||||
* we select it
|
||||
* - if the toolbox is open, and the targetted tool is selected,
|
||||
* and the host is NOT a window, we close the toolbox
|
||||
* - if the toolbox is open, and the targetted tool is selected,
|
||||
* and the host is a window, we raise the toolbox window
|
||||
*/
|
||||
selectToolCommand: function(gBrowser, toolId) {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
|
||||
if (toolbox && toolbox.currentToolId == toolId) {
|
||||
if (toolbox.hostType == Toolbox.HostType.WINDOW) {
|
||||
toolbox.raise();
|
||||
} else {
|
||||
toolbox.destroy();
|
||||
}
|
||||
} else {
|
||||
gDevTools.showToolbox(target, toolId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -363,7 +391,7 @@ let gDevToolsBrowser = {
|
||||
let cmd = doc.createElement("command");
|
||||
cmd.id = "Tools:" + id;
|
||||
cmd.setAttribute("oncommand",
|
||||
'gDevToolsBrowser.toggleToolboxCommand(gBrowser, "' + id + '");');
|
||||
'gDevToolsBrowser.selectToolCommand(gBrowser, "' + id + '");');
|
||||
|
||||
let key = null;
|
||||
if (toolDefinition.key) {
|
||||
@ -376,15 +404,14 @@ let gDevToolsBrowser = {
|
||||
key.setAttribute("key", toolDefinition.key);
|
||||
}
|
||||
|
||||
key.setAttribute("oncommand",
|
||||
'gDevToolsBrowser.toggleToolboxCommand(gBrowser, "' + id + '");');
|
||||
key.setAttribute("command", cmd.id);
|
||||
key.setAttribute("modifiers", toolDefinition.modifiers);
|
||||
}
|
||||
|
||||
let bc = doc.createElement("broadcaster");
|
||||
bc.id = "devtoolsMenuBroadcaster_" + id;
|
||||
bc.setAttribute("label", toolDefinition.label);
|
||||
bc.setAttribute("command", "Tools:" + id);
|
||||
bc.setAttribute("command", cmd.id);
|
||||
|
||||
if (key) {
|
||||
bc.setAttribute("key", "key_" + id);
|
||||
@ -474,7 +501,9 @@ let gDevToolsBrowser = {
|
||||
*/
|
||||
_removeToolFromMenu: function DT_removeToolFromMenu(toolId, doc) {
|
||||
let command = doc.getElementById("Tools:" + toolId);
|
||||
command.parentNode.removeChild(command);
|
||||
if (command) {
|
||||
command.parentNode.removeChild(command);
|
||||
}
|
||||
|
||||
let key = doc.getElementById("key_" + toolId);
|
||||
if (key) {
|
||||
@ -482,7 +511,19 @@ let gDevToolsBrowser = {
|
||||
}
|
||||
|
||||
let bc = doc.getElementById("devtoolsMenuBroadcaster_" + toolId);
|
||||
bc.parentNode.removeChild(bc);
|
||||
if (bc) {
|
||||
bc.parentNode.removeChild(bc);
|
||||
}
|
||||
|
||||
let appmenuitem = doc.getElementById("appmenuitem_" + toolId);
|
||||
if (appmenuitem) {
|
||||
appmenuitem.parentNode.removeChild(appmenuitem);
|
||||
}
|
||||
|
||||
let menuitem = doc.getElementById("menuitem_" + toolId);
|
||||
if (menuitem) {
|
||||
menuitem.parentNode.removeChild(menuitem);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,8 @@ function toolRegistered(event, toolId)
|
||||
for (let win of getAllBrowserWindows()) {
|
||||
let command = win.document.getElementById("Tools:" + toolId);
|
||||
ok(command, "command for new tool added to every browser window");
|
||||
let menuitem = win.document.getElementById("menuitem_" + toolId);
|
||||
ok(menuitem, "menu item of new tool added to every browser window");
|
||||
}
|
||||
|
||||
// then unregister it
|
||||
@ -92,6 +94,8 @@ function toolUnregistered(event, toolId)
|
||||
for (let win of getAllBrowserWindows()) {
|
||||
let command = win.document.getElementById("Tools:" + toolId);
|
||||
ok(!command, "command removed from every browser window");
|
||||
let menuitem = win.document.getElementById("menuitem_" + toolId);
|
||||
ok(!menuitem, "menu item removed from every browser window");
|
||||
}
|
||||
|
||||
cleanup();
|
||||
|
@ -11,9 +11,14 @@
|
||||
<?xml-stylesheet href="chrome://browser/skin/devtools/common.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/devtools/toolbox.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/source-editor-overlay.xul"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<commandset id="editMenuCommands"/>
|
||||
<keyset id="editMenuKeys"/>
|
||||
|
||||
<notificationbox id="toolbox-notificationbox" flex="1">
|
||||
<toolbar class="devtools-tabbar">
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -39,9 +39,6 @@ this.InspectorPanel = function InspectorPanel(iframeWindow, toolbox) {
|
||||
this.panelWin = iframeWindow;
|
||||
this.panelWin.inspector = this;
|
||||
|
||||
this.tabTarget = (this.target.tab != null);
|
||||
this.winTarget = (this.target.window != null);
|
||||
|
||||
EventEmitter.decorate(this);
|
||||
}
|
||||
|
||||
@ -73,7 +70,7 @@ InspectorPanel.prototype = {
|
||||
|
||||
this.breadcrumbs = new HTMLBreadcrumbs(this);
|
||||
|
||||
if (this.tabTarget) {
|
||||
if (this.target.isLocalTab) {
|
||||
this.browser = this.target.tab.linkedBrowser;
|
||||
this.scheduleLayoutChange = this.scheduleLayoutChange.bind(this);
|
||||
this.browser.addEventListener("resize", this.scheduleLayoutChange, true);
|
||||
@ -90,6 +87,33 @@ InspectorPanel.prototype = {
|
||||
}.bind(this);
|
||||
this.highlighter.on("locked", this.updateInspectorButton);
|
||||
this.highlighter.on("unlocked", this.updateInspectorButton);
|
||||
|
||||
// Show a warning when the debugger is paused.
|
||||
// We show the warning only when the inspector
|
||||
// is selected.
|
||||
this.updateDebuggerPausedWarning = function() {
|
||||
let notificationBox = this._toolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
||||
if (!notification && this._toolbox.currentToolId == "inspector" &&
|
||||
this.target.isThreadPaused) {
|
||||
let message = this.strings.GetStringFromName("debuggerPausedWarning.message");
|
||||
notificationBox.appendNotification(message,
|
||||
"inspector-script-paused", "", notificationBox.PRIORITY_WARNING_HIGH);
|
||||
}
|
||||
|
||||
if (notification && this._toolbox.currentToolId != "inspector") {
|
||||
notificationBox.removeNotification(notification);
|
||||
}
|
||||
|
||||
if (notification && !this.target.isThreadPaused) {
|
||||
notificationBox.removeNotification(notification);
|
||||
}
|
||||
|
||||
}.bind(this);
|
||||
this.target.on("thread-paused", this.updateDebuggerPausedWarning);
|
||||
this.target.on("thread-resumed", this.updateDebuggerPausedWarning);
|
||||
this._toolbox.on("select", this.updateDebuggerPausedWarning);
|
||||
this.updateDebuggerPausedWarning();
|
||||
}
|
||||
|
||||
this._initMarkup();
|
||||
@ -99,11 +123,10 @@ InspectorPanel.prototype = {
|
||||
this.isReady = true;
|
||||
|
||||
// All the components are initialized. Let's select a node.
|
||||
if (this.tabTarget) {
|
||||
if (this.target.isLocalTab) {
|
||||
let root = this.browser.contentDocument.documentElement;
|
||||
this._selection.setNode(root);
|
||||
}
|
||||
if (this.winTarget) {
|
||||
} else if (this.target.window) {
|
||||
let root = this.target.window.document.documentElement;
|
||||
this._selection.setNode(root);
|
||||
}
|
||||
@ -316,8 +339,6 @@ InspectorPanel.prototype = {
|
||||
|
||||
this.cancelLayoutChange();
|
||||
|
||||
this._toolbox = null;
|
||||
|
||||
if (this.browser) {
|
||||
this.browser.removeEventListener("resize", this.scheduleLayoutChange, true);
|
||||
this.browser = null;
|
||||
@ -332,6 +353,12 @@ InspectorPanel.prototype = {
|
||||
this.highlighter.destroy();
|
||||
}
|
||||
|
||||
this.target.off("thread-paused", this.updateDebuggerPausedWarning);
|
||||
this.target.off("thread-resumed", this.updateDebuggerPausedWarning);
|
||||
this._toolbox.off("select", this.updateDebuggerPausedWarning);
|
||||
|
||||
this._toolbox = null;
|
||||
|
||||
this.sidebar.off("select", this._setDefaultSidebar);
|
||||
this.sidebar.destroy();
|
||||
this.sidebar = null;
|
||||
@ -429,12 +456,7 @@ InspectorPanel.prototype = {
|
||||
|
||||
this._markupBox.removeAttribute("hidden");
|
||||
|
||||
let controllerWindow;
|
||||
if (this.tabTarget) {
|
||||
controllerWindow = this.target.tab.ownerDocument.defaultView;
|
||||
} else if (this.winTarget) {
|
||||
controllerWindow = this.target.window;
|
||||
}
|
||||
let controllerWindow = this._toolbox.doc.defaultView;
|
||||
this.markup = new MarkupView(this, this._markupFrame, controllerWindow);
|
||||
|
||||
this.emit("markuploaded");
|
||||
|
@ -37,10 +37,10 @@ function test() {
|
||||
function editField(aField, aValue)
|
||||
{
|
||||
aField.focus();
|
||||
EventUtils.sendKey("return");
|
||||
EventUtils.sendKey("return", inspector.panelWin);
|
||||
let input = inplaceEditor(aField).input;
|
||||
input.value = aValue;
|
||||
input.blur();
|
||||
EventUtils.sendKey("return", inspector.panelWin);
|
||||
}
|
||||
|
||||
function assertAttributes(aElement, aAttributes)
|
||||
@ -62,7 +62,8 @@ function test() {
|
||||
class: "node1"
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
inspector.once("markupmutation", after);
|
||||
let editor = markup.getContainer(doc.querySelector("#node1")).editor;
|
||||
let attr = editor.attrs["class"].querySelector(".editable");
|
||||
editField(attr, 'class="changednode1"');
|
||||
@ -83,10 +84,11 @@ function test() {
|
||||
class: "unchanged"
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
let editor = markup.getContainer(doc.querySelector("#node22")).editor;
|
||||
let attr = editor.attrs["class"].querySelector(".editable");
|
||||
editField(attr, 'class="""');
|
||||
executeSoon(after);
|
||||
},
|
||||
after: function() {
|
||||
assertAttributes(doc.querySelector("#node22"), {
|
||||
@ -104,7 +106,8 @@ function test() {
|
||||
class: "node4"
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
inspector.once("markupmutation", after);
|
||||
let editor = markup.getContainer(doc.querySelector("#node4")).editor;
|
||||
let attr = editor.attrs["class"].querySelector(".editable");
|
||||
editField(attr, '');
|
||||
@ -123,7 +126,8 @@ function test() {
|
||||
id: "node14",
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
inspector.once("markupmutation", after);
|
||||
let editor = markup.getContainer(doc.querySelector("#node14")).editor;
|
||||
let attr = editor.newAttr;
|
||||
editField(attr, 'class="newclass" style="color:green"');
|
||||
@ -144,10 +148,11 @@ function test() {
|
||||
id: "node23",
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
let editor = markup.getContainer(doc.querySelector("#node23")).editor;
|
||||
let attr = editor.newAttr;
|
||||
editField(attr, 'class="newclass" style="""');
|
||||
executeSoon(after);
|
||||
},
|
||||
after: function() {
|
||||
assertAttributes(doc.querySelector("#node23"), {
|
||||
@ -163,10 +168,11 @@ function test() {
|
||||
id: "node24",
|
||||
});
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
let editor = markup.getContainer(doc.querySelector("#node24")).editor;
|
||||
let attr = editor.attrs["id"].querySelector(".editable");
|
||||
editField(attr, attr.textContent + ' class="""');
|
||||
executeSoon(after);
|
||||
},
|
||||
after: function() {
|
||||
assertAttributes(doc.querySelector("#node24"), {
|
||||
@ -181,7 +187,8 @@ function test() {
|
||||
let node = doc.querySelector('.node6').firstChild;
|
||||
is(node.nodeValue, "line6", "Text should be unchanged");
|
||||
},
|
||||
execute: function() {
|
||||
execute: function(after) {
|
||||
inspector.once("markupmutation", after);
|
||||
let node = doc.querySelector('.node6').firstChild;
|
||||
let editor = markup.getContainer(node).editor;
|
||||
let field = editor.elt.querySelector("pre");
|
||||
@ -222,23 +229,37 @@ function test() {
|
||||
let startNode = doc.documentElement.cloneNode();
|
||||
markup = inspector.markup;
|
||||
markup.expandAll();
|
||||
for (let step of edits) {
|
||||
info("START " + step.desc);
|
||||
if (step.setup) {
|
||||
step.setup();
|
||||
}
|
||||
step.before();
|
||||
step.execute();
|
||||
step.after();
|
||||
ok(markup.undo.canUndo(), "Should be able to undo.");
|
||||
markup.undo.undo();
|
||||
step.before();
|
||||
ok(markup.undo.canRedo(), "Should be able to redo.");
|
||||
markup.undo.redo();
|
||||
step.after();
|
||||
info("END " + step.desc);
|
||||
|
||||
let cursor = 0;
|
||||
|
||||
function nextEditTest() {
|
||||
executeSoon(function() {
|
||||
if (cursor >= edits.length) {
|
||||
addAttributes();
|
||||
} else {
|
||||
let step = edits[cursor++];
|
||||
info("START " + step.desc);
|
||||
if (step.setup) {
|
||||
step.setup();
|
||||
}
|
||||
step.before();
|
||||
info("before execute");
|
||||
step.execute(function() {
|
||||
info("after execute");
|
||||
step.after();
|
||||
ok(markup.undo.canUndo(), "Should be able to undo.");
|
||||
markup.undo.undo();
|
||||
step.before();
|
||||
ok(markup.undo.canRedo(), "Should be able to redo.");
|
||||
markup.undo.redo();
|
||||
step.after();
|
||||
info("END " + step.desc);
|
||||
nextEditTest();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
addAttributes();
|
||||
nextEditTest();
|
||||
}
|
||||
|
||||
function addAttributes() {
|
||||
@ -318,7 +339,7 @@ function test() {
|
||||
inspector.selection.setNode(doc.querySelector("#node18"));
|
||||
},
|
||||
executeCont: function() {
|
||||
EventUtils.sendKey("delete");
|
||||
EventUtils.sendKey("delete", inspector.panelWin);
|
||||
},
|
||||
after: function() {
|
||||
ok(!doc.querySelector("#node18"), "Node 18 should not exist.")
|
||||
|
@ -824,7 +824,7 @@ SourceEditor.prototype = {
|
||||
*/
|
||||
_linesRulerClick: function SE__linesRulerClick(aLineIndex, aEvent)
|
||||
{
|
||||
if (aLineIndex === undefined) {
|
||||
if (aLineIndex === undefined || aLineIndex == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -839,7 +839,11 @@ SourceEditor.prototype = {
|
||||
selection.end : this.getLineEnd(aLineIndex);
|
||||
this.setSelection(newStart, newEnd);
|
||||
} else {
|
||||
this.setCaretPosition(aLineIndex);
|
||||
if (this._annotationRuler) {
|
||||
this._annotationRulerClick(aLineIndex, aEvent);
|
||||
} else {
|
||||
this.setCaretPosition(aLineIndex);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -22,6 +22,10 @@ confirmNavigationAway.buttonStayAccesskey=S
|
||||
|
||||
breadcrumbs.siblings=Siblings
|
||||
|
||||
# LOCALIZATION NOTE (debuggerPausedWarning): Used in the Inspector tool, when
|
||||
# the user switch to the inspector when the debugger is paused.
|
||||
debuggerPausedWarning.message=Debugger is paused. Some features like mouse selection will not work.
|
||||
|
||||
# LOCALIZATION NOTE (nodeMenu.tooltiptext)
|
||||
# This menu appears in the Infobar (on top of the highlighted node) once
|
||||
# the node is selected.
|
||||
|
@ -48,6 +48,7 @@
|
||||
.command-button {
|
||||
padding: 0 8px;
|
||||
margin: 0;
|
||||
border-width: 0;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,9 @@ this.NetworkHelper =
|
||||
let result = [];
|
||||
|
||||
cookies.forEach(function(aCookie) {
|
||||
let [name, value] = aCookie.split("=");
|
||||
let equal = aCookie.indexOf("=");
|
||||
let name = aCookie.substr(0, equal);
|
||||
let value = aCookie.substr(equal + 1);
|
||||
result.push({name: unescape(name.trim()),
|
||||
value: unescape(value.trim())});
|
||||
});
|
||||
@ -314,8 +316,9 @@ this.NetworkHelper =
|
||||
let cookies = [];
|
||||
|
||||
rawCookies.forEach(function(aCookie) {
|
||||
let name = unescape(aCookie.substr(0, aCookie.indexOf("=")).trim());
|
||||
let parts = aCookie.substr(aCookie.indexOf("=") + 1).split(";");
|
||||
let equal = aCookie.indexOf("=");
|
||||
let name = unescape(aCookie.substr(0, equal).trim());
|
||||
let parts = aCookie.substr(equal + 1).split(";");
|
||||
let value = unescape(parts.shift().trim());
|
||||
|
||||
let cookie = {name: name, value: value};
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
document.cookie = "foobar=fooval";
|
||||
document.cookie = "omgfoo=bug768096";
|
||||
document.cookie = "badcookie=bug826798=st3fan";
|
||||
// --></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -74,7 +74,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
|
||||
break;
|
||||
case "requestCookies":
|
||||
expectedPacket = {
|
||||
cookies: 2,
|
||||
cookies: 3,
|
||||
};
|
||||
break;
|
||||
case "requestPostData":
|
||||
@ -151,11 +151,12 @@ function onRequestCookies(aState, aResponse)
|
||||
{
|
||||
info("checking request cookies");
|
||||
|
||||
is(aResponse.cookies.length, 2, "request cookies length");
|
||||
is(aResponse.cookies.length, 3, "request cookies length");
|
||||
|
||||
checkHeadersOrCookies(aResponse.cookies, {
|
||||
foobar: "fooval",
|
||||
omgfoo: "bug768096",
|
||||
badcookie: "bug826798=st3fan",
|
||||
});
|
||||
|
||||
onRequestPostData = onRequestPostData.bind(null, aState);
|
||||
|
@ -96,7 +96,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
|
||||
break;
|
||||
case "requestCookies":
|
||||
expectedPacket = {
|
||||
cookies: 2,
|
||||
cookies: 3,
|
||||
};
|
||||
break;
|
||||
case "requestPostData":
|
||||
@ -174,11 +174,12 @@ function onRequestCookies(aState, aResponse)
|
||||
{
|
||||
info("checking request cookies");
|
||||
|
||||
is(aResponse.cookies.length, 2, "request cookies length");
|
||||
is(aResponse.cookies.length, 3, "request cookies length");
|
||||
|
||||
checkHeadersOrCookies(aResponse.cookies, {
|
||||
foobar: "fooval",
|
||||
omgfoo: "bug768096",
|
||||
badcookie: "bug826798=st3fan",
|
||||
});
|
||||
|
||||
onRequestPostData = onRequestPostData.bind(null, aState);
|
||||
|
@ -89,7 +89,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
|
||||
break;
|
||||
case "requestCookies":
|
||||
expectedPacket = {
|
||||
cookies: 2,
|
||||
cookies: 3,
|
||||
};
|
||||
break;
|
||||
case "requestPostData":
|
||||
@ -167,11 +167,12 @@ function onRequestCookies(aState, aResponse)
|
||||
{
|
||||
info("checking request cookies");
|
||||
|
||||
is(aResponse.cookies.length, 2, "request cookies length");
|
||||
is(aResponse.cookies.length, 3, "request cookies length");
|
||||
|
||||
checkHeadersOrCookies(aResponse.cookies, {
|
||||
foobar: "fooval",
|
||||
omgfoo: "bug768096",
|
||||
badcookie: "bug826798=st3fan",
|
||||
});
|
||||
|
||||
onRequestPostData = onRequestPostData.bind(null, aState);
|
||||
|
Loading…
Reference in New Issue
Block a user