mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound.
This commit is contained in:
commit
aa76626ff9
@ -621,8 +621,8 @@ HistoryMenu.prototype = {
|
||||
let m = document.createElement("menuitem");
|
||||
m.setAttribute("label", menuLabel);
|
||||
let selectedTab = undoItem.tabs[undoItem.selected - 1];
|
||||
if (selectedTab.attributes.image) {
|
||||
let iconURL = selectedTab.attributes.image;
|
||||
if (selectedTab.image) {
|
||||
let iconURL = selectedTab.image;
|
||||
// don't initiate a connection just to fetch a favicon (see bug 467828)
|
||||
if (/^https?:/.test(iconURL))
|
||||
iconURL = "moz-anno:favicon:" + iconURL;
|
||||
|
@ -476,7 +476,7 @@ nsContextMenu.prototype = {
|
||||
},
|
||||
|
||||
inspectNode: function CM_inspectNode() {
|
||||
let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser;
|
||||
let tt = devtools.TargetFactory.forTab(gBrowser.selectedTab);
|
||||
return gDevTools.showToolbox(tt, "inspector").then(function(toolbox) {
|
||||
|
@ -248,10 +248,6 @@ let SessionStoreInternal = {
|
||||
Ci.nsISupportsWeakReference
|
||||
]),
|
||||
|
||||
// xul:tab attributes to (re)store (extensions might want to hook in here);
|
||||
// the favicon is always saved for the about:sessionrestore page
|
||||
xulAttributes: {"image": true},
|
||||
|
||||
// set default load state
|
||||
_loadState: STATE_STOPPED,
|
||||
|
||||
@ -1300,7 +1296,7 @@ let SessionStoreInternal = {
|
||||
this._windows[aWindow.__SSi]._closedTabs.unshift({
|
||||
state: tabState,
|
||||
title: tabTitle,
|
||||
image: aTab.getAttribute("image"),
|
||||
image: tabbrowser.getIcon(aTab),
|
||||
pos: aTab._tPos
|
||||
});
|
||||
var length = this._windows[aWindow.__SSi]._closedTabs.length;
|
||||
@ -1696,11 +1692,9 @@ let SessionStoreInternal = {
|
||||
},
|
||||
|
||||
persistTabAttribute: function ssi_persistTabAttribute(aName) {
|
||||
if (aName in this.xulAttributes)
|
||||
return; // this attribute is already being tracked
|
||||
|
||||
this.xulAttributes[aName] = true;
|
||||
this.saveStateDelayed();
|
||||
if (TabAttributes.persist(aName)) {
|
||||
this.saveStateDelayed();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1990,11 +1984,12 @@ let SessionStoreInternal = {
|
||||
else if (tabData.disallow)
|
||||
delete tabData.disallow;
|
||||
|
||||
tabData.attributes = {};
|
||||
for (let name in this.xulAttributes) {
|
||||
if (aTab.hasAttribute(name))
|
||||
tabData.attributes[name] = aTab.getAttribute(name);
|
||||
}
|
||||
// Save tab attributes.
|
||||
tabData.attributes = TabAttributes.get(aTab);
|
||||
|
||||
// Store the tab icon.
|
||||
let tabbrowser = aTab.ownerDocument.defaultView.gBrowser;
|
||||
tabData.image = tabbrowser.getIcon(aTab);
|
||||
|
||||
if (aTab.__SS_extdata)
|
||||
tabData.extData = aTab.__SS_extdata;
|
||||
@ -2983,8 +2978,10 @@ let SessionStoreInternal = {
|
||||
else
|
||||
tabbrowser.showTab(tab);
|
||||
|
||||
for (let name in tabData.attributes)
|
||||
this.xulAttributes[name] = true;
|
||||
if ("attributes" in tabData) {
|
||||
// Ensure that we persist tab attributes restored from previous sessions.
|
||||
Object.keys(tabData.attributes).forEach(a => TabAttributes.persist(a));
|
||||
}
|
||||
|
||||
// keep the data around to prevent dataloss in case
|
||||
// a tab gets closed before it's been properly restored
|
||||
@ -3107,10 +3104,15 @@ let SessionStoreInternal = {
|
||||
for (let cap of gDocShellCapabilities(browser.docShell))
|
||||
browser.docShell["allow" + cap] = !disallow.has(cap);
|
||||
|
||||
for (let name in this.xulAttributes)
|
||||
tab.removeAttribute(name);
|
||||
for (let name in tabData.attributes)
|
||||
tab.setAttribute(name, tabData.attributes[name]);
|
||||
// Restore tab attributes.
|
||||
if ("attributes" in tabData) {
|
||||
TabAttributes.set(tab, tabData.attributes);
|
||||
}
|
||||
|
||||
// Restore the tab icon.
|
||||
if ("image" in tabData) {
|
||||
aWindow.gBrowser.setIcon(tab, tabData.image);
|
||||
}
|
||||
|
||||
if (tabData.storage && browser.docShell instanceof Ci.nsIDocShell)
|
||||
SessionStorage.deserialize(browser.docShell, tabData.storage);
|
||||
@ -4622,6 +4624,52 @@ let DyingWindowCache = {
|
||||
}
|
||||
};
|
||||
|
||||
// A set of tab attributes to persist. We will read a given list of tab
|
||||
// attributes when collecting tab data and will re-set those attributes when
|
||||
// the given tab data is restored to a new tab.
|
||||
let TabAttributes = {
|
||||
_attrs: new Set(),
|
||||
|
||||
// We never want to directly read or write those attributes.
|
||||
// 'image' should not be accessed directly but handled by using the
|
||||
// gBrowser.getIcon()/setIcon() methods.
|
||||
// 'pending' is used internal by sessionstore and managed accordingly.
|
||||
_skipAttrs: new Set(["image", "pending"]),
|
||||
|
||||
persist: function (name) {
|
||||
if (this._attrs.has(name) || this._skipAttrs.has(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._attrs.add(name);
|
||||
return true;
|
||||
},
|
||||
|
||||
get: function (tab) {
|
||||
let data = {};
|
||||
|
||||
for (let name of this._attrs) {
|
||||
if (tab.hasAttribute(name)) {
|
||||
data[name] = tab.getAttribute(name);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
set: function (tab, data = {}) {
|
||||
// Clear attributes.
|
||||
for (let name of this._attrs) {
|
||||
tab.removeAttribute(name);
|
||||
}
|
||||
|
||||
// Set attributes.
|
||||
for (let name in data) {
|
||||
tab.setAttribute(name, data[name]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// This is used to help meter the number of restoring tabs. This is the control
|
||||
// point for telling the next tab to restore. It gets attached to each gBrowser
|
||||
// via gBrowser.addTabsProgressListener
|
||||
|
@ -17,6 +17,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
head.js \
|
||||
browser_attributes.js \
|
||||
browser_capabilities.js \
|
||||
browser_dying_cache.js \
|
||||
browser_form_restore_events.js \
|
||||
|
72
browser/components/sessionstore/test/browser_attributes.js
Normal file
72
browser/components/sessionstore/test/browser_attributes.js
Normal file
@ -0,0 +1,72 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
TestRunner.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test makes sure that we correctly preserve tab attributes when storing
|
||||
* and restoring tabs. It also ensures that we skip special attributes like
|
||||
* 'image' and 'pending' that need to be handled differently or internally.
|
||||
*/
|
||||
|
||||
const PREF = "browser.sessionstore.restore_on_demand";
|
||||
|
||||
function runTests() {
|
||||
Services.prefs.setBoolPref(PREF, true)
|
||||
registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
|
||||
|
||||
// Add a new tab with a nice icon.
|
||||
let tab = gBrowser.addTab("about:robots");
|
||||
yield whenBrowserLoaded(tab.linkedBrowser);
|
||||
|
||||
// Check that the tab has an 'image' attribute.
|
||||
ok(tab.hasAttribute("image"), "tab.image exists");
|
||||
|
||||
// Make sure we do not persist 'image' attributes.
|
||||
ss.persistTabAttribute("image");
|
||||
let {attributes} = JSON.parse(ss.getTabState(tab));
|
||||
ok(!("image" in attributes), "'image' attribute not saved");
|
||||
ok(!("custom" in attributes), "'custom' attribute not saved");
|
||||
|
||||
// Test persisting a custom attribute.
|
||||
tab.setAttribute("custom", "foobar");
|
||||
ss.persistTabAttribute("custom");
|
||||
|
||||
let {attributes} = JSON.parse(ss.getTabState(tab));
|
||||
is(attributes.custom, "foobar", "'custom' attribute is correct");
|
||||
|
||||
// Make sure we're backwards compatible and restore old 'image' attributes.
|
||||
let state = {
|
||||
entries: [{url: "about:mozilla"}],
|
||||
attributes: {custom: "foobaz", image: gBrowser.getIcon(tab)}
|
||||
};
|
||||
|
||||
// Prepare a pending tab waiting to be restored.
|
||||
whenTabRestoring(tab);
|
||||
yield ss.setTabState(tab, JSON.stringify(state));
|
||||
|
||||
ok(tab.hasAttribute("pending"), "tab is pending");
|
||||
is(gBrowser.getIcon(tab), state.attributes.image, "tab has correct icon");
|
||||
|
||||
// Let the pending tab load.
|
||||
gBrowser.selectedTab = tab;
|
||||
yield whenBrowserLoaded(tab.linkedBrowser);
|
||||
|
||||
// Ensure no 'image' or 'pending' attributes are stored.
|
||||
let {attributes} = JSON.parse(ss.getTabState(tab));
|
||||
ok(!("image" in attributes), "'image' attribute not saved");
|
||||
ok(!("pending" in attributes), "'pending' attribute not saved");
|
||||
is(attributes.custom, "foobaz", "'custom' attribute is correct");
|
||||
|
||||
// Clean up.
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
|
||||
function whenTabRestoring(tab) {
|
||||
tab.addEventListener("SSTabRestoring", function onRestoring() {
|
||||
tab.removeEventListener("SSTabRestoring", onRestoring);
|
||||
executeSoon(next);
|
||||
});
|
||||
}
|
@ -27,7 +27,7 @@ function onTabViewWindowLoaded(win) {
|
||||
// Create a bunch of tabs in the group
|
||||
let bg = {inBackground: true};
|
||||
let datatext = win.gBrowser.loadOneTab("data:text/plain,bug610242", bg);
|
||||
let datahtml = win.gBrowser.loadOneTab("data:text/html,<blink>don't blink!</blink>", bg);
|
||||
let datahtml = win.gBrowser.loadOneTab("data:text/html,<h1>hi!</h1>", bg);
|
||||
let mozilla = win.gBrowser.loadOneTab("about:mozilla", bg);
|
||||
let synclog = win.gBrowser.loadOneTab("about:sync-log", bg);
|
||||
let html = win.gBrowser.loadOneTab("http://example.com", bg);
|
||||
|
@ -22,7 +22,7 @@ Cu.import("resource:///modules/devtools/shared/event-emitter.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppCacheUtils",
|
||||
"resource:///modules/devtools/AppCacheUtils.jsm");
|
||||
|
||||
|
20
browser/devtools/commandline/gcli.jsm
Normal file
20
browser/devtools/commandline/gcli.jsm
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012, Mozilla Foundation and contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "gcli" ];
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm");
|
@ -24,7 +24,7 @@ let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).req
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm", {});
|
||||
|
||||
let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
|
||||
let TargetFactory = (Cu.import("resource:///modules/devtools/gDevTools.jsm", {})).devtools.TargetFactory;
|
||||
let TargetFactory = (Cu.import("resource://gre/modules/devtools/Loader.jsm", {})).devtools.TargetFactory;
|
||||
|
||||
let Promise = (Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {})).Promise;
|
||||
let assert = { ok: ok, is: is, log: info };
|
||||
|
@ -1,19 +1,22 @@
|
||||
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ ];
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/gcli.jsm");
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "console",
|
||||
"resource://gre/modules/devtools/Console.jsm");
|
||||
|
||||
"resource://gre/modules/devtools/Console.jsm");
|
||||
|
||||
/**
|
||||
* 'break' command
|
||||
@ -32,8 +35,8 @@ gcli.addCommand({
|
||||
description: gcli.lookup("breaklistDesc"),
|
||||
returnType: "breakpoints",
|
||||
exec: function(args, context) {
|
||||
let panel = getPanel(context, "jsdebugger", {ensure_opened: true});
|
||||
return panel.then(function(dbg) {
|
||||
let dbg = getPanel(context, "jsdebugger", { ensure_opened: true });
|
||||
return dbg.then(function(dbg) {
|
||||
let breakpoints = [];
|
||||
for (let source in dbg.panelWin.DebuggerView.Sources) {
|
||||
for (let { attachment: breakpoint } in source) {
|
||||
@ -106,8 +109,8 @@ var breakListHtml = "" +
|
||||
" <span class='gcli-out-shortcut'" +
|
||||
" data-command='break del ${breakpoint.index}'" +
|
||||
" onclick='${onclick}'" +
|
||||
" ondblclick='${ondblclick}'" +
|
||||
" >" + gcli.lookup("breaklistOutRemove") + "</span>" +
|
||||
" ondblclick='${ondblclick}'>" +
|
||||
" " + gcli.lookup("breaklistOutRemove") + "</span>" +
|
||||
" </td>" +
|
||||
" </tr>" +
|
||||
" </tbody>" +
|
||||
@ -138,15 +141,11 @@ gcli.addCommand({
|
||||
type: {
|
||||
name: "selection",
|
||||
data: function(args, context) {
|
||||
let files = [];
|
||||
let dbg = getPanel(context, "jsdebugger");
|
||||
if (dbg) {
|
||||
let sourcesView = dbg.panelWin.DebuggerView.Sources;
|
||||
for (let item in sourcesView) {
|
||||
files.push(item.value);
|
||||
}
|
||||
return dbg.panelWin.DebuggerView.Sources.values;
|
||||
}
|
||||
return files;
|
||||
return [];
|
||||
}
|
||||
},
|
||||
description: gcli.lookup("breakaddlineFileDesc")
|
||||
@ -165,7 +164,8 @@ gcli.addCommand({
|
||||
if (!dbg) {
|
||||
return gcli.lookup("debuggerStopped");
|
||||
}
|
||||
var deferred = context.defer();
|
||||
|
||||
let deferred = context.defer();
|
||||
let position = { url: args.file, line: args.line };
|
||||
dbg.addBreakpoint(position, function(aBreakpoint, aError) {
|
||||
if (aError) {
|
||||
@ -178,7 +178,6 @@ gcli.addCommand({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 'break del' command
|
||||
*/
|
||||
@ -187,15 +186,13 @@ gcli.addCommand({
|
||||
description: gcli.lookup("breakdelDesc"),
|
||||
params: [
|
||||
{
|
||||
name: "breakid",
|
||||
name: "breakIndex",
|
||||
type: {
|
||||
name: "number",
|
||||
min: 0,
|
||||
max: function(args, context) {
|
||||
let dbg = getPanel(context, "jsdebugger");
|
||||
return dbg == null ?
|
||||
null :
|
||||
Object.keys(dbg.getAllBreakpoints()).length - 1;
|
||||
return dbg == null ? 0 : Object.keys(dbg.getAllBreakpoints()).length - 1;
|
||||
},
|
||||
},
|
||||
description: gcli.lookup("breakdelBreakidDesc")
|
||||
@ -209,7 +206,7 @@ gcli.addCommand({
|
||||
}
|
||||
|
||||
let breakpoints = dbg.getAllBreakpoints();
|
||||
let id = Object.keys(breakpoints)[args.breakid];
|
||||
let id = Object.keys(breakpoints)[args.breakIndex];
|
||||
if (!id || !(id in breakpoints)) {
|
||||
return gcli.lookup("breakNotFound");
|
||||
}
|
||||
@ -244,7 +241,7 @@ gcli.addCommand({
|
||||
description: gcli.lookup("dbgOpen"),
|
||||
params: [],
|
||||
exec: function(args, context) {
|
||||
return gDevTools.showToolbox(context.environment.target, "jsdebugger").then(function() null);
|
||||
return gDevTools.showToolbox(context.environment.target, "jsdebugger").then(() => null);
|
||||
}
|
||||
});
|
||||
|
||||
@ -256,7 +253,7 @@ gcli.addCommand({
|
||||
description: gcli.lookup("dbgClose"),
|
||||
params: [],
|
||||
exec: function(args, context) {
|
||||
return gDevTools.closeToolbox(context.environment.target).then(function() null);
|
||||
return gDevTools.closeToolbox(context.environment.target).then(() => null);
|
||||
}
|
||||
});
|
||||
|
||||
@ -388,6 +385,7 @@ gcli.addCommand({
|
||||
if (!dbg) {
|
||||
return gcli.lookup("debuggerClosed");
|
||||
}
|
||||
|
||||
let sources = dbg._view.Sources.values;
|
||||
let div = createXHTMLElement(doc, "div");
|
||||
let ol = createXHTMLElement(doc, "ol");
|
||||
@ -414,16 +412,14 @@ function createXHTMLElement(document, tagname) {
|
||||
* @see |updateCommand()| and |executeCommand()|
|
||||
*/
|
||||
function withCommand(element, action) {
|
||||
var command = element.getAttribute("data-command");
|
||||
let command = element.getAttribute("data-command");
|
||||
if (!command) {
|
||||
command = element.querySelector("*[data-command]")
|
||||
.getAttribute("data-command");
|
||||
command = element.querySelector("*[data-command]").getAttribute("data-command");
|
||||
}
|
||||
|
||||
if (command) {
|
||||
action(command);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
console.warn("Missing data-command for " + util.findCssSelector(element));
|
||||
}
|
||||
}
|
||||
@ -462,18 +458,22 @@ function createExecuteHandler(context) {
|
||||
/**
|
||||
* A helper to go from a command context to a debugger panel
|
||||
*/
|
||||
function getPanel(context, id, opts) {
|
||||
function getPanel(context, id, options = {}) {
|
||||
if (context == null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let target = context.environment.target;
|
||||
if (opts && opts.ensure_opened) {
|
||||
if (options.ensure_opened) {
|
||||
return gDevTools.showToolbox(target, id).then(function(toolbox) {
|
||||
return toolbox.getPanel(id);
|
||||
});
|
||||
} else {
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
return toolbox && toolbox.getPanel(id);
|
||||
if (toolbox) {
|
||||
return toolbox.getPanel(id);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
|
||||
"resource://gre/modules/devtools/dbg-server.jsm");
|
||||
|
||||
function DebuggerPanel(iframeWindow, toolbox) {
|
||||
this.DebuggerPanel = function DebuggerPanel(iframeWindow, toolbox) {
|
||||
this.panelWin = iframeWindow;
|
||||
this._toolbox = toolbox;
|
||||
|
||||
@ -85,5 +85,5 @@ DebuggerPanel.prototype = {
|
||||
|
||||
getAllBreakpoints: function() {
|
||||
return this._bkp.store;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ DebuggerUI.prototype = {
|
||||
* Update the status of tool's menuitems and buttons when
|
||||
* the user switches tabs.
|
||||
*/
|
||||
listenToTabs: function DUI_listenToTabs() {
|
||||
listenToTabs: function() {
|
||||
let win = this.chromeWindow;
|
||||
let tabs = win.gBrowser.tabContainer;
|
||||
|
||||
@ -56,7 +56,7 @@ DebuggerUI.prototype = {
|
||||
* Called by the DebuggerPane to update the Debugger toggle switches with the
|
||||
* debugger state.
|
||||
*/
|
||||
refreshCommand: function DUI_refreshCommand() {
|
||||
refreshCommand: function() {
|
||||
let scriptDebugger = this.getDebugger();
|
||||
let command = this.chromeWindow.document.getElementById("Tools:Debugger");
|
||||
let selectedTab = this.chromeWindow.gBrowser.selectedTab;
|
||||
@ -74,7 +74,7 @@ DebuggerUI.prototype = {
|
||||
* @return DebuggerPane | null
|
||||
* The script debugger instance if it's started, null if stopped.
|
||||
*/
|
||||
toggleDebugger: function DUI_toggleDebugger() {
|
||||
toggleDebugger: function() {
|
||||
let scriptDebugger = this.findDebugger();
|
||||
let selectedTab = this.chromeWindow.gBrowser.selectedTab;
|
||||
|
||||
@ -91,7 +91,7 @@ DebuggerUI.prototype = {
|
||||
* @return RemoteDebuggerWindow | null
|
||||
* The remote debugger instance if it's started, null if stopped.
|
||||
*/
|
||||
toggleRemoteDebugger: function DUI_toggleRemoteDebugger() {
|
||||
toggleRemoteDebugger: function() {
|
||||
let remoteDebugger = this.getRemoteDebugger();
|
||||
|
||||
if (remoteDebugger) {
|
||||
@ -107,7 +107,7 @@ DebuggerUI.prototype = {
|
||||
* @return ChromeDebuggerProcess | null
|
||||
* The chrome debugger instance if it's started, null if stopped.
|
||||
*/
|
||||
toggleChromeDebugger: function DUI_toggleChromeDebugger(aOnClose, aOnRun) {
|
||||
toggleChromeDebugger: function(aOnClose, aOnRun) {
|
||||
let chromeDebugger = this.getChromeDebugger();
|
||||
|
||||
if (chromeDebugger) {
|
||||
@ -123,7 +123,7 @@ DebuggerUI.prototype = {
|
||||
* @return DebuggerPane | null
|
||||
* The script debugger instance if it exists, null otherwise.
|
||||
*/
|
||||
findDebugger: function DUI_findDebugger() {
|
||||
findDebugger: function() {
|
||||
let enumerator = Services.wm.getEnumerator("navigator:browser");
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let chromeWindow = enumerator.getNext().QueryInterface(Ci.nsIDOMWindow);
|
||||
@ -141,7 +141,7 @@ DebuggerUI.prototype = {
|
||||
* @return DebuggerPane | null
|
||||
* The script debugger instance if it exists, null otherwise.
|
||||
*/
|
||||
getDebugger: function DUI_getDebugger() {
|
||||
getDebugger: function() {
|
||||
return '_scriptDebugger' in this ? this._scriptDebugger : null;
|
||||
},
|
||||
|
||||
@ -151,7 +151,7 @@ DebuggerUI.prototype = {
|
||||
* @return RemoteDebuggerWindow | null
|
||||
* The remote debugger instance if it exists, null otherwise.
|
||||
*/
|
||||
getRemoteDebugger: function DUI_getRemoteDebugger() {
|
||||
getRemoteDebugger: function() {
|
||||
return '_remoteDebugger' in this ? this._remoteDebugger : null;
|
||||
},
|
||||
|
||||
@ -161,7 +161,7 @@ DebuggerUI.prototype = {
|
||||
* @return ChromeDebuggerProcess | null
|
||||
* The chrome debugger instance if it exists, null otherwise.
|
||||
*/
|
||||
getChromeDebugger: function DUI_getChromeDebugger() {
|
||||
getChromeDebugger: function() {
|
||||
return '_chromeDebugger' in this ? this._chromeDebugger : null;
|
||||
}
|
||||
};
|
||||
@ -174,7 +174,7 @@ DebuggerUI.prototype = {
|
||||
* @param XULElement aTab
|
||||
* The tab in which to create the debugger.
|
||||
*/
|
||||
function DebuggerPane(aDebuggerUI, aTab) {
|
||||
this.DebuggerPane = function DebuggerPane(aDebuggerUI, aTab) {
|
||||
this.globalUI = aDebuggerUI;
|
||||
this._win = aDebuggerUI.chromeWindow;
|
||||
this._tab = aTab;
|
||||
@ -188,7 +188,7 @@ DebuggerPane.prototype = {
|
||||
/**
|
||||
* Initializes the debugger server.
|
||||
*/
|
||||
_initServer: function DP__initServer() {
|
||||
_initServer: function() {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
@ -198,7 +198,7 @@ DebuggerPane.prototype = {
|
||||
/**
|
||||
* Creates and initializes the widgets containing the debugger UI.
|
||||
*/
|
||||
_create: function DP__create() {
|
||||
_create: function() {
|
||||
this.globalUI._scriptDebugger = this;
|
||||
|
||||
let gBrowser = this._win.gBrowser;
|
||||
@ -238,7 +238,7 @@ DebuggerPane.prototype = {
|
||||
* Clients can pass a close callback to be notified when
|
||||
* the panel successfully closes.
|
||||
*/
|
||||
close: function DP_close(aCloseCallback) {
|
||||
close: function(aCloseCallback) {
|
||||
if (!this.globalUI) {
|
||||
return;
|
||||
}
|
||||
@ -305,7 +305,7 @@ DebuggerPane.prototype = {
|
||||
* @param DebuggerUI aDebuggerUI
|
||||
* The parent instance creating the new debugger.
|
||||
*/
|
||||
function RemoteDebuggerWindow(aDebuggerUI) {
|
||||
this.RemoteDebuggerWindow = function RemoteDebuggerWindow(aDebuggerUI) {
|
||||
this.globalUI = aDebuggerUI;
|
||||
this._win = aDebuggerUI.chromeWindow;
|
||||
|
||||
@ -317,7 +317,7 @@ RemoteDebuggerWindow.prototype = {
|
||||
/**
|
||||
* Creates and initializes the widgets containing the remote debugger UI.
|
||||
*/
|
||||
_create: function DP__create() {
|
||||
_create: function() {
|
||||
this.globalUI._remoteDebugger = this;
|
||||
|
||||
this._dbgwin = this.globalUI.chromeWindow.open(DBG_XUL,
|
||||
@ -343,7 +343,7 @@ RemoteDebuggerWindow.prototype = {
|
||||
/**
|
||||
* Closes the remote debugger, along with the parent window if necessary.
|
||||
*/
|
||||
close: function DP_close() {
|
||||
close: function() {
|
||||
if (!this.globalUI) {
|
||||
return;
|
||||
}
|
||||
@ -390,7 +390,7 @@ RemoteDebuggerWindow.prototype = {
|
||||
* @param function aOnRun
|
||||
* Optional, a function called when the process starts running.
|
||||
*/
|
||||
function ChromeDebuggerProcess(aDebuggerUI, aOnClose, aOnRun) {
|
||||
this.ChromeDebuggerProcess = function ChromeDebuggerProcess(aDebuggerUI, aOnClose, aOnRun) {
|
||||
this.globalUI = aDebuggerUI;
|
||||
this._win = aDebuggerUI.chromeWindow;
|
||||
this._closeCallback = aOnClose;
|
||||
@ -405,7 +405,7 @@ ChromeDebuggerProcess.prototype = {
|
||||
/**
|
||||
* Initializes the debugger server.
|
||||
*/
|
||||
_initServer: function RDP__initServer() {
|
||||
_initServer: function() {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
@ -416,7 +416,7 @@ ChromeDebuggerProcess.prototype = {
|
||||
/**
|
||||
* Initializes a profile for the remote debugger process.
|
||||
*/
|
||||
_initProfile: function RDP__initProfile() {
|
||||
_initProfile: function() {
|
||||
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.createInstance(Ci.nsIToolkitProfileService);
|
||||
|
||||
@ -460,7 +460,7 @@ ChromeDebuggerProcess.prototype = {
|
||||
/**
|
||||
* Creates and initializes the profile & process for the remote debugger.
|
||||
*/
|
||||
_create: function RDP__create() {
|
||||
_create: function() {
|
||||
this.globalUI._chromeDebugger = this;
|
||||
|
||||
let file = Services.dirsvc.get("XREExeF", Ci.nsIFile);
|
||||
@ -485,7 +485,7 @@ ChromeDebuggerProcess.prototype = {
|
||||
/**
|
||||
* Closes the remote debugger, removing the profile and killing the process.
|
||||
*/
|
||||
close: function RDP_close() {
|
||||
close: function() {
|
||||
dumpn("Closing chrome debugging process");
|
||||
if (!this.globalUI) {
|
||||
dumpn("globalUI is missing");
|
||||
@ -520,7 +520,7 @@ let L10N = {
|
||||
* @param string aName
|
||||
* @return string
|
||||
*/
|
||||
getStr: function L10N_getStr(aName) {
|
||||
getStr: function(aName) {
|
||||
return this.stringBundle.GetStringFromName(aName);
|
||||
}
|
||||
};
|
||||
|
@ -5,9 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
const DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties";
|
||||
const NEW_SOURCE_IGNORED_URLS = ["debugger eval code", "self-hosted"];
|
||||
@ -41,7 +39,7 @@ let DebuggerController = {
|
||||
/**
|
||||
* Initializes the debugger controller.
|
||||
*/
|
||||
initialize: function DC_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the DebuggerController");
|
||||
|
||||
this.startupDebugger = this.startupDebugger.bind(this);
|
||||
@ -63,7 +61,7 @@ let DebuggerController = {
|
||||
* @return object
|
||||
* A promise that is resolved when the debugger finishes startup.
|
||||
*/
|
||||
startupDebugger: function DC_startupDebugger() {
|
||||
startupDebugger: function() {
|
||||
if (this._isInitialized) {
|
||||
return this._startup.promise;
|
||||
}
|
||||
@ -92,7 +90,7 @@ let DebuggerController = {
|
||||
* @return object
|
||||
* A promise that is resolved when the debugger finishes shutdown.
|
||||
*/
|
||||
shutdownDebugger: function DC__shutdownDebugger() {
|
||||
shutdownDebugger: function() {
|
||||
if (this._isDestroyed) {
|
||||
return this._shutdown.promise;
|
||||
}
|
||||
@ -128,7 +126,7 @@ let DebuggerController = {
|
||||
* @return object
|
||||
* A promise that is resolved when the debugger finishes connecting.
|
||||
*/
|
||||
connect: function DC_connect() {
|
||||
connect: function() {
|
||||
if (this._connection) {
|
||||
return this._connection.promise;
|
||||
}
|
||||
@ -171,7 +169,7 @@ let DebuggerController = {
|
||||
/**
|
||||
* Disconnects the debugger client and removes event handlers as necessary.
|
||||
*/
|
||||
disconnect: function DC_disconnect() {
|
||||
disconnect: function() {
|
||||
// Return early if the client didn't even have a chance to instantiate.
|
||||
if (!this.client) {
|
||||
return;
|
||||
@ -198,7 +196,7 @@ let DebuggerController = {
|
||||
* @param object aPacket
|
||||
* Packet received from the server.
|
||||
*/
|
||||
_onTabNavigated: function DC__onTabNavigated(aType, aPacket) {
|
||||
_onTabNavigated: function(aType, aPacket) {
|
||||
if (aType == "will-navigate") {
|
||||
DebuggerView._handleTabNavigation();
|
||||
|
||||
@ -217,7 +215,7 @@ let DebuggerController = {
|
||||
/**
|
||||
* Called when the debugged tab is closed.
|
||||
*/
|
||||
_onTabDetached: function DC__onTabDetached() {
|
||||
_onTabDetached: function() {
|
||||
this.shutdownDebugger();
|
||||
},
|
||||
|
||||
@ -231,7 +229,7 @@ let DebuggerController = {
|
||||
* @param function aCallback
|
||||
* A function to invoke once the client attached to the active thread.
|
||||
*/
|
||||
_startDebuggingTab: function DC__startDebuggingTab(aClient, aThreadActor, aCallback) {
|
||||
_startDebuggingTab: function(aClient, aThreadActor, aCallback) {
|
||||
if (!aClient) {
|
||||
Cu.reportError("No client found!");
|
||||
return;
|
||||
@ -259,7 +257,7 @@ let DebuggerController = {
|
||||
/**
|
||||
* Warn if resuming execution produced a wrongOrder error.
|
||||
*/
|
||||
_ensureResumptionOrder: function DC__ensureResumptionOrder(aResponse) {
|
||||
_ensureResumptionOrder: function(aResponse) {
|
||||
if (aResponse.error == "wrongOrder") {
|
||||
DebuggerView.Toolbar.showResumeWarning(aResponse.lastPausedUrl);
|
||||
}
|
||||
@ -275,7 +273,7 @@ let DebuggerController = {
|
||||
* @param function aCallback
|
||||
* A function to invoke once the client attached to the active thread.
|
||||
*/
|
||||
_startChromeDebugging: function DC__startChromeDebugging(aClient, aChromeDebugger, aCallback) {
|
||||
_startChromeDebugging: function(aClient, aChromeDebugger, aCallback) {
|
||||
if (!aClient) {
|
||||
Cu.reportError("No client found!");
|
||||
return;
|
||||
@ -304,7 +302,7 @@ let DebuggerController = {
|
||||
* Detach and reattach to the thread actor with useSourceMaps true, blow
|
||||
* away old scripts and get sources again.
|
||||
*/
|
||||
reconfigureThread: function DC_reconfigureThread(aUseSourceMaps) {
|
||||
reconfigureThread: function(aUseSourceMaps) {
|
||||
this.client.reconfigureThread(aUseSourceMaps, (aResponse) => {
|
||||
if (aResponse.error) {
|
||||
let msg = "Couldn't reconfigure thread: " + aResponse.message;
|
||||
@ -326,7 +324,7 @@ let DebuggerController = {
|
||||
/**
|
||||
* Attempts to quit the current process if allowed.
|
||||
*/
|
||||
_quitApp: function DC__quitApp() {
|
||||
_quitApp: function() {
|
||||
let canceled = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
|
||||
@ -362,7 +360,7 @@ ThreadState.prototype = {
|
||||
/**
|
||||
* Connect to the current thread client.
|
||||
*/
|
||||
connect: function TS_connect() {
|
||||
connect: function() {
|
||||
dumpn("ThreadState is connecting...");
|
||||
this.activeThread.addListener("paused", this._update);
|
||||
this.activeThread.addListener("resumed", this._update);
|
||||
@ -373,7 +371,7 @@ ThreadState.prototype = {
|
||||
/**
|
||||
* Disconnect from the client.
|
||||
*/
|
||||
disconnect: function TS_disconnect() {
|
||||
disconnect: function() {
|
||||
if (!this.activeThread) {
|
||||
return;
|
||||
}
|
||||
@ -385,7 +383,7 @@ ThreadState.prototype = {
|
||||
/**
|
||||
* Handles any initialization on a tab navigation event issued by the client.
|
||||
*/
|
||||
_handleTabNavigation: function TS__handleTabNavigation() {
|
||||
_handleTabNavigation: function() {
|
||||
if (!this.activeThread) {
|
||||
return;
|
||||
}
|
||||
@ -396,7 +394,7 @@ ThreadState.prototype = {
|
||||
/**
|
||||
* Update the UI after a thread state change.
|
||||
*/
|
||||
_update: function TS__update(aEvent) {
|
||||
_update: function(aEvent) {
|
||||
DebuggerView.Toolbar.toggleResumeButtonState(this.activeThread.state);
|
||||
|
||||
if (DebuggerController._target && (aEvent == "paused" || aEvent == "resumed")) {
|
||||
@ -434,7 +432,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Connect to the current thread client.
|
||||
*/
|
||||
connect: function SF_connect() {
|
||||
connect: function() {
|
||||
dumpn("StackFrames is connecting...");
|
||||
this.activeThread.addListener("paused", this._onPaused);
|
||||
this.activeThread.addListener("resumed", this._onResumed);
|
||||
@ -446,7 +444,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Disconnect from the client.
|
||||
*/
|
||||
disconnect: function SF_disconnect() {
|
||||
disconnect: function() {
|
||||
if (!this.activeThread) {
|
||||
return;
|
||||
}
|
||||
@ -460,7 +458,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Handles any initialization on a tab navigation event issued by the client.
|
||||
*/
|
||||
_handleTabNavigation: function SF__handleTabNavigation() {
|
||||
_handleTabNavigation: function() {
|
||||
dumpn("Handling tab navigation in the StackFrames");
|
||||
// Nothing to do here yet.
|
||||
},
|
||||
@ -473,7 +471,7 @@ StackFrames.prototype = {
|
||||
* @param object aPacket
|
||||
* The response packet.
|
||||
*/
|
||||
_onPaused: function SF__onPaused(aEvent, aPacket) {
|
||||
_onPaused: function(aEvent, aPacket) {
|
||||
switch (aPacket.why.type) {
|
||||
// If paused by a breakpoint, store the breakpoint location.
|
||||
case "breakpoint":
|
||||
@ -496,7 +494,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Handler for the thread client's resumed notification.
|
||||
*/
|
||||
_onResumed: function SF__onResumed() {
|
||||
_onResumed: function() {
|
||||
DebuggerView.editor.setDebugLocation(-1);
|
||||
|
||||
// Prepare the watch expression evaluation string for the next pause.
|
||||
@ -508,7 +506,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Handler for the thread client's framesadded notification.
|
||||
*/
|
||||
_onFrames: function SF__onFrames() {
|
||||
_onFrames: function() {
|
||||
// Ignore useless notifications.
|
||||
if (!this.activeThread.cachedFrames.length) {
|
||||
return;
|
||||
@ -591,7 +589,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Handler for the thread client's framescleared notification.
|
||||
*/
|
||||
_onFramesCleared: function SF__onFramesCleared() {
|
||||
_onFramesCleared: function() {
|
||||
this.currentFrame = null;
|
||||
this.currentWatchExpressions = null;
|
||||
this.currentBreakpointLocation = null;
|
||||
@ -607,7 +605,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Called soon after the thread client's framescleared notification.
|
||||
*/
|
||||
_afterFramesCleared: function SF__afterFramesCleared() {
|
||||
_afterFramesCleared: function() {
|
||||
// Ignore useless notifications.
|
||||
if (this.activeThread.cachedFrames.length) {
|
||||
return;
|
||||
@ -626,7 +624,7 @@ StackFrames.prototype = {
|
||||
* @param number aDepth
|
||||
* The depth of the frame in the stack.
|
||||
*/
|
||||
selectFrame: function SF_selectFrame(aDepth) {
|
||||
selectFrame: function(aDepth) {
|
||||
let frame = this.activeThread.cachedFrames[this.currentFrame = aDepth];
|
||||
if (!frame) {
|
||||
return;
|
||||
@ -704,7 +702,7 @@ StackFrames.prototype = {
|
||||
* @param object aEnv
|
||||
* The scope's environment.
|
||||
*/
|
||||
_addScopeExpander: function SF__addScopeExpander(aScope, aEnv) {
|
||||
_addScopeExpander: function(aScope, aEnv) {
|
||||
aScope._sourceEnvironment = aEnv;
|
||||
|
||||
// It's a good idea to be prepared in case of an expansion.
|
||||
@ -722,7 +720,7 @@ StackFrames.prototype = {
|
||||
* @param any aGrip
|
||||
* The grip of the variable.
|
||||
*/
|
||||
_addVarExpander: function SF__addVarExpander(aVar, aGrip) {
|
||||
_addVarExpander: function(aVar, aGrip) {
|
||||
// No need for expansion for primitive values.
|
||||
if (VariablesView.isPrimitive({ value: aGrip })) {
|
||||
return;
|
||||
@ -746,7 +744,7 @@ StackFrames.prototype = {
|
||||
* @param object aExp
|
||||
* The grip of the evaluation results.
|
||||
*/
|
||||
_fetchWatchExpressions: function SF__fetchWatchExpressions(aScope, aExp) {
|
||||
_fetchWatchExpressions: function(aScope, aExp) {
|
||||
// Fetch the expressions only once.
|
||||
if (aScope._fetched) {
|
||||
return;
|
||||
@ -754,7 +752,7 @@ StackFrames.prototype = {
|
||||
aScope._fetched = true;
|
||||
|
||||
// Add nodes for every watch expression in scope.
|
||||
this.activeThread.pauseGrip(aExp).getPrototypeAndProperties(function(aResponse) {
|
||||
this.activeThread.pauseGrip(aExp).getPrototypeAndProperties((aResponse) => {
|
||||
let ownProperties = aResponse.ownProperties;
|
||||
let totalExpressions = DebuggerView.WatchExpressions.itemCount;
|
||||
|
||||
@ -774,7 +772,7 @@ StackFrames.prototype = {
|
||||
// Signal that watch expressions have been fetched.
|
||||
window.dispatchEvent(document, "Debugger:FetchedWatchExpressions");
|
||||
DebuggerView.Variables.commitHierarchy();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -784,7 +782,7 @@ StackFrames.prototype = {
|
||||
* @param Scope aScope
|
||||
* The scope where the variables will be placed into.
|
||||
*/
|
||||
_fetchScopeVariables: function SF__fetchScopeVariables(aScope) {
|
||||
_fetchScopeVariables: function(aScope) {
|
||||
// Fetch the variables only once.
|
||||
if (aScope._fetched) {
|
||||
return;
|
||||
@ -796,7 +794,7 @@ StackFrames.prototype = {
|
||||
case "with":
|
||||
case "object":
|
||||
// Add nodes for every variable in scope.
|
||||
this.activeThread.pauseGrip(env.object).getPrototypeAndProperties(function(aResponse) {
|
||||
this.activeThread.pauseGrip(env.object).getPrototypeAndProperties((aResponse) => {
|
||||
let { ownProperties, safeGetterValues } = aResponse;
|
||||
this._mergeSafeGetterValues(ownProperties, safeGetterValues);
|
||||
this._insertScopeVariables(ownProperties, aScope);
|
||||
@ -804,7 +802,7 @@ StackFrames.prototype = {
|
||||
// Signal that variables have been fetched.
|
||||
window.dispatchEvent(document, "Debugger:FetchedVariables");
|
||||
DebuggerView.Variables.commitHierarchy();
|
||||
}.bind(this));
|
||||
});
|
||||
break;
|
||||
case "block":
|
||||
case "function":
|
||||
@ -830,7 +828,7 @@ StackFrames.prototype = {
|
||||
* @param object aFrame
|
||||
* The frame to get some references from.
|
||||
*/
|
||||
_insertScopeFrameReferences: function SF__insertScopeFrameReferences(aScope, aFrame) {
|
||||
_insertScopeFrameReferences: function(aScope, aFrame) {
|
||||
// Add any thrown exception.
|
||||
if (this.currentException) {
|
||||
let excRef = aScope.addVar("<exception>", { value: this.currentException });
|
||||
@ -851,7 +849,7 @@ StackFrames.prototype = {
|
||||
* @param Scope aScope
|
||||
* The scope where the nodes will be placed into.
|
||||
*/
|
||||
_insertScopeArguments: function SF__insertScopeArguments(aArguments, aScope) {
|
||||
_insertScopeArguments: function(aArguments, aScope) {
|
||||
if (!aArguments) {
|
||||
return;
|
||||
}
|
||||
@ -871,7 +869,7 @@ StackFrames.prototype = {
|
||||
* @param Scope aScope
|
||||
* The scope where the nodes will be placed into.
|
||||
*/
|
||||
_insertScopeVariables: function SF__insertScopeVariables(aVariables, aScope) {
|
||||
_insertScopeVariables: function(aVariables, aScope) {
|
||||
if (!aVariables) {
|
||||
return;
|
||||
}
|
||||
@ -896,7 +894,7 @@ StackFrames.prototype = {
|
||||
* @param Variable aVar
|
||||
* The variable where the properties will be placed into.
|
||||
*/
|
||||
_fetchVarProperties: function SF__fetchVarProperties(aVar) {
|
||||
_fetchVarProperties: function(aVar) {
|
||||
// Fetch the properties only once.
|
||||
if (aVar._fetched) {
|
||||
return;
|
||||
@ -904,7 +902,7 @@ StackFrames.prototype = {
|
||||
aVar._fetched = true;
|
||||
let grip = aVar._sourceGrip;
|
||||
|
||||
this.activeThread.pauseGrip(grip).getPrototypeAndProperties(function(aResponse) {
|
||||
this.activeThread.pauseGrip(grip).getPrototypeAndProperties((aResponse) => {
|
||||
let { ownProperties, prototype, safeGetterValues } = aResponse;
|
||||
let sortable = VariablesView.NON_SORTABLE_CLASSES.indexOf(grip.class) == -1;
|
||||
|
||||
@ -933,7 +931,7 @@ StackFrames.prototype = {
|
||||
// Signal that properties have been fetched.
|
||||
window.dispatchEvent(document, "Debugger:FetchedProperties");
|
||||
DebuggerView.Variables.commitHierarchy();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -947,17 +945,15 @@ StackFrames.prototype = {
|
||||
* @param object aSafeGetterValues
|
||||
* The |safeGetterValues| object.
|
||||
*/
|
||||
_mergeSafeGetterValues:
|
||||
function SF__mergeSafeGetterValues(aOwnProperties, aSafeGetterValues) {
|
||||
_mergeSafeGetterValues: function(aOwnProperties, aSafeGetterValues) {
|
||||
// Merge the safe getter values into one object such that we can use it
|
||||
// in VariablesView.
|
||||
for (let name of Object.keys(aSafeGetterValues)) {
|
||||
if (name in aOwnProperties) {
|
||||
aOwnProperties[name].getterValue = aSafeGetterValues[name].getterValue;
|
||||
aOwnProperties[name].getterPrototypeLevel = aSafeGetterValues[name]
|
||||
.getterPrototypeLevel;
|
||||
}
|
||||
else {
|
||||
aOwnProperties[name].getterPrototypeLevel =
|
||||
aSafeGetterValues[name].getterPrototypeLevel;
|
||||
} else {
|
||||
aOwnProperties[name] = aSafeGetterValues[name];
|
||||
}
|
||||
}
|
||||
@ -969,7 +965,7 @@ StackFrames.prototype = {
|
||||
* @param object aFrame
|
||||
* The new frame to add.
|
||||
*/
|
||||
_addFrame: function SF__addFrame(aFrame) {
|
||||
_addFrame: function(aFrame) {
|
||||
let depth = aFrame.depth;
|
||||
let { url, line } = aFrame.where;
|
||||
let frameLocation = NetworkHelper.convertToUnicode(unescape(url));
|
||||
@ -981,7 +977,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Loads more stack frames from the debugger server cache.
|
||||
*/
|
||||
addMoreFrames: function SF_addMoreFrames() {
|
||||
addMoreFrames: function() {
|
||||
this.activeThread.fillFrames(
|
||||
this.activeThread.cachedFrames.length + CALL_STACK_PAGE_SIZE);
|
||||
},
|
||||
@ -989,7 +985,7 @@ StackFrames.prototype = {
|
||||
/**
|
||||
* Updates a list of watch expressions to evaluate on each pause.
|
||||
*/
|
||||
syncWatchExpressions: function SF_syncWatchExpressions() {
|
||||
syncWatchExpressions: function() {
|
||||
let list = DebuggerView.WatchExpressions.getExpressions();
|
||||
|
||||
// Sanity check all watch expressions before syncing them. To avoid
|
||||
@ -1040,7 +1036,7 @@ StackFrames.prototype = {
|
||||
* @param number aFrame [optional]
|
||||
* The frame depth used for evaluation.
|
||||
*/
|
||||
evaluate: function SF_evaluate(aExpression, aFrame = this.currentFrame || 0) {
|
||||
evaluate: function(aExpression, aFrame = this.currentFrame || 0) {
|
||||
let frame = this.activeThread.cachedFrames[aFrame];
|
||||
this.activeThread.eval(frame.actor, aExpression);
|
||||
}
|
||||
@ -1068,7 +1064,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Connect to the current thread client.
|
||||
*/
|
||||
connect: function SS_connect() {
|
||||
connect: function() {
|
||||
dumpn("SourceScripts is connecting...");
|
||||
this.debuggerClient.addListener("newGlobal", this._onNewGlobal);
|
||||
this.debuggerClient.addListener("newSource", this._onNewSource);
|
||||
@ -1078,7 +1074,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Disconnect from the client.
|
||||
*/
|
||||
disconnect: function SS_disconnect() {
|
||||
disconnect: function() {
|
||||
if (!this.activeThread) {
|
||||
return;
|
||||
}
|
||||
@ -1091,7 +1087,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Handles any initialization on a tab navigation event issued by the client.
|
||||
*/
|
||||
_handleTabNavigation: function SS__handleTabNavigation() {
|
||||
_handleTabNavigation: function() {
|
||||
if (!this.activeThread) {
|
||||
return;
|
||||
}
|
||||
@ -1106,7 +1102,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Handler for the debugger client's unsolicited newGlobal notification.
|
||||
*/
|
||||
_onNewGlobal: function SS__onNewGlobal(aNotification, aPacket) {
|
||||
_onNewGlobal: function(aNotification, aPacket) {
|
||||
// TODO: bug 806775, update the globals list using aPacket.hostAnnotations
|
||||
// from bug 801084.
|
||||
},
|
||||
@ -1114,7 +1110,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Handler for the debugger client's unsolicited newSource notification.
|
||||
*/
|
||||
_onNewSource: function SS__onNewSource(aNotification, aPacket) {
|
||||
_onNewSource: function(aNotification, aPacket) {
|
||||
// Ignore bogus scripts, e.g. generated from 'clientEvaluate' packets.
|
||||
if (NEW_SOURCE_IGNORED_URLS.indexOf(aPacket.source.url) != -1) {
|
||||
return;
|
||||
@ -1154,7 +1150,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Callback for the debugger's active thread getSources() method.
|
||||
*/
|
||||
_onSourcesAdded: function SS__onSourcesAdded(aResponse) {
|
||||
_onSourcesAdded: function(aResponse) {
|
||||
if (aResponse.error) {
|
||||
Cu.reportError(new Error("Error getting sources: " + aResponse.message));
|
||||
return;
|
||||
@ -1203,7 +1199,7 @@ SourceScripts.prototype = {
|
||||
* @param function aTimeout
|
||||
* Function called when the source text takes too long to fetch.
|
||||
*/
|
||||
getText: function SS_getText(aSource, aCallback, aTimeout) {
|
||||
getText: function(aSource, aCallback, aTimeout) {
|
||||
// If already loaded, return the source text immediately.
|
||||
if (aSource.loaded) {
|
||||
aCallback(aSource);
|
||||
@ -1240,7 +1236,7 @@ SourceScripts.prototype = {
|
||||
* @return array
|
||||
* An array containing [url, text] entries for the fetched sources.
|
||||
*/
|
||||
getCache: function SS_getCache() {
|
||||
getCache: function() {
|
||||
let sources = [];
|
||||
for (let source of this._cache) {
|
||||
sources.push(source);
|
||||
@ -1251,7 +1247,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Clears all the fetched sources from cache.
|
||||
*/
|
||||
clearCache: function SS_clearCache() {
|
||||
clearCache: function() {
|
||||
this._cache.clear();
|
||||
},
|
||||
|
||||
@ -1266,7 +1262,7 @@ SourceScripts.prototype = {
|
||||
* - onTimeout: optional, called when a source takes too long to fetch
|
||||
* - onFinished: called when all the sources are fetched
|
||||
*/
|
||||
fetchSources: function SS_fetchSources(aUrls, aCallbacks = {}) {
|
||||
fetchSources: function(aUrls, aCallbacks = {}) {
|
||||
this._fetchQueue = new Set();
|
||||
this._fetchCallbacks = aCallbacks;
|
||||
|
||||
@ -1297,7 +1293,7 @@ SourceScripts.prototype = {
|
||||
* @param object aSource
|
||||
* The source object coming from the active thread.
|
||||
*/
|
||||
_onFetch: function SS__onFetch(aSource) {
|
||||
_onFetch: function(aSource) {
|
||||
// Remember the source in a cache so we don't have to fetch it again.
|
||||
this._cache.set(aSource.url, aSource.text);
|
||||
|
||||
@ -1327,7 +1323,7 @@ SourceScripts.prototype = {
|
||||
* @param object aSource
|
||||
* The source object coming from the active thread.
|
||||
*/
|
||||
_onTimeout: function SS__onTimeout(aSource) {
|
||||
_onTimeout: function(aSource) {
|
||||
// Remove the source from the fetch queue.
|
||||
this._fetchQueue.delete(aSource.url);
|
||||
|
||||
@ -1345,7 +1341,7 @@ SourceScripts.prototype = {
|
||||
/**
|
||||
* Called when all the sources have been fetched.
|
||||
*/
|
||||
_onFinished: function SS__onFinished() {
|
||||
_onFinished: function() {
|
||||
// Invoke the finish callback if provided via fetchSources();
|
||||
if (this._fetchCallbacks.onFinished) {
|
||||
this._fetchCallbacks.onFinished();
|
||||
@ -1398,7 +1394,7 @@ Breakpoints.prototype = {
|
||||
/**
|
||||
* Adds the source editor breakpoint handlers.
|
||||
*/
|
||||
initialize: function BP_initialize() {
|
||||
initialize: function() {
|
||||
this.editor.addEventListener(
|
||||
SourceEditor.EVENTS.BREAKPOINT_CHANGE, this._onEditorBreakpointChange);
|
||||
},
|
||||
@ -1406,7 +1402,7 @@ Breakpoints.prototype = {
|
||||
/**
|
||||
* Removes the source editor breakpoint handlers & all the added breakpoints.
|
||||
*/
|
||||
destroy: function BP_destroy() {
|
||||
destroy: function() {
|
||||
this.editor.removeEventListener(
|
||||
SourceEditor.EVENTS.BREAKPOINT_CHANGE, this._onEditorBreakpointChange);
|
||||
|
||||
@ -1422,7 +1418,7 @@ Breakpoints.prototype = {
|
||||
* @param object aEvent
|
||||
* The SourceEditor.EVENTS.BREAKPOINT_CHANGE event object.
|
||||
*/
|
||||
_onEditorBreakpointChange: function BP__onEditorBreakpointChange(aEvent) {
|
||||
_onEditorBreakpointChange: function(aEvent) {
|
||||
if (this._skipEditorBreakpointCallbacks) {
|
||||
return;
|
||||
}
|
||||
@ -1438,11 +1434,11 @@ Breakpoints.prototype = {
|
||||
* @param object aEditorBreakpoint
|
||||
* The breakpoint object coming from the editor.
|
||||
*/
|
||||
_onEditorBreakpointAdd: function BP__onEditorBreakpointAdd(aEditorBreakpoint) {
|
||||
_onEditorBreakpointAdd: function(aEditorBreakpoint) {
|
||||
let url = DebuggerView.Sources.selectedValue;
|
||||
let line = aEditorBreakpoint.line + 1;
|
||||
|
||||
this.addBreakpoint({ url: url, line: line }, function(aBreakpointClient) {
|
||||
this.addBreakpoint({ url: url, line: line }, (aBreakpointClient) => {
|
||||
// If the breakpoint client has an "actualLocation" attached, then
|
||||
// the original requested placement for the breakpoint wasn't accepted.
|
||||
// In this case, we need to update the editor with the new location.
|
||||
@ -1450,7 +1446,7 @@ Breakpoints.prototype = {
|
||||
this.editor.removeBreakpoint(line - 1);
|
||||
this.editor.addBreakpoint(aBreakpointClient.actualLocation.line - 1);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1459,7 +1455,7 @@ Breakpoints.prototype = {
|
||||
* @param object aEditorBreakpoint
|
||||
* The breakpoint object that was removed from the editor.
|
||||
*/
|
||||
_onEditorBreakpointRemove: function BP__onEditorBreakpointRemove(aEditorBreakpoint) {
|
||||
_onEditorBreakpointRemove: function(aEditorBreakpoint) {
|
||||
let url = DebuggerView.Sources.selectedValue;
|
||||
let line = aEditorBreakpoint.line + 1;
|
||||
|
||||
@ -1471,7 +1467,7 @@ Breakpoints.prototype = {
|
||||
* breakpoints in the debugger and adds them back into the editor view.
|
||||
* This is invoked when the selected script is changed.
|
||||
*/
|
||||
updateEditorBreakpoints: function BP_updateEditorBreakpoints() {
|
||||
updateEditorBreakpoints: function() {
|
||||
for each (let breakpointClient in this.store) {
|
||||
if (DebuggerView.Sources.selectedValue == breakpointClient.location.url) {
|
||||
this._showBreakpoint(breakpointClient, {
|
||||
@ -1487,7 +1483,7 @@ Breakpoints.prototype = {
|
||||
* breakpoints in the debugger and adds them back into the breakpoints pane.
|
||||
* This is invoked when scripts are added.
|
||||
*/
|
||||
updatePaneBreakpoints: function BP_updatePaneBreakpoints() {
|
||||
updatePaneBreakpoints: function() {
|
||||
for each (let breakpointClient in this.store) {
|
||||
if (DebuggerView.Sources.containsValue(breakpointClient.location.url)) {
|
||||
this._showBreakpoint(breakpointClient, {
|
||||
@ -1519,8 +1515,7 @@ Breakpoints.prototype = {
|
||||
* - noPaneUpdate: tells if you want to skip breakpoint pane updates
|
||||
* - noPaneHighlight: tells if you don't want to highlight the breakpoint
|
||||
*/
|
||||
addBreakpoint:
|
||||
function BP_addBreakpoint(aLocation, aCallback, aFlags = {}) {
|
||||
addBreakpoint: function(aLocation, aCallback, aFlags = {}) {
|
||||
let breakpointClient = this.getBreakpoint(aLocation.url, aLocation.line);
|
||||
|
||||
// If the breakpoint was already added, callback immediately.
|
||||
@ -1529,7 +1524,7 @@ Breakpoints.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this.activeThread.setBreakpoint(aLocation, function(aResponse, aBreakpointClient) {
|
||||
this.activeThread.setBreakpoint(aLocation, (aResponse, aBreakpointClient) => {
|
||||
let { url, line } = aResponse.actualLocation || aLocation;
|
||||
|
||||
// If the response contains a breakpoint that exists in the cache, prevent
|
||||
@ -1569,7 +1564,7 @@ Breakpoints.prototype = {
|
||||
|
||||
// We're done here.
|
||||
aCallback && aCallback(aBreakpointClient, aResponse.error);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1584,8 +1579,7 @@ Breakpoints.prototype = {
|
||||
* @param object aFlags [optional]
|
||||
* @see DebuggerController.Breakpoints.addBreakpoint
|
||||
*/
|
||||
removeBreakpoint:
|
||||
function BP_removeBreakpoint(aBreakpointClient, aCallback, aFlags = {}) {
|
||||
removeBreakpoint: function(aBreakpointClient, aCallback, aFlags = {}) {
|
||||
let breakpointActor = (aBreakpointClient || {}).actor;
|
||||
|
||||
// If the breakpoint was already removed, callback immediately.
|
||||
@ -1594,7 +1588,7 @@ Breakpoints.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
aBreakpointClient.remove(function() {
|
||||
aBreakpointClient.remove(() => {
|
||||
// Delete the breakpoint client from the store.
|
||||
delete this.store[breakpointActor];
|
||||
|
||||
@ -1603,7 +1597,7 @@ Breakpoints.prototype = {
|
||||
|
||||
// We're done here.
|
||||
aCallback && aCallback(aBreakpointClient.location);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1614,7 +1608,7 @@ Breakpoints.prototype = {
|
||||
* @param object aFlags [optional]
|
||||
* @see DebuggerController.Breakpoints.addBreakpoint
|
||||
*/
|
||||
_showBreakpoint: function BP__showBreakpoint(aBreakpointClient, aFlags = {}) {
|
||||
_showBreakpoint: function(aBreakpointClient, aFlags = {}) {
|
||||
let currentSourceUrl = DebuggerView.Sources.selectedValue;
|
||||
let { url, line } = aBreakpointClient.location;
|
||||
|
||||
@ -1650,7 +1644,7 @@ Breakpoints.prototype = {
|
||||
* @param object aFlags [optional]
|
||||
* @see DebuggerController.Breakpoints.addBreakpoint
|
||||
*/
|
||||
_hideBreakpoint: function BP__hideBreakpoint(aBreakpointClient, aFlags = {}) {
|
||||
_hideBreakpoint: function(aBreakpointClient, aFlags = {}) {
|
||||
let currentSourceUrl = DebuggerView.Sources.selectedValue;
|
||||
let { url, line } = aBreakpointClient.location;
|
||||
|
||||
@ -1678,7 +1672,7 @@ Breakpoints.prototype = {
|
||||
* @return object
|
||||
* The BreakpointActor object.
|
||||
*/
|
||||
getBreakpoint: function BP_getBreakpoint(aUrl, aLine) {
|
||||
getBreakpoint: function(aUrl, aLine) {
|
||||
for each (let breakpointClient in this.store) {
|
||||
if (breakpointClient.location.url == aUrl &&
|
||||
breakpointClient.location.line == aLine) {
|
||||
|
@ -33,7 +33,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVS_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the SourcesView");
|
||||
|
||||
this.node = new SideMenuWidget(document.getElementById("sources"));
|
||||
@ -64,7 +64,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVS_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the SourcesView");
|
||||
|
||||
window.removeEventListener("Debugger:EditorLoaded", this._onEditorLoad, false);
|
||||
@ -102,7 +102,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* Additional options for adding the source. Supported options:
|
||||
* - forced: force the source to be immediately added
|
||||
*/
|
||||
addSource: function DVS_addSource(aSource, aOptions = {}) {
|
||||
addSource: function(aSource, aOptions = {}) {
|
||||
let url = aSource.url;
|
||||
let label = SourceUtils.getSourceLabel(url.split(" -> ").pop());
|
||||
let group = SourceUtils.getSourceGroup(url.split(" -> ").pop());
|
||||
@ -132,7 +132,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* - boolean openPopupFlag [optional]
|
||||
* A flag specifying if the expression popup should be shown.
|
||||
*/
|
||||
addBreakpoint: function DVS_addBreakpoint(aOptions) {
|
||||
addBreakpoint: function(aOptions) {
|
||||
let { sourceLocation: url, lineNumber: line } = aOptions;
|
||||
|
||||
// Make sure we're not duplicating anything. If a breakpoint at the
|
||||
@ -180,7 +180,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param number aLineNumber
|
||||
* The breakpoint line number.
|
||||
*/
|
||||
removeBreakpoint: function DVS_removeBreakpoint(aSourceLocation, aLineNumber) {
|
||||
removeBreakpoint: function(aSourceLocation, aLineNumber) {
|
||||
// When a parent source item is removed, all the child breakpoint items are
|
||||
// also automagically removed.
|
||||
let sourceItem = this.getItemByValue(aSourceLocation);
|
||||
@ -209,7 +209,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @return MenuItem
|
||||
* The corresponding breakpoint item if found, null otherwise.
|
||||
*/
|
||||
getBreakpoint: function DVS_getBreakpoint(aSourceLocation, aLineNumber) {
|
||||
getBreakpoint: function(aSourceLocation, aLineNumber) {
|
||||
let breakpointKey = this._getBreakpointKey(aSourceLocation, aLineNumber);
|
||||
return this._breakpointsCache.get(breakpointKey);
|
||||
},
|
||||
@ -231,8 +231,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @return boolean
|
||||
* True if breakpoint existed and was enabled, false otherwise.
|
||||
*/
|
||||
enableBreakpoint:
|
||||
function DVS_enableBreakpoint(aSourceLocation, aLineNumber, aOptions = {}) {
|
||||
enableBreakpoint: function(aSourceLocation, aLineNumber, aOptions = {}) {
|
||||
let breakpointItem = this.getBreakpoint(aSourceLocation, aLineNumber);
|
||||
if (!breakpointItem) {
|
||||
return false;
|
||||
@ -277,8 +276,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @return boolean
|
||||
* True if breakpoint existed and was disabled, false otherwise.
|
||||
*/
|
||||
disableBreakpoint:
|
||||
function DVS_disableBreakpoint(aSourceLocation, aLineNumber, aOptions = {}) {
|
||||
disableBreakpoint: function(aSourceLocation, aLineNumber, aOptions = {}) {
|
||||
let breakpointItem = this.getBreakpoint(aSourceLocation, aLineNumber);
|
||||
if (!breakpointItem) {
|
||||
return false;
|
||||
@ -315,8 +313,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* - updateEditor: true if editor updates should be allowed
|
||||
* - openPopup: true if the expression popup should be shown
|
||||
*/
|
||||
highlightBreakpoint:
|
||||
function DVS_highlightBreakpoint(aSourceLocation, aLineNumber, aFlags = {}) {
|
||||
highlightBreakpoint: function(aSourceLocation, aLineNumber, aFlags = {}) {
|
||||
let breakpointItem = this.getBreakpoint(aSourceLocation, aLineNumber);
|
||||
if (!breakpointItem) {
|
||||
return;
|
||||
@ -342,7 +339,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Unhighlights the current breakpoint in this sources container.
|
||||
*/
|
||||
unhighlightBreakpoint: function DVS_unhighlightBreakpoint() {
|
||||
unhighlightBreakpoint: function() {
|
||||
this._unselectBreakpoint();
|
||||
this._hideConditionalPopup();
|
||||
},
|
||||
@ -372,7 +369,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param MenuItem aItem
|
||||
* The breakpoint item to select.
|
||||
*/
|
||||
_selectBreakpoint: function DVS__selectBreakpoint(aItem) {
|
||||
_selectBreakpoint: function(aItem) {
|
||||
if (this._selectedBreakpoint == aItem) {
|
||||
return;
|
||||
}
|
||||
@ -387,7 +384,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Marks the current breakpoint as unselected in this sources container.
|
||||
*/
|
||||
_unselectBreakpoint: function DVS__unselectBreakpoint() {
|
||||
_unselectBreakpoint: function() {
|
||||
if (this._selectedBreakpoint) {
|
||||
this._selectedBreakpoint.markDeselected();
|
||||
this._selectedBreakpoint = null;
|
||||
@ -397,7 +394,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Opens a conditional breakpoint's expression input popup.
|
||||
*/
|
||||
_openConditionalPopup: function DVS__openConditionalPopup() {
|
||||
_openConditionalPopup: function() {
|
||||
let selectedBreakpoint = this.selectedBreakpoint;
|
||||
let selectedClient = this.selectedClient;
|
||||
|
||||
@ -417,7 +414,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Hides a conditional breakpoint's expression input popup.
|
||||
*/
|
||||
_hideConditionalPopup: function DVS__hideConditionalPopup() {
|
||||
_hideConditionalPopup: function() {
|
||||
this._cbPanel.hidden = true;
|
||||
this._cbPanel.hidePopup();
|
||||
},
|
||||
@ -435,7 +432,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* An object containing the breakpoint container, checkbox,
|
||||
* line number and line text nodes.
|
||||
*/
|
||||
_createBreakpointView: function DVS_createBreakpointView(aOptions) {
|
||||
_createBreakpointView: function(aOptions) {
|
||||
let { lineNumber, lineText } = aOptions;
|
||||
|
||||
let checkbox = document.createElement("checkbox");
|
||||
@ -484,7 +481,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @return object
|
||||
* An object containing the breakpoint commandset and menu popup ids.
|
||||
*/
|
||||
_createContextMenu: function DVS__createContextMenu(aOptions) {
|
||||
_createContextMenu: function(aOptions) {
|
||||
let commandsetId = "bp-cSet-" + aOptions.actor;
|
||||
let menupopupId = "bp-mPop-" + aOptions.actor;
|
||||
|
||||
@ -565,7 +562,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aContextMenu
|
||||
* An object containing the breakpoint commandset and menu popup ids.
|
||||
*/
|
||||
_destroyContextMenu: function DVS__destroyContextMenu(aContextMenu) {
|
||||
_destroyContextMenu: function(aContextMenu) {
|
||||
dumpn("Destroying context menu: " +
|
||||
aContextMenu.commandsetId + " & " + aContextMenu.menupopupId);
|
||||
|
||||
@ -581,7 +578,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
*/
|
||||
_onBreakpointRemoved: function DVS__onBreakpointRemoved(aItem) {
|
||||
_onBreakpointRemoved: function(aItem) {
|
||||
dumpn("Finalizing breakpoint item: " + aItem);
|
||||
|
||||
let { sourceLocation: url, lineNumber: line, popup } = aItem.attachment;
|
||||
@ -592,7 +589,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The load listener for the source editor.
|
||||
*/
|
||||
_onEditorLoad: function DVS__onEditorLoad({ detail: editor }) {
|
||||
_onEditorLoad: function({ detail: editor }) {
|
||||
editor.addEventListener("Selection", this._onEditorSelection, false);
|
||||
editor.addEventListener("ContextMenu", this._onEditorContextMenu, false);
|
||||
},
|
||||
@ -600,7 +597,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The unload listener for the source editor.
|
||||
*/
|
||||
_onEditorUnload: function DVS__onEditorUnload({ detail: editor }) {
|
||||
_onEditorUnload: function({ detail: editor }) {
|
||||
editor.removeEventListener("Selection", this._onEditorSelection, false);
|
||||
editor.removeEventListener("ContextMenu", this._onEditorContextMenu, false);
|
||||
},
|
||||
@ -608,7 +605,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The selection listener for the source editor.
|
||||
*/
|
||||
_onEditorSelection: function DVS__onEditorSelection(e) {
|
||||
_onEditorSelection: function(e) {
|
||||
let { start, end } = e.newValue;
|
||||
|
||||
let sourceLocation = this.selectedValue;
|
||||
@ -625,7 +622,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The context menu listener for the source editor.
|
||||
*/
|
||||
_onEditorContextMenu: function DVS__onEditorContextMenu({ x, y }) {
|
||||
_onEditorContextMenu: function({ x, y }) {
|
||||
let offset = DebuggerView.editor.getOffsetAtLocation(x, y);
|
||||
let line = DebuggerView.editor.getLineAtOffset(offset);
|
||||
this._editorContextMenuLineNumber = line;
|
||||
@ -634,7 +631,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The mouse down listener for the sources container.
|
||||
*/
|
||||
_onSourceMouseDown: function DVS__onSourceMouseDown(e) {
|
||||
_onSourceMouseDown: function(e) {
|
||||
let item = this.getItemForElement(e.target);
|
||||
if (item) {
|
||||
// The container is not empty and we clicked on an actual item.
|
||||
@ -645,7 +642,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The select listener for the sources container.
|
||||
*/
|
||||
_onSourceSelect: function DVS__onSourceSelect() {
|
||||
_onSourceSelect: function() {
|
||||
if (!this.refresh()) {
|
||||
return;
|
||||
}
|
||||
@ -659,7 +656,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for the sources container.
|
||||
*/
|
||||
_onSourceClick: function DVS__onSourceClick() {
|
||||
_onSourceClick: function() {
|
||||
// Use this container as a filtering target.
|
||||
DebuggerView.Filtering.target = this;
|
||||
},
|
||||
@ -667,7 +664,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a breakpoint container.
|
||||
*/
|
||||
_onBreakpointClick: function DVS__onBreakpointClick(e) {
|
||||
_onBreakpointClick: function(e) {
|
||||
let sourceItem = this.getItemForElement(e.target);
|
||||
let breakpointItem = this.getItemForElement.call(sourceItem, e.target);
|
||||
let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment;
|
||||
@ -683,7 +680,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a breakpoint checkbox.
|
||||
*/
|
||||
_onBreakpointCheckboxClick: function DVS__onBreakpointCheckboxClick(e) {
|
||||
_onBreakpointCheckboxClick: function(e) {
|
||||
let sourceItem = this.getItemForElement(e.target);
|
||||
let breakpointItem = this.getItemForElement.call(sourceItem, e.target);
|
||||
let { sourceLocation: url, lineNumber: line, disabled } = breakpointItem.attachment;
|
||||
@ -700,14 +697,14 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The popup showing listener for the breakpoints conditional expression panel.
|
||||
*/
|
||||
_onConditionalPopupShowing: function DVS__onConditionalPopupShowing() {
|
||||
_onConditionalPopupShowing: function() {
|
||||
this._conditionalPopupVisible = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* The popup shown listener for the breakpoints conditional expression panel.
|
||||
*/
|
||||
_onConditionalPopupShown: function DVS__onConditionalPopupShown() {
|
||||
_onConditionalPopupShown: function() {
|
||||
this._cbTextbox.focus();
|
||||
this._cbTextbox.select();
|
||||
},
|
||||
@ -715,21 +712,21 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The popup hiding listener for the breakpoints conditional expression panel.
|
||||
*/
|
||||
_onConditionalPopupHiding: function DVS__onConditionalPopupHiding() {
|
||||
_onConditionalPopupHiding: function() {
|
||||
this._conditionalPopupVisible = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* The input listener for the breakpoints conditional expression textbox.
|
||||
*/
|
||||
_onConditionalTextboxInput: function DVS__onConditionalTextboxInput() {
|
||||
_onConditionalTextboxInput: function() {
|
||||
this.selectedClient.conditionalExpression = this._cbTextbox.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* The keypress listener for the breakpoints conditional expression textbox.
|
||||
*/
|
||||
_onConditionalTextboxKeyPress: function DVS__onConditionalTextboxKeyPress(e) {
|
||||
_onConditionalTextboxKeyPress: function(e) {
|
||||
if (e.keyCode == e.DOM_VK_RETURN || e.keyCode == e.DOM_VK_ENTER) {
|
||||
this._hideConditionalPopup();
|
||||
}
|
||||
@ -738,7 +735,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Called when the add breakpoint key sequence was pressed.
|
||||
*/
|
||||
_onCmdAddBreakpoint: function BP__onCmdAddBreakpoint() {
|
||||
_onCmdAddBreakpoint: function() {
|
||||
// If this command was executed via the context menu, add the breakpoint
|
||||
// on the currently hovered line in the source editor.
|
||||
if (this._editorContextMenuLineNumber >= 0) {
|
||||
@ -766,7 +763,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Called when the add conditional breakpoint key sequence was pressed.
|
||||
*/
|
||||
_onCmdAddConditionalBreakpoint: function BP__onCmdAddConditionalBreakpoint() {
|
||||
_onCmdAddConditionalBreakpoint: function() {
|
||||
// If this command was executed via the context menu, add the breakpoint
|
||||
// on the currently hovered line in the source editor.
|
||||
if (this._editorContextMenuLineNumber >= 0) {
|
||||
@ -799,7 +796,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onSetConditional: function DVS__onSetConditional(aDetails) {
|
||||
_onSetConditional: function(aDetails) {
|
||||
let { sourceLocation: url, lineNumber: line, actor } = aDetails;
|
||||
let breakpointItem = this.getBreakpoint(url, line);
|
||||
this.highlightBreakpoint(url, line, { openPopup: true });
|
||||
@ -811,7 +808,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onEnableSelf: function DVS__onEnableSelf(aDetails) {
|
||||
_onEnableSelf: function(aDetails) {
|
||||
let { sourceLocation: url, lineNumber: line, actor } = aDetails;
|
||||
|
||||
if (this.enableBreakpoint(url, line)) {
|
||||
@ -829,7 +826,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDisableSelf: function DVS__onDisableSelf(aDetails) {
|
||||
_onDisableSelf: function(aDetails) {
|
||||
let { sourceLocation: url, lineNumber: line, actor } = aDetails;
|
||||
|
||||
if (this.disableBreakpoint(url, line)) {
|
||||
@ -847,7 +844,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDeleteSelf: function DVS__onDeleteSelf(aDetails) {
|
||||
_onDeleteSelf: function(aDetails) {
|
||||
let { sourceLocation: url, lineNumber: line } = aDetails;
|
||||
let breakpointClient = DebuggerController.Breakpoints.getBreakpoint(url, line);
|
||||
|
||||
@ -861,7 +858,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onEnableOthers: function DVS__onEnableOthers(aDetails) {
|
||||
_onEnableOthers: function(aDetails) {
|
||||
for (let [, item] of this._breakpointsCache) {
|
||||
if (item.attachment.actor != aDetails.actor) {
|
||||
this._onEnableSelf(item.attachment);
|
||||
@ -875,7 +872,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDisableOthers: function DVS__onDisableOthers(aDetails) {
|
||||
_onDisableOthers: function(aDetails) {
|
||||
for (let [, item] of this._breakpointsCache) {
|
||||
if (item.attachment.actor != aDetails.actor) {
|
||||
this._onDisableSelf(item.attachment);
|
||||
@ -889,7 +886,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDeleteOthers: function DVS__onDeleteOthers(aDetails) {
|
||||
_onDeleteOthers: function(aDetails) {
|
||||
for (let [, item] of this._breakpointsCache) {
|
||||
if (item.attachment.actor != aDetails.actor) {
|
||||
this._onDeleteSelf(item.attachment);
|
||||
@ -903,7 +900,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onEnableAll: function DVS__onEnableAll(aDetails) {
|
||||
_onEnableAll: function(aDetails) {
|
||||
this._onEnableOthers(aDetails);
|
||||
this._onEnableSelf(aDetails);
|
||||
},
|
||||
@ -914,7 +911,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDisableAll: function DVS__onDisableAll(aDetails) {
|
||||
_onDisableAll: function(aDetails) {
|
||||
this._onDisableOthers(aDetails);
|
||||
this._onDisableSelf(aDetails);
|
||||
},
|
||||
@ -925,7 +922,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aDetails
|
||||
* The breakpoint details (sourceLocation, lineNumber etc.).
|
||||
*/
|
||||
_onDeleteAll: function DVS__onDeleteAll(aDetails) {
|
||||
_onDeleteAll: function(aDetails) {
|
||||
this._onDeleteOthers(aDetails);
|
||||
this._onDeleteSelf(aDetails);
|
||||
},
|
||||
@ -940,7 +937,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* @return string
|
||||
* The breakpoint identifier.
|
||||
*/
|
||||
_getBreakpointKey: function DVS__getBreakpointKey(aSourceLocation, aLineNumber) {
|
||||
_getBreakpointKey: function(aSourceLocation, aLineNumber) {
|
||||
return [aSourceLocation, aLineNumber].join();
|
||||
},
|
||||
|
||||
@ -967,7 +964,7 @@ let SourceUtils = {
|
||||
* SourceUtils.getSourceLabel or Source Utils.getSourceGroup.
|
||||
* This should be done every time the content location changes.
|
||||
*/
|
||||
clearCache: function SU_clearCache() {
|
||||
clearCache: function() {
|
||||
this._labelsCache.clear();
|
||||
this._groupsCache.clear();
|
||||
},
|
||||
@ -980,7 +977,7 @@ let SourceUtils = {
|
||||
* @return string
|
||||
* The simplified label.
|
||||
*/
|
||||
getSourceLabel: function SU_getSourceLabel(aUrl) {
|
||||
getSourceLabel: function(aUrl) {
|
||||
let cachedLabel = this._labelsCache.get(aUrl);
|
||||
if (cachedLabel) {
|
||||
return cachedLabel;
|
||||
@ -1001,7 +998,7 @@ let SourceUtils = {
|
||||
* @return string
|
||||
* The simplified group.
|
||||
*/
|
||||
getSourceGroup: function SU_getSourceGroup(aUrl) {
|
||||
getSourceGroup: function(aUrl) {
|
||||
let cachedGroup = this._groupsCache.get(aUrl);
|
||||
if (cachedGroup) {
|
||||
return cachedGroup;
|
||||
@ -1054,7 +1051,7 @@ let SourceUtils = {
|
||||
* @return string
|
||||
* The shortened url.
|
||||
*/
|
||||
trimUrlLength: function SU_trimUrlLength(aUrl, aLength, aSection) {
|
||||
trimUrlLength: function(aUrl, aLength, aSection) {
|
||||
aLength = aLength || SOURCE_URL_DEFAULT_MAX_LENGTH;
|
||||
aSection = aSection || "end";
|
||||
|
||||
@ -1082,7 +1079,7 @@ let SourceUtils = {
|
||||
* @return string
|
||||
* The shortened url.
|
||||
*/
|
||||
trimUrlQuery: function SU_trimUrlQuery(aUrl) {
|
||||
trimUrlQuery: function(aUrl) {
|
||||
let length = aUrl.length;
|
||||
let q1 = aUrl.indexOf('?');
|
||||
let q2 = aUrl.indexOf('&');
|
||||
@ -1107,7 +1104,7 @@ let SourceUtils = {
|
||||
* @return string
|
||||
* The resulting label at the final step.
|
||||
*/
|
||||
trimUrl: function SU_trimUrl(aUrl, aLabel, aSeq) {
|
||||
trimUrl: function(aUrl, aLabel, aSeq) {
|
||||
if (!(aUrl instanceof Ci.nsIURL)) {
|
||||
try {
|
||||
// Use an nsIURL to parse all the url path parts.
|
||||
@ -1204,7 +1201,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVWE_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the WatchExpressionsView");
|
||||
|
||||
this.node = new ListWidget(document.getElementById("expressions"));
|
||||
@ -1219,7 +1216,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVWE_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the WatchExpressionsView");
|
||||
|
||||
this.node.removeEventListener("click", this._onClick, false);
|
||||
@ -1231,7 +1228,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @param string aExpression [optional]
|
||||
* An optional initial watch expression text.
|
||||
*/
|
||||
addExpression: function DVWE_addExpression(aExpression = "") {
|
||||
addExpression: function(aExpression = "") {
|
||||
// Watch expressions are UI elements which benefit from visible panes.
|
||||
DebuggerView.showInstrumentsPane();
|
||||
|
||||
@ -1260,7 +1257,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @param number aIndex
|
||||
* The index used to identify the watch expression.
|
||||
*/
|
||||
removeExpressionAt: function DVWE_removeExpressionAt(aIndex) {
|
||||
removeExpressionAt: function(aIndex) {
|
||||
this.remove(this._cache[aIndex]);
|
||||
this._cache.splice(aIndex, 1);
|
||||
},
|
||||
@ -1275,7 +1272,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @param string aExpression
|
||||
* The new watch expression text.
|
||||
*/
|
||||
switchExpression: function DVWE_switchExpression(aVar, aExpression) {
|
||||
switchExpression: function(aVar, aExpression) {
|
||||
let expressionItem =
|
||||
[i for (i of this._cache) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
|
||||
@ -1301,7 +1298,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @param Variable aVar
|
||||
* The variable representing the watch expression evaluation.
|
||||
*/
|
||||
deleteExpression: function DVWE_deleteExpression(aVar) {
|
||||
deleteExpression: function(aVar) {
|
||||
let expressionItem =
|
||||
[i for (i of this._cache) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
|
||||
@ -1320,7 +1317,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @return string
|
||||
* The watch expression code string.
|
||||
*/
|
||||
getExpression: function DVWE_getExpression(aIndex) {
|
||||
getExpression: function(aIndex) {
|
||||
return this._cache[aIndex].attachment.currentExpression;
|
||||
},
|
||||
|
||||
@ -1330,7 +1327,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @return array
|
||||
* The watch expressions code strings.
|
||||
*/
|
||||
getExpressions: function DVWE_getExpressions() {
|
||||
getExpressions: function() {
|
||||
return [item.attachment.currentExpression for (item of this._cache)];
|
||||
},
|
||||
|
||||
@ -1342,7 +1339,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
* @param any aAttachment
|
||||
* Some attached primitive/object.
|
||||
*/
|
||||
_createItemView: function DVWE__createItemView(aElementNode, aAttachment) {
|
||||
_createItemView: function(aElementNode, aAttachment) {
|
||||
let arrowNode = document.createElement("box");
|
||||
arrowNode.className = "dbg-expression-arrow";
|
||||
|
||||
@ -1373,7 +1370,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Called when the add watch expression key sequence was pressed.
|
||||
*/
|
||||
_onCmdAddExpression: function BP__onCmdAddExpression(aText) {
|
||||
_onCmdAddExpression: function(aText) {
|
||||
// Only add a new expression if there's no pending input.
|
||||
if (this.getExpressions().indexOf("") == -1) {
|
||||
this.addExpression(aText || DebuggerView.editor.getSelectedText());
|
||||
@ -1383,7 +1380,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Called when the remove all watch expressions key sequence was pressed.
|
||||
*/
|
||||
_onCmdRemoveAllExpressions: function BP__onCmdRemoveAllExpressions() {
|
||||
_onCmdRemoveAllExpressions: function() {
|
||||
// Empty the view of all the watch expressions and clear the cache.
|
||||
this.empty();
|
||||
this._cache.length = 0;
|
||||
@ -1395,7 +1392,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for this container.
|
||||
*/
|
||||
_onClick: function DVWE__onClick(e) {
|
||||
_onClick: function(e) {
|
||||
if (e.button != 0) {
|
||||
// Only allow left-click to trigger this event.
|
||||
return;
|
||||
@ -1410,7 +1407,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a watch expression's close button.
|
||||
*/
|
||||
_onClose: function DVWE__onClose(e) {
|
||||
_onClose: function(e) {
|
||||
let expressionItem = this.getItemForElement(e.target);
|
||||
this.removeExpressionAt(this._cache.indexOf(expressionItem));
|
||||
|
||||
@ -1425,7 +1422,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The blur listener for a watch expression's textbox.
|
||||
*/
|
||||
_onBlur: function DVWE__onBlur({ target: textbox }) {
|
||||
_onBlur: function({ target: textbox }) {
|
||||
let expressionItem = this.getItemForElement(textbox);
|
||||
let oldExpression = expressionItem.attachment.currentExpression;
|
||||
let newExpression = textbox.value.trim();
|
||||
@ -1450,7 +1447,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The keypress listener for a watch expression's textbox.
|
||||
*/
|
||||
_onKeyPress: function DVWE__onKeyPress(e) {
|
||||
_onKeyPress: function(e) {
|
||||
switch(e.keyCode) {
|
||||
case e.DOM_VK_RETURN:
|
||||
case e.DOM_VK_ENTER:
|
||||
@ -1466,7 +1463,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
*/
|
||||
_generateId: (function() {
|
||||
let count = 0;
|
||||
return function DVWE__generateId() {
|
||||
return function() {
|
||||
return (++count) + "";
|
||||
};
|
||||
})(),
|
||||
@ -1494,7 +1491,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVGS_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the GlobalSearchView");
|
||||
|
||||
this.node = new ListWidget(document.getElementById("globalsearch"));
|
||||
@ -1508,7 +1505,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVGS_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the GlobalSearchView");
|
||||
|
||||
this.node.removeEventListener("scroll", this._onScroll, false);
|
||||
@ -1534,7 +1531,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Hides and removes all items from this search container.
|
||||
*/
|
||||
clearView: function DVGS_clearView() {
|
||||
clearView: function() {
|
||||
this.hidden = true;
|
||||
this.empty();
|
||||
window.dispatchEvent(document, "Debugger:GlobalSearch:ViewCleared");
|
||||
@ -1543,7 +1540,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Focuses the next found match in the source editor.
|
||||
*/
|
||||
focusNextMatch: function DVGS_focusNextMatch() {
|
||||
focusNextMatch: function() {
|
||||
let totalLineResults = LineResults.size();
|
||||
if (!totalLineResults) {
|
||||
return;
|
||||
@ -1559,7 +1556,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Focuses the previously found match in the source editor.
|
||||
*/
|
||||
focusPrevMatch: function DVGS_focusPrevMatch() {
|
||||
focusPrevMatch: function() {
|
||||
let totalLineResults = LineResults.size();
|
||||
if (!totalLineResults) {
|
||||
return;
|
||||
@ -1583,7 +1580,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param string aQuery
|
||||
* The string to search for.
|
||||
*/
|
||||
scheduleSearch: function DVGS_scheduleSearch(aQuery) {
|
||||
scheduleSearch: function(aQuery) {
|
||||
if (!this.delayedSearch) {
|
||||
this.performSearch(aQuery);
|
||||
return;
|
||||
@ -1601,7 +1598,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param string aQuery
|
||||
* The string to search for.
|
||||
*/
|
||||
performSearch: function DVGS_performSearch(aQuery) {
|
||||
performSearch: function(aQuery) {
|
||||
window.clearTimeout(this._searchTimeout);
|
||||
this._searchFunction = null;
|
||||
this._startSearch(aQuery);
|
||||
@ -1613,7 +1610,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param string aQuery
|
||||
* The string to search for.
|
||||
*/
|
||||
_startSearch: function DVGS__startSearch(aQuery) {
|
||||
_startSearch: function(aQuery) {
|
||||
this._searchedToken = aQuery;
|
||||
|
||||
DebuggerController.SourceScripts.fetchSources(DebuggerView.Sources.values, {
|
||||
@ -1625,7 +1622,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* Finds string matches in all the sources stored in the controller's cache,
|
||||
* and groups them by location and line number.
|
||||
*/
|
||||
_performGlobalSearch: function DVGS__performGlobalSearch() {
|
||||
_performGlobalSearch: function() {
|
||||
// Get the currently searched token from the filtering input.
|
||||
let token = this._searchedToken;
|
||||
|
||||
@ -1711,7 +1708,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param GlobalResults aGlobalResults
|
||||
* An object containing all source results, grouped by source location.
|
||||
*/
|
||||
_createGlobalResultsUI: function DVGS__createGlobalResultsUI(aGlobalResults) {
|
||||
_createGlobalResultsUI: function(aGlobalResults) {
|
||||
let i = 0;
|
||||
|
||||
for (let [location, sourceResults] in aGlobalResults) {
|
||||
@ -1737,8 +1734,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param boolean aExpandFlag
|
||||
* True to expand the source results.
|
||||
*/
|
||||
_createSourceResultsUI:
|
||||
function DVGS__createSourceResultsUI(aLocation, aSourceResults, aExpandFlag) {
|
||||
_createSourceResultsUI: function(aLocation, aSourceResults, aExpandFlag) {
|
||||
// Append a source results item to this container.
|
||||
let sourceResultsItem = this.push([aLocation, aSourceResults.matchCount], {
|
||||
index: -1, /* specifies on which position should the item be appended */
|
||||
@ -1762,8 +1758,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param string aMatchCount
|
||||
* The source result's match count.
|
||||
*/
|
||||
_createItemView:
|
||||
function DVGS__createItemView(aElementNode, aAttachment, aLocation, aMatchCount) {
|
||||
_createItemView: function(aElementNode, aAttachment, aLocation, aMatchCount) {
|
||||
let { sourceResults, expandFlag } = aAttachment;
|
||||
|
||||
sourceResults.createView(aElementNode, aLocation, aMatchCount, expandFlag, {
|
||||
@ -1776,7 +1771,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a results header.
|
||||
*/
|
||||
_onHeaderClick: function DVGS__onHeaderClick(e) {
|
||||
_onHeaderClick: function(e) {
|
||||
let sourceResultsItem = SourceResults.getItemForElement(e.target);
|
||||
sourceResultsItem.instance.toggle(e);
|
||||
},
|
||||
@ -1784,7 +1779,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a results line.
|
||||
*/
|
||||
_onLineClick: function DVGLS__onLineClick(e) {
|
||||
_onLineClick: function(e) {
|
||||
let lineResultsItem = LineResults.getItemForElement(e.target);
|
||||
this._onMatchClick({ target: lineResultsItem.firstMatch });
|
||||
},
|
||||
@ -1792,7 +1787,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for a result match.
|
||||
*/
|
||||
_onMatchClick: function DVGLS__onMatchClick(e) {
|
||||
_onMatchClick: function(e) {
|
||||
if (e instanceof Event) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -1819,7 +1814,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The scroll listener for the global search container.
|
||||
*/
|
||||
_onScroll: function DVGS__onScroll(e) {
|
||||
_onScroll: function(e) {
|
||||
for (let item in this) {
|
||||
this._expandResultsIfNeeded(item.target);
|
||||
}
|
||||
@ -1831,7 +1826,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param nsIDOMNode aTarget
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
_expandResultsIfNeeded: function DVGS__expandResultsIfNeeded(aTarget) {
|
||||
_expandResultsIfNeeded: function(aTarget) {
|
||||
let sourceResultsItem = SourceResults.getItemForElement(aTarget);
|
||||
if (sourceResultsItem.instance.toggled ||
|
||||
sourceResultsItem.instance.expanded) {
|
||||
@ -1851,7 +1846,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param nsIDOMNode aMatch
|
||||
* The match to scroll into view.
|
||||
*/
|
||||
_scrollMatchIntoViewIfNeeded: function DVGS__scrollMatchIntoViewIfNeeded(aMatch) {
|
||||
_scrollMatchIntoViewIfNeeded: function(aMatch) {
|
||||
let boxObject = this.node._parent.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
|
||||
boxObject.ensureElementIsVisible(aMatch);
|
||||
},
|
||||
@ -1862,7 +1857,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param nsIDOMNode aMatch
|
||||
* The match to start a bounce animation for.
|
||||
*/
|
||||
_bounceMatch: function DVGS__bounceMatch(aMatch) {
|
||||
_bounceMatch: function(aMatch) {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
aMatch.addEventListener("transitionend", function onEvent() {
|
||||
aMatch.removeEventListener("transitionend", onEvent);
|
||||
@ -1900,7 +1895,7 @@ GlobalResults.prototype = {
|
||||
* @param SourceResults aSourceResults
|
||||
* An object containing all the matched lines for a specific source.
|
||||
*/
|
||||
add: function GR_add(aLocation, aSourceResults) {
|
||||
add: function(aLocation, aSourceResults) {
|
||||
this._store.set(aLocation, aSourceResults);
|
||||
},
|
||||
|
||||
@ -1930,7 +1925,7 @@ SourceResults.prototype = {
|
||||
* @param LineResults aLineResults
|
||||
* An object containing all the matches for a specific line.
|
||||
*/
|
||||
add: function SR_add(aLineNumber, aLineResults) {
|
||||
add: function(aLineNumber, aLineResults) {
|
||||
this._store.set(aLineNumber, aLineResults);
|
||||
},
|
||||
|
||||
@ -1942,7 +1937,7 @@ SourceResults.prototype = {
|
||||
/**
|
||||
* Expands the element, showing all the added details.
|
||||
*/
|
||||
expand: function SR_expand() {
|
||||
expand: function() {
|
||||
this._target.resultsContainer.removeAttribute("hidden")
|
||||
this._target.arrow.setAttribute("open", "");
|
||||
},
|
||||
@ -1950,7 +1945,7 @@ SourceResults.prototype = {
|
||||
/**
|
||||
* Collapses the element, hiding all the added details.
|
||||
*/
|
||||
collapse: function SR_collapse() {
|
||||
collapse: function() {
|
||||
this._target.resultsContainer.setAttribute("hidden", "true");
|
||||
this._target.arrow.removeAttribute("open");
|
||||
},
|
||||
@ -1958,7 +1953,7 @@ SourceResults.prototype = {
|
||||
/**
|
||||
* Toggles between the element collapse/expand state.
|
||||
*/
|
||||
toggle: function SR_toggle(e) {
|
||||
toggle: function(e) {
|
||||
if (e instanceof Event) {
|
||||
this._userToggled = true;
|
||||
}
|
||||
@ -2012,8 +2007,7 @@ SourceResults.prototype = {
|
||||
* - onHeaderClick
|
||||
* - onMatchClick
|
||||
*/
|
||||
createView:
|
||||
function SR_createView(aElementNode, aLocation, aMatchCount, aExpandFlag, aCallbacks) {
|
||||
createView: function(aElementNode, aLocation, aMatchCount, aExpandFlag, aCallbacks) {
|
||||
this._target = aElementNode;
|
||||
|
||||
let arrow = document.createElement("box");
|
||||
@ -2093,7 +2087,7 @@ LineResults.prototype = {
|
||||
* @param boolean aMatchFlag
|
||||
* True if the chunk is a matched string, false if just text content.
|
||||
*/
|
||||
add: function LC_add(aString, aRange, aMatchFlag) {
|
||||
add: function(aString, aRange, aMatchFlag) {
|
||||
this._store.push({
|
||||
string: aString,
|
||||
range: aRange,
|
||||
@ -2119,7 +2113,7 @@ LineResults.prototype = {
|
||||
* - onMatchClick
|
||||
* - onLineClick
|
||||
*/
|
||||
createView: function LR_createView(aContainer, aLineNumber, aCallbacks) {
|
||||
createView: function(aContainer, aLineNumber, aCallbacks) {
|
||||
this._target = aContainer;
|
||||
|
||||
let lineNumberNode = document.createElement("label");
|
||||
@ -2171,7 +2165,7 @@ LineResults.prototype = {
|
||||
* @param nsIDOMNode aNode
|
||||
* @param object aMatchChunk
|
||||
*/
|
||||
_entangleMatch: function LR__entangleMatch(aLineNumber, aNode, aMatchChunk) {
|
||||
_entangleMatch: function(aLineNumber, aNode, aMatchChunk) {
|
||||
LineResults._itemsByElement.set(aNode, {
|
||||
lineNumber: aLineNumber,
|
||||
lineData: aMatchChunk
|
||||
@ -2183,7 +2177,7 @@ LineResults.prototype = {
|
||||
* @param nsIDOMNode aNode
|
||||
* @param nsIDOMNode aFirstMatch
|
||||
*/
|
||||
_entangleLine: function LR__entangleLine(aNode, aFirstMatch) {
|
||||
_entangleLine: function(aNode, aFirstMatch) {
|
||||
LineResults._itemsByElement.set(aNode, {
|
||||
firstMatch: aFirstMatch,
|
||||
nonenumerable: true
|
||||
@ -2209,7 +2203,7 @@ LineResults.prototype = {
|
||||
*/
|
||||
GlobalResults.prototype.__iterator__ =
|
||||
SourceResults.prototype.__iterator__ =
|
||||
LineResults.prototype.__iterator__ = function DVGS_iterator() {
|
||||
LineResults.prototype.__iterator__ = function() {
|
||||
for (let item of this._store) {
|
||||
yield item;
|
||||
}
|
||||
@ -2224,7 +2218,7 @@ LineResults.prototype.__iterator__ = function DVGS_iterator() {
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
SourceResults.getItemForElement =
|
||||
LineResults.getItemForElement = function DVGS_getItemForElement(aElement) {
|
||||
LineResults.getItemForElement = function(aElement) {
|
||||
return MenuContainer.prototype.getItemForElement.call(this, aElement);
|
||||
};
|
||||
|
||||
@ -2237,7 +2231,7 @@ LineResults.getItemForElement = function DVGS_getItemForElement(aElement) {
|
||||
* The matched element, or null if nothing is found.
|
||||
*/
|
||||
SourceResults.getElementAtIndex =
|
||||
LineResults.getElementAtIndex = function DVGS_getElementAtIndex(aIndex) {
|
||||
LineResults.getElementAtIndex = function(aIndex) {
|
||||
for (let [element, item] of this._itemsByElement) {
|
||||
if (!item.nonenumerable && !aIndex--) {
|
||||
return element;
|
||||
@ -2255,7 +2249,7 @@ LineResults.getElementAtIndex = function DVGS_getElementAtIndex(aIndex) {
|
||||
* The index of the matched element, or -1 if nothing is found.
|
||||
*/
|
||||
SourceResults.indexOfElement =
|
||||
LineResults.indexOfElement = function DVGS_indexOFElement(aElement) {
|
||||
LineResults.indexOfElement = function(aElement) {
|
||||
let count = 0;
|
||||
for (let [element, item] of this._itemsByElement) {
|
||||
if (element == aElement) {
|
||||
@ -2275,7 +2269,7 @@ LineResults.indexOfElement = function DVGS_indexOFElement(aElement) {
|
||||
* The number of key/value pairs in the corresponding map.
|
||||
*/
|
||||
SourceResults.size =
|
||||
LineResults.size = function DVGS_size() {
|
||||
LineResults.size = function() {
|
||||
let count = 0;
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
if (!item.nonenumerable) {
|
||||
|
@ -23,7 +23,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVT_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the ToolbarView");
|
||||
|
||||
this._instrumentsPaneToggleButton = document.getElementById("instruments-pane-toggle");
|
||||
@ -61,7 +61,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVT_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the ToolbarView");
|
||||
|
||||
this._instrumentsPaneToggleButton.removeEventListener("mousedown", this._onTogglePanesPressed, false);
|
||||
@ -77,7 +77,7 @@ ToolbarView.prototype = {
|
||||
* @param string aState
|
||||
* Either "paused" or "attached".
|
||||
*/
|
||||
toggleResumeButtonState: function DVT_toggleResumeButtonState(aState) {
|
||||
toggleResumeButtonState: function(aState) {
|
||||
// If we're paused, check and show a resume label on the button.
|
||||
if (aState == "paused") {
|
||||
this._resumeButton.setAttribute("checked", "true");
|
||||
@ -97,7 +97,7 @@ ToolbarView.prototype = {
|
||||
* @param string aPausedUrl
|
||||
* The URL of the last paused debuggee.
|
||||
*/
|
||||
showResumeWarning: function DVT_showResumeWarning(aPausedUrl) {
|
||||
showResumeWarning: function(aPausedUrl) {
|
||||
let label = L10N.getFormatStr("resumptionOrderPanelTitle", [aPausedUrl]);
|
||||
document.getElementById("resumption-panel-desc").textContent = label;
|
||||
this._resumeOrderPanel.openPopup(this._resumeButton);
|
||||
@ -109,14 +109,14 @@ ToolbarView.prototype = {
|
||||
* @param boolean aVisibleFlag
|
||||
* Specifies the intended visibility.
|
||||
*/
|
||||
toggleChromeGlobalsContainer: function DVT_toggleChromeGlobalsContainer(aVisibleFlag) {
|
||||
toggleChromeGlobalsContainer: function(aVisibleFlag) {
|
||||
this._chromeGlobals.setAttribute("hidden", !aVisibleFlag);
|
||||
},
|
||||
|
||||
/**
|
||||
* Listener handling the toggle button click event.
|
||||
*/
|
||||
_onTogglePanesPressed: function DVT__onTogglePanesPressed() {
|
||||
_onTogglePanesPressed: function() {
|
||||
DebuggerView.toggleInstrumentsPane({
|
||||
visible: DebuggerView.instrumentsPaneHidden,
|
||||
animated: true,
|
||||
@ -127,7 +127,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Listener handling the pause/resume button click event.
|
||||
*/
|
||||
_onResumePressed: function DVT__onResumePressed() {
|
||||
_onResumePressed: function() {
|
||||
if (DebuggerController.activeThread.paused) {
|
||||
let warn = DebuggerController._ensureResumptionOrder;
|
||||
DebuggerController.activeThread.resume(warn);
|
||||
@ -139,7 +139,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Listener handling the step over button click event.
|
||||
*/
|
||||
_onStepOverPressed: function DVT__onStepOverPressed() {
|
||||
_onStepOverPressed: function() {
|
||||
if (DebuggerController.activeThread.paused) {
|
||||
DebuggerController.activeThread.stepOver();
|
||||
}
|
||||
@ -148,7 +148,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Listener handling the step in button click event.
|
||||
*/
|
||||
_onStepInPressed: function DVT__onStepInPressed() {
|
||||
_onStepInPressed: function() {
|
||||
if (DebuggerController.activeThread.paused) {
|
||||
DebuggerController.activeThread.stepIn();
|
||||
}
|
||||
@ -157,7 +157,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Listener handling the step out button click event.
|
||||
*/
|
||||
_onStepOutPressed: function DVT__onStepOutPressed() {
|
||||
_onStepOutPressed: function() {
|
||||
if (DebuggerController.activeThread.paused) {
|
||||
DebuggerController.activeThread.stepOut();
|
||||
}
|
||||
@ -194,7 +194,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVO_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the OptionsView");
|
||||
|
||||
this._button = document.getElementById("debugger-options");
|
||||
@ -214,7 +214,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVO_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the OptionsView");
|
||||
// Nothing to do here yet.
|
||||
},
|
||||
@ -222,21 +222,21 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Listener handling the 'gear menu' popup showing event.
|
||||
*/
|
||||
_onPopupShowing: function DVO__onPopupShowing() {
|
||||
_onPopupShowing: function() {
|
||||
this._button.setAttribute("open", "true");
|
||||
},
|
||||
|
||||
/**
|
||||
* Listener handling the 'gear menu' popup hiding event.
|
||||
*/
|
||||
_onPopupHiding: function DVO__onPopupHiding() {
|
||||
_onPopupHiding: function() {
|
||||
this._button.removeAttribute("open");
|
||||
},
|
||||
|
||||
/**
|
||||
* Listener handling the 'pause on exceptions' menuitem command.
|
||||
*/
|
||||
_togglePauseOnExceptions: function DVO__togglePauseOnExceptions() {
|
||||
_togglePauseOnExceptions: function() {
|
||||
DebuggerController.activeThread.pauseOnExceptions(Prefs.pauseOnExceptions =
|
||||
this._pauseOnExceptionsItem.getAttribute("checked") == "true");
|
||||
},
|
||||
@ -244,7 +244,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Listener handling the 'show panes on startup' menuitem command.
|
||||
*/
|
||||
_toggleShowPanesOnStartup: function DVO__toggleShowPanesOnStartup() {
|
||||
_toggleShowPanesOnStartup: function() {
|
||||
Prefs.panesVisibleOnStartup =
|
||||
this._showPanesOnStartupItem.getAttribute("checked") == "true";
|
||||
},
|
||||
@ -252,7 +252,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Listener handling the 'show non-enumerables' menuitem command.
|
||||
*/
|
||||
_toggleShowVariablesOnlyEnum: function DVO__toggleShowVariablesOnlyEnum() {
|
||||
_toggleShowVariablesOnlyEnum: function() {
|
||||
DebuggerView.Variables.onlyEnumVisible = Prefs.variablesOnlyEnumVisible =
|
||||
this._showVariablesOnlyEnumItem.getAttribute("checked") == "true";
|
||||
},
|
||||
@ -260,7 +260,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Listener handling the 'show variables searchbox' menuitem command.
|
||||
*/
|
||||
_toggleShowVariablesFilterBox: function DVO__toggleShowVariablesFilterBox() {
|
||||
_toggleShowVariablesFilterBox: function() {
|
||||
DebuggerView.Variables.searchEnabled = Prefs.variablesSearchboxVisible =
|
||||
this._showVariablesFilterBoxItem.getAttribute("checked") == "true";
|
||||
},
|
||||
@ -268,7 +268,7 @@ OptionsView.prototype = {
|
||||
/**
|
||||
* Listener handling the 'show original source' menuitem command.
|
||||
*/
|
||||
_toggleShowOriginalSource: function DVO__toggleShowOriginalSource() {
|
||||
_toggleShowOriginalSource: function() {
|
||||
let pref = Prefs.sourceMapsEnabled =
|
||||
this._showOriginalSourceItem.getAttribute("checked") == "true";
|
||||
|
||||
@ -297,7 +297,7 @@ create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVCG_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the ChromeGlobalsView");
|
||||
|
||||
this.node = document.getElementById("chrome-globals");
|
||||
@ -314,7 +314,7 @@ create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVT_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the ChromeGlobalsView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
@ -324,7 +324,7 @@ create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The select listener for the chrome globals container.
|
||||
*/
|
||||
_onSelect: function DVCG__onSelect() {
|
||||
_onSelect: function() {
|
||||
if (!this.refresh()) {
|
||||
return;
|
||||
}
|
||||
@ -334,7 +334,7 @@ create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for the chrome globals container.
|
||||
*/
|
||||
_onClick: function DVCG__onClick() {
|
||||
_onClick: function() {
|
||||
// Use this container as a filtering target.
|
||||
DebuggerView.Filtering.target = this;
|
||||
}
|
||||
@ -358,7 +358,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVSF_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the StackFramesView");
|
||||
|
||||
let commandset = this._commandset = document.createElement("commandset");
|
||||
@ -378,7 +378,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVSF_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the StackFramesView");
|
||||
|
||||
this.node.removeEventListener("mousedown", this._onClick, false);
|
||||
@ -398,7 +398,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @param number aDepth
|
||||
* The frame depth specified by the debugger.
|
||||
*/
|
||||
addFrame: function DVSF_addFrame(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
addFrame: function(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
// Create the element node and menu entry for the stack frame item.
|
||||
let frameView = this._createFrameView.apply(this, arguments);
|
||||
let menuEntry = this._createMenuEntry.apply(this, arguments);
|
||||
@ -428,7 +428,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @param number aDepth
|
||||
* The frame depth specified by the debugger controller.
|
||||
*/
|
||||
highlightFrame: function DVSF_highlightFrame(aDepth) {
|
||||
highlightFrame: function(aDepth) {
|
||||
let selectedItem = this.selectedItem = this._framesCache.get(aDepth);
|
||||
|
||||
for (let item in this) {
|
||||
@ -459,8 +459,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @return nsIDOMNode
|
||||
* The stack frame view.
|
||||
*/
|
||||
_createFrameView:
|
||||
function DVSF__createFrameView(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
_createFrameView: function(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
let frameDetails =
|
||||
SourceUtils.trimUrlLength(
|
||||
SourceUtils.getSourceLabel(aSourceLocation),
|
||||
@ -499,8 +498,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @return object
|
||||
* An object containing the stack frame command and menu item.
|
||||
*/
|
||||
_createMenuEntry:
|
||||
function DVSF__createMenuEntry(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
_createMenuEntry: function(aFrameTitle, aSourceLocation, aLineNumber, aDepth) {
|
||||
let frameDescription =
|
||||
SourceUtils.trimUrlLength(
|
||||
SourceUtils.getSourceLabel(aSourceLocation),
|
||||
@ -549,7 +547,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @param object aMenuEntry
|
||||
* An object containing the stack frame command and menu item.
|
||||
*/
|
||||
_destroyMenuEntry: function DVSF__destroyMenuEntry(aMenuEntry) {
|
||||
_destroyMenuEntry: function(aMenuEntry) {
|
||||
dumpn("Destroying context menu: " +
|
||||
aMenuEntry.command.id + " & " + aMenuEntry.menuitem.id);
|
||||
|
||||
@ -565,7 +563,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
*/
|
||||
_onStackframeRemoved: function DVSF__onStackframeRemoved(aItem) {
|
||||
_onStackframeRemoved: function(aItem) {
|
||||
dumpn("Finalizing stackframe item: " + aItem);
|
||||
|
||||
let { popup, depth } = aItem.attachment;
|
||||
@ -576,7 +574,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The click listener for the stackframes container.
|
||||
*/
|
||||
_onClick: function DVSF__onClick(e) {
|
||||
_onClick: function(e) {
|
||||
if (e && e.button != 0) {
|
||||
// Only allow left-click to trigger this event.
|
||||
return;
|
||||
@ -591,7 +589,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The scroll listener for the stackframes container.
|
||||
*/
|
||||
_onScroll: function DVSF__onScroll() {
|
||||
_onScroll: function() {
|
||||
// Update the stackframes container only if we have to.
|
||||
if (!this.dirty) {
|
||||
return;
|
||||
@ -603,7 +601,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Requests the addition of more frames from the controller.
|
||||
*/
|
||||
_afterScroll: function DVSF__afterScroll() {
|
||||
_afterScroll: function() {
|
||||
let list = this.node._list;
|
||||
let scrollPosition = list.scrollPosition;
|
||||
let scrollWidth = list.scrollWidth;
|
||||
@ -625,7 +623,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
* @param number aDepth
|
||||
* The depth of the frame in the stack.
|
||||
*/
|
||||
_selectFrame: function DVSF__selectFrame(aDepth) {
|
||||
_selectFrame: function(aDepth) {
|
||||
DebuggerController.StackFrames.selectFrame(aDepth);
|
||||
},
|
||||
|
||||
@ -646,7 +644,7 @@ let StackFrameUtils = {
|
||||
* @param object aFrame
|
||||
* The stack frame to label.
|
||||
*/
|
||||
getFrameTitle: function SFU_getFrameTitle(aFrame) {
|
||||
getFrameTitle: function(aFrame) {
|
||||
if (aFrame.type == "call") {
|
||||
let c = aFrame.callee;
|
||||
return (c.name || c.userDisplayName || c.displayName || "(anonymous)");
|
||||
@ -662,7 +660,7 @@ let StackFrameUtils = {
|
||||
* @return string
|
||||
* The scope's label.
|
||||
*/
|
||||
getScopeLabel: function SFU_getScopeLabel(aEnv) {
|
||||
getScopeLabel: function(aEnv) {
|
||||
let name = "";
|
||||
|
||||
// Name the outermost scope Global.
|
||||
@ -707,7 +705,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVF_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the FilterView");
|
||||
|
||||
this._searchbox = document.getElementById("searchbox");
|
||||
@ -764,7 +762,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVF_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the FilterView");
|
||||
|
||||
this._searchbox.removeEventListener("click", this._onClick, false);
|
||||
@ -880,7 +878,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Clears the text from the searchbox and resets any changed view.
|
||||
*/
|
||||
clearSearch: function DVF_clearSearch() {
|
||||
clearSearch: function() {
|
||||
this._searchbox.value = "";
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
},
|
||||
@ -891,7 +889,7 @@ FilterView.prototype = {
|
||||
* @param string aFile
|
||||
* The source location to search for.
|
||||
*/
|
||||
_performFileSearch: function DVF__performFileSearch(aFile) {
|
||||
_performFileSearch: function(aFile) {
|
||||
// Don't search for files if the input hasn't changed.
|
||||
if (this._prevSearchedFile == aFile) {
|
||||
return;
|
||||
@ -958,7 +956,7 @@ FilterView.prototype = {
|
||||
* @param number aLine
|
||||
* The source line number to jump to.
|
||||
*/
|
||||
_performLineSearch: function DVF__performLineSearch(aLine) {
|
||||
_performLineSearch: function(aLine) {
|
||||
// Don't search for lines if the input hasn't changed.
|
||||
if (this._prevSearchedLine != aLine && aLine) {
|
||||
DebuggerView.editor.setCaretPosition(aLine - 1);
|
||||
@ -979,7 +977,7 @@ FilterView.prototype = {
|
||||
* @param string aToken
|
||||
* The source token to find.
|
||||
*/
|
||||
_performTokenSearch: function DVF__performTokenSearch(aToken) {
|
||||
_performTokenSearch: function(aToken) {
|
||||
// Don't search for tokens if the input hasn't changed.
|
||||
if (this._prevSearchedToken != aToken && aToken) {
|
||||
let editor = DebuggerView.editor;
|
||||
@ -1000,14 +998,14 @@ FilterView.prototype = {
|
||||
/**
|
||||
* The click listener for the search container.
|
||||
*/
|
||||
_onClick: function DVF__onClick() {
|
||||
_onClick: function() {
|
||||
this._searchboxHelpPanel.openPopup(this._searchbox);
|
||||
},
|
||||
|
||||
/**
|
||||
* The search listener for the search container.
|
||||
*/
|
||||
_onSearch: function DVF__onScriptsSearch() {
|
||||
_onSearch: function() {
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
let [operator, file, line, token] = this.searchboxInfo;
|
||||
|
||||
@ -1046,7 +1044,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* The key press listener for the search container.
|
||||
*/
|
||||
_onKeyPress: function DVF__onScriptsKeyPress(e) {
|
||||
_onKeyPress: function(e) {
|
||||
// This attribute is not implemented in Gecko at this time, see bug 680830.
|
||||
e.char = String.fromCharCode(e.charCode);
|
||||
|
||||
@ -1175,7 +1173,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* The blur listener for the search container.
|
||||
*/
|
||||
_onBlur: function DVF__onBlur() {
|
||||
_onBlur: function() {
|
||||
DebuggerView.GlobalSearch.clearView();
|
||||
DebuggerView.FilteredSources.clearView();
|
||||
DebuggerView.FilteredFunctions.clearView();
|
||||
@ -1189,7 +1187,7 @@ FilterView.prototype = {
|
||||
* @param string aOperator
|
||||
* The operator to use for filtering.
|
||||
*/
|
||||
_doSearch: function DVF__doSearch(aOperator = "") {
|
||||
_doSearch: function(aOperator = "") {
|
||||
this._searchbox.focus();
|
||||
this._searchbox.value = ""; // Need to clear value beforehand. Bug 779738.
|
||||
this._searchbox.value = aOperator;
|
||||
@ -1198,7 +1196,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the source location filter key sequence was pressed.
|
||||
*/
|
||||
_doFileSearch: function DVF__doFileSearch() {
|
||||
_doFileSearch: function() {
|
||||
this._doSearch();
|
||||
this._searchboxHelpPanel.openPopup(this._searchbox);
|
||||
},
|
||||
@ -1206,7 +1204,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the global search filter key sequence was pressed.
|
||||
*/
|
||||
_doGlobalSearch: function DVF__doGlobalSearch() {
|
||||
_doGlobalSearch: function() {
|
||||
this._doSearch(SEARCH_GLOBAL_FLAG);
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
},
|
||||
@ -1214,7 +1212,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the source function filter key sequence was pressed.
|
||||
*/
|
||||
_doFunctionSearch: function DVF__doFunctionSearch() {
|
||||
_doFunctionSearch: function() {
|
||||
this._doSearch(SEARCH_FUNCTION_FLAG);
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
},
|
||||
@ -1222,7 +1220,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the source token filter key sequence was pressed.
|
||||
*/
|
||||
_doTokenSearch: function DVF__doTokenSearch() {
|
||||
_doTokenSearch: function() {
|
||||
this._doSearch(SEARCH_TOKEN_FLAG);
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
},
|
||||
@ -1230,7 +1228,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the source line filter key sequence was pressed.
|
||||
*/
|
||||
_doLineSearch: function DVF__doLineSearch() {
|
||||
_doLineSearch: function() {
|
||||
this._doSearch(SEARCH_LINE_FLAG);
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
},
|
||||
@ -1238,7 +1236,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the variable search filter key sequence was pressed.
|
||||
*/
|
||||
_doVariableSearch: function DVF__doVariableSearch() {
|
||||
_doVariableSearch: function() {
|
||||
DebuggerView.Variables.performSearch("");
|
||||
this._doSearch(SEARCH_VARIABLE_FLAG);
|
||||
this._searchboxHelpPanel.hidePopup();
|
||||
@ -1247,7 +1245,7 @@ FilterView.prototype = {
|
||||
/**
|
||||
* Called when the variables focus key sequence was pressed.
|
||||
*/
|
||||
_doVariablesFocus: function DVG__doVariablesFocus() {
|
||||
_doVariablesFocus: function() {
|
||||
DebuggerView.showInstrumentsPane();
|
||||
DebuggerView.Variables.focusFirstVisibleNode();
|
||||
},
|
||||
@ -1291,7 +1289,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVFS_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the FilteredSourcesView");
|
||||
|
||||
this.anchor = document.getElementById("searchbox");
|
||||
@ -1300,7 +1298,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVFS_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the FilteredSourcesView");
|
||||
|
||||
this.anchor = null;
|
||||
@ -1309,7 +1307,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
/**
|
||||
* Updates the list of sources displayed in this container.
|
||||
*/
|
||||
syncFileSearch: function DVFS_syncFileSearch() {
|
||||
syncFileSearch: function() {
|
||||
this.empty();
|
||||
|
||||
// If there's no currently searched file, or there are no matches found,
|
||||
@ -1347,7 +1345,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
/**
|
||||
* The click listener for this container.
|
||||
*/
|
||||
onClick: function DVFS_onClick(e) {
|
||||
onClick: function(e) {
|
||||
let locationItem = this.getItemForElement(e.target);
|
||||
if (locationItem) {
|
||||
this.select(locationItem);
|
||||
@ -1361,7 +1359,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
* @param MenuItem aItem
|
||||
* The item associated with the element to select.
|
||||
*/
|
||||
onSelect: function DVFS_onSelect(e) {
|
||||
onSelect: function(e) {
|
||||
let locationItem = this.getItemForElement(e.target);
|
||||
if (locationItem) {
|
||||
DebuggerView.Sources.selectedValue = locationItem.attachment.fullValue;
|
||||
@ -1385,7 +1383,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVFF_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the FilteredFunctionsView");
|
||||
|
||||
this.anchor = document.getElementById("searchbox");
|
||||
@ -1394,7 +1392,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVFF_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the FilteredFunctionsView");
|
||||
|
||||
this.anchor = null;
|
||||
@ -1411,7 +1409,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
* @param string aQuery
|
||||
* The function to search for.
|
||||
*/
|
||||
scheduleSearch: function DVFF_scheduleSearch(aQuery) {
|
||||
scheduleSearch: function(aQuery) {
|
||||
if (!this.delayedSearch) {
|
||||
this.performSearch(aQuery);
|
||||
return;
|
||||
@ -1429,7 +1427,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
* @param string aQuery
|
||||
* The function to search for.
|
||||
*/
|
||||
performSearch: function DVFF_performSearch(aQuery) {
|
||||
performSearch: function(aQuery) {
|
||||
window.clearTimeout(this._searchTimeout);
|
||||
this._searchFunction = null;
|
||||
this._startSearch(aQuery);
|
||||
@ -1441,7 +1439,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
* @param string aQuery
|
||||
* The function to search for.
|
||||
*/
|
||||
_startSearch: function DVFF__startSearch(aQuery) {
|
||||
_startSearch: function(aQuery) {
|
||||
this._searchedToken = aQuery;
|
||||
|
||||
DebuggerController.SourceScripts.fetchSources(DebuggerView.Sources.values, {
|
||||
@ -1453,7 +1451,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
* Finds function matches in all the sources stored in the cache, and groups
|
||||
* them by location and line number.
|
||||
*/
|
||||
_performFunctionSearch: function DVFF__performFunctionSearch() {
|
||||
_performFunctionSearch: function() {
|
||||
// Get the currently searched token from the filtering input.
|
||||
// Continue parsing even if the searched token is an empty string, to
|
||||
// cache the syntax tree nodes generated by the reflection API.
|
||||
@ -1509,7 +1507,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
* @param array aSearchResults
|
||||
* The results array, containing search details for each source.
|
||||
*/
|
||||
_syncFunctionSearch: function DVFF__syncFunctionSearch(aSearchResults) {
|
||||
_syncFunctionSearch: function(aSearchResults) {
|
||||
this.empty();
|
||||
|
||||
// Show the popup even if the search token is an empty string. If there are
|
||||
@ -1565,7 +1563,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
/**
|
||||
* The click listener for this container.
|
||||
*/
|
||||
onClick: function DVFF_onClick(e) {
|
||||
onClick: function(e) {
|
||||
let functionItem = this.getItemForElement(e.target);
|
||||
if (functionItem) {
|
||||
this.select(functionItem);
|
||||
@ -1576,7 +1574,7 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
/**
|
||||
* The select listener for this container.
|
||||
*/
|
||||
onSelect: function DVFF_onSelect(e) {
|
||||
onSelect: function(e) {
|
||||
let functionItem = this.getItemForElement(e.target);
|
||||
if (functionItem) {
|
||||
let sourceUrl = functionItem.attachment.sourceUrl;
|
||||
|
@ -38,7 +38,7 @@ let DebuggerView = {
|
||||
* @param function aCallback
|
||||
* Called after the view finishes initializing.
|
||||
*/
|
||||
initialize: function DV_initialize(aCallback) {
|
||||
initialize: function(aCallback) {
|
||||
dumpn("Initializing the DebuggerView");
|
||||
|
||||
this._initializeWindow();
|
||||
@ -72,7 +72,7 @@ let DebuggerView = {
|
||||
* @param function aCallback
|
||||
* Called after the view finishes destroying.
|
||||
*/
|
||||
destroy: function DV_destroy(aCallback) {
|
||||
destroy: function(aCallback) {
|
||||
dumpn("Destroying the DebuggerView");
|
||||
|
||||
this.Toolbar.destroy();
|
||||
@ -95,7 +95,7 @@ let DebuggerView = {
|
||||
/**
|
||||
* Initializes the UI for the window.
|
||||
*/
|
||||
_initializeWindow: function DV__initializeWindow() {
|
||||
_initializeWindow: function() {
|
||||
dumpn("Initializing the DebuggerView window");
|
||||
|
||||
let isRemote = window._isRemoteDebugger;
|
||||
@ -116,7 +116,7 @@ let DebuggerView = {
|
||||
/**
|
||||
* Destroys the UI for the window.
|
||||
*/
|
||||
_destroyWindow: function DV__destroyWindow() {
|
||||
_destroyWindow: function() {
|
||||
dumpn("Destroying the DebuggerView window");
|
||||
|
||||
if (window._isRemoteDebugger || window._isChromeDebugger) {
|
||||
@ -130,7 +130,7 @@ let DebuggerView = {
|
||||
/**
|
||||
* Initializes the UI for all the displayed panes.
|
||||
*/
|
||||
_initializePanes: function DV__initializePanes() {
|
||||
_initializePanes: function() {
|
||||
dumpn("Initializing the DebuggerView panes");
|
||||
|
||||
this._sourcesPane = document.getElementById("sources-pane");
|
||||
@ -148,7 +148,7 @@ let DebuggerView = {
|
||||
/**
|
||||
* Destroys the UI for all the displayed panes.
|
||||
*/
|
||||
_destroyPanes: function DV__destroyPanes() {
|
||||
_destroyPanes: function() {
|
||||
dumpn("Destroying the DebuggerView panes");
|
||||
|
||||
Prefs.sourcesWidth = this._sourcesPane.getAttribute("width");
|
||||
@ -165,7 +165,7 @@ let DebuggerView = {
|
||||
* @param function aCallback
|
||||
* Called after the editor finishes initializing.
|
||||
*/
|
||||
_initializeEditor: function DV__initializeEditor(aCallback) {
|
||||
_initializeEditor: function(aCallback) {
|
||||
dumpn("Initializing the DebuggerView editor");
|
||||
|
||||
let placeholder = document.getElementById("editor");
|
||||
@ -178,18 +178,18 @@ let DebuggerView = {
|
||||
};
|
||||
|
||||
this.editor = new SourceEditor();
|
||||
this.editor.init(placeholder, config, function() {
|
||||
this.editor.init(placeholder, config, () => {
|
||||
this._loadingText = L10N.getStr("loadingText");
|
||||
this._onEditorLoad();
|
||||
aCallback();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* The load event handler for the source editor, also executing any necessary
|
||||
* post-load operations.
|
||||
*/
|
||||
_onEditorLoad: function DV__onEditorLoad() {
|
||||
_onEditorLoad: function() {
|
||||
dumpn("Finished loading the DebuggerView editor");
|
||||
|
||||
DebuggerController.Breakpoints.initialize();
|
||||
@ -201,7 +201,7 @@ let DebuggerView = {
|
||||
* Destroys the SourceEditor instance and also executes any necessary
|
||||
* post-unload operations.
|
||||
*/
|
||||
_destroyEditor: function DV__destroyEditor() {
|
||||
_destroyEditor: function() {
|
||||
dumpn("Destroying the DebuggerView editor");
|
||||
|
||||
DebuggerController.Breakpoints.destroy();
|
||||
@ -219,7 +219,7 @@ let DebuggerView = {
|
||||
* @param string aTextContent [optional]
|
||||
* The source text content.
|
||||
*/
|
||||
setEditorMode: function DV_setEditorMode(aUrl, aContentType = "", aTextContent = "") {
|
||||
setEditorMode: function(aUrl, aContentType = "", aTextContent = "") {
|
||||
if (aContentType) {
|
||||
if (/javascript/.test(aContentType)) {
|
||||
this.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
|
||||
@ -328,7 +328,7 @@ let DebuggerView = {
|
||||
* - noCaret: don't set the caret location at the specified line
|
||||
* - noDebug: don't set the debug location at the specified line
|
||||
*/
|
||||
updateEditor: function DV_updateEditor(aUrl, aLine, aFlags = {}) {
|
||||
updateEditor: function(aUrl, aLine, aFlags = {}) {
|
||||
if (!this._isInitialized || this._isDestroyed) {
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ let DebuggerView = {
|
||||
* @return string
|
||||
* The specified line's text.
|
||||
*/
|
||||
getEditorLine: function DV_getEditorLine(aLine) {
|
||||
getEditorLine: function(aLine) {
|
||||
let line = aLine || this.editor.getCaretPosition().line;
|
||||
let start = this.editor.getLineStart(line);
|
||||
let end = this.editor.getLineEnd(line);
|
||||
@ -405,7 +405,7 @@ let DebuggerView = {
|
||||
* @return string
|
||||
* The selected text.
|
||||
*/
|
||||
getEditorSelection: function DV_getEditorSelection() {
|
||||
getEditorSelection: function() {
|
||||
let selection = this.editor.getSelection();
|
||||
return this.editor.getText(selection.start, selection.end);
|
||||
},
|
||||
@ -427,7 +427,7 @@ let DebuggerView = {
|
||||
* - delayed: true to wait a few cycles before toggle
|
||||
* - callback: a function to invoke when the toggle finishes
|
||||
*/
|
||||
toggleInstrumentsPane: function DV__toggleInstrumentsPane(aFlags) {
|
||||
toggleInstrumentsPane: function(aFlags) {
|
||||
let pane = this._instrumentsPane;
|
||||
let button = this._instrumentsPaneToggleButton;
|
||||
|
||||
@ -448,7 +448,7 @@ let DebuggerView = {
|
||||
* @param function aCallback
|
||||
* A function to invoke when the toggle finishes.
|
||||
*/
|
||||
showInstrumentsPane: function DV__showInstrumentsPane(aCallback) {
|
||||
showInstrumentsPane: function(aCallback) {
|
||||
DebuggerView.toggleInstrumentsPane({
|
||||
visible: true,
|
||||
animated: true,
|
||||
@ -460,7 +460,7 @@ let DebuggerView = {
|
||||
/**
|
||||
* Handles any initialization on a tab navigation event issued by the client.
|
||||
*/
|
||||
_handleTabNavigation: function DV__handleTabNavigation() {
|
||||
_handleTabNavigation: function() {
|
||||
dumpn("Handling tab navigation in the DebuggerView");
|
||||
|
||||
this.Filtering.clearSearch();
|
||||
@ -565,8 +565,7 @@ ListWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
insertItemAt:
|
||||
function DVSL_insertItemAt(aIndex, aLabel, aValue, aDescription, aAttachment) {
|
||||
insertItemAt: function(aIndex, aLabel, aValue, aDescription, aAttachment) {
|
||||
let list = this._list;
|
||||
let childNodes = list.childNodes;
|
||||
|
||||
@ -586,7 +585,7 @@ ListWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
getItemAtIndex: function DVSL_getItemAtIndex(aIndex) {
|
||||
getItemAtIndex: function(aIndex) {
|
||||
return this._list.childNodes[aIndex];
|
||||
},
|
||||
|
||||
@ -596,7 +595,7 @@ ListWidget.prototype = {
|
||||
* @param nsIDOMNode aChild
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
removeChild: function DVSL__removeChild(aChild) {
|
||||
removeChild: function(aChild) {
|
||||
this._list.removeChild(aChild);
|
||||
|
||||
if (this._selectedItem == aChild) {
|
||||
@ -610,7 +609,7 @@ ListWidget.prototype = {
|
||||
/**
|
||||
* Immediately removes all of the child nodes from this container.
|
||||
*/
|
||||
removeAllItems: function DVSL_removeAllItems() {
|
||||
removeAllItems: function() {
|
||||
let parent = this._parent;
|
||||
let list = this._list;
|
||||
let firstChild;
|
||||
@ -678,7 +677,7 @@ ListWidget.prototype = {
|
||||
/**
|
||||
* Creates and appends a label displayed permanently in this container's header.
|
||||
*/
|
||||
_appendPermaNotice: function DVSL__appendPermaNotice() {
|
||||
_appendPermaNotice: function() {
|
||||
if (this._permaTextNode || !this._permaTextValue) {
|
||||
return;
|
||||
}
|
||||
@ -694,7 +693,7 @@ ListWidget.prototype = {
|
||||
/**
|
||||
* Creates and appends a label signaling that this container is empty.
|
||||
*/
|
||||
_appendEmptyNotice: function DVSL__appendEmptyNotice() {
|
||||
_appendEmptyNotice: function() {
|
||||
if (this._emptyTextNode || !this._emptyTextValue) {
|
||||
return;
|
||||
}
|
||||
@ -710,7 +709,7 @@ ListWidget.prototype = {
|
||||
/**
|
||||
* Removes the label signaling that this container is empty.
|
||||
*/
|
||||
_removeEmptyNotice: function DVSL__removeEmptyNotice() {
|
||||
_removeEmptyNotice: function() {
|
||||
if (!this._emptyTextNode) {
|
||||
return;
|
||||
}
|
||||
@ -827,7 +826,7 @@ create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Removes all items from this container and hides it.
|
||||
*/
|
||||
clearView: function RPC_clearView() {
|
||||
clearView: function() {
|
||||
this.hidden = true;
|
||||
this.empty();
|
||||
window.dispatchEvent(document, "Debugger:ResultsPanelContainer:ViewCleared");
|
||||
@ -836,7 +835,7 @@ create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Focuses the next found item in this container.
|
||||
*/
|
||||
focusNext: function RPC_focusNext() {
|
||||
focusNext: function() {
|
||||
let nextIndex = this.selectedIndex + 1;
|
||||
if (nextIndex >= this.itemCount) {
|
||||
nextIndex = 0;
|
||||
@ -847,7 +846,7 @@ create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Focuses the previously found item in this container.
|
||||
*/
|
||||
focusPrev: function RPC_focusPrev() {
|
||||
focusPrev: function() {
|
||||
let prevIndex = this.selectedIndex - 1;
|
||||
if (prevIndex < 0) {
|
||||
prevIndex = this.itemCount - 1;
|
||||
@ -861,7 +860,7 @@ create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
* @param MenuItem | number aItem
|
||||
* The item associated with the element to select.
|
||||
*/
|
||||
select: function RPC_select(aItem) {
|
||||
select: function(aItem) {
|
||||
if (typeof aItem == "number") {
|
||||
this.select(this.getItemAtIndex(aItem));
|
||||
return;
|
||||
@ -938,7 +937,7 @@ RemoteDebuggerPrompt.prototype = {
|
||||
* @param boolean aIsReconnectingFlag
|
||||
* True to show the reconnect message instead of the connect request.
|
||||
*/
|
||||
show: function RDP_show(aIsReconnectingFlag) {
|
||||
show: function(aIsReconnectingFlag) {
|
||||
let check = { value: Prefs.remoteAutoConnect };
|
||||
let input = { value: Prefs.remoteHost + ":" + Prefs.remotePort };
|
||||
let parts;
|
||||
|
@ -12,6 +12,7 @@ Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
|
||||
Cu.import("resource://gre/modules/devtools/dbg-client.jsm", tempScope);
|
||||
Cu.import("resource:///modules/source-editor.jsm", tempScope);
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
||||
let Services = tempScope.Services;
|
||||
let SourceEditor = tempScope.SourceEditor;
|
||||
let DebuggerServer = tempScope.DebuggerServer;
|
||||
|
@ -24,7 +24,7 @@ let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).req
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm", {});
|
||||
|
||||
let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
|
||||
let TargetFactory = (Cu.import("resource:///modules/devtools/gDevTools.jsm", {})).devtools.TargetFactory;
|
||||
let TargetFactory = (Cu.import("resource://gre/modules/devtools/Loader.jsm", {})).devtools.TargetFactory;
|
||||
|
||||
let Promise = (Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {})).Promise;
|
||||
let assert = { ok: ok, is: is, log: info };
|
||||
|
@ -2,7 +2,8 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let tempScope = {};
|
||||
let {devtools, gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
|
||||
|
@ -10,7 +10,8 @@ const Cu = Components.utils;
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
||||
let {devtools, gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
|
||||
let gClient;
|
||||
let gConnectionTimeout;
|
||||
|
@ -4,192 +4,15 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "gDevTools", "DevTools", "gDevToolsBrowser", "devtools" ];
|
||||
this.EXPORTED_SYMBOLS = [ "gDevTools", "DevTools", "gDevToolsBrowser" ];
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
let loader = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {}).Loader;
|
||||
|
||||
// Used when the tools should be loaded from the Firefox package itself (the default)
|
||||
|
||||
var BuiltinProvider = {
|
||||
load: function(done) {
|
||||
this.loader = new loader.Loader({
|
||||
paths: {
|
||||
"": "resource://gre/modules/commonjs/",
|
||||
"main" : "resource:///modules/devtools/main",
|
||||
"devtools": "resource:///modules/devtools",
|
||||
"devtools/toolkit": "resource://gre/modules/devtools"
|
||||
},
|
||||
globals: {},
|
||||
});
|
||||
this.main = loader.main(this.loader, "main");
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
},
|
||||
|
||||
unload: function(reason) {
|
||||
loader.unload(this.loader, reason);
|
||||
delete this.loader;
|
||||
},
|
||||
};
|
||||
|
||||
var SrcdirProvider = {
|
||||
load: function(done) {
|
||||
let srcdir = Services.prefs.getComplexValue("devtools.loader.srcdir",
|
||||
Ci.nsISupportsString);
|
||||
srcdir = OS.Path.normalize(srcdir.data.trim());
|
||||
let devtoolsDir = OS.Path.join(srcdir, "browser/devtools");
|
||||
let toolkitDir = OS.Path.join(srcdir, "toolkit/devtools");
|
||||
|
||||
this.loader = new loader.Loader({
|
||||
paths: {
|
||||
"": "resource://gre/modules/commonjs/",
|
||||
"devtools/toolkit": "file://" + toolkitDir,
|
||||
"devtools": "file://" + devtoolsDir,
|
||||
"main": "file://" + devtoolsDir + "/main.js"
|
||||
},
|
||||
globals: {}
|
||||
});
|
||||
|
||||
this.main = loader.main(this.loader, "main");
|
||||
|
||||
return this._writeManifest(devtoolsDir).then((data) => {
|
||||
this._writeManifest(toolkitDir);
|
||||
}).then(null, Cu.reportError);
|
||||
},
|
||||
|
||||
unload: function(reason) {
|
||||
loader.unload(this.loader, reason);
|
||||
delete this.loader;
|
||||
},
|
||||
|
||||
_readFile: function(filename) {
|
||||
let deferred = Promise.defer();
|
||||
let file = new FileUtils.File(filename);
|
||||
NetUtil.asyncFetch(file, (inputStream, status) => {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
deferred.reject(new Error("Couldn't load manifest: " + filename + "\n"));
|
||||
return;
|
||||
}
|
||||
var data = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
||||
deferred.resolve(data);
|
||||
});
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
_writeFile: function(filename, data) {
|
||||
let deferred = Promise.defer();
|
||||
let file = new FileUtils.File(filename);
|
||||
|
||||
var ostream = FileUtils.openSafeFileOutputStream(file)
|
||||
|
||||
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||
createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
var istream = converter.convertToInputStream(data);
|
||||
NetUtil.asyncCopy(istream, ostream, (status) => {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
deferred.reject(new Error("Couldn't write manifest: " + filename + "\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
deferred.resolve(null);
|
||||
});
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
_writeManifest: function(dir) {
|
||||
return this._readFile(dir + "/jar.mn").then((data) => {
|
||||
// The file data is contained within inputStream.
|
||||
// You can read it into a string with
|
||||
let entries = [];
|
||||
let lines = data.split(/\n/);
|
||||
let preprocessed = /^\s*\*/;
|
||||
let contentEntry = new RegExp("^\\s+content/(\\w+)/(\\S+)\\s+\\((\\S+)\\)");
|
||||
for (let line of lines) {
|
||||
if (preprocessed.test(line)) {
|
||||
dump("Unable to override preprocessed file: " + line + "\n");
|
||||
continue;
|
||||
}
|
||||
let match = contentEntry.exec(line);
|
||||
if (match) {
|
||||
let entry = "override chrome://" + match[1] + "/content/" + match[2] + "\tfile://" + dir + "/" + match[3];
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
return this._writeFile(dir + "/chrome.manifest", entries.join("\n"));
|
||||
}).then(() => {
|
||||
Components.manager.addBootstrappedManifestLocation(new FileUtils.File(dir));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.devtools = {
|
||||
_provider: null,
|
||||
|
||||
get main() this._provider.main,
|
||||
|
||||
// This is a gross gross hack. In one place (computed-view.js) we use
|
||||
// Iterator, but the addon-sdk loader takes Iterator off the global.
|
||||
// Give computed-view.js a way to get back to the Iterator until we have
|
||||
// a chance to fix that crap.
|
||||
_Iterator: Iterator,
|
||||
|
||||
setProvider: function(provider) {
|
||||
if (provider === this._provider) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._provider) {
|
||||
delete this.require;
|
||||
this._provider.unload("newprovider");
|
||||
gDevTools._teardown();
|
||||
}
|
||||
this._provider = provider;
|
||||
this._provider.load();
|
||||
this.require = loader.Require(this._provider.loader, { id: "devtools" })
|
||||
|
||||
let exports = this._provider.main;
|
||||
// Let clients find exports on this object.
|
||||
Object.getOwnPropertyNames(exports).forEach(key => {
|
||||
XPCOMUtils.defineLazyGetter(this, key, () => exports[key]);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Choose a default tools provider based on the preferences.
|
||||
*/
|
||||
_chooseProvider: function() {
|
||||
if (Services.prefs.prefHasUserValue("devtools.loader.srcdir")) {
|
||||
this.setProvider(SrcdirProvider);
|
||||
} else {
|
||||
this.setProvider(BuiltinProvider);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reload the current provider.
|
||||
*/
|
||||
reload: function() {
|
||||
var events = devtools.require("sdk/system/events");
|
||||
events.emit("startupcache-invalidate", {});
|
||||
|
||||
this._provider.unload("reload");
|
||||
delete this._provider;
|
||||
gDevTools._teardown();
|
||||
this._chooseProvider();
|
||||
},
|
||||
};
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
const FORBIDDEN_IDS = new Set(["toolbox", ""]);
|
||||
const MAX_ORDINAL = 99;
|
||||
@ -876,5 +699,5 @@ gDevTools.on("toolbox-destroyed", gDevToolsBrowser._updateMenuCheckbox);
|
||||
|
||||
Services.obs.addObserver(gDevToolsBrowser.destroy, "quit-application", false);
|
||||
|
||||
// Now load the tools.
|
||||
devtools._chooseProvider();
|
||||
// Load the browser devtools main module as the loader's main module.
|
||||
devtools.main("devtools/main");
|
||||
|
@ -6,6 +6,9 @@ let temp = {}
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", temp);
|
||||
let DevTools = temp.DevTools;
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", temp);
|
||||
let devtools = temp.devtools;
|
||||
|
||||
let Toolbox = devtools.Toolbox;
|
||||
|
||||
let toolbox, target;
|
||||
|
@ -10,7 +10,7 @@ let console = tempScope.console;
|
||||
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", tempScope);
|
||||
let Promise = tempScope.Promise;
|
||||
|
||||
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
/**
|
||||
* 'inspect' command
|
||||
|
@ -9,7 +9,7 @@ let tempScope = {};
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tempScope);
|
||||
let LayoutHelpers = tempScope.LayoutHelpers;
|
||||
|
||||
let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
|
||||
|
@ -24,7 +24,7 @@ let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).req
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm", {});
|
||||
|
||||
let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
|
||||
let TargetFactory = (Cu.import("resource:///modules/devtools/gDevTools.jsm", {})).devtools.TargetFactory;
|
||||
let TargetFactory = (Cu.import("resource://gre/modules/devtools/Loader.jsm", {})).devtools.TargetFactory;
|
||||
|
||||
let Promise = (Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {})).Promise;
|
||||
let assert = { ok: ok, is: is, log: info };
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
function test() {
|
||||
|
@ -9,7 +9,7 @@
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
let {CssLogic} = devtools.require("devtools/styleinspector/css-logic");
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
// Clear preferences that may be set during the course of tests.
|
||||
|
@ -15,7 +15,7 @@ Cu.import("resource:///modules/devtools/shared/event-emitter.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
function NetMonitorPanel(iframeWindow, toolbox) {
|
||||
this.NetMonitorPanel = function NetMonitorPanel(iframeWindow, toolbox) {
|
||||
this.panelWin = iframeWindow;
|
||||
this._toolbox = toolbox;
|
||||
|
||||
@ -33,7 +33,7 @@ NetMonitorPanel.prototype = {
|
||||
* @return object
|
||||
* A Promise that is resolved when the NetMonitor completes opening.
|
||||
*/
|
||||
open: function NetMonitorPanel_open() {
|
||||
open: function() {
|
||||
let promise;
|
||||
|
||||
// Local monitoring needs to make the target remote.
|
||||
|
@ -5,9 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
@ -247,7 +245,7 @@ TargetEventsHandler.prototype = {
|
||||
_onTabNavigated: function(aType, aPacket) {
|
||||
if (aType == "will-navigate") {
|
||||
NetMonitorView.RequestsMenu.reset();
|
||||
NetMonitorView.NetworkDetails.toggle(false);
|
||||
NetMonitorView.NetworkDetails.reset();
|
||||
window.emit("NetMonitor:TargetWillNavigate");
|
||||
}
|
||||
if (aType == "navigate") {
|
||||
@ -461,7 +459,7 @@ NetworkEventsHandler.prototype = {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_onEventTimings: function NEH__onEventTimings(aResponse) {
|
||||
_onEventTimings: function(aResponse) {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
eventTimings: aResponse
|
||||
});
|
||||
@ -479,7 +477,7 @@ NetworkEventsHandler.prototype = {
|
||||
* A promise that is resolved when the full string contents
|
||||
* are available, or rejected if something goes wrong.
|
||||
*/
|
||||
getString: function NEH_getString(aStringGrip) {
|
||||
getString: function(aStringGrip) {
|
||||
// Make sure this is a long string.
|
||||
if (typeof aStringGrip != "object" || aStringGrip.type != "longString") {
|
||||
return Promise.resolve(aStringGrip); // Go home string, you're drunk.
|
||||
|
@ -16,8 +16,9 @@ const REQUESTS_WATERFALL_HEADER_TICKS_SPACING_MIN = 60; // px
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_MULTIPLE = 5; // ms
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_SCALES = 3;
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_SPACING_MIN = 10; // px
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_MIN = 10; // byte
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_ADD = 16; // byte
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_COLOR_RGB = [128, 136, 144];
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_MIN = 32; // byte
|
||||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_ADD = 32; // byte
|
||||
const DEFAULT_HTTP_VERSION = "HTTP/1.1";
|
||||
const HEADERS_SIZE_DECIMALS = 3;
|
||||
const CONTENT_SIZE_DECIMALS = 2;
|
||||
@ -66,7 +67,7 @@ let NetMonitorView = {
|
||||
* @param function aCallback
|
||||
* Called after the view finishes initializing.
|
||||
*/
|
||||
initialize: function NV_initialize(aCallback) {
|
||||
initialize: function(aCallback) {
|
||||
dumpn("Initializing the NetMonitorView");
|
||||
|
||||
this._initializePanes();
|
||||
@ -84,7 +85,7 @@ let NetMonitorView = {
|
||||
* @param function aCallback
|
||||
* Called after the view finishes destroying.
|
||||
*/
|
||||
destroy: function NV_destroy(aCallback) {
|
||||
destroy: function(aCallback) {
|
||||
dumpn("Destroying the NetMonitorView");
|
||||
|
||||
this.Toolbar.destroy();
|
||||
@ -99,7 +100,7 @@ let NetMonitorView = {
|
||||
/**
|
||||
* Initializes the UI for all the displayed panes.
|
||||
*/
|
||||
_initializePanes: function DV__initializePanes() {
|
||||
_initializePanes: function() {
|
||||
dumpn("Initializing the NetMonitorView panes");
|
||||
|
||||
this._detailsPane = $("#details-pane");
|
||||
@ -116,7 +117,7 @@ let NetMonitorView = {
|
||||
/**
|
||||
* Destroys the UI for all the displayed panes.
|
||||
*/
|
||||
_destroyPanes: function DV__destroyPanes() {
|
||||
_destroyPanes: function() {
|
||||
dumpn("Destroying the NetMonitorView panes");
|
||||
|
||||
Prefs.networkDetailsWidth = this._detailsPane.getAttribute("width");
|
||||
@ -145,7 +146,7 @@ let NetMonitorView = {
|
||||
* @param number aTabIndex [optional]
|
||||
* The index of the intended selected tab in the details pane.
|
||||
*/
|
||||
toggleDetailsPane: function DV__toggleDetailsPane(aFlags, aTabIndex) {
|
||||
toggleDetailsPane: function(aFlags, aTabIndex) {
|
||||
let pane = this._detailsPane;
|
||||
let button = this._detailsPaneToggleButton;
|
||||
|
||||
@ -172,7 +173,7 @@ let NetMonitorView = {
|
||||
* @return object
|
||||
* A Promise that is resolved when the editor is available.
|
||||
*/
|
||||
editor: function NV_editor(aId) {
|
||||
editor: function(aId) {
|
||||
dumpn("Getting a NetMonitorView editor: " + aId);
|
||||
|
||||
if (this._editorPromises.has(aId)) {
|
||||
@ -209,7 +210,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function NVT_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the ToolbarView");
|
||||
|
||||
this._detailsPaneToggleButton = $("#details-pane-toggle");
|
||||
@ -219,7 +220,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function NVT_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the ToolbarView");
|
||||
|
||||
this._detailsPaneToggleButton.removeEventListener("mousedown", this._onTogglePanesPressed, false);
|
||||
@ -228,7 +229,7 @@ ToolbarView.prototype = {
|
||||
/**
|
||||
* Listener handling the toggle button click event.
|
||||
*/
|
||||
_onTogglePanesPressed: function NVT__onTogglePanesPressed() {
|
||||
_onTogglePanesPressed: function() {
|
||||
let requestsMenu = NetMonitorView.RequestsMenu;
|
||||
let networkDetails = NetMonitorView.NetworkDetails;
|
||||
|
||||
@ -266,7 +267,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the network monitor is started.
|
||||
*/
|
||||
initialize: function NVRM_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the RequestsMenuView");
|
||||
|
||||
this.node = new SideMenuWidget($("#requests-menu-contents"), false);
|
||||
@ -281,7 +282,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Destruction function, called when the network monitor is closed.
|
||||
*/
|
||||
destroy: function NVRM_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the SourcesView");
|
||||
|
||||
this.node.removeEventListener("mousedown", this._onMouseDown, false);
|
||||
@ -292,7 +293,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Resets this container (removes all the networking information).
|
||||
*/
|
||||
reset: function NVRM_reset() {
|
||||
reset: function() {
|
||||
this.empty();
|
||||
this._firstRequestStartedMillis = -1;
|
||||
this._lastRequestEndedMillis = -1;
|
||||
@ -316,7 +317,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param string aUrl
|
||||
* Specifies the request's url.
|
||||
*/
|
||||
addRequest: function NVRM_addRequest(aId, aStartedDateTime, aMethod, aUrl) {
|
||||
addRequest: function(aId, aStartedDateTime, aMethod, aUrl) {
|
||||
// Convert the received date/time string to a unix timestamp.
|
||||
let unixTime = Date.parse(aStartedDateTime);
|
||||
|
||||
@ -351,7 +352,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param string aType
|
||||
* Either "status", "method", "file", "domain", "type" or "size".
|
||||
*/
|
||||
sortBy: function NVRM_sortBy(aType) {
|
||||
sortBy: function(aType) {
|
||||
let target = $("#requests-menu-" + aType + "-button");
|
||||
let headers = document.querySelectorAll(".requests-menu-header-button");
|
||||
|
||||
@ -475,7 +476,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* An object containing several { key: value } tuples of network info.
|
||||
* Supported keys are "httpVersion", "status", "statusText" etc.
|
||||
*/
|
||||
updateRequest: function NVRM_updateRequest(aId, aData) {
|
||||
updateRequest: function(aId, aData) {
|
||||
// Prevent interference from zombie updates received after target closed.
|
||||
if (NetMonitorView._isDestroyed) {
|
||||
return;
|
||||
@ -493,7 +494,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Starts adding all queued additional information about network requests.
|
||||
*/
|
||||
_flushRequests: function NVRM__flushRequests() {
|
||||
_flushRequests: function() {
|
||||
// For each queued additional information packet, get the corresponding
|
||||
// request item in the view and update it based on the specified data.
|
||||
for (let [id, data] of this._updateQueue) {
|
||||
@ -592,7 +593,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @return nsIDOMNode
|
||||
* The network request view.
|
||||
*/
|
||||
_createMenuView: function NVRM__createMenuView(aMethod, aUrl) {
|
||||
_createMenuView: function(aMethod, aUrl) {
|
||||
let uri = Services.io.newURI(aUrl, null, null).QueryInterface(Ci.nsIURL);
|
||||
let name = NetworkHelper.convertToUnicode(unescape(uri.fileName)) || "/";
|
||||
let query = NetworkHelper.convertToUnicode(unescape(uri.query));
|
||||
@ -629,7 +630,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param any aValue
|
||||
* The new value to be shown.
|
||||
*/
|
||||
_updateMenuView: function NVRM__updateMenuView(aItem, aKey, aValue) {
|
||||
_updateMenuView: function(aItem, aKey, aValue) {
|
||||
switch (aKey) {
|
||||
case "status": {
|
||||
let node = $(".requests-menu-status", aItem.target);
|
||||
@ -676,7 +677,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param object aTimings
|
||||
* An object containing timing information.
|
||||
*/
|
||||
_createWaterfallView: function NVRM__createWaterfallView(aItem, aTimings) {
|
||||
_createWaterfallView: function(aItem, aTimings) {
|
||||
let { target, attachment } = aItem;
|
||||
let sections = ["dns", "connect", "send", "wait", "receive"];
|
||||
// Skipping "blocked" because it doesn't work yet.
|
||||
@ -723,7 +724,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param boolean aReset
|
||||
* True if this container's width was changed.
|
||||
*/
|
||||
_flushWaterfallViews: function NVRM__flushWaterfallViews(aReset) {
|
||||
_flushWaterfallViews: function(aReset) {
|
||||
// To avoid expensive operations like getBoundingClientRect() and
|
||||
// rebuilding the waterfall background each time a new request comes in,
|
||||
// stuff is cached. However, in certain scenarios like when the window
|
||||
@ -777,7 +778,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param number aScale
|
||||
* The current waterfall scale.
|
||||
*/
|
||||
_showWaterfallDivisionLabels: function NVRM__showWaterfallDivisionLabels(aScale) {
|
||||
_showWaterfallDivisionLabels: function(aScale) {
|
||||
let container = $("#requests-menu-waterfall-header-box");
|
||||
let availableWidth = this._waterfallWidth - REQUESTS_WATERFALL_SAFE_BOUNDS;
|
||||
|
||||
@ -824,7 +825,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param number aScale
|
||||
* The current waterfall scale.
|
||||
*/
|
||||
_drawWaterfallBackground: function NVRM__drawWaterfallBackground(aScale) {
|
||||
_drawWaterfallBackground: function(aScale) {
|
||||
if (!this._canvas || !this._ctx) {
|
||||
this._canvas = document.createElementNS(HTML_NS, "canvas");
|
||||
this._ctx = this._canvas.getContext("2d");
|
||||
@ -846,6 +847,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
|
||||
// Build new millisecond tick lines...
|
||||
let timingStep = REQUESTS_WATERFALL_BACKGROUND_TICKS_MULTIPLE;
|
||||
let [r, g, b] = REQUESTS_WATERFALL_BACKGROUND_TICKS_COLOR_RGB;
|
||||
let alphaComponent = REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_MIN;
|
||||
let optimalTickIntervalFound = false;
|
||||
|
||||
@ -862,7 +864,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
for (let i = 1; i <= REQUESTS_WATERFALL_BACKGROUND_TICKS_SCALES; i++) {
|
||||
let increment = scaledStep * Math.pow(2, i);
|
||||
for (let x = 0; x < canvasWidth; x += increment) {
|
||||
data32[x | 0] = (alphaComponent << 24) | (255 << 16) | (255 << 8) | 255;
|
||||
data32[x | 0] = (alphaComponent << 24) | (b << 16) | (g << 8) | r;
|
||||
}
|
||||
alphaComponent += REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_ADD;
|
||||
}
|
||||
@ -877,7 +879,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Reapplies the current waterfall background on all request items.
|
||||
*/
|
||||
_flushWaterfallBackgrounds: function NVRM__flushWaterfallBackgrounds() {
|
||||
_flushWaterfallBackgrounds: function() {
|
||||
for (let [, { target }] of this._cache) {
|
||||
let waterfallNode = $(".requests-menu-waterfall", target);
|
||||
waterfallNode.style.backgroundImage = this._cachedWaterfallBackground;
|
||||
@ -887,7 +889,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Hides the overflowing columns in the requests table.
|
||||
*/
|
||||
_hideOverflowingColumns: function NVRM__hideOverflowingColumns() {
|
||||
_hideOverflowingColumns: function() {
|
||||
let table = $("#network-table");
|
||||
let toolbar = $("#requests-menu-toolbar");
|
||||
let columns = [
|
||||
@ -916,7 +918,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
*/
|
||||
_onRequestItemRemoved: function NVRM__onRequestItemRemoved(aItem) {
|
||||
_onRequestItemRemoved: function(aItem) {
|
||||
dumpn("Finalizing network request item: " + aItem);
|
||||
this._cache.delete(aItem.attachment.id);
|
||||
},
|
||||
@ -924,7 +926,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The mouse down listener for this container.
|
||||
*/
|
||||
_onMouseDown: function NVRM__onMouseDown(e) {
|
||||
_onMouseDown: function(e) {
|
||||
let item = this.getItemForElement(e.target);
|
||||
if (item) {
|
||||
// The container is not empty and we clicked on an actual item.
|
||||
@ -935,7 +937,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The selection listener for this container.
|
||||
*/
|
||||
_onSelect: function NVRM__onSelect(e) {
|
||||
_onSelect: function(e) {
|
||||
NetMonitorView.NetworkDetails.populate(this.selectedItem.attachment);
|
||||
NetMonitorView.NetworkDetails.toggle(true);
|
||||
},
|
||||
@ -943,7 +945,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* The resize listener for this container's window.
|
||||
*/
|
||||
_onResize: function NVRM__onResize(e) {
|
||||
_onResize: function(e) {
|
||||
// Allow requests to settle down first.
|
||||
drain("resize-events", RESIZE_REFRESH_RATE, () => this._flushWaterfallViews(true));
|
||||
},
|
||||
@ -955,7 +957,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param number aUnixTime
|
||||
* The milliseconds to check and save.
|
||||
*/
|
||||
_registerFirstRequestStart: function NVRM__registerFirstRequestStart(aUnixTime) {
|
||||
_registerFirstRequestStart: function(aUnixTime) {
|
||||
if (this._firstRequestStartedMillis == -1) {
|
||||
this._firstRequestStartedMillis = aUnixTime;
|
||||
}
|
||||
@ -968,7 +970,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* @param number aUnixTime
|
||||
* The milliseconds to check and save.
|
||||
*/
|
||||
_registerLastRequestEnd: function NVRM__registerLastRequestEnd(aUnixTime) {
|
||||
_registerLastRequestEnd: function(aUnixTime) {
|
||||
if (this._lastRequestEndedMillis < aUnixTime) {
|
||||
this._lastRequestEndedMillis = aUnixTime;
|
||||
}
|
||||
@ -1006,13 +1008,15 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
*/
|
||||
function NetworkDetailsView() {
|
||||
dumpn("NetworkDetailsView was instantiated");
|
||||
|
||||
this._onTabSelect = this._onTabSelect.bind(this);
|
||||
};
|
||||
|
||||
create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the network monitor is started.
|
||||
*/
|
||||
initialize: function NVND_initialize() {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the RequestsMenuView");
|
||||
|
||||
this.node = $("#details-pane");
|
||||
@ -1044,12 +1048,14 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
this._responseHeaders = L10N.getStr("responseHeaders");
|
||||
this._requestCookies = L10N.getStr("requestCookies");
|
||||
this._responseCookies = L10N.getStr("responseCookies");
|
||||
|
||||
$("tabpanels", this.node).addEventListener("select", this._onTabSelect);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destruction function, called when the network monitor is closed.
|
||||
*/
|
||||
destroy: function NVND_destroy() {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the SourcesView");
|
||||
},
|
||||
|
||||
@ -1059,18 +1065,26 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param boolean aVisibleFlag
|
||||
* Specifies the intended visibility.
|
||||
*/
|
||||
toggle: function NVND_toggle(aVisibleFlag) {
|
||||
toggle: function(aVisibleFlag) {
|
||||
NetMonitorView.toggleDetailsPane({ visible: aVisibleFlag });
|
||||
NetMonitorView.RequestsMenu._flushWaterfallViews(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Hides and resets this container (removes all the networking information).
|
||||
*/
|
||||
reset: function() {
|
||||
this.toggle(false);
|
||||
this._dataSrc = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Populates this view with the specified data.
|
||||
*
|
||||
* @param object aData
|
||||
* The data source (this should be the attachment of a request item).
|
||||
*/
|
||||
populate: function NVND_populate(aData) {
|
||||
populate: function(aData) {
|
||||
$("#request-params-box").setAttribute("flex", "1");
|
||||
$("#request-params-box").hidden = false;
|
||||
$("#request-post-data-textarea-box").hidden = true;
|
||||
@ -1083,17 +1097,45 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
this._params.empty();
|
||||
this._json.empty();
|
||||
|
||||
if (aData) {
|
||||
this._setSummary(aData);
|
||||
this._setResponseHeaders(aData.responseHeaders);
|
||||
this._setRequestHeaders(aData.requestHeaders);
|
||||
this._setResponseCookies(aData.responseCookies);
|
||||
this._setRequestCookies(aData.requestCookies);
|
||||
this._setRequestGetParams(aData.url);
|
||||
this._setRequestPostParams(aData.requestHeaders, aData.requestPostData);
|
||||
this._setResponseBody(aData.url, aData.responseContent);
|
||||
this._setTimingsInformation(aData.eventTimings);
|
||||
this._dataSrc = { src: aData, populated: [] };
|
||||
this._onTabSelect();
|
||||
},
|
||||
|
||||
/**
|
||||
* Listener handling the tab selection event.
|
||||
*/
|
||||
_onTabSelect: function() {
|
||||
let { src, populated } = this._dataSrc || {};
|
||||
let tab = this.node.selectedIndex;
|
||||
|
||||
// Make sure the data source is valid and don't populate the same tab twice.
|
||||
if (!src || populated[tab]) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (tab) {
|
||||
case 0: // "Headers"
|
||||
this._setSummary(src);
|
||||
this._setResponseHeaders(src.responseHeaders);
|
||||
this._setRequestHeaders(src.requestHeaders);
|
||||
break;
|
||||
case 1: // "Cookies"
|
||||
this._setResponseCookies(src.responseCookies);
|
||||
this._setRequestCookies(src.requestCookies);
|
||||
break;
|
||||
case 2: // "Params"
|
||||
this._setRequestGetParams(src.url);
|
||||
this._setRequestPostParams(src.requestHeaders, src.requestPostData);
|
||||
break;
|
||||
case 3: // "Response"
|
||||
this._setResponseBody(src.url, src.responseContent);
|
||||
break;
|
||||
case 4: // "Timings"
|
||||
this._setTimingsInformation(src.eventTimings);
|
||||
break;
|
||||
}
|
||||
|
||||
populated[tab] = true;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1102,7 +1144,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aData
|
||||
* The data source (this should be the attachment of a request item).
|
||||
*/
|
||||
_setSummary: function NVND__setSummary(aData) {
|
||||
_setSummary: function(aData) {
|
||||
if (aData.url) {
|
||||
let unicodeUrl = NetworkHelper.convertToUnicode(unescape(aData.url));
|
||||
$("#headers-summary-url-value").setAttribute("value", unicodeUrl);
|
||||
@ -1141,7 +1183,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setRequestHeaders: function NVND__setRequestHeaders(aResponse) {
|
||||
_setRequestHeaders: function(aResponse) {
|
||||
if (aResponse && aResponse.headers.length) {
|
||||
this._addHeaders(this._requestHeaders, aResponse);
|
||||
}
|
||||
@ -1153,7 +1195,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setResponseHeaders: function NVND__setResponseHeaders(aResponse) {
|
||||
_setResponseHeaders: function(aResponse) {
|
||||
if (aResponse && aResponse.headers.length) {
|
||||
aResponse.headers.sort((a, b) => a.name > b.name);
|
||||
this._addHeaders(this._responseHeaders, aResponse);
|
||||
@ -1168,7 +1210,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_addHeaders: function NVND__addHeaders(aName, aResponse) {
|
||||
_addHeaders: function(aName, aResponse) {
|
||||
let kb = aResponse.headersSize / 1024;
|
||||
let size = L10N.numberWithDecimals(kb, HEADERS_SIZE_DECIMALS);
|
||||
let text = L10N.getFormatStr("networkMenu.sizeKB", size);
|
||||
@ -1187,7 +1229,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setRequestCookies: function NVND__setRequestCookies(aResponse) {
|
||||
_setRequestCookies: function(aResponse) {
|
||||
if (aResponse && aResponse.cookies.length) {
|
||||
aResponse.cookies.sort((a, b) => a.name > b.name);
|
||||
this._addCookies(this._requestCookies, aResponse);
|
||||
@ -1200,7 +1242,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setResponseCookies: function NVND__setResponseCookies(aResponse) {
|
||||
_setResponseCookies: function(aResponse) {
|
||||
if (aResponse && aResponse.cookies.length) {
|
||||
this._addCookies(this._responseCookies, aResponse);
|
||||
}
|
||||
@ -1214,7 +1256,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_addCookies: function NVND__addCookies(aName, aResponse) {
|
||||
_addCookies: function(aName, aResponse) {
|
||||
let cookiesScope = this._cookies.addScope(aName);
|
||||
cookiesScope.expanded = true;
|
||||
|
||||
@ -1248,7 +1290,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param string aUrl
|
||||
* The request's url.
|
||||
*/
|
||||
_setRequestGetParams: function NVND__setRequestGetParams(aUrl) {
|
||||
_setRequestGetParams: function(aUrl) {
|
||||
let uri = Services.io.newURI(aUrl, null, null).QueryInterface(Ci.nsIURL);
|
||||
let query = uri.query;
|
||||
if (query) {
|
||||
@ -1264,7 +1306,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aPostResponse
|
||||
* The "requestPostData" message received from the server.
|
||||
*/
|
||||
_setRequestPostParams: function NVND__setRequestPostParams(aHeadersResponse, aPostResponse) {
|
||||
_setRequestPostParams: function(aHeadersResponse, aPostResponse) {
|
||||
if (!aHeadersResponse || !aPostResponse) {
|
||||
return;
|
||||
}
|
||||
@ -1303,7 +1345,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param string aParams
|
||||
* A query string of params (e.g. "?foo=bar&baz=42").
|
||||
*/
|
||||
_addParams: function NVND__addParams(aName, aParams) {
|
||||
_addParams: function(aName, aParams) {
|
||||
// Turn the params string into an array containing { name: value } tuples.
|
||||
let paramsArray = aParams.replace(/^[?&]/, "").split("&").map((e) =>
|
||||
let (param = e.split("=")) {
|
||||
@ -1328,7 +1370,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setResponseBody: function NVND__setresponseBody(aUrl, aResponse) {
|
||||
_setResponseBody: function(aUrl, aResponse) {
|
||||
if (!aResponse) {
|
||||
return;
|
||||
}
|
||||
@ -1401,7 +1443,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
* @param object aResponse
|
||||
* The message received from the server.
|
||||
*/
|
||||
_setTimingsInformation: function NVND__setTimingsInformation(aResponse) {
|
||||
_setTimingsInformation: function(aResponse) {
|
||||
if (!aResponse) {
|
||||
return;
|
||||
}
|
||||
@ -1464,6 +1506,7 @@ create({ constructor: NetworkDetailsView, proto: MenuContainer.prototype }, {
|
||||
.style.transform = "translateX(" + (scale * (blocked + dns + connect + send + wait)) + "px)";
|
||||
},
|
||||
|
||||
_dataSrc: null,
|
||||
_headers: null,
|
||||
_cookies: null,
|
||||
_params: null,
|
||||
|
@ -6,7 +6,8 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
let { Promise } = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
|
||||
let { gDevTools, devtools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
let Toolbox = devtools.Toolbox;
|
||||
|
||||
|
@ -7,6 +7,8 @@ const REMOTE_ENABLED = "devtools.debugger.remote-enabled";
|
||||
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", temp);
|
||||
let gDevTools = temp.gDevTools;
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", temp);
|
||||
let TargetFactory = temp.devtools.TargetFactory;
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/dbg-server.jsm", temp);
|
||||
|
@ -33,7 +33,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "VariablesView",
|
||||
"resource:///modules/devtools/VariablesView.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
const SCRATCHPAD_CONTEXT_CONTENT = 1;
|
||||
const SCRATCHPAD_CONTEXT_BROWSER = 2;
|
||||
|
@ -31,7 +31,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "require",
|
||||
"resource://gre/modules/devtools/Require.jsm");
|
||||
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
|
||||
/**
|
||||
|
@ -18,49 +18,55 @@
|
||||
document.documentElement.style.display = display; // Restore
|
||||
}
|
||||
|
||||
function switchTheme(theme, old_theme) {
|
||||
function switchTheme(newTheme, oldTheme) {
|
||||
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
if (old_theme && theme != old_theme) {
|
||||
let old_theme_url = Services.io.newURI(DEVTOOLS_SKIN_URL + old_theme +
|
||||
"-theme.css", null, null);
|
||||
|
||||
if (oldTheme && newTheme != oldTheme) {
|
||||
let oldThemeUrl = Services.io.newURI(
|
||||
DEVTOOLS_SKIN_URL + oldTheme + "-theme.css", null, null);
|
||||
try {
|
||||
winUtils.removeSheet(old_theme_url, window.AUTHOR_SHEET);
|
||||
winUtils.removeSheet(oldThemeUrl, window.AUTHOR_SHEET);
|
||||
} catch(ex) {}
|
||||
}
|
||||
let theme_url = Services.io.newURI(DEVTOOLS_SKIN_URL + theme + "-theme.css",
|
||||
null, null);
|
||||
winUtils.loadSheet(theme_url, window.AUTHOR_SHEET);
|
||||
let scrollbar_url =
|
||||
Services.io.newURI(DEVTOOLS_SKIN_URL + "floating-scrollbars-light.css",
|
||||
null, null);
|
||||
if (theme == "dark") {
|
||||
winUtils.loadSheet(scrollbar_url, window.AGENT_SHEET);
|
||||
forceStyle();
|
||||
}
|
||||
else if (old_theme == "dark") {
|
||||
|
||||
let newThemeUrl = Services.io.newURI(
|
||||
DEVTOOLS_SKIN_URL + newTheme + "-theme.css", null, null);
|
||||
let scrollbarsUrl = Services.io.newURI(
|
||||
DEVTOOLS_SKIN_URL + "floating-scrollbars-light.css", null, null);
|
||||
|
||||
winUtils.loadSheet(newThemeUrl, window.AUTHOR_SHEET);
|
||||
|
||||
if (newTheme == "dark") {
|
||||
winUtils.loadSheet(scrollbarsUrl, window.AGENT_SHEET);
|
||||
} else if (oldTheme == "dark") {
|
||||
try {
|
||||
winUtils.removeSheet(scrollbar_url, window.AGENT_SHEET);
|
||||
winUtils.removeSheet(scrollbarsUrl, window.AGENT_SHEET);
|
||||
} catch(ex) {}
|
||||
forceStyle();
|
||||
}
|
||||
document.documentElement.classList.remove("theme-" + old_theme);
|
||||
document.documentElement.classList.add("theme-" + theme);
|
||||
|
||||
forceStyle();
|
||||
|
||||
document.documentElement.classList.remove("theme-" + oldTheme);
|
||||
document.documentElement.classList.add("theme-" + newTheme);
|
||||
}
|
||||
|
||||
function handlePrefChange(event, data) {
|
||||
if (data.pref == "devtools.theme") {
|
||||
switchTheme(data.newValue, data.oldValue);
|
||||
switchTheme(data.newValue, data.oldValue);
|
||||
}
|
||||
}
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm");
|
||||
|
||||
let theme = Services.prefs.getCharPref("devtools.theme");
|
||||
switchTheme(theme);
|
||||
|
||||
gDevTools.on("pref-changed", handlePrefChange);
|
||||
window.addEventListener("unload", function() {
|
||||
gDevTools.off("pref-changed", handlePrefChange);
|
||||
});
|
||||
})()
|
||||
})();
|
||||
|
@ -71,7 +71,7 @@ BreadcrumbsWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
insertItemAt: function BCW_insertItemAt(aIndex, aContents) {
|
||||
insertItemAt: function(aIndex, aContents) {
|
||||
let list = this._list;
|
||||
let breadcrumb = new Breadcrumb(this, aContents);
|
||||
return list.insertBefore(breadcrumb._target, list.childNodes[aIndex]);
|
||||
@ -85,7 +85,7 @@ BreadcrumbsWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
getItemAtIndex: function BCW_getItemAtIndex(aIndex) {
|
||||
getItemAtIndex: function(aIndex) {
|
||||
return this._list.childNodes[aIndex];
|
||||
},
|
||||
|
||||
@ -95,7 +95,7 @@ BreadcrumbsWidget.prototype = {
|
||||
* @param nsIDOMNode aChild
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
removeChild: function BCW_removeChild(aChild) {
|
||||
removeChild: function(aChild) {
|
||||
this._list.removeChild(aChild);
|
||||
|
||||
if (this._selectedItem == aChild) {
|
||||
@ -106,7 +106,7 @@ BreadcrumbsWidget.prototype = {
|
||||
/**
|
||||
* Removes all of the child nodes from this container.
|
||||
*/
|
||||
removeAllItems: function BCW_removeAllItems() {
|
||||
removeAllItems: function() {
|
||||
let list = this._list;
|
||||
|
||||
while (list.hasChildNodes()) {
|
||||
@ -154,7 +154,7 @@ BreadcrumbsWidget.prototype = {
|
||||
/**
|
||||
* The underflow and overflow listener for the arrowscrollbox container.
|
||||
*/
|
||||
_onUnderflow: function BCW__onUnderflow({target}) {
|
||||
_onUnderflow: function({ target }) {
|
||||
if (target != this._list) {
|
||||
return;
|
||||
}
|
||||
@ -166,7 +166,7 @@ BreadcrumbsWidget.prototype = {
|
||||
/**
|
||||
* The underflow and overflow listener for the arrowscrollbox container.
|
||||
*/
|
||||
_onOverflow: function BCW__onOverflow({target}) {
|
||||
_onOverflow: function({ target }) {
|
||||
if (target != this._list) {
|
||||
return;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ SideMenuWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
insertItemAt: function SMW_insertItemAt(aIndex, aContents, aTooltip = "", aGroup = "") {
|
||||
insertItemAt: function(aIndex, aContents, aTooltip = "", aGroup = "") {
|
||||
// Invalidate any notices set on this widget.
|
||||
this.removeAttribute("notice");
|
||||
|
||||
@ -105,8 +105,8 @@ SideMenuWidget.prototype = {
|
||||
(aIndex < 0 || aIndex >= this._orderedMenuElementsArray.length) &&
|
||||
(this._list.scrollTop + this._list.clientHeight >= this._list.scrollHeight);
|
||||
|
||||
let group = this._getGroupForName(aGroup);
|
||||
let item = this._getItemForGroup(group, aContents, aTooltip);
|
||||
let group = this._getMenuGroupForName(aGroup);
|
||||
let item = this._getMenuItemForGroup(group, aContents, aTooltip);
|
||||
let element = item.insertSelfAt(aIndex);
|
||||
|
||||
if (this.maintainSelectionVisible) {
|
||||
@ -127,7 +127,7 @@ SideMenuWidget.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
getItemAtIndex: function SMW_getItemAtIndex(aIndex) {
|
||||
getItemAtIndex: function(aIndex) {
|
||||
return this._orderedMenuElementsArray[aIndex];
|
||||
},
|
||||
|
||||
@ -137,7 +137,7 @@ SideMenuWidget.prototype = {
|
||||
* @param nsIDOMNode aChild
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
removeChild: function SMW_removeChild(aChild) {
|
||||
removeChild: function(aChild) {
|
||||
if (aChild.className == "side-menu-widget-item-contents") {
|
||||
// Remove the item itself, not the contents.
|
||||
aChild.parentNode.remove();
|
||||
@ -157,7 +157,7 @@ SideMenuWidget.prototype = {
|
||||
/**
|
||||
* Removes all of the child nodes from this container.
|
||||
*/
|
||||
removeAllItems: function SMW_removeAllItems() {
|
||||
removeAllItems: function() {
|
||||
let parent = this._parent;
|
||||
let list = this._list;
|
||||
|
||||
@ -208,7 +208,7 @@ SideMenuWidget.prototype = {
|
||||
* Ensures the selected element is visible.
|
||||
* @see SideMenuWidget.prototype.ensureElementIsVisible.
|
||||
*/
|
||||
ensureSelectionIsVisible: function SMW_ensureSelectionIsVisible(aFlags) {
|
||||
ensureSelectionIsVisible: function(aFlags) {
|
||||
this.ensureElementIsVisible(this.selectedItem, aFlags);
|
||||
},
|
||||
|
||||
@ -222,7 +222,7 @@ SideMenuWidget.prototype = {
|
||||
* - withGroup: true if the group header should also be made visible, if possible
|
||||
* - delayed: wait a few cycles before ensuring the selection is visible
|
||||
*/
|
||||
ensureElementIsVisible: function SMW_ensureElementIsVisible(aElement, aFlags = {}) {
|
||||
ensureElementIsVisible: function(aElement, aFlags = {}) {
|
||||
if (!aElement) {
|
||||
return;
|
||||
}
|
||||
@ -248,7 +248,7 @@ SideMenuWidget.prototype = {
|
||||
/**
|
||||
* Shows all the groups, even the ones with no visible children.
|
||||
*/
|
||||
showEmptyGroups: function SMW_showEmptyGroups() {
|
||||
showEmptyGroups: function() {
|
||||
for (let group of this._orderedGroupElementsArray) {
|
||||
group.hidden = false;
|
||||
}
|
||||
@ -257,7 +257,7 @@ SideMenuWidget.prototype = {
|
||||
/**
|
||||
* Hides all the groups which have no visible children.
|
||||
*/
|
||||
hideEmptyGroups: function SMW_hideEmptyGroups() {
|
||||
hideEmptyGroups: function() {
|
||||
let visibleChildNodes = ".side-menu-widget-item-contents:not([hidden=true])";
|
||||
|
||||
for (let group of this._orderedGroupElementsArray) {
|
||||
@ -276,7 +276,7 @@ SideMenuWidget.prototype = {
|
||||
* @return string
|
||||
* The current attribute value.
|
||||
*/
|
||||
getAttribute: function SMW_getAttribute(aName) {
|
||||
getAttribute: function(aName) {
|
||||
return this._parent.getAttribute(aName);
|
||||
},
|
||||
|
||||
@ -288,7 +288,7 @@ SideMenuWidget.prototype = {
|
||||
* @param string aValue
|
||||
* The desired attribute value.
|
||||
*/
|
||||
setAttribute: function SMW_setAttribute(aName, aValue) {
|
||||
setAttribute: function(aName, aValue) {
|
||||
this._parent.setAttribute(aName, aValue);
|
||||
|
||||
if (aName == "notice") {
|
||||
@ -302,7 +302,7 @@ SideMenuWidget.prototype = {
|
||||
* @param string aName
|
||||
* The name of the attribute.
|
||||
*/
|
||||
removeAttribute: function SMW_removeAttribute(aName) {
|
||||
removeAttribute: function(aName) {
|
||||
this._parent.removeAttribute(aName);
|
||||
|
||||
if (aName == "notice") {
|
||||
@ -325,7 +325,7 @@ SideMenuWidget.prototype = {
|
||||
/**
|
||||
* Creates and appends a label representing a notice in this container.
|
||||
*/
|
||||
_appendNotice: function DVSL__appendNotice() {
|
||||
_appendNotice: function() {
|
||||
if (this._noticeTextNode || !this._noticeTextValue) {
|
||||
return;
|
||||
}
|
||||
@ -347,7 +347,7 @@ SideMenuWidget.prototype = {
|
||||
/**
|
||||
* Removes the label representing a notice in this container.
|
||||
*/
|
||||
_removeNotice: function DVSL__removeNotice() {
|
||||
_removeNotice: function() {
|
||||
if (!this._noticeTextNode) {
|
||||
return;
|
||||
}
|
||||
@ -366,7 +366,7 @@ SideMenuWidget.prototype = {
|
||||
* @return SideMenuGroup
|
||||
* The newly created group.
|
||||
*/
|
||||
_getGroupForName: function SMW__getGroupForName(aName) {
|
||||
_getMenuGroupForName: function(aName) {
|
||||
let cachedGroup = this._groupsByName.get(aName);
|
||||
if (cachedGroup) {
|
||||
return cachedGroup;
|
||||
@ -380,7 +380,7 @@ SideMenuWidget.prototype = {
|
||||
|
||||
/**
|
||||
* Gets a menu item to be displayed inside a group.
|
||||
* @see SideMenuWidget.prototype._getGroupForName
|
||||
* @see SideMenuWidget.prototype._getMenuGroupForName
|
||||
*
|
||||
* @param SideMenuGroup aGroup
|
||||
* The group to contain the menu item.
|
||||
@ -389,7 +389,7 @@ SideMenuWidget.prototype = {
|
||||
* @param string aTooltip [optional]
|
||||
* A tooltip attribute for the displayed item.
|
||||
*/
|
||||
_getItemForGroup: function SMW__getItemForGroup(aGroup, aContents, aTooltip) {
|
||||
_getMenuItemForGroup: function(aGroup, aContents, aTooltip) {
|
||||
return new SideMenuItem(aGroup, aContents, aTooltip, this._showArrows);
|
||||
},
|
||||
|
||||
@ -464,7 +464,7 @@ SideMenuGroup.prototype = {
|
||||
* @param number aIndex
|
||||
* The position in the container intended for this group.
|
||||
*/
|
||||
insertSelfAt: function SMG_insertSelfAt(aIndex) {
|
||||
insertSelfAt: function(aIndex) {
|
||||
let ownerList = this.ownerView._list;
|
||||
let groupsArray = this._orderedGroupElementsArray;
|
||||
|
||||
@ -483,7 +483,7 @@ SideMenuGroup.prototype = {
|
||||
* @return number
|
||||
* The expected index.
|
||||
*/
|
||||
findExpectedIndexForSelf: function SMG_findExpectedIndexForSelf() {
|
||||
findExpectedIndexForSelf: function() {
|
||||
let identifier = this.identifier;
|
||||
let groupsArray = this._orderedGroupElementsArray;
|
||||
|
||||
@ -561,7 +561,7 @@ SideMenuItem.prototype = {
|
||||
* @return nsIDOMNode
|
||||
* The element associated with the displayed item.
|
||||
*/
|
||||
insertSelfAt: function SMI_insertSelfAt(aIndex) {
|
||||
insertSelfAt: function(aIndex) {
|
||||
let ownerList = this.ownerView._list;
|
||||
let menuArray = this._orderedMenuElementsArray;
|
||||
|
||||
|
@ -97,7 +97,7 @@ VariablesView.prototype = {
|
||||
* @return Scope
|
||||
* The newly created Scope instance.
|
||||
*/
|
||||
addScope: function VV_addScope(aName = "") {
|
||||
addScope: function(aName = "") {
|
||||
this._removeEmptyNotice();
|
||||
this._toggleSearchVisibility(true);
|
||||
|
||||
@ -116,7 +116,7 @@ VariablesView.prototype = {
|
||||
* The number of milliseconds to delay the operation if
|
||||
* lazy emptying of this container is enabled.
|
||||
*/
|
||||
empty: function VV_empty(aTimeout = this.lazyEmptyDelay) {
|
||||
empty: function(aTimeout = this.lazyEmptyDelay) {
|
||||
// If there are no items in this container, emptying is useless.
|
||||
if (!this._store.length) {
|
||||
return;
|
||||
@ -155,7 +155,7 @@ VariablesView.prototype = {
|
||||
* @see VariablesView.empty
|
||||
* @see VariablesView.commitHierarchy
|
||||
*/
|
||||
_emptySoon: function VV__emptySoon(aTimeout) {
|
||||
_emptySoon: function(aTimeout) {
|
||||
let prevList = this._list;
|
||||
let currList = this._list = this.document.createElement("scrollbox");
|
||||
|
||||
@ -372,7 +372,7 @@ VariablesView.prototype = {
|
||||
* Enables variable and property searching in this view.
|
||||
* Use the "searchEnabled" setter to enable searching.
|
||||
*/
|
||||
_enableSearch: function VV__enableSearch() {
|
||||
_enableSearch: function() {
|
||||
// If searching was already enabled, no need to re-enable it again.
|
||||
if (this._searchboxContainer) {
|
||||
return;
|
||||
@ -403,7 +403,7 @@ VariablesView.prototype = {
|
||||
* Disables variable and property searching in this view.
|
||||
* Use the "searchEnabled" setter to disable searching.
|
||||
*/
|
||||
_disableSearch: function VV__disableSearch() {
|
||||
_disableSearch: function() {
|
||||
// If searching was already disabled, no need to re-disable it again.
|
||||
if (!this._searchboxContainer) {
|
||||
return;
|
||||
@ -423,7 +423,7 @@ VariablesView.prototype = {
|
||||
* @param boolean aVisibleFlag
|
||||
* Specifies the intended visibility.
|
||||
*/
|
||||
_toggleSearchVisibility: function VV__toggleSearchVisibility(aVisibleFlag) {
|
||||
_toggleSearchVisibility: function(aVisibleFlag) {
|
||||
// If searching was already disabled, there's no need to hide it.
|
||||
if (!this._searchboxContainer) {
|
||||
return;
|
||||
@ -434,14 +434,14 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Listener handling the searchbox input event.
|
||||
*/
|
||||
_onSearchboxInput: function VV__onSearchboxInput() {
|
||||
_onSearchboxInput: function() {
|
||||
this.performSearch(this._searchboxNode.value);
|
||||
},
|
||||
|
||||
/**
|
||||
* Listener handling the searchbox key press event.
|
||||
*/
|
||||
_onSearchboxKeyPress: function VV__onSearchboxKeyPress(e) {
|
||||
_onSearchboxKeyPress: function(e) {
|
||||
switch(e.keyCode) {
|
||||
case e.DOM_VK_RETURN:
|
||||
case e.DOM_VK_ENTER:
|
||||
@ -465,7 +465,7 @@ VariablesView.prototype = {
|
||||
* @param string aQuery
|
||||
* The variable or property to search for.
|
||||
*/
|
||||
scheduleSearch: function VV_scheduleSearch(aQuery) {
|
||||
scheduleSearch: function(aQuery) {
|
||||
if (!this.delayedSearch) {
|
||||
this.performSearch(aQuery);
|
||||
return;
|
||||
@ -483,7 +483,7 @@ VariablesView.prototype = {
|
||||
* @param string aQuery
|
||||
* The variable or property to search for.
|
||||
*/
|
||||
performSearch: function VV_performSearch(aQuery) {
|
||||
performSearch: function(aQuery) {
|
||||
this.window.clearTimeout(this._searchTimeout);
|
||||
this._searchFunction = null;
|
||||
this._startSearch(aQuery);
|
||||
@ -504,7 +504,7 @@ VariablesView.prototype = {
|
||||
* @param string aQuery
|
||||
* The variable or property to search for.
|
||||
*/
|
||||
_startSearch: function VV__startSearch(aQuery) {
|
||||
_startSearch: function(aQuery) {
|
||||
for (let scope of this._store) {
|
||||
switch (aQuery) {
|
||||
case "":
|
||||
@ -524,7 +524,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Expands the first search results in this container.
|
||||
*/
|
||||
expandFirstSearchResults: function VV_expandFirstSearchResults() {
|
||||
expandFirstSearchResults: function() {
|
||||
for (let scope of this._store) {
|
||||
let match = scope._firstMatch;
|
||||
if (match) {
|
||||
@ -544,7 +544,7 @@ VariablesView.prototype = {
|
||||
* The first visible scope, variable or property, or null if nothing
|
||||
* is found.
|
||||
*/
|
||||
_findInVisibleItems: function VV__findInVisibleItems(aPredicate) {
|
||||
_findInVisibleItems: function(aPredicate) {
|
||||
for (let scope of this._store) {
|
||||
let result = scope._findInVisibleItems(aPredicate);
|
||||
if (result) {
|
||||
@ -566,7 +566,7 @@ VariablesView.prototype = {
|
||||
* The last visible scope, variable or property, or null if nothing
|
||||
* is found.
|
||||
*/
|
||||
_findInVisibleItemsReverse: function VV__findInVisibleItemsReverse(aPredicate) {
|
||||
_findInVisibleItemsReverse: function(aPredicate) {
|
||||
for (let i = this._store.length - 1; i >= 0; i--) {
|
||||
let scope = this._store[i];
|
||||
let result = scope._findInVisibleItemsReverse(aPredicate);
|
||||
@ -580,7 +580,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Focuses the first visible scope, variable, or property in this container.
|
||||
*/
|
||||
focusFirstVisibleNode: function VV_focusFirstVisibleNode() {
|
||||
focusFirstVisibleNode: function() {
|
||||
let focusableItem = this._findInVisibleItems(item => item.focusable);
|
||||
|
||||
if (focusableItem) {
|
||||
@ -593,7 +593,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Focuses the last visible scope, variable, or property in this container.
|
||||
*/
|
||||
focusLastVisibleNode: function VV_focusLastVisibleNode() {
|
||||
focusLastVisibleNode: function() {
|
||||
let focusableItem = this._findInVisibleItemsReverse(item => item.focusable);
|
||||
|
||||
if (focusableItem) {
|
||||
@ -611,7 +611,7 @@ VariablesView.prototype = {
|
||||
* @return Scope
|
||||
* The matched scope, or null if nothing is found.
|
||||
*/
|
||||
getScopeForNode: function VV_getScopeForNode(aNode) {
|
||||
getScopeForNode: function(aNode) {
|
||||
let item = this._itemsByElement.get(aNode);
|
||||
if (item && !(item instanceof Variable) && !(item instanceof Property)) {
|
||||
return item;
|
||||
@ -628,7 +628,7 @@ VariablesView.prototype = {
|
||||
* @return Scope | Variable | Property
|
||||
* The matched scope, variable or property, or null if nothing is found.
|
||||
*/
|
||||
getItemForNode: function VV_getItemForNode(aNode) {
|
||||
getItemForNode: function(aNode) {
|
||||
return this._itemsByElement.get(aNode);
|
||||
},
|
||||
|
||||
@ -638,7 +638,7 @@ VariablesView.prototype = {
|
||||
* @return Scope | Variable | Property
|
||||
* The focused scope, variable or property, or null if nothing is found.
|
||||
*/
|
||||
getFocusedItem: function VV_getFocusedItem() {
|
||||
getFocusedItem: function() {
|
||||
let focused = this.document.commandDispatcher.focusedElement;
|
||||
return this.getItemForNode(focused);
|
||||
},
|
||||
@ -647,7 +647,7 @@ VariablesView.prototype = {
|
||||
* Focuses the next scope, variable or property in this view.
|
||||
* @see VariablesView.prototype._focusChange
|
||||
*/
|
||||
focusNextItem: function VV_focusNextItem(aMaintainViewFocusedFlag) {
|
||||
focusNextItem: function(aMaintainViewFocusedFlag) {
|
||||
this._focusChange("advanceFocus", aMaintainViewFocusedFlag)
|
||||
},
|
||||
|
||||
@ -655,7 +655,7 @@ VariablesView.prototype = {
|
||||
* Focuses the previous scope, variable or property in this view.
|
||||
* @see VariablesView.prototype._focusChange
|
||||
*/
|
||||
focusPrevItem: function VV_focusPrevItem(aMaintainViewFocusedFlag) {
|
||||
focusPrevItem: function(aMaintainViewFocusedFlag) {
|
||||
this._focusChange("rewindFocus", aMaintainViewFocusedFlag)
|
||||
},
|
||||
|
||||
@ -670,7 +670,7 @@ VariablesView.prototype = {
|
||||
* True if the focus went out of bounds and the first or last element
|
||||
* in this view was focused instead.
|
||||
*/
|
||||
_focusChange: function VV__focusChange(aDirection, aMaintainViewFocusedFlag) {
|
||||
_focusChange: function(aDirection, aMaintainViewFocusedFlag) {
|
||||
let commandDispatcher = this.document.commandDispatcher;
|
||||
let item;
|
||||
|
||||
@ -711,7 +711,7 @@ VariablesView.prototype = {
|
||||
* @return boolean
|
||||
* True if the item was successfully focused.
|
||||
*/
|
||||
_focusItem: function VV__focusItem(aItem, aCollapseFlag) {
|
||||
_focusItem: function(aItem, aCollapseFlag) {
|
||||
if (!aItem.focusable) {
|
||||
return false;
|
||||
}
|
||||
@ -726,7 +726,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Listener handling a key press event on the view.
|
||||
*/
|
||||
_onViewKeyPress: function VV__onViewKeyPress(e) {
|
||||
_onViewKeyPress: function(e) {
|
||||
let item = this.getFocusedItem();
|
||||
|
||||
switch (e.keyCode) {
|
||||
@ -856,7 +856,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Creates and appends a label signaling that this container is empty.
|
||||
*/
|
||||
_appendEmptyNotice: function VV__appendEmptyNotice() {
|
||||
_appendEmptyNotice: function() {
|
||||
if (this._emptyTextNode || !this._emptyTextValue) {
|
||||
return;
|
||||
}
|
||||
@ -872,7 +872,7 @@ VariablesView.prototype = {
|
||||
/**
|
||||
* Removes the label signaling that this container is empty.
|
||||
*/
|
||||
_removeEmptyNotice: function VV__removeEmptyNotice() {
|
||||
_removeEmptyNotice: function() {
|
||||
if (!this._emptyTextNode) {
|
||||
return;
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ Scope.prototype = {
|
||||
* @return Variable
|
||||
* The newly created Variable instance, null if it already exists.
|
||||
*/
|
||||
addVar: function S_addVar(aName = "", aDescriptor = {}, aRelaxed = false) {
|
||||
addVar: function(aName = "", aDescriptor = {}, aRelaxed = false) {
|
||||
if (this._store.has(aName) && !aRelaxed) {
|
||||
return null;
|
||||
}
|
||||
@ -1147,7 +1147,7 @@ Scope.prototype = {
|
||||
* @return Variable
|
||||
* The matched variable, or null if nothing is found.
|
||||
*/
|
||||
get: function S_get(aName) {
|
||||
get: function(aName) {
|
||||
return this._store.get(aName);
|
||||
},
|
||||
|
||||
@ -1160,7 +1160,7 @@ Scope.prototype = {
|
||||
* @return Variable | Property
|
||||
* The matched variable or property, or null if nothing is found.
|
||||
*/
|
||||
find: function S_find(aNode) {
|
||||
find: function(aNode) {
|
||||
for (let [, variable] of this._store) {
|
||||
let match;
|
||||
if (variable._target == aNode) {
|
||||
@ -1184,7 +1184,7 @@ Scope.prototype = {
|
||||
* @return boolean
|
||||
* True if the specified item is a direct child, false otherwise.
|
||||
*/
|
||||
isChildOf: function S_isChildOf(aParent) {
|
||||
isChildOf: function(aParent) {
|
||||
return this.ownerView == aParent;
|
||||
},
|
||||
|
||||
@ -1197,7 +1197,7 @@ Scope.prototype = {
|
||||
* @return boolean
|
||||
* True if the specified item is a descendant, false otherwise.
|
||||
*/
|
||||
isDescendantOf: function S_isDescendantOf(aParent) {
|
||||
isDescendantOf: function(aParent) {
|
||||
if (this.isChildOf(aParent)) {
|
||||
return true;
|
||||
}
|
||||
@ -1211,7 +1211,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Shows the scope.
|
||||
*/
|
||||
show: function S_show() {
|
||||
show: function() {
|
||||
this._target.hidden = false;
|
||||
this._isContentVisible = true;
|
||||
|
||||
@ -1223,7 +1223,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Hides the scope.
|
||||
*/
|
||||
hide: function S_hide() {
|
||||
hide: function() {
|
||||
this._target.hidden = true;
|
||||
this._isContentVisible = false;
|
||||
|
||||
@ -1235,7 +1235,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Expands the scope, showing all the added details.
|
||||
*/
|
||||
expand: function S_expand() {
|
||||
expand: function() {
|
||||
if (this._isExpanded || this._locked) {
|
||||
return;
|
||||
}
|
||||
@ -1272,7 +1272,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Collapses the scope, hiding all the added details.
|
||||
*/
|
||||
collapse: function S_collapse() {
|
||||
collapse: function() {
|
||||
if (!this._isExpanded || this._locked) {
|
||||
return;
|
||||
}
|
||||
@ -1289,7 +1289,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Toggles between the scope's collapsed and expanded state.
|
||||
*/
|
||||
toggle: function S_toggle(e) {
|
||||
toggle: function(e) {
|
||||
if (e && e.button != 0) {
|
||||
// Only allow left-click to trigger this event.
|
||||
return;
|
||||
@ -1310,7 +1310,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Shows the scope's title header.
|
||||
*/
|
||||
showHeader: function S_showHeader() {
|
||||
showHeader: function() {
|
||||
if (this._isHeaderVisible || !this._nameString) {
|
||||
return;
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ Scope.prototype = {
|
||||
* Hides the scope's title header.
|
||||
* This action will automatically expand the scope.
|
||||
*/
|
||||
hideHeader: function S_hideHeader() {
|
||||
hideHeader: function() {
|
||||
if (!this._isHeaderVisible) {
|
||||
return;
|
||||
}
|
||||
@ -1334,7 +1334,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Shows the scope's expand/collapse arrow.
|
||||
*/
|
||||
showArrow: function S_showArrow() {
|
||||
showArrow: function() {
|
||||
if (this._isArrowVisible) {
|
||||
return;
|
||||
}
|
||||
@ -1345,7 +1345,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Hides the scope's expand/collapse arrow.
|
||||
*/
|
||||
hideArrow: function S_hideArrow() {
|
||||
hideArrow: function() {
|
||||
if (!this._isArrowVisible) {
|
||||
return;
|
||||
}
|
||||
@ -1441,7 +1441,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Focus this scope.
|
||||
*/
|
||||
focus: function S_focus() {
|
||||
focus: function() {
|
||||
this._variablesView._focusItem(this);
|
||||
},
|
||||
|
||||
@ -1451,7 +1451,7 @@ Scope.prototype = {
|
||||
* @param function aCallback
|
||||
* @param boolean aCapture
|
||||
*/
|
||||
addEventListener: function S_addEventListener(aName, aCallback, aCapture) {
|
||||
addEventListener: function(aName, aCallback, aCapture) {
|
||||
this._title.addEventListener(aName, aCallback, aCapture);
|
||||
},
|
||||
|
||||
@ -1461,7 +1461,7 @@ Scope.prototype = {
|
||||
* @param function aCallback
|
||||
* @param boolean aCapture
|
||||
*/
|
||||
removeEventListener: function S_removeEventListener(aName, aCallback, aCapture) {
|
||||
removeEventListener: function(aName, aCallback, aCapture) {
|
||||
this._title.removeEventListener(aName, aCallback, aCapture);
|
||||
},
|
||||
|
||||
@ -1503,7 +1503,7 @@ Scope.prototype = {
|
||||
* @param object aFlags [optional]
|
||||
* Additional options or flags for this scope.
|
||||
*/
|
||||
_init: function S__init(aName, aFlags) {
|
||||
_init: function(aName, aFlags) {
|
||||
this._idString = generateId(this._nameString = aName);
|
||||
this._displayScope(aName, "variables-view-scope", "devtools-toolbar");
|
||||
this._addEventListeners();
|
||||
@ -1520,7 +1520,7 @@ Scope.prototype = {
|
||||
* @param string aTitleClassName [optional]
|
||||
* A custom class name for this scope's title.
|
||||
*/
|
||||
_displayScope: function S__createScope(aName, aClassName, aTitleClassName) {
|
||||
_displayScope: function(aName, aClassName, aTitleClassName) {
|
||||
let document = this.document;
|
||||
|
||||
let element = this._target = document.createElement("vbox");
|
||||
@ -1554,14 +1554,14 @@ Scope.prototype = {
|
||||
/**
|
||||
* Adds the necessary event listeners for this scope.
|
||||
*/
|
||||
_addEventListeners: function S__addEventListeners() {
|
||||
_addEventListeners: function() {
|
||||
this._title.addEventListener("mousedown", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* The click listener for this scope's title.
|
||||
*/
|
||||
_onClick: function S__onClick(e) {
|
||||
_onClick: function(e) {
|
||||
if (e.target == this._inputNode ||
|
||||
e.target == this._editNode ||
|
||||
e.target == this._deleteNode) {
|
||||
@ -1584,7 +1584,7 @@ Scope.prototype = {
|
||||
* @param nsIDOMNode aChild
|
||||
* The child node to append.
|
||||
*/
|
||||
_lazyAppend: function S__lazyAppend(aImmediateFlag, aEnumerableFlag, aChild) {
|
||||
_lazyAppend: function(aImmediateFlag, aEnumerableFlag, aChild) {
|
||||
// Append immediately, don't stage items and don't allow for a paint flush.
|
||||
if (aImmediateFlag || !this._variablesView.lazyAppend) {
|
||||
if (aEnumerableFlag) {
|
||||
@ -1617,7 +1617,7 @@ Scope.prototype = {
|
||||
* Appends all the batched nodes to this scope's enumerable and non-enumerable
|
||||
* containers.
|
||||
*/
|
||||
_batchAppend: function S__batchAppend() {
|
||||
_batchAppend: function() {
|
||||
let document = this.document;
|
||||
let batchItems = this._batchItems;
|
||||
|
||||
@ -1636,7 +1636,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Starts spinning a throbber in this scope's title.
|
||||
*/
|
||||
_startThrobber: function S__startThrobber() {
|
||||
_startThrobber: function() {
|
||||
if (this._throbber) {
|
||||
this._throbber.hidden = false;
|
||||
return;
|
||||
@ -1649,7 +1649,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Stops spinning the throbber in this scope's title.
|
||||
*/
|
||||
_stopThrobber: function S__stopThrobber() {
|
||||
_stopThrobber: function() {
|
||||
if (!this._throbber) {
|
||||
return;
|
||||
}
|
||||
@ -1659,7 +1659,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Opens the enumerable items container.
|
||||
*/
|
||||
_openEnum: function S__openEnum() {
|
||||
_openEnum: function() {
|
||||
this._arrow.setAttribute("open", "");
|
||||
this._enum.setAttribute("open", "");
|
||||
this._stopThrobber();
|
||||
@ -1668,7 +1668,7 @@ Scope.prototype = {
|
||||
/**
|
||||
* Opens the non-enumerable items container.
|
||||
*/
|
||||
_openNonEnum: function S__openNonEnum() {
|
||||
_openNonEnum: function() {
|
||||
this._nonenum.setAttribute("open", "");
|
||||
this._stopThrobber();
|
||||
},
|
||||
@ -1718,7 +1718,7 @@ Scope.prototype = {
|
||||
* @param string aLowerCaseQuery
|
||||
* The lowercased name of the variable or property to search for.
|
||||
*/
|
||||
_performSearch: function S__performSearch(aLowerCaseQuery) {
|
||||
_performSearch: function(aLowerCaseQuery) {
|
||||
for (let [, variable] of this._store) {
|
||||
let currentObject = variable;
|
||||
let lowerCaseName = variable._nameString.toLowerCase();
|
||||
@ -1816,7 +1816,7 @@ Scope.prototype = {
|
||||
* The first visible scope, variable or property, or null if nothing
|
||||
* is found.
|
||||
*/
|
||||
_findInVisibleItems: function S__findInVisibleItems(aPredicate) {
|
||||
_findInVisibleItems: function(aPredicate) {
|
||||
if (aPredicate(this)) {
|
||||
return this;
|
||||
}
|
||||
@ -1857,7 +1857,7 @@ Scope.prototype = {
|
||||
* The last visible scope, variable or property, or null if nothing
|
||||
* is found.
|
||||
*/
|
||||
_findInVisibleItemsReverse: function S__findInVisibleItemsReverse(aPredicate) {
|
||||
_findInVisibleItemsReverse: function(aPredicate) {
|
||||
if (this._isExpanded) {
|
||||
if (this._variablesView._nonEnumVisible) {
|
||||
for (let i = this._nonEnumItems.length - 1; i >= 0; i--) {
|
||||
@ -2016,7 +2016,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @return Property
|
||||
* The newly created Property instance, null if it already exists.
|
||||
*/
|
||||
addProperty: function V_addProperty(aName = "", aDescriptor = {}, aRelaxed = false) {
|
||||
addProperty: function(aName = "", aDescriptor = {}, aRelaxed = false) {
|
||||
if (this._store.has(aName) && !aRelaxed) {
|
||||
return null;
|
||||
}
|
||||
@ -2050,7 +2050,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* - sorted: true to sort all the properties before adding them
|
||||
* - callback: function invoked after each property is added
|
||||
*/
|
||||
addProperties: function V_addProperties(aProperties, aOptions = {}) {
|
||||
addProperties: function(aProperties, aOptions = {}) {
|
||||
let propertyNames = Object.keys(aProperties);
|
||||
|
||||
// Sort all of the properties before adding them, if preferred.
|
||||
@ -2078,7 +2078,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* - sorted: true to sort all the properties before adding them
|
||||
* - expanded: true to expand all the properties after adding them
|
||||
*/
|
||||
populate: function V_populate(aObject, aOptions = {}) {
|
||||
populate: function(aObject, aOptions = {}) {
|
||||
// Retrieve the properties only once.
|
||||
if (this._fetched) {
|
||||
return;
|
||||
@ -2123,7 +2123,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* The raw object you want to display. If unspecified, the object is
|
||||
* assumed to be defined in a _sourceValue property on the target.
|
||||
*/
|
||||
_populateTarget: function V__populateTarget(aVar, aObject = aVar._sourceValue) {
|
||||
_populateTarget: function(aVar, aObject = aVar._sourceValue) {
|
||||
aVar.populate(aObject);
|
||||
},
|
||||
|
||||
@ -2140,7 +2140,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @return Property
|
||||
* The newly added property instance.
|
||||
*/
|
||||
_addRawValueProperty: function V__addRawValueProperty(aName, aDescriptor, aValue) {
|
||||
_addRawValueProperty: function(aName, aDescriptor, aValue) {
|
||||
let descriptor = Object.create(aDescriptor);
|
||||
descriptor.value = VariablesView.getGrip(aValue);
|
||||
|
||||
@ -2166,7 +2166,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @return Property
|
||||
* The newly added property instance.
|
||||
*/
|
||||
_addRawNonValueProperty: function V__addRawNonValueProperty(aName, aDescriptor) {
|
||||
_addRawNonValueProperty: function(aName, aDescriptor) {
|
||||
let descriptor = Object.create(aDescriptor);
|
||||
descriptor.get = VariablesView.getGrip(aDescriptor.get);
|
||||
descriptor.set = VariablesView.getGrip(aDescriptor.set);
|
||||
@ -2216,7 +2216,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* - { type: "null" }
|
||||
* - { type: "object", class: "Object" }
|
||||
*/
|
||||
setGrip: function V_setGrip(aGrip) {
|
||||
setGrip: function(aGrip) {
|
||||
// Don't allow displaying grip information if there's no name available.
|
||||
if (!this._nameString || aGrip === undefined || aGrip === null) {
|
||||
return;
|
||||
@ -2252,7 +2252,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @param object aDescriptor
|
||||
* The variable's descriptor.
|
||||
*/
|
||||
_init: function V__init(aName, aDescriptor) {
|
||||
_init: function(aName, aDescriptor) {
|
||||
this._idString = generateId(this._nameString = aName);
|
||||
this._displayScope(aName, "variables-view-variable variable-or-property");
|
||||
|
||||
@ -2275,7 +2275,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @param boolean aImmediateFlag
|
||||
* @see Scope.prototype._lazyAppend
|
||||
*/
|
||||
_onInit: function V__onInit(aImmediateFlag) {
|
||||
_onInit: function(aImmediateFlag) {
|
||||
if (this._initialDescriptor.enumerable ||
|
||||
this._nameString == "this" ||
|
||||
this._nameString == "<exception>") {
|
||||
@ -2290,7 +2290,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Creates the necessary nodes for this variable.
|
||||
*/
|
||||
_displayVariable: function V__createVariable() {
|
||||
_displayVariable: function() {
|
||||
let document = this.document;
|
||||
let descriptor = this._initialDescriptor;
|
||||
|
||||
@ -2346,7 +2346,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Adds specific nodes for this variable based on custom flags.
|
||||
*/
|
||||
_customizeVariable: function V__customizeVariable() {
|
||||
_customizeVariable: function() {
|
||||
if (this.ownerView.eval) {
|
||||
if (!this._isUndefined && (this.getter || this.setter)) {
|
||||
let editNode = this._editNode = this.document.createElement("toolbarbutton");
|
||||
@ -2371,14 +2371,14 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Prepares a tooltip for this variable.
|
||||
*/
|
||||
_prepareTooltip: function V__prepareTooltip() {
|
||||
_prepareTooltip: function() {
|
||||
this._target.addEventListener("mouseover", this._displayTooltip, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a tooltip for this variable.
|
||||
*/
|
||||
_displayTooltip: function V__displayTooltip() {
|
||||
_displayTooltip: function() {
|
||||
this._target.removeEventListener("mouseover", this._displayTooltip, false);
|
||||
|
||||
if (this.ownerView.descriptorTooltip) {
|
||||
@ -2423,7 +2423,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* Sets a variable's configurable, enumerable and writable attributes,
|
||||
* and specifies if it's a 'this', '<exception>' or '__proto__' reference.
|
||||
*/
|
||||
_setAttributes: function V__setAttributes() {
|
||||
_setAttributes: function() {
|
||||
let descriptor = this._initialDescriptor;
|
||||
let name = this._nameString;
|
||||
|
||||
@ -2456,7 +2456,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Adds the necessary event listeners for this variable.
|
||||
*/
|
||||
_addEventListeners: function V__addEventListeners() {
|
||||
_addEventListeners: function() {
|
||||
this._name.addEventListener("dblclick", this._activateNameInput, false);
|
||||
this._valueLabel.addEventListener("mousedown", this._activateValueInput, false);
|
||||
this._title.addEventListener("mousedown", this._onClick, false);
|
||||
@ -2472,7 +2472,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @param object aCallbacks
|
||||
* An object containing the onKeypress and onBlur callbacks.
|
||||
*/
|
||||
_activateInput: function V__activateInput(aLabel, aClassName, aCallbacks) {
|
||||
_activateInput: function(aLabel, aClassName, aCallbacks) {
|
||||
let initialString = aLabel.getAttribute("value");
|
||||
|
||||
// Create a texbox input element which will be shown in the current
|
||||
@ -2516,7 +2516,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
* @param object aCallbacks
|
||||
* An object containing the onKeypress and onBlur callbacks.
|
||||
*/
|
||||
_deactivateInput: function V__deactivateInput(aLabel, aInput, aCallbacks) {
|
||||
_deactivateInput: function(aLabel, aInput, aCallbacks) {
|
||||
aInput.parentNode.replaceChild(aLabel, aInput);
|
||||
this._variablesView._boxObject.scrollBy(-this._target.clientWidth, 0);
|
||||
|
||||
@ -2534,7 +2534,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Makes this variable's name editable.
|
||||
*/
|
||||
_activateNameInput: function V__activateNameInput(e) {
|
||||
_activateNameInput: function(e) {
|
||||
if (e && e.button != 0) {
|
||||
// Only allow left-click to trigger this event.
|
||||
return;
|
||||
@ -2561,7 +2561,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Deactivates this variable's editable name mode.
|
||||
*/
|
||||
_deactivateNameInput: function V__deactivateNameInput(e) {
|
||||
_deactivateNameInput: function(e) {
|
||||
this._deactivateInput(this._name, e.target, {
|
||||
onKeypress: this._onNameInputKeyPress,
|
||||
onBlur: this._deactivateNameInput
|
||||
@ -2573,7 +2573,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Makes this variable's value editable.
|
||||
*/
|
||||
_activateValueInput: function V__activateValueInput(e) {
|
||||
_activateValueInput: function(e) {
|
||||
if (e && e.button != 0) {
|
||||
// Only allow left-click to trigger this event.
|
||||
return;
|
||||
@ -2598,7 +2598,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Deactivates this variable's editable value mode.
|
||||
*/
|
||||
_deactivateValueInput: function V__deactivateValueInput(e) {
|
||||
_deactivateValueInput: function(e) {
|
||||
this._deactivateInput(this._valueLabel, e.target, {
|
||||
onKeypress: this._onValueInputKeyPress,
|
||||
onBlur: this._deactivateValueInput
|
||||
@ -2608,7 +2608,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Disables this variable prior to a new name switch or value evaluation.
|
||||
*/
|
||||
_disable: function V__disable() {
|
||||
_disable: function() {
|
||||
this.hideArrow();
|
||||
this._separatorLabel.hidden = true;
|
||||
this._valueLabel.hidden = true;
|
||||
@ -2626,7 +2626,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Deactivates this variable's editable mode and callbacks the new name.
|
||||
*/
|
||||
_saveNameInput: function V__saveNameInput(e) {
|
||||
_saveNameInput: function(e) {
|
||||
let input = e.target;
|
||||
let initialString = this._name.getAttribute("value");
|
||||
let currentString = input.value.trim();
|
||||
@ -2644,7 +2644,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* Deactivates this variable's editable mode and evaluates the new value.
|
||||
*/
|
||||
_saveValueInput: function V__saveValueInput(e) {
|
||||
_saveValueInput: function(e) {
|
||||
let input = e.target;
|
||||
let initialString = this._valueLabel.getAttribute("value");
|
||||
let currentString = input.value.trim();
|
||||
@ -2667,7 +2667,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* The key press listener for this variable's editable name textbox.
|
||||
*/
|
||||
_onNameInputKeyPress: function V__onNameInputKeyPress(e) {
|
||||
_onNameInputKeyPress: function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
switch(e.keyCode) {
|
||||
@ -2686,7 +2686,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* The key press listener for this variable's editable value textbox.
|
||||
*/
|
||||
_onValueInputKeyPress: function V__onValueInputKeyPress(e) {
|
||||
_onValueInputKeyPress: function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
switch(e.keyCode) {
|
||||
@ -2705,7 +2705,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* The click listener for the edit button.
|
||||
*/
|
||||
_onEdit: function V__onEdit(e) {
|
||||
_onEdit: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this._activateValueInput();
|
||||
@ -2714,7 +2714,7 @@ ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
/**
|
||||
* The click listener for the delete button.
|
||||
*/
|
||||
_onDelete: function V__onDelete(e) {
|
||||
_onDelete: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
@ -2769,7 +2769,7 @@ ViewHelpers.create({ constructor: Property, proto: Variable.prototype }, {
|
||||
* @param object aDescriptor
|
||||
* The property's descriptor.
|
||||
*/
|
||||
_init: function P__init(aName, aDescriptor) {
|
||||
_init: function(aName, aDescriptor) {
|
||||
this._idString = generateId(this._nameString = aName);
|
||||
this._displayScope(aName, "variables-view-property variable-or-property");
|
||||
|
||||
@ -2792,7 +2792,7 @@ ViewHelpers.create({ constructor: Property, proto: Variable.prototype }, {
|
||||
* @param boolean aImmediateFlag
|
||||
* @see Scope.prototype._lazyAppend
|
||||
*/
|
||||
_onInit: function P__onInit(aImmediateFlag) {
|
||||
_onInit: function(aImmediateFlag) {
|
||||
if (this._initialDescriptor.enumerable) {
|
||||
this.ownerView._lazyAppend(aImmediateFlag, true, this._target);
|
||||
this.ownerView._enumItems.push(this);
|
||||
@ -2809,7 +2809,7 @@ ViewHelpers.create({ constructor: Property, proto: Variable.prototype }, {
|
||||
VariablesView.prototype.__iterator__ =
|
||||
Scope.prototype.__iterator__ =
|
||||
Variable.prototype.__iterator__ =
|
||||
Property.prototype.__iterator__ = function VV_iterator() {
|
||||
Property.prototype.__iterator__ = function() {
|
||||
for (let item of this._store) {
|
||||
yield item;
|
||||
}
|
||||
@ -2819,7 +2819,7 @@ Property.prototype.__iterator__ = function VV_iterator() {
|
||||
* Forget everything recorded about added scopes, variables or properties.
|
||||
* @see VariablesView.createHierarchy
|
||||
*/
|
||||
VariablesView.prototype.clearHierarchy = function VV_clearHierarchy() {
|
||||
VariablesView.prototype.clearHierarchy = function() {
|
||||
this._prevHierarchy.clear();
|
||||
this._currHierarchy.clear();
|
||||
};
|
||||
@ -2828,7 +2828,7 @@ VariablesView.prototype.clearHierarchy = function VV_clearHierarchy() {
|
||||
* Start recording a hierarchy of any added scopes, variables or properties.
|
||||
* @see VariablesView.commitHierarchy
|
||||
*/
|
||||
VariablesView.prototype.createHierarchy = function VV_createHierarchy() {
|
||||
VariablesView.prototype.createHierarchy = function() {
|
||||
this._prevHierarchy = this._currHierarchy;
|
||||
this._currHierarchy = new Map(); // Don't clear, this is just simple swapping.
|
||||
};
|
||||
@ -2837,7 +2837,7 @@ VariablesView.prototype.createHierarchy = function VV_createHierarchy() {
|
||||
* Briefly flash the variables that changed between the previous and current
|
||||
* scope/variable/property hierarchies and reopen previously expanded nodes.
|
||||
*/
|
||||
VariablesView.prototype.commitHierarchy = function VV_commitHierarchy() {
|
||||
VariablesView.prototype.commitHierarchy = function() {
|
||||
let prevHierarchy = this._prevHierarchy;
|
||||
let currHierarchy = this._currHierarchy;
|
||||
|
||||
@ -2910,7 +2910,7 @@ VariablesView.prototype.commitHierarchyIgnoredItems = Object.create(null, {
|
||||
* @param object aDescriptor
|
||||
* The variable's descriptor.
|
||||
*/
|
||||
VariablesView.isPrimitive = function VV_isPrimitive(aDescriptor) {
|
||||
VariablesView.isPrimitive = function(aDescriptor) {
|
||||
// For accessor property descriptors, the getter and setter need to be
|
||||
// contained in 'get' and 'set' properties.
|
||||
let getter = aDescriptor.get;
|
||||
@ -2941,7 +2941,7 @@ VariablesView.isPrimitive = function VV_isPrimitive(aDescriptor) {
|
||||
* @param object aDescriptor
|
||||
* The variable's descriptor.
|
||||
*/
|
||||
VariablesView.isUndefined = function VV_isUndefined(aDescriptor) {
|
||||
VariablesView.isUndefined = function(aDescriptor) {
|
||||
// For accessor property descriptors, the getter and setter need to be
|
||||
// contained in 'get' and 'set' properties.
|
||||
let getter = aDescriptor.get;
|
||||
@ -2968,7 +2968,7 @@ VariablesView.isUndefined = function VV_isUndefined(aDescriptor) {
|
||||
* @param object aDescriptor
|
||||
* The variable's descriptor.
|
||||
*/
|
||||
VariablesView.isFalsy = function VV_isFalsy(aDescriptor) {
|
||||
VariablesView.isFalsy = function(aDescriptor) {
|
||||
// As described in the remote debugger protocol, the value grip
|
||||
// must be contained in a 'value' property.
|
||||
let grip = aDescriptor.value;
|
||||
@ -2993,7 +2993,7 @@ VariablesView.isFalsy = function VV_isFalsy(aDescriptor) {
|
||||
* @return any
|
||||
* The value's grip.
|
||||
*/
|
||||
VariablesView.getGrip = function VV_getGrip(aValue) {
|
||||
VariablesView.getGrip = function(aValue) {
|
||||
if (aValue === undefined) {
|
||||
return { type: "undefined" };
|
||||
}
|
||||
@ -3016,7 +3016,7 @@ VariablesView.getGrip = function VV_getGrip(aValue) {
|
||||
* @return string
|
||||
* The formatted property string.
|
||||
*/
|
||||
VariablesView.getString = function VV_getString(aGrip, aConciseFlag) {
|
||||
VariablesView.getString = function(aGrip, aConciseFlag) {
|
||||
if (aGrip && typeof aGrip == "object") {
|
||||
switch (aGrip.type) {
|
||||
case "undefined":
|
||||
@ -3051,7 +3051,7 @@ VariablesView.getString = function VV_getString(aGrip, aConciseFlag) {
|
||||
* @return string
|
||||
* The custom class style.
|
||||
*/
|
||||
VariablesView.getClass = function VV_getClass(aGrip) {
|
||||
VariablesView.getClass = function(aGrip) {
|
||||
if (aGrip && typeof aGrip == "object") {
|
||||
switch (aGrip.type) {
|
||||
case "undefined":
|
||||
@ -3085,7 +3085,7 @@ VariablesView.getClass = function VV_getClass(aGrip) {
|
||||
*/
|
||||
let generateId = (function() {
|
||||
let count = 0;
|
||||
return function VV_generateId(aName = "") {
|
||||
return function(aName = "") {
|
||||
return aName.toLowerCase().trim().replace(/\s+/g, "-") + (++count);
|
||||
};
|
||||
})();
|
||||
|
@ -31,7 +31,7 @@ this.ViewHelpers = {
|
||||
* @param object aProperties
|
||||
* The properties extending the prototype.
|
||||
*/
|
||||
create: function VH_create({ constructor, proto }, aProperties = {}) {
|
||||
create: function({ constructor, proto }, aProperties = {}) {
|
||||
let descriptors = {
|
||||
constructor: { value: constructor }
|
||||
};
|
||||
@ -54,7 +54,7 @@ this.ViewHelpers = {
|
||||
* True if the event was cancelled or a registered handler
|
||||
* called preventDefault.
|
||||
*/
|
||||
dispatchEvent: function VH_dispatchEvent(aTarget, aType, aDetail) {
|
||||
dispatchEvent: function(aTarget, aType, aDetail) {
|
||||
if (!aTarget) {
|
||||
return true; // Event cancelled.
|
||||
}
|
||||
@ -75,7 +75,7 @@ this.ViewHelpers = {
|
||||
* @param nsIDOMNode aNode
|
||||
* A node to delegate the methods to.
|
||||
*/
|
||||
delegateWidgetAttributeMethods: function VH_delegateWidgetAttributeMethods(aWidget, aNode) {
|
||||
delegateWidgetAttributeMethods: function(aWidget, aNode) {
|
||||
aWidget.getAttribute = aNode.getAttribute.bind(aNode);
|
||||
aWidget.setAttribute = aNode.setAttribute.bind(aNode);
|
||||
aWidget.removeAttribute = aNode.removeAttribute.bind(aNode);
|
||||
@ -90,7 +90,7 @@ this.ViewHelpers = {
|
||||
* @param nsIDOMNode aNode
|
||||
* A node to delegate the methods to.
|
||||
*/
|
||||
delegateWidgetEventMethods: function VH_delegateWidgetEventMethods(aWidget, aNode) {
|
||||
delegateWidgetEventMethods: function(aWidget, aNode) {
|
||||
aWidget.addEventListener = aNode.addEventListener.bind(aNode);
|
||||
aWidget.removeEventListener = aNode.removeEventListener.bind(aNode);
|
||||
},
|
||||
@ -107,7 +107,7 @@ this.ViewHelpers = {
|
||||
* @param nsIDOMNode aPane
|
||||
* The element representing the pane to toggle.
|
||||
*/
|
||||
togglePane: function VH_togglePane(aFlags, aPane) {
|
||||
togglePane: function(aFlags, aPane) {
|
||||
// Hiding is always handled via margins, not the hidden attribute.
|
||||
aPane.removeAttribute("hidden");
|
||||
|
||||
@ -171,7 +171,7 @@ this.ViewHelpers = {
|
||||
* @param string aStringBundleName
|
||||
* The desired string bundle's name.
|
||||
*/
|
||||
ViewHelpers.L10N = function L10N(aStringBundleName) {
|
||||
ViewHelpers.L10N = function(aStringBundleName) {
|
||||
XPCOMUtils.defineLazyGetter(this, "stringBundle", () =>
|
||||
Services.strings.createBundle(aStringBundleName));
|
||||
|
||||
@ -188,7 +188,7 @@ ViewHelpers.L10N.prototype = {
|
||||
* @param string aName
|
||||
* @return string
|
||||
*/
|
||||
getStr: function L10N_getStr(aName) {
|
||||
getStr: function(aName) {
|
||||
return this.stringBundle.GetStringFromName(aName);
|
||||
},
|
||||
|
||||
@ -199,7 +199,7 @@ ViewHelpers.L10N.prototype = {
|
||||
* @param array aArgs
|
||||
* @return string
|
||||
*/
|
||||
getFormatStr: function L10N_getFormatStr(aName, ...aArgs) {
|
||||
getFormatStr: function(aName, ...aArgs) {
|
||||
return this.stringBundle.formatStringFromName(aName, aArgs, aArgs.length);
|
||||
},
|
||||
|
||||
@ -214,7 +214,7 @@ ViewHelpers.L10N.prototype = {
|
||||
* @return string
|
||||
* The localized number as a string.
|
||||
*/
|
||||
numberWithDecimals: function L10N__numberWithDecimals(aNumber, aDecimals = 0) {
|
||||
numberWithDecimals: function(aNumber, aDecimals = 0) {
|
||||
// If this is an integer, don't do anything special.
|
||||
if (aNumber == (aNumber | 0)) {
|
||||
return aNumber;
|
||||
@ -247,7 +247,7 @@ ViewHelpers.L10N.prototype = {
|
||||
* @param object aPrefsObject
|
||||
* An object containing { accessorName: [prefType, prefName] } keys.
|
||||
*/
|
||||
ViewHelpers.Prefs = function Prefs(aPrefsRoot = "", aPrefsObject = {}) {
|
||||
ViewHelpers.Prefs = function(aPrefsRoot = "", aPrefsObject = {}) {
|
||||
this.root = aPrefsRoot;
|
||||
|
||||
for (let accessorName in aPrefsObject) {
|
||||
@ -264,7 +264,7 @@ ViewHelpers.Prefs.prototype = {
|
||||
* @param string aPrefName
|
||||
* @return any
|
||||
*/
|
||||
_get: function P__get(aType, aPrefName) {
|
||||
_get: function(aType, aPrefName) {
|
||||
if (this[aPrefName] === undefined) {
|
||||
this[aPrefName] = Services.prefs["get" + aType + "Pref"](aPrefName);
|
||||
}
|
||||
@ -278,7 +278,7 @@ ViewHelpers.Prefs.prototype = {
|
||||
* @param string aPrefName
|
||||
* @param any aValue
|
||||
*/
|
||||
_set: function P__set(aType, aPrefName, aValue) {
|
||||
_set: function(aType, aPrefName, aValue) {
|
||||
Services.prefs["set" + aType + "Pref"](aPrefName, aValue);
|
||||
this[aPrefName] = aValue;
|
||||
},
|
||||
@ -290,7 +290,7 @@ ViewHelpers.Prefs.prototype = {
|
||||
* @param string aType
|
||||
* @param string aPrefName
|
||||
*/
|
||||
map: function P_map(aAccessorName, aType, aPrefName) {
|
||||
map: function(aAccessorName, aType, aPrefName) {
|
||||
Object.defineProperty(this, aAccessorName, {
|
||||
get: () => this._get(aType, [this.root, aPrefName].join(".")),
|
||||
set: (aValue) => this._set(aType, [this.root, aPrefName].join("."), aValue)
|
||||
@ -343,11 +343,11 @@ MenuItem.prototype = {
|
||||
* Additional options or flags supported by this operation:
|
||||
* - attachment: some attached primitive/object for the item
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function called when the child node is removed
|
||||
* - finalize: function invoked when the child node is removed
|
||||
* @return MenuItem
|
||||
* The item associated with the displayed element.
|
||||
*/
|
||||
append: function MI_append(aElement, aOptions = {}) {
|
||||
append: function(aElement, aOptions = {}) {
|
||||
let item = new MenuItem(aOptions.attachment);
|
||||
|
||||
// Handle any additional options before appending the child node.
|
||||
@ -371,7 +371,7 @@ MenuItem.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item associated with the element to remove.
|
||||
*/
|
||||
remove: function MI_remove(aItem) {
|
||||
remove: function(aItem) {
|
||||
if (!aItem) {
|
||||
return;
|
||||
}
|
||||
@ -382,7 +382,7 @@ MenuItem.prototype = {
|
||||
/**
|
||||
* Visually marks this menu item as selected.
|
||||
*/
|
||||
markSelected: function MI_markSelected() {
|
||||
markSelected: function() {
|
||||
if (!this._target) {
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ MenuItem.prototype = {
|
||||
/**
|
||||
* Visually marks this menu item as deselected.
|
||||
*/
|
||||
markDeselected: function MI_markDeselected() {
|
||||
markDeselected: function() {
|
||||
if (!this._target) {
|
||||
return;
|
||||
}
|
||||
@ -407,7 +407,7 @@ MenuItem.prototype = {
|
||||
* @param nsIDOMNode aElement [optional]
|
||||
* A custom element to set the attributes to.
|
||||
*/
|
||||
setAttributes: function MI_setAttributes(aAttributes, aElement = this._target) {
|
||||
setAttributes: function(aAttributes, aElement = this._target) {
|
||||
for (let [name, value] of aAttributes) {
|
||||
aElement.setAttribute(name, value);
|
||||
}
|
||||
@ -421,7 +421,7 @@ MenuItem.prototype = {
|
||||
* @param nsIDOMNode aElement
|
||||
* The element displaying the item.
|
||||
*/
|
||||
_entangleItem: function MI__entangleItem(aItem, aElement) {
|
||||
_entangleItem: function(aItem, aElement) {
|
||||
if (!this._itemsByElement) {
|
||||
this._itemsByElement = new Map(); // This needs to be iterable.
|
||||
}
|
||||
@ -436,7 +436,7 @@ MenuItem.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
*/
|
||||
_untangleItem: function MI__untangleItem(aItem) {
|
||||
_untangleItem: function(aItem) {
|
||||
if (aItem.finalize) {
|
||||
aItem.finalize(aItem);
|
||||
}
|
||||
@ -455,7 +455,7 @@ MenuItem.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item to forget.
|
||||
*/
|
||||
_unlinkItem: function MC__unlinkItem(aItem) {
|
||||
_unlinkItem: function(aItem) {
|
||||
this._itemsByElement.delete(aItem._target);
|
||||
},
|
||||
|
||||
@ -463,7 +463,7 @@ MenuItem.prototype = {
|
||||
* Returns a string representing the object.
|
||||
* @return string
|
||||
*/
|
||||
toString: function MI_toString() {
|
||||
toString: function() {
|
||||
if (this._label && this._value) {
|
||||
return this._label + " -> " + this._value;
|
||||
}
|
||||
@ -557,12 +557,12 @@ MenuContainer.prototype = {
|
||||
* - relaxed: true if this container should allow dupes & degenerates
|
||||
* - attachment: some attached primitive/object for the item
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function called when the item is untangled (removed)
|
||||
* - finalize: function invokde when the item is untangled (removed)
|
||||
* @return MenuItem
|
||||
* The item associated with the displayed element if an unstaged push,
|
||||
* undefined if the item was staged for a later commit.
|
||||
*/
|
||||
push: function MC_push(aContents, aOptions = {}) {
|
||||
push: function(aContents, aOptions = {}) {
|
||||
let item = new MenuItem(aOptions.attachment, aContents);
|
||||
|
||||
// Batch the item to be added later.
|
||||
@ -588,7 +588,7 @@ MenuContainer.prototype = {
|
||||
* Additional options or flags supported by this operation:
|
||||
* - sorted: true to sort all the items before adding them
|
||||
*/
|
||||
commit: function MC_commit(aOptions = {}) {
|
||||
commit: function(aOptions = {}) {
|
||||
let stagedItems = this._stagedItems;
|
||||
|
||||
// Sort the items before adding them to this container, if preferred.
|
||||
@ -610,7 +610,7 @@ MenuContainer.prototype = {
|
||||
* @return boolean
|
||||
* True if a selected item was available, false otherwise.
|
||||
*/
|
||||
refresh: function MC_refresh() {
|
||||
refresh: function() {
|
||||
let selectedValue = this.selectedValue;
|
||||
if (!selectedValue) {
|
||||
return false;
|
||||
@ -628,7 +628,7 @@ MenuContainer.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item associated with the element to remove.
|
||||
*/
|
||||
remove: function MC_remove(aItem) {
|
||||
remove: function(aItem) {
|
||||
if (!aItem) {
|
||||
return;
|
||||
}
|
||||
@ -639,7 +639,7 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Removes all items from this container.
|
||||
*/
|
||||
empty: function MC_empty() {
|
||||
empty: function() {
|
||||
this._preferredValue = this.selectedValue;
|
||||
this._container.selectedItem = null;
|
||||
this._container.removeAllItems();
|
||||
@ -661,7 +661,7 @@ MenuContainer.prototype = {
|
||||
* Does not remove any item in this container. Instead, it overrides the
|
||||
* current label to signal that it is unavailable and removes the tooltip.
|
||||
*/
|
||||
setUnavailable: function MC_setUnavailable() {
|
||||
setUnavailable: function() {
|
||||
this._container.setAttribute("notice", this.unavailableText);
|
||||
this._container.setAttribute("label", this.unavailableText);
|
||||
this._container.removeAttribute("tooltiptext");
|
||||
@ -684,7 +684,7 @@ MenuContainer.prototype = {
|
||||
* @param boolean aVisibleFlag
|
||||
* Specifies the intended visibility.
|
||||
*/
|
||||
toggleContents: function MC_toggleContents(aVisibleFlag) {
|
||||
toggleContents: function(aVisibleFlag) {
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
item._target.hidden = !aVisibleFlag;
|
||||
}
|
||||
@ -698,7 +698,7 @@ MenuContainer.prototype = {
|
||||
* will become the new default sorting predicate in this container.
|
||||
* If unspecified, all items will be sorted by their label.
|
||||
*/
|
||||
sortContents: function MC_sortContents(aPredicate = this._sortPredicate) {
|
||||
sortContents: function(aPredicate = this._sortPredicate) {
|
||||
let sortedItems = this.allItems.sort(this._sortPredicate = aPredicate);
|
||||
|
||||
for (let i = 0, len = sortedItems.length; i < len; i++) {
|
||||
@ -714,7 +714,7 @@ MenuContainer.prototype = {
|
||||
* @param MenuItem aSecond
|
||||
* The second menu item to be swapped.
|
||||
*/
|
||||
swapItems: function MC_swapItems(aFirst, aSecond) {
|
||||
swapItems: function(aFirst, aSecond) {
|
||||
if (aFirst == aSecond) { // We're just dandy, thank you.
|
||||
return;
|
||||
}
|
||||
@ -773,7 +773,7 @@ MenuContainer.prototype = {
|
||||
* @param number aSecond
|
||||
* The index of the second menu item to be swapped.
|
||||
*/
|
||||
swapItemsAtIndices: function MC_swapItemsAtIndices(aFirst, aSecond) {
|
||||
swapItemsAtIndices: function(aFirst, aSecond) {
|
||||
this.swapItems(this.getItemAtIndex(aFirst), this.getItemAtIndex(aSecond));
|
||||
},
|
||||
|
||||
@ -786,7 +786,7 @@ MenuContainer.prototype = {
|
||||
* @return boolean
|
||||
* True if the label is known, false otherwise.
|
||||
*/
|
||||
containsLabel: function MC_containsLabel(aLabel) {
|
||||
containsLabel: function(aLabel) {
|
||||
return this._itemsByLabel.has(aLabel) ||
|
||||
this._stagedItems.some(function({item}) item._label == aLabel);
|
||||
},
|
||||
@ -800,7 +800,7 @@ MenuContainer.prototype = {
|
||||
* @return boolean
|
||||
* True if the value is known, false otherwise.
|
||||
*/
|
||||
containsValue: function MC_containsValue(aValue) {
|
||||
containsValue: function(aValue) {
|
||||
return this._itemsByValue.has(aValue) ||
|
||||
this._stagedItems.some(function({item}) item._value == aValue);
|
||||
},
|
||||
@ -911,7 +911,7 @@ MenuContainer.prototype = {
|
||||
* @return MenuItem
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemAtIndex: function MC_getItemAtIndex(aIndex) {
|
||||
getItemAtIndex: function(aIndex) {
|
||||
return this.getItemForElement(this._container.getItemAtIndex(aIndex));
|
||||
},
|
||||
|
||||
@ -923,7 +923,7 @@ MenuContainer.prototype = {
|
||||
* @return MenuItem
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemByLabel: function MC_getItemByLabel(aLabel) {
|
||||
getItemByLabel: function(aLabel) {
|
||||
return this._itemsByLabel.get(aLabel);
|
||||
},
|
||||
|
||||
@ -935,7 +935,7 @@ MenuContainer.prototype = {
|
||||
* @return MenuItem
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemByValue: function MC_getItemByValue(aValue) {
|
||||
getItemByValue: function(aValue) {
|
||||
return this._itemsByValue.get(aValue);
|
||||
},
|
||||
|
||||
@ -947,7 +947,7 @@ MenuContainer.prototype = {
|
||||
* @return MenuItem
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemForElement: function MC_getItemForElement(aElement) {
|
||||
getItemForElement: function(aElement) {
|
||||
while (aElement) {
|
||||
let item = this._itemsByElement.get(aElement);
|
||||
if (item) {
|
||||
@ -966,7 +966,7 @@ MenuContainer.prototype = {
|
||||
* @return number
|
||||
* The index of the matched item, or -1 if nothing is found.
|
||||
*/
|
||||
indexOfItem: function MC_indexOfItem(aItem) {
|
||||
indexOfItem: function(aItem) {
|
||||
return this._indexOfElement(aItem._target);
|
||||
},
|
||||
|
||||
@ -978,7 +978,7 @@ MenuContainer.prototype = {
|
||||
* @return number
|
||||
* The index of the matched element, or -1 if nothing is found.
|
||||
*/
|
||||
_indexOfElement: function MC__indexOfElement(aElement) {
|
||||
_indexOfElement: function(aElement) {
|
||||
let container = this._container;
|
||||
let itemCount = this._itemsByElement.size;
|
||||
|
||||
@ -1065,7 +1065,7 @@ MenuContainer.prototype = {
|
||||
* @return boolean
|
||||
* True if the element is unique, false otherwise.
|
||||
*/
|
||||
isUnique: function MC_isUnique(aItem) {
|
||||
isUnique: function(aItem) {
|
||||
switch (this.uniquenessQualifier) {
|
||||
case 1:
|
||||
return !this._itemsByLabel.has(aItem._label) &&
|
||||
@ -1089,7 +1089,7 @@ MenuContainer.prototype = {
|
||||
* @return boolean
|
||||
* True if the element is eligible, false otherwise.
|
||||
*/
|
||||
isEligible: function MC_isEligible(aItem) {
|
||||
isEligible: function(aItem) {
|
||||
return aItem._prebuiltTarget || (this.isUnique(aItem) &&
|
||||
aItem._label != "undefined" && aItem._label != "null" &&
|
||||
aItem._value != "undefined" && aItem._value != "null");
|
||||
@ -1104,7 +1104,7 @@ MenuContainer.prototype = {
|
||||
* @return number
|
||||
* The expected item index.
|
||||
*/
|
||||
_findExpectedIndex: function MC__findExpectedIndex(aItem) {
|
||||
_findExpectedIndex: function(aItem) {
|
||||
let container = this._container;
|
||||
let itemCount = this.itemCount;
|
||||
|
||||
@ -1128,11 +1128,11 @@ MenuContainer.prototype = {
|
||||
* - node: allows the insertion of prebuilt nodes instead of labels
|
||||
* - relaxed: true if this container should allow dupes & degenerates
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function called when the item is untangled (removed)
|
||||
* - finalize: function when the item is untangled (removed)
|
||||
* @return MenuItem
|
||||
* The item associated with the displayed element, null if rejected.
|
||||
*/
|
||||
_insertItemAt: function MC__insertItemAt(aIndex, aItem, aOptions = {}) {
|
||||
_insertItemAt: function(aIndex, aItem, aOptions = {}) {
|
||||
// Relaxed nodes may be appended without verifying their eligibility.
|
||||
if (!aOptions.relaxed && !this.isEligible(aItem)) {
|
||||
return null;
|
||||
@ -1165,7 +1165,7 @@ MenuContainer.prototype = {
|
||||
* @param nsIDOMNode aElement
|
||||
* The element displaying the item.
|
||||
*/
|
||||
_entangleItem: function MC__entangleItem(aItem, aElement) {
|
||||
_entangleItem: function(aItem, aElement) {
|
||||
this._itemsByLabel.set(aItem._label, aItem);
|
||||
this._itemsByValue.set(aItem._value, aItem);
|
||||
this._itemsByElement.set(aElement, aItem);
|
||||
@ -1178,7 +1178,7 @@ MenuContainer.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
*/
|
||||
_untangleItem: function MC__untangleItem(aItem) {
|
||||
_untangleItem: function(aItem) {
|
||||
if (aItem.finalize) {
|
||||
aItem.finalize(aItem);
|
||||
}
|
||||
@ -1197,7 +1197,7 @@ MenuContainer.prototype = {
|
||||
* @param MenuItem aItem
|
||||
* The item to forget.
|
||||
*/
|
||||
_unlinkItem: function MI__unlinkItem(aItem) {
|
||||
_unlinkItem: function(aItem) {
|
||||
this._itemsByLabel.delete(aItem._label);
|
||||
this._itemsByValue.delete(aItem._value);
|
||||
this._itemsByElement.delete(aItem._target);
|
||||
@ -1216,7 +1216,7 @@ MenuContainer.prototype = {
|
||||
* 0 to leave aFirst and aSecond unchanged with respect to each other
|
||||
* 1 to sort aSecond to a lower index than aFirst
|
||||
*/
|
||||
_sortPredicate: function MC__sortPredicate(aFirst, aSecond) {
|
||||
_sortPredicate: function(aFirst, aSecond) {
|
||||
return +(aFirst._label.toLowerCase() > aSecond._label.toLowerCase());
|
||||
},
|
||||
|
||||
@ -1232,7 +1232,7 @@ MenuContainer.prototype = {
|
||||
* A generator-iterator over all the items in this container.
|
||||
*/
|
||||
MenuItem.prototype.__iterator__ =
|
||||
MenuContainer.prototype.__iterator__ = function VH_iterator() {
|
||||
MenuContainer.prototype.__iterator__ = function() {
|
||||
if (!this._itemsByElement) {
|
||||
return;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ const STYLE_EDITOR_TEMPLATE = "stylesheet";
|
||||
*
|
||||
* Emits events:
|
||||
* 'editor-added': A new editor was added to the UI
|
||||
* 'editor-selected': An editor was selected
|
||||
* 'error': An error occured
|
||||
*
|
||||
* @param {StyleEditorDebuggee} debuggee
|
||||
@ -340,6 +341,8 @@ StyleEditorUI.prototype = {
|
||||
});
|
||||
|
||||
this._view.activeSummary = editor.summary;
|
||||
|
||||
this.emit("editor-selected", editor);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/styleedito
|
||||
const TEST_HOST = 'mochi.test:8888';
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
||||
let TargetFactory = tempScope.devtools.TargetFactory;
|
||||
Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
|
||||
let console = tempScope.console;
|
||||
|
@ -24,7 +24,7 @@ let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).req
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm", {});
|
||||
|
||||
let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
|
||||
let TargetFactory = (Cu.import("resource:///modules/devtools/gDevTools.jsm", {})).devtools.TargetFactory;
|
||||
let TargetFactory = (Cu.import("resource://gre/modules/devtools/Loader.jsm", {})).devtools.TargetFactory;
|
||||
|
||||
let Promise = (Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {})).Promise;
|
||||
let assert = { ok: ok, is: is, log: info };
|
||||
|
@ -43,7 +43,7 @@ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
function UpdateProcess(aWin, aGenerator, aOptions)
|
||||
{
|
||||
this.win = aWin;
|
||||
this.iter = devtools._Iterator(aGenerator);
|
||||
this.iter = _Iterator(aGenerator);
|
||||
this.onItem = aOptions.onItem || function() {};
|
||||
this.onBatch = aOptions.onBatch || function () {};
|
||||
this.onDone = aOptions.onDone || function() {};
|
||||
@ -934,7 +934,7 @@ SelectorView.prototype = {
|
||||
|
||||
if (ToolDefinitions.styleEditor.isTargetSupported(target)) {
|
||||
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
|
||||
toolbox.getCurrentPanel().selectStyleSheet(styleSheet, line);
|
||||
toolbox.getCurrentPanel().selectStyleSheet(styleSheet.href, line);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
<script type="application/javascript;version=1.8">
|
||||
window.setPanel = function(panel, iframe) {
|
||||
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let inspector = devtools.require("devtools/styleinspector/style-inspector");
|
||||
this.computedview = new inspector.ComputedViewTool(panel, window, iframe);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
<script type="application/javascript;version=1.8">
|
||||
window.setPanel = function(panel, iframe) {
|
||||
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let inspector = devtools.require("devtools/styleinspector/style-inspector");
|
||||
this.ruleview = new inspector.RuleViewTool(panel, window, iframe);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ function RuleViewTool(aInspector, aWindow, aIFrame)
|
||||
|
||||
if (ToolDefinitions.styleEditor.isTargetSupported(target)) {
|
||||
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
|
||||
toolbox.getCurrentPanel().selectStyleSheet(styleSheet, line);
|
||||
toolbox.getCurrentPanel().selectStyleSheet(styleSheet.href, line);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -6,29 +6,40 @@ let doc;
|
||||
let inspector;
|
||||
let computedView;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
doc.body.innerHTML = '<style type="text/css"> ' +
|
||||
'html { color: #000000; } ' +
|
||||
'span { font-variant: small-caps; color: #000000; } ' +
|
||||
'.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' +
|
||||
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' +
|
||||
'<h1>Some header text</h1>\n' +
|
||||
'<p id="salutation" style="font-size: 12pt">hi.</p>\n' +
|
||||
'<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' +
|
||||
'solely to provide some things to <span style="color: yellow">' +
|
||||
'highlight</span> and <span style="font-weight: bold">count</span> ' +
|
||||
'style list-items in the box at right. If you are reading this, ' +
|
||||
'you should go do something else instead. Maybe read a book. Or better ' +
|
||||
'yet, write some test-cases for another bit of code. ' +
|
||||
'<span style="font-style: italic">some text</span></p>\n' +
|
||||
'<p id="closing">more text</p>\n' +
|
||||
'<p>even more text</p>' +
|
||||
'</div>';
|
||||
doc.title = "Rule view style editor link test";
|
||||
const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
|
||||
[".highlight {",
|
||||
"color: blue",
|
||||
"}"].join("\n"));
|
||||
|
||||
const DOCUMENT_URL = "data:text/html,"+encodeURIComponent(
|
||||
['<html>' +
|
||||
'<head>' +
|
||||
'<title>Computed view style editor link test</title>',
|
||||
'<style type="text/css"> ',
|
||||
'html { color: #000000; } ',
|
||||
'span { font-variant: small-caps; color: #000000; } ',
|
||||
'.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ',
|
||||
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">',
|
||||
'</style>',
|
||||
'<link rel="stylesheet" type="text/css" href="'+STYLESHEET_URL+'">',
|
||||
'</head>',
|
||||
'<body>',
|
||||
'<h1>Some header text</h1>',
|
||||
'<p id="salutation" style="font-size: 12pt">hi.</p>',
|
||||
'<p id="body" style="font-size: 12pt">I am a test-case. This text exists ',
|
||||
'solely to provide some things to ',
|
||||
'<span style="color: yellow" class="highlight">',
|
||||
'highlight</span> and <span style="font-weight: bold">count</span> ',
|
||||
'style list-items in the box at right. If you are reading this, ',
|
||||
'you should go do something else instead. Maybe read a book. Or better ',
|
||||
'yet, write some test-cases for another bit of code. ',
|
||||
'<span style="font-style: italic">some text</span></p>',
|
||||
'<p id="closing">more text</p>',
|
||||
'<p>even more text</p>',
|
||||
'</div>',
|
||||
'</body>',
|
||||
'</html>'].join("\n"));
|
||||
|
||||
openInspector(selectNode);
|
||||
}
|
||||
|
||||
|
||||
function selectNode(aInspector)
|
||||
@ -69,7 +80,9 @@ function testInlineStyle()
|
||||
info("closing window");
|
||||
win.close();
|
||||
Services.ww.unregisterNotification(onWindow);
|
||||
testInlineStyleSheet();
|
||||
executeSoon(() => {
|
||||
testInlineStyleSheet();
|
||||
});
|
||||
});
|
||||
});
|
||||
let link = getLinkByIndex(0);
|
||||
@ -82,26 +95,44 @@ function testInlineStyleSheet()
|
||||
info("clicking an inline stylesheet");
|
||||
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
toolbox.once("styleeditor-selected", () => {
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
|
||||
panel.UI.on("editor-added", (event, editor) => {
|
||||
validateStyleEditorSheet(editor);
|
||||
})
|
||||
panel.UI.once("editor-selected", (event, editor) => {
|
||||
validateStyleEditorSheet(editor, 0);
|
||||
executeSoon(() => {
|
||||
testExternalStyleSheet(toolbox);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
let link = getLinkByIndex(1);
|
||||
let link = getLinkByIndex(2);
|
||||
link.click();
|
||||
}
|
||||
|
||||
function validateStyleEditorSheet(aEditor)
|
||||
function testExternalStyleSheet(toolbox) {
|
||||
info ("clicking an external stylesheet");
|
||||
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
panel.UI.once("editor-selected", (event, editor) => {
|
||||
is(toolbox.currentToolId, "styleeditor", "style editor selected");
|
||||
validateStyleEditorSheet(editor, 1);
|
||||
finishUp();
|
||||
});
|
||||
|
||||
toolbox.selectTool("inspector").then(function () {
|
||||
info("inspector selected");
|
||||
let link = getLinkByIndex(1);
|
||||
link.click();
|
||||
});
|
||||
}
|
||||
|
||||
function validateStyleEditorSheet(aEditor, aExpectedSheetIndex)
|
||||
{
|
||||
info("validating style editor stylesheet");
|
||||
|
||||
let sheet = doc.styleSheets[0];
|
||||
let sheet = doc.styleSheets[aExpectedSheetIndex];
|
||||
is(aEditor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
|
||||
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function expandProperty(aIndex, aCallback)
|
||||
@ -137,8 +168,8 @@ function test()
|
||||
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
|
||||
true);
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
waitForFocus(function () { openInspector(selectNode); }, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<p>Computed view style editor link test</p>";
|
||||
content.location = DOCUMENT_URL;
|
||||
}
|
||||
|
@ -12,28 +12,43 @@ let tempScope = {};
|
||||
Cu.import("resource://gre/modules/Services.jsm", tempScope);
|
||||
let Services = tempScope.Services;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
doc.body.innerHTML = '<style type="text/css"> ' +
|
||||
'html { color: #000000; } ' +
|
||||
'span { font-variant: small-caps; color: #000000; } ' +
|
||||
'.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' +
|
||||
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' +
|
||||
'<h1>Some header text</h1>\n' +
|
||||
'<p id="salutation" style="font-size: 12pt">hi.</p>\n' +
|
||||
'<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' +
|
||||
'solely to provide some things to <span style="color: yellow">' +
|
||||
'highlight</span> and <span style="font-weight: bold">count</span> ' +
|
||||
'style list-items in the box at right. If you are reading this, ' +
|
||||
'you should go do something else instead. Maybe read a book. Or better ' +
|
||||
'yet, write some test-cases for another bit of code. ' +
|
||||
'<span style="font-style: italic">some text</span></p>\n' +
|
||||
'<p id="closing">more text</p>\n' +
|
||||
'<p>even more text</p>' +
|
||||
'</div>';
|
||||
doc.title = "Rule view style editor link test";
|
||||
const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
|
||||
["#first {",
|
||||
"color: blue",
|
||||
"}"].join("\n"));
|
||||
|
||||
const DOCUMENT_URL = "data:text/html,"+encodeURIComponent(
|
||||
['<html>' +
|
||||
'<head>' +
|
||||
'<title>Rule view style editor link test</title>',
|
||||
'<style type="text/css"> ',
|
||||
'html { color: #000000; } ',
|
||||
'div { font-variant: small-caps; color: #000000; } ',
|
||||
'.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ',
|
||||
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">',
|
||||
'</style>',
|
||||
'<link rel="stylesheet" type="text/css" href="'+STYLESHEET_URL+'">',
|
||||
'</head>',
|
||||
'<body>',
|
||||
'<h1>Some header text</h1>',
|
||||
'<p id="salutation" style="font-size: 12pt">hi.</p>',
|
||||
'<p id="body" style="font-size: 12pt">I am a test-case. This text exists ',
|
||||
'solely to provide some things to ',
|
||||
'<span style="color: yellow" class="highlight">',
|
||||
'highlight</span> and <span style="font-weight: bold">count</span> ',
|
||||
'style list-items in the box at right. If you are reading this, ',
|
||||
'you should go do something else instead. Maybe read a book. Or better ',
|
||||
'yet, write some test-cases for another bit of code. ',
|
||||
'<span style="font-style: italic">some text</span></p>',
|
||||
'<p id="closing">more text</p>',
|
||||
'<p>even more text</p>',
|
||||
'</div>',
|
||||
'</body>',
|
||||
'</html>'].join("\n"));
|
||||
|
||||
function openToolbox() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
gDevTools.showToolbox(target, "inspector").then(function(aToolbox) {
|
||||
toolbox = aToolbox;
|
||||
inspector = toolbox.getCurrentPanel();
|
||||
@ -73,7 +88,9 @@ function testInlineStyle()
|
||||
is(windowType, "navigator:view-source", "view source window is open");
|
||||
win.close();
|
||||
Services.ww.unregisterNotification(onWindow);
|
||||
testInlineStyleSheet();
|
||||
executeSoon(() => {
|
||||
testInlineStyleSheet();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -90,26 +107,41 @@ function testInlineStyleSheet()
|
||||
toolbox.once("styleeditor-ready", function(id, aToolbox) {
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
|
||||
panel.UI.on("editor-added", (event, editor) => {
|
||||
validateStyleEditorSheet(editor);
|
||||
panel.UI.once("editor-selected", (event, editor) => {
|
||||
validateStyleEditorSheet(editor, 0);
|
||||
executeSoon(() => {
|
||||
testExternalStyleSheet(toolbox);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
let link = getLinkByIndex(1);
|
||||
let link = getLinkByIndex(2);
|
||||
link.scrollIntoView();
|
||||
link.click();
|
||||
}
|
||||
|
||||
function validateStyleEditorSheet(aEditor)
|
||||
function testExternalStyleSheet(toolbox) {
|
||||
info ("clicking an external stylesheet");
|
||||
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
panel.UI.once("editor-selected", (event, editor) => {
|
||||
is(toolbox.currentToolId, "styleeditor", "style editor tool selected");
|
||||
validateStyleEditorSheet(editor, 1);
|
||||
finishUp();
|
||||
});
|
||||
|
||||
toolbox.selectTool("inspector").then(function () {
|
||||
let link = getLinkByIndex(1);
|
||||
link.scrollIntoView();
|
||||
link.click();
|
||||
});
|
||||
}
|
||||
|
||||
function validateStyleEditorSheet(aEditor, aExpectedSheetIndex)
|
||||
{
|
||||
info("validating style editor stylesheet");
|
||||
|
||||
let sheet = doc.styleSheets[0];
|
||||
|
||||
let sheet = doc.styleSheets[aExpectedSheetIndex];
|
||||
is(aEditor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
|
||||
win.close();
|
||||
|
||||
finishup();
|
||||
}
|
||||
|
||||
function getLinkByIndex(aIndex)
|
||||
@ -120,7 +152,7 @@ function getLinkByIndex(aIndex)
|
||||
return links[aIndex];
|
||||
}
|
||||
|
||||
function finishup()
|
||||
function finishUp()
|
||||
{
|
||||
gBrowser.removeCurrentTab();
|
||||
contentWindow = doc = inspector = toolbox = win = null;
|
||||
@ -136,8 +168,8 @@ function test()
|
||||
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
|
||||
true);
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
waitForFocus(openToolbox, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<p>Rule view style editor link test</p>";
|
||||
content.location = DOCUMENT_URL;
|
||||
}
|
||||
|
@ -7,7 +7,10 @@ let tempScope = {};
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
|
||||
let ConsoleUtils = tempScope.ConsoleUtils;
|
||||
let gDevTools = tempScope.gDevTools;
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
||||
let devtools = tempScope.devtools;
|
||||
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
let {CssHtmlTree} = devtools.require("devtools/styleinspector/computed-view");
|
||||
let {CssRuleView, _ElementStyle} = devtools.require("devtools/styleinspector/rule-view");
|
||||
|
@ -1,13 +1,15 @@
|
||||
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ ];
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Components.utils.import("resource://gre/modules/devtools/gcli.jsm");
|
||||
Components.utils.import("resource:///modules/devtools/gDevTools.jsm");
|
||||
Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
// Fetch TiltManager using the current loader, but don't save a
|
||||
// reference to it, because it might change with a tool reload.
|
||||
|
@ -17,7 +17,7 @@ function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
createTab(function() {
|
||||
let { devtools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TiltManager = devtools.require("devtools/tilt/tilt").TiltManager;
|
||||
let TiltGL = devtools.require("devtools/tilt/tilt-gl");
|
||||
let {EPSILON, TiltMath, vec3, mat3, mat4, quat4} = devtools.require("devtools/tilt/tilt-math");
|
||||
|
@ -17,7 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
@ -10,6 +10,7 @@ Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm", tempScope);
|
||||
let WebConsoleUtils = tempScope.WebConsoleUtils;
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
|
||||
let gDevTools = tempScope.gDevTools;
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
||||
let TargetFactory = tempScope.devtools.TargetFactory;
|
||||
Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
|
||||
let console = tempScope.console;
|
||||
|
@ -41,7 +41,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "EventEmitter",
|
||||
"resource:///modules/devtools/shared/event-emitter.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
|
||||
let l10n = new WebConsoleUtils.l10n(STRINGS_URI);
|
||||
|
238
toolkit/devtools/Loader.jsm
Normal file
238
toolkit/devtools/Loader.jsm
Normal file
@ -0,0 +1,238 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Manages the addon-sdk loader instance used to load the developer tools.
|
||||
*/
|
||||
|
||||
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "console", "resource://gre/modules/devtools/Console.jsm");
|
||||
|
||||
let loader = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {}).Loader;
|
||||
let Promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}).Promise;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["devtools"];
|
||||
|
||||
/**
|
||||
* Providers are different strategies for loading the devtools.
|
||||
*/
|
||||
|
||||
let loaderGlobals = {
|
||||
console: console,
|
||||
_Iterator: Iterator
|
||||
}
|
||||
|
||||
// Used when the tools should be loaded from the Firefox package itself (the default)
|
||||
var BuiltinProvider = {
|
||||
load: function(done) {
|
||||
this.loader = new loader.Loader({
|
||||
paths: {
|
||||
"": "resource://gre/modules/commonjs/",
|
||||
"main": "resource:///modules/devtools/main.js",
|
||||
"devtools": "resource:///modules/devtools",
|
||||
"devtools/server": "resource://gre/modules/devtools/server"
|
||||
},
|
||||
globals: loaderGlobals
|
||||
});
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
},
|
||||
|
||||
unload: function(reason) {
|
||||
loader.unload(this.loader, reason);
|
||||
delete this.loader;
|
||||
},
|
||||
};
|
||||
|
||||
// Used when the tools should be loaded from a mozilla-central checkout. In addition
|
||||
// to different paths, it needs to write chrome.manifest files to override chrome urls
|
||||
// from the builtin tools.
|
||||
var SrcdirProvider = {
|
||||
load: function(done) {
|
||||
let srcdir = Services.prefs.getComplexValue("devtools.loader.srcdir",
|
||||
Ci.nsISupportsString);
|
||||
srcdir = OS.Path.normalize(srcdir.data.trim());
|
||||
let devtoolsDir = OS.Path.join(srcdir, "browser/devtools");
|
||||
let toolkitDir = OS.Path.join(srcdir, "toolkit/devtools");
|
||||
let serverDir = OS.Path.join(toolkitDir, "server")
|
||||
|
||||
this.loader = new loader.Loader({
|
||||
paths: {
|
||||
"": "resource://gre/modules/commonjs/",
|
||||
"devtools/server": "file://" + serverDir,
|
||||
"devtools": "file://" + devtoolsDir,
|
||||
"main": "file://" + devtoolsDir + "/main.js"
|
||||
},
|
||||
globals: loaderGlobals
|
||||
});
|
||||
|
||||
return this._writeManifest(devtoolsDir).then((data) => {
|
||||
this._writeManifest(toolkitDir);
|
||||
}).then(null, Cu.reportError);
|
||||
},
|
||||
|
||||
unload: function(reason) {
|
||||
loader.unload(this.loader, reason);
|
||||
delete this.loader;
|
||||
},
|
||||
|
||||
_readFile: function(filename) {
|
||||
let deferred = Promise.defer();
|
||||
let file = new FileUtils.File(filename);
|
||||
NetUtil.asyncFetch(file, (inputStream, status) => {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
deferred.reject(new Error("Couldn't load manifest: " + filename + "\n"));
|
||||
return;
|
||||
}
|
||||
var data = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
||||
deferred.resolve(data);
|
||||
});
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
_writeFile: function(filename, data) {
|
||||
let deferred = Promise.defer();
|
||||
let file = new FileUtils.File(filename);
|
||||
|
||||
var ostream = FileUtils.openSafeFileOutputStream(file)
|
||||
|
||||
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||
createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
var istream = converter.convertToInputStream(data);
|
||||
NetUtil.asyncCopy(istream, ostream, (status) => {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
deferred.reject(new Error("Couldn't write manifest: " + filename + "\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
deferred.resolve(null);
|
||||
});
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
_writeManifest: function(dir) {
|
||||
return this._readFile(dir + "/jar.mn").then((data) => {
|
||||
// The file data is contained within inputStream.
|
||||
// You can read it into a string with
|
||||
let entries = [];
|
||||
let lines = data.split(/\n/);
|
||||
let preprocessed = /^\s*\*/;
|
||||
let contentEntry = new RegExp("^\\s+content/(\\w+)/(\\S+)\\s+\\((\\S+)\\)");
|
||||
for (let line of lines) {
|
||||
if (preprocessed.test(line)) {
|
||||
dump("Unable to override preprocessed file: " + line + "\n");
|
||||
continue;
|
||||
}
|
||||
let match = contentEntry.exec(line);
|
||||
if (match) {
|
||||
let entry = "override chrome://" + match[1] + "/content/" + match[2] + "\tfile://" + dir + "/" + match[3];
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
return this._writeFile(dir + "/chrome.manifest", entries.join("\n"));
|
||||
}).then(() => {
|
||||
Components.manager.addBootstrappedManifestLocation(new FileUtils.File(dir));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The main devtools API.
|
||||
* In addition to a few loader-related details, this object will also include all
|
||||
* exports from the main module.
|
||||
*/
|
||||
this.devtools = {
|
||||
_provider: null,
|
||||
|
||||
/**
|
||||
* Add a URI to the loader.
|
||||
* @param string id
|
||||
* The module id that can be used within the loader to refer to this module.
|
||||
* @param string uri
|
||||
* The URI to load as a module.
|
||||
* @returns The module's exports.
|
||||
*/
|
||||
loadURI: function(id, uri) {
|
||||
let module = loader.Module(id, uri);
|
||||
return loader.load(this._provider.loader, module).exports;
|
||||
},
|
||||
|
||||
/**
|
||||
* Let the loader know the ID of the main module to load.
|
||||
*
|
||||
* The loader doesn't need a main module, but it's nice to have. This
|
||||
* will be called by the browser devtools to load the devtools/main module.
|
||||
*
|
||||
* When only using the server, there's no main module, and this method
|
||||
* can be ignored.
|
||||
*/
|
||||
main: function(id) {
|
||||
this._mainid = id;
|
||||
this._main = loader.main(this._provider.loader, id);
|
||||
|
||||
// Mirror the main module's exports on this object.
|
||||
Object.getOwnPropertyNames(this._main).forEach(key => {
|
||||
XPCOMUtils.defineLazyGetter(this, key, () => this._main[key]);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Override the provider used to load the tools.
|
||||
*/
|
||||
setProvider: function(provider) {
|
||||
if (provider === this._provider) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._provider) {
|
||||
delete this.require;
|
||||
this._provider.unload("newprovider");
|
||||
gDevTools._teardown();
|
||||
}
|
||||
this._provider = provider;
|
||||
this._provider.load();
|
||||
this.require = loader.Require(this._provider.loader, { id: "devtools" });
|
||||
|
||||
if (this._mainid) {
|
||||
this.main(mainid);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Choose a default tools provider based on the preferences.
|
||||
*/
|
||||
_chooseProvider: function() {
|
||||
if (Services.prefs.prefHasUserValue("devtools.loader.srcdir")) {
|
||||
this.setProvider(SrcdirProvider);
|
||||
} else {
|
||||
this.setProvider(BuiltinProvider);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reload the current provider.
|
||||
*/
|
||||
reload: function() {
|
||||
var events = devtools.require("sdk/system/events");
|
||||
events.emit("startupcache-invalidate", {});
|
||||
|
||||
this._provider.unload("reload");
|
||||
delete this._provider;
|
||||
gDevTools._teardown();
|
||||
this._chooseProvider();
|
||||
},
|
||||
};
|
||||
|
||||
// Now load the tools.
|
||||
devtools._chooseProvider();
|
@ -33,7 +33,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gActivityDistributor",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
|
||||
"resource:///modules/devtools/gDevTools.jsm");
|
||||
"resource://gre/modules/devtools/Loader.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "VariablesView",
|
||||
"resource:///modules/devtools/VariablesView.jsm");
|
||||
|
Loading…
Reference in New Issue
Block a user