Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merge mozilla-central into mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan committed Nov 7, 2012
2 parents 099da99 + cf51cf7 commit 71e35fb
Show file tree
Hide file tree
Showing 31 changed files with 2,675 additions and 163 deletions.
3 changes: 1 addition & 2 deletions b2g/chrome/content/dbg-browser-actors.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ DeviceTabActor.prototype._pushContext = function DTA_pushContext() {
this._contextPool = new ActorPool(this.conn);
this.conn.addActorPool(this._contextPool);

this.threadActor = new ThreadActor(this);
this._addDebuggees(this.browser.wrappedJSObject);
this.threadActor = new ThreadActor(this, this.browser.wrappedJSObject);
this._contextPool.addActor(this.threadActor);
};

Expand Down
3 changes: 2 additions & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,8 @@ pref("devtools.debugger.ui.remote-win.height", 400);
pref("devtools.debugger.ui.stackframes-width", 200);
pref("devtools.debugger.ui.variables-width", 300);
pref("devtools.debugger.ui.panes-visible-on-startup", false);
pref("devtools.debugger.ui.non-enum-visible", true);
pref("devtools.debugger.ui.variables-non-enum-visible", true);
pref("devtools.debugger.ui.variables-searchbox-visible", false);

// Enable the style inspector
pref("devtools.styleinspector.enabled", true);
Expand Down
43 changes: 33 additions & 10 deletions browser/devtools/debugger/debugger-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ StackFrames.prototype = {

// Add the variable's __proto__.
if (prototype.type != "null") {
aVar.addProperties({ "__proto__ ": { value: prototype } });
aVar.addProperty("__proto__", { value: prototype });
// Expansion handlers must be set after the properties are added.
this._addExpander(aVar.get("__proto__ "), prototype);
this._addExpander(aVar.get("__proto__"), prototype);
}

aVar.fetched = true;
Expand Down Expand Up @@ -734,6 +734,7 @@ SourceScripts.prototype = {
* Connect to the current thread client.
*/
connect: function SS_connect() {
dumpn("SourceScripts is connecting...");
this.debuggerClient.addListener("newScript", this._onNewScript);
this.debuggerClient.addListener("newGlobal", this._onNewGlobal);
this._handleTabNavigation();
Expand All @@ -746,6 +747,7 @@ SourceScripts.prototype = {
if (!this.activeThread) {
return;
}
dumpn("SourceScripts is disconnecting...");
this.debuggerClient.removeListener("newScript", this._onNewScript);
this.debuggerClient.removeListener("newGlobal", this._onNewGlobal);
},
Expand Down Expand Up @@ -1248,7 +1250,8 @@ XPCOMUtils.defineLazyGetter(L10N, "ellipsis", function() {
const STACKFRAMES_WIDTH = "devtools.debugger.ui.stackframes-width";
const VARIABLES_WIDTH = "devtools.debugger.ui.variables-width";
const PANES_VISIBLE_ON_STARTUP = "devtools.debugger.ui.panes-visible-on-startup";
const NON_ENUM_VISIBLE = "devtools.debugger.ui.non-enum-visible";
const VARIABLES_NON_ENUM_VISIBLE = "devtools.debugger.ui.variables-non-enum-visible";
const VARIABLES_SEARCHBOX_VISIBLE = "devtools.debugger.ui.variables-searchbox-visible";
const REMOTE_HOST = "devtools.debugger.remote-host";
const REMOTE_PORT = "devtools.debugger.remote-port";
const REMOTE_AUTO_CONNECT = "devtools.debugger.remote-autoconnect";
Expand Down Expand Up @@ -1324,21 +1327,41 @@ let Prefs = {
* properties and variables in the scope view.
* @return boolean
*/
get nonEnumVisible() {
if (this._nonEnumVisible === undefined) {
this._nonEnumVisible = Services.prefs.getBoolPref(NON_ENUM_VISIBLE);
get variablesNonEnumVisible() {
if (this._varNonEnum === undefined) {
this._varNonEnum = Services.prefs.getBoolPref(VARIABLES_NON_ENUM_VISIBLE);
}
return this._nonEnumVisible;
return this._varNonEnum;
},

/**
* Sets a flag specifying if the debugger should show non-enumerable
* properties and variables in the scope view.
* @param boolean value
*/
set nonEnumVisible(value) {
Services.prefs.setBoolPref(NON_ENUM_VISIBLE, value);
this._nonEnumVisible = value;
set variablesNonEnumVisible(value) {
Services.prefs.setBoolPref(VARIABLES_NON_ENUM_VISIBLE, value);
this._varNonEnum = value;
},

/**
* Gets a flag specifying if the a variables searchbox should be shown.
* @return boolean
*/
get variablesSearchboxVisible() {
if (this._varSearchbox === undefined) {
this._varSearchbox = Services.prefs.getBoolPref(VARIABLES_SEARCHBOX_VISIBLE);
}
return this._varSearchbox;
},

/**
* Sets a flag specifying if the a variables searchbox should be shown.
* @param boolean value
*/
set variablesSearchboxVisible(value) {
Services.prefs.setBoolPref(VARIABLES_SEARCHBOX_VISIBLE, value);
this._varSearchbox = value;
},

/**
Expand Down
9 changes: 5 additions & 4 deletions browser/devtools/debugger/debugger-panes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ SourceResults.prototype = {
*/
toggle: function SR_toggle(e) {
if (e instanceof Event) {
this._toggled = true;
this._userToggled = true;
}
this.expanded ^= 1;
},
Expand All @@ -1230,9 +1230,10 @@ SourceResults.prototype = {
set expanded(aFlag) this[aFlag ? "expand" : "collapse"](),

/**
* Returns true if this element was toggled via user interaction.
* Returns if this element was ever toggled via user interaction.
* @return boolean
*/
get toggled() this._toggled,
get toggled() this._userToggled,

/**
* Gets the element associated with this item.
Expand Down Expand Up @@ -1313,7 +1314,7 @@ SourceResults.prototype = {

_store: null,
_target: null,
_toggled: false
_userToggled: false
};

/**
Expand Down
112 changes: 83 additions & 29 deletions browser/devtools/debugger/debugger-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ function OptionsView() {
dumpn("OptionsView was instantiated");
this._togglePauseOnExceptions = this._togglePauseOnExceptions.bind(this);
this._toggleShowPanesOnStartup = this._toggleShowPanesOnStartup.bind(this);
this._toggleShowNonEnum = this._toggleShowNonEnum.bind(this);
this._toggleShowVariablesNonEnum = this._toggleShowVariablesNonEnum.bind(this);
this._toggleShowVariablesSearchbox = this._toggleShowVariablesSearchbox.bind(this);
}

OptionsView.prototype = {
Expand All @@ -211,11 +212,13 @@ OptionsView.prototype = {
this._button = document.getElementById("debugger-options");
this._pauseOnExceptionsItem = document.getElementById("pause-on-exceptions");
this._showPanesOnStartupItem = document.getElementById("show-panes-on-startup");
this._showNonEnumItem = document.getElementById("show-nonenum");
this._showVariablesNonEnumItem = document.getElementById("show-vars-nonenum");
this._showVariablesSearchboxItem = document.getElementById("show-vars-searchbox");

this._pauseOnExceptionsItem.setAttribute("checked", "false");
this._showPanesOnStartupItem.setAttribute("checked", Prefs.panesVisibleOnStartup);
this._showNonEnumItem.setAttribute("checked", Prefs.nonEnumVisible);
this._showVariablesNonEnumItem.setAttribute("checked", Prefs.variablesNonEnumVisible);
this._showVariablesSearchboxItem.setAttribute("checked", Prefs.variablesSearchboxVisible);
},

/**
Expand Down Expand Up @@ -259,15 +262,24 @@ OptionsView.prototype = {
/**
* Listener handling the 'show non-enumerables' menuitem command.
*/
_toggleShowNonEnum: function DVO__toggleShowNonEnum() {
DebuggerView.Variables.nonEnumVisible = Prefs.nonEnumVisible =
this._showNonEnumItem.getAttribute("checked") == "true";
_toggleShowVariablesNonEnum: function DVO__toggleShowVariablesNonEnum() {
DebuggerView.Variables.nonEnumVisible = Prefs.variablesNonEnumVisible =
this._showVariablesNonEnumItem.getAttribute("checked") == "true";
},

/**
* Listener handling the 'show variables searchbox' menuitem command.
*/
_toggleShowVariablesSearchbox: function DVO__toggleShowVariablesSearchbox() {
DebuggerView.Variables.searchEnabled = Prefs.variablesSearchboxVisible =
this._showVariablesSearchboxItem.getAttribute("checked") == "true";
},

_button: null,
_pauseOnExceptionsItem: null,
_showPanesOnStartupItem: null,
_showNonEnumItem: null
_showVariablesNonEnumItem: null,
_showVariablesSearchboxItem: null
};

/**
Expand Down Expand Up @@ -562,11 +574,14 @@ FilterView.prototype = {
this._tokenOperatorLabel = document.getElementById("token-operator-label");
this._lineOperatorButton = document.getElementById("line-operator-button");
this._lineOperatorLabel = document.getElementById("line-operator-label");
this._variableOperatorButton = document.getElementById("variable-operator-button");
this._variableOperatorLabel = document.getElementById("variable-operator-label");

this._globalSearchKey = LayoutHelpers.prettyKey(document.getElementById("globalSearchKey"));
this._fileSearchKey = LayoutHelpers.prettyKey(document.getElementById("fileSearchKey"));
this._lineSearchKey = LayoutHelpers.prettyKey(document.getElementById("lineSearchKey"));
this._tokenSearchKey = LayoutHelpers.prettyKey(document.getElementById("tokenSearchKey"));
this._variableSearchKey = LayoutHelpers.prettyKey(document.getElementById("variableSearchKey"));

this._searchbox.addEventListener("click", this._onClick, false);
this._searchbox.addEventListener("select", this._onSearch, false);
Expand All @@ -577,13 +592,16 @@ FilterView.prototype = {
this._globalOperatorButton.setAttribute("label", SEARCH_GLOBAL_FLAG);
this._tokenOperatorButton.setAttribute("label", SEARCH_TOKEN_FLAG);
this._lineOperatorButton.setAttribute("label", SEARCH_LINE_FLAG);
this._variableOperatorButton.setAttribute("label", SEARCH_VARIABLE_FLAG);

this._globalOperatorLabel.setAttribute("value",
L10N.getFormatStr("searchPanelGlobal", [this._globalSearchKey]));
this._tokenOperatorLabel.setAttribute("value",
L10N.getFormatStr("searchPanelToken", [this._tokenSearchKey]));
this._lineOperatorLabel.setAttribute("value",
L10N.getFormatStr("searchPanelLine", [this._lineSearchKey]));
this._variableOperatorLabel.setAttribute("value",
L10N.getFormatStr("searchPanelVariable", [this._variableSearchKey]));

// TODO: bug 806775
// if (window._isChromeDebugger) {
Expand Down Expand Up @@ -628,16 +646,17 @@ FilterView.prototype = {
* @return array
*/
get searchboxInfo() {
let file, line, token, global;
let file, line, token, isGlobal, isVariable;

let rawValue = this._searchbox.value;
let rawLength = rawValue.length;
let globalFlagIndex = rawValue.indexOf(SEARCH_GLOBAL_FLAG);
let variableFlagIndex = rawValue.indexOf(SEARCH_VARIABLE_FLAG);
let lineFlagIndex = rawValue.lastIndexOf(SEARCH_LINE_FLAG);
let tokenFlagIndex = rawValue.lastIndexOf(SEARCH_TOKEN_FLAG);

// This is not a global search, allow file or line flags.
if (globalFlagIndex != 0) {
// This is not a global or variable search, allow file or line flags.
if (globalFlagIndex != 0 && variableFlagIndex != 0) {
let fileEnd = lineFlagIndex != -1
? lineFlagIndex
: tokenFlagIndex != -1 ? tokenFlagIndex : rawLength;
Expand All @@ -649,17 +668,27 @@ FilterView.prototype = {
file = rawValue.slice(0, fileEnd);
line = ~~(rawValue.slice(fileEnd + 1, lineEnd)) || -1;
token = rawValue.slice(lineEnd + 1);
global = false;
isGlobal = false;
isVariable = false;
}
// Global searches dissalow the use of file or line flags.
else {
else if (globalFlagIndex == 0) {
file = "";
line = -1;
token = rawValue.slice(1);
isGlobal = true;
isVariable = false;
}
// Variable searches dissalow the use of file or line flags.
else if (variableFlagIndex == 0) {
file = "";
line = -1;
token = rawValue.slice(1);
global = true;
isGlobal = false;
isVariable = true;
}

return [file, line, token, global];
return [file, line, token, isGlobal, isVariable];
},

/**
Expand Down Expand Up @@ -787,25 +816,33 @@ FilterView.prototype = {
*/
_onSearch: function DVF__onScriptsSearch() {
this._searchboxPanel.hidePopup();
let [file, line, token, global] = this.searchboxInfo;
let [file, line, token, isGlobal, isVariable] = this.searchboxInfo;

// If this is a global search, schedule it for when the user stops typing,
// or hide the corresponding pane otherwise.
if (global) {
if (isGlobal) {
DebuggerView.GlobalSearch.scheduleSearch();
} else {
DebuggerView.GlobalSearch.clearView();
this._performFileSearch(file);
this._performLineSearch(line);
this._performTokenSearch(token);
return;
}

// If this is a variable search, defer the action to the corresponding
// variables view instance.
if (isVariable) {
DebuggerView.Variables.performSearch(token);
return;
}

DebuggerView.GlobalSearch.clearView();
this._performFileSearch(file);
this._performLineSearch(line);
this._performTokenSearch(token);
},

/**
* The key press listener for the search container.
*/
_onKeyPress: function DVF__onScriptsKeyPress(e) {
let [file, line, token, global] = this.searchboxInfo;
let [file, line, token, isGlobal, isVariable] = this.searchboxInfo;
let action;

switch (e.keyCode) {
Expand Down Expand Up @@ -835,18 +872,26 @@ FilterView.prototype = {
e.preventDefault();
e.stopPropagation();

if (global) {
// Perform a global search based on the specified operator.
if (isGlobal) {
if (DebuggerView.GlobalSearch.hidden) {
DebuggerView.GlobalSearch.scheduleSearch();
} else {
DebuggerView.GlobalSearch[["focusNextMatch", "focusPrevMatch"][action]]();
}
} else {
let editor = DebuggerView.editor;
let offset = editor[["findNext", "findPrevious"][action]](true);
if (offset > -1) {
editor.setSelection(offset, offset + token.length)
}
return;
}

// Perform a variable search based on the specified operator.
if (isVariable) {
DebuggerView.Variables.expandFirstSearchResults();
return;
}

let editor = DebuggerView.editor;
let offset = editor[["findNext", "findPrevious"][action]](true);
if (offset > -1) {
editor.setSelection(offset, offset + token.length)
}
},

Expand All @@ -855,6 +900,7 @@ FilterView.prototype = {
*/
_onBlur: function DVF__onBlur() {
DebuggerView.GlobalSearch.clearView();
DebuggerView.Variables.performSearch(null);
this._searchboxPanel.hidePopup();
},

Expand Down Expand Up @@ -902,6 +948,14 @@ FilterView.prototype = {
this._searchboxPanel.hidePopup();
},

/**
* Called when the variable search filter key sequence was pressed.
*/
_doVariableSearch: function DVF__doVariableSearch() {
this._doSearch(SEARCH_VARIABLE_FLAG);
this._searchboxPanel.hidePopup();
},

_searchbox: null,
_searchboxPanel: null,
_globalOperatorButton: null,
Expand Down
5 changes: 4 additions & 1 deletion browser/devtools/debugger/debugger-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const GLOBAL_SEARCH_ACTION_DELAY = 150; // ms
const SEARCH_GLOBAL_FLAG = "!";
const SEARCH_LINE_FLAG = ":";
const SEARCH_TOKEN_FLAG = "#";
const SEARCH_VARIABLE_FLAG = "*";

/**
* Object defining the debugger view components.
Expand All @@ -38,8 +39,10 @@ let DebuggerView = {
this.GlobalSearch.initialize();

this.Variables = new VariablesView(document.getElementById("variables"));
this.Variables.searchPlaceholder = L10N.getStr("emptyVariablesFilterText");
this.Variables.emptyText = L10N.getStr("emptyVariablesText");
this.Variables.nonEnumVisible = Prefs.nonEnumVisible;
this.Variables.nonEnumVisible = Prefs.variablesNonEnumVisible;
this.Variables.searchEnabled = Prefs.variablesSearchboxVisible;
this.Variables.eval = DebuggerController.StackFrames.evaluate;
this.Variables.lazyEmpty = true;

Expand Down
Loading

0 comments on commit 71e35fb

Please sign in to comment.