mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 14:30:47 +00:00
merge m-c to fx-team
This commit is contained in:
commit
87ee5e0faf
@ -25,11 +25,6 @@ let gBrowserThumbnails = {
|
|||||||
*/
|
*/
|
||||||
_timeouts: null,
|
_timeouts: null,
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache for the PageThumbs module.
|
|
||||||
*/
|
|
||||||
_pageThumbs: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of tab events we want to listen for.
|
* List of tab events we want to listen for.
|
||||||
*/
|
*/
|
||||||
@ -52,9 +47,6 @@ let gBrowserThumbnails = {
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this._timeouts = new WeakMap();
|
this._timeouts = new WeakMap();
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "_pageThumbs",
|
|
||||||
"resource:///modules/PageThumbs.jsm", "PageThumbs");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function Thumbnails_uninit() {
|
uninit: function Thumbnails_uninit() {
|
||||||
@ -100,7 +92,7 @@ let gBrowserThumbnails = {
|
|||||||
|
|
||||||
_capture: function Thumbnails_capture(aBrowser) {
|
_capture: function Thumbnails_capture(aBrowser) {
|
||||||
if (this._shouldCapture(aBrowser))
|
if (this._shouldCapture(aBrowser))
|
||||||
this._pageThumbs.captureAndStore(aBrowser);
|
PageThumbs.captureAndStore(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
||||||
|
@ -140,6 +140,9 @@ XPCOMUtils.defineLazyGetter(this, "Social", function() {
|
|||||||
return tmp.Social;
|
return tmp.Social;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
|
||||||
|
"resource:///modules/PageThumbs.jsm");
|
||||||
|
|
||||||
#ifdef MOZ_SAFE_BROWSING
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
XPCOMUtils.defineLazyGetter(this, "SafeBrowsing", function() {
|
XPCOMUtils.defineLazyGetter(this, "SafeBrowsing", function() {
|
||||||
let tmp = {};
|
let tmp = {};
|
||||||
|
@ -3407,7 +3407,20 @@
|
|||||||
// Set the cursor to an arrow during tab drags.
|
// Set the cursor to an arrow during tab drags.
|
||||||
dt.mozCursor = "default";
|
dt.mozCursor = "default";
|
||||||
|
|
||||||
let canvas = tabPreviews.capture(tab, false);
|
// Create a canvas to which we capture the current tab.
|
||||||
|
let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||||
|
canvas.mozOpaque = true;
|
||||||
|
|
||||||
|
// We want drag images to be about 1/6th of the available screen width.
|
||||||
|
const widthFactor = 0.1739; // 1:5.75 inverse
|
||||||
|
canvas.width = Math.ceil(screen.availWidth * widthFactor);
|
||||||
|
|
||||||
|
// Maintain a 16:9 aspect ratio for drag images.
|
||||||
|
const aspectRatio = 0.5625; // 16:9 inverse
|
||||||
|
canvas.height = Math.round(canvas.width * aspectRatio);
|
||||||
|
|
||||||
|
let browser = tab.linkedBrowser;
|
||||||
|
PageThumbs.captureToCanvas(browser.contentWindow, canvas);
|
||||||
dt.setDragImage(canvas, 0, 0);
|
dt.setDragImage(canvas, 0, 0);
|
||||||
|
|
||||||
// _dragOffsetX/Y give the coordinates that the mouse should be
|
// _dragOffsetX/Y give the coordinates that the mouse should be
|
||||||
|
@ -116,11 +116,26 @@ let PageThumbs = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let telemetryCaptureTime = new Date();
|
|
||||||
let [sw, sh, scale] = this._determineCropSize(aWindow);
|
|
||||||
|
|
||||||
let canvas = this._createCanvas();
|
let canvas = this._createCanvas();
|
||||||
let ctx = canvas.getContext("2d");
|
this.captureToCanvas(aWindow, canvas);
|
||||||
|
|
||||||
|
// Fetch the canvas data on the next event loop tick so that we allow
|
||||||
|
// some event processing in between drawing to the canvas and encoding
|
||||||
|
// its data. We want to block the UI as short as possible. See bug 744100.
|
||||||
|
Services.tm.currentThread.dispatch(function () {
|
||||||
|
canvas.mozFetchAsStream(aCallback, this.contentType);
|
||||||
|
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Captures a thumbnail from a given window and draws it to the given canvas.
|
||||||
|
* @param aWindow The DOM window to capture a thumbnail from.
|
||||||
|
* @param aCanvas The canvas to draw to.
|
||||||
|
*/
|
||||||
|
captureToCanvas: function PageThumbs_captureToCanvas(aWindow, aCanvas) {
|
||||||
|
let telemetryCaptureTime = new Date();
|
||||||
|
let [sw, sh, scale] = this._determineCropSize(aWindow, aCanvas);
|
||||||
|
let ctx = aCanvas.getContext("2d");
|
||||||
|
|
||||||
// Scale the canvas accordingly.
|
// Scale the canvas accordingly.
|
||||||
ctx.scale(scale, scale);
|
ctx.scale(scale, scale);
|
||||||
@ -136,13 +151,6 @@ let PageThumbs = {
|
|||||||
let telemetry = Services.telemetry;
|
let telemetry = Services.telemetry;
|
||||||
telemetry.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
|
telemetry.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
|
||||||
.add(new Date() - telemetryCaptureTime);
|
.add(new Date() - telemetryCaptureTime);
|
||||||
|
|
||||||
// Fetch the canvas data on the next event loop tick so that we allow
|
|
||||||
// some event processing in between drawing to the canvas and encoding
|
|
||||||
// its data. We want to block the UI as short as possible. See bug 744100.
|
|
||||||
Services.tm.currentThread.dispatch(function () {
|
|
||||||
canvas.mozFetchAsStream(aCallback, this.contentType);
|
|
||||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,13 +201,14 @@ let PageThumbs = {
|
|||||||
/**
|
/**
|
||||||
* Determines the crop size for a given content window.
|
* Determines the crop size for a given content window.
|
||||||
* @param aWindow The content window.
|
* @param aWindow The content window.
|
||||||
|
* @param aCanvas The target canvas.
|
||||||
* @return An array containing width, height and scale.
|
* @return An array containing width, height and scale.
|
||||||
*/
|
*/
|
||||||
_determineCropSize: function PageThumbs_determineCropSize(aWindow) {
|
_determineCropSize: function PageThumbs_determineCropSize(aWindow, aCanvas) {
|
||||||
let sw = aWindow.innerWidth;
|
let sw = aWindow.innerWidth;
|
||||||
let sh = aWindow.innerHeight;
|
let sh = aWindow.innerHeight;
|
||||||
|
|
||||||
let [thumbnailWidth, thumbnailHeight] = this._getThumbnailSize();
|
let {width: thumbnailWidth, height: thumbnailHeight} = aCanvas;
|
||||||
let scale = Math.max(thumbnailWidth / sw, thumbnailHeight / sh);
|
let scale = Math.max(thumbnailWidth / sw, thumbnailHeight / sh);
|
||||||
let scaledWidth = sw * scale;
|
let scaledWidth = sw * scale;
|
||||||
let scaledHeight = sh * scale;
|
let scaledHeight = sh * scale;
|
||||||
|
@ -11,8 +11,6 @@ registerCleanupFunction(function () {
|
|||||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
let cachedXULDocument;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide the default test function to start our test runner.
|
* Provide the default test function to start our test runner.
|
||||||
*/
|
*/
|
||||||
|
@ -51,15 +51,16 @@ let DebuggerController = {
|
|||||||
window.removeEventListener("DOMContentLoaded", this._startupDebugger, true);
|
window.removeEventListener("DOMContentLoaded", this._startupDebugger, true);
|
||||||
|
|
||||||
DebuggerView.initializePanes();
|
DebuggerView.initializePanes();
|
||||||
DebuggerView.initializeEditor();
|
DebuggerView.initializeEditor(function() {
|
||||||
DebuggerView.StackFrames.initialize();
|
DebuggerView.Scripts.initialize();
|
||||||
DebuggerView.Breakpoints.initialize();
|
DebuggerView.StackFrames.initialize();
|
||||||
DebuggerView.Properties.initialize();
|
DebuggerView.Breakpoints.initialize();
|
||||||
DebuggerView.Scripts.initialize();
|
DebuggerView.Properties.initialize();
|
||||||
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
|
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
|
||||||
|
|
||||||
this.dispatchEvent("Debugger:Loaded");
|
this.dispatchEvent("Debugger:Loaded");
|
||||||
this._connect();
|
this._connect();
|
||||||
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -934,7 +935,7 @@ SourceScripts.prototype = {
|
|||||||
|
|
||||||
// Select the preferred script if one exists, the first entry otherwise.
|
// Select the preferred script if one exists, the first entry otherwise.
|
||||||
let preferredScriptUrl = DebuggerView.Scripts.preferredScriptUrl;
|
let preferredScriptUrl = DebuggerView.Scripts.preferredScriptUrl;
|
||||||
if (preferredScriptUrl) {
|
if (preferredScriptUrl && DebuggerView.Scripts.contains(preferredScriptUrl)) {
|
||||||
DebuggerView.Scripts.selectScript(preferredScriptUrl);
|
DebuggerView.Scripts.selectScript(preferredScriptUrl);
|
||||||
} else {
|
} else {
|
||||||
DebuggerView.Scripts.selectIndex(0);
|
DebuggerView.Scripts.selectIndex(0);
|
||||||
|
@ -32,8 +32,11 @@ let DebuggerView = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the SourceEditor instance.
|
* Initializes the SourceEditor instance.
|
||||||
|
*
|
||||||
|
* @param function aCallback
|
||||||
|
* Called after the editor finishes initializing.
|
||||||
*/
|
*/
|
||||||
initializeEditor: function DV_initializeEditor() {
|
initializeEditor: function DV_initializeEditor(aCallback) {
|
||||||
let placeholder = document.getElementById("editor");
|
let placeholder = document.getElementById("editor");
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
@ -45,7 +48,10 @@ let DebuggerView = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.editor = new SourceEditor();
|
this.editor = new SourceEditor();
|
||||||
this.editor.init(placeholder, config, this._onEditorLoad.bind(this));
|
this.editor.init(placeholder, config, function() {
|
||||||
|
this._onEditorLoad();
|
||||||
|
aCallback();
|
||||||
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -474,7 +480,7 @@ ScriptsView.prototype = {
|
|||||||
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
||||||
scripts.getItemAtIndex(i).hidden = false;
|
scripts.getItemAtIndex(i).hidden = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (this._prevSearchedFile !== file) {
|
||||||
let found = false;
|
let found = false;
|
||||||
|
|
||||||
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
||||||
@ -502,15 +508,18 @@ ScriptsView.prototype = {
|
|||||||
scripts.removeAttribute("tooltiptext");
|
scripts.removeAttribute("tooltiptext");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (line > -1) {
|
if (this._prevSearchedLine !== line && line > -1) {
|
||||||
editor.setCaretPosition(line - 1);
|
editor.setCaretPosition(line - 1);
|
||||||
}
|
}
|
||||||
if (token.length) {
|
if (this._prevSearchedToken !== token && token.length > 0) {
|
||||||
let offset = editor.find(token, { ignoreCase: true });
|
let offset = editor.find(token, { ignoreCase: true });
|
||||||
if (offset > -1) {
|
if (offset > -1) {
|
||||||
editor.setSelection(offset, offset + token.length)
|
editor.setSelection(offset, offset + token.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this._prevSearchedFile = file;
|
||||||
|
this._prevSearchedLine = line;
|
||||||
|
this._prevSearchedToken = token;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +44,7 @@ MOCHITEST_BROWSER_TESTS = \
|
|||||||
browser_dbg_stack-04.js \
|
browser_dbg_stack-04.js \
|
||||||
browser_dbg_stack-05.js \
|
browser_dbg_stack-05.js \
|
||||||
browser_dbg_location-changes.js \
|
browser_dbg_location-changes.js \
|
||||||
|
browser_dbg_location-changes-new.js \
|
||||||
browser_dbg_location-changes-blank.js \
|
browser_dbg_location-changes-blank.js \
|
||||||
browser_dbg_script-switching.js \
|
browser_dbg_script-switching.js \
|
||||||
browser_dbg_scripts-sorting.js \
|
browser_dbg_scripts-sorting.js \
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure that changing the tab location URL to a page with other scripts works.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var gPane = null;
|
||||||
|
var gTab = null;
|
||||||
|
var gDebuggee = null;
|
||||||
|
var gDebugger = null;
|
||||||
|
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
||||||
|
gTab = aTab;
|
||||||
|
gDebuggee = aDebuggee;
|
||||||
|
gPane = aPane;
|
||||||
|
gDebugger = gPane.contentWindow;
|
||||||
|
|
||||||
|
testSimpleCall();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function testSimpleCall() {
|
||||||
|
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||||
|
Services.tm.currentThread.dispatch({
|
||||||
|
run: function() {
|
||||||
|
var frames = gDebugger.DebuggerView.StackFrames._frames,
|
||||||
|
childNodes = frames.childNodes;
|
||||||
|
|
||||||
|
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||||
|
"Should only be getting stack frames while paused.");
|
||||||
|
|
||||||
|
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
||||||
|
"Should have only one frame.");
|
||||||
|
|
||||||
|
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
|
||||||
|
"All children should be frames.");
|
||||||
|
|
||||||
|
isnot(gDebugger.DebuggerView.Scripts.selected, null,
|
||||||
|
"There should be a selected script.");
|
||||||
|
isnot(gDebugger.editor.getText().length, 0,
|
||||||
|
"The source editor should have some text displayed.");
|
||||||
|
|
||||||
|
testLocationChange();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
gDebuggee.simpleCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
function testLocationChange()
|
||||||
|
{
|
||||||
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||||
|
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
|
||||||
|
ok(true, "tabNavigated event was fired.");
|
||||||
|
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
|
||||||
|
ok(true, "Successfully reattached to the tab again.");
|
||||||
|
|
||||||
|
// Wait for the initial resume...
|
||||||
|
gDebugger.gClient.addOneTimeListener("resumed", function() {
|
||||||
|
isnot(gDebugger.DebuggerView.Scripts.selected, null,
|
||||||
|
"There should be a selected script.");
|
||||||
|
isnot(gDebugger.editor.getText().length, 0,
|
||||||
|
"The source editor should have some text displayed.");
|
||||||
|
|
||||||
|
let menulist = gDebugger.DebuggerView.Scripts._scripts;
|
||||||
|
let noScripts = gDebugger.L10N.getStr("noScriptsText");
|
||||||
|
isnot(menulist.getAttribute("label"), noScripts,
|
||||||
|
"The menulist should not display a notice that there are no scripts availalble.");
|
||||||
|
isnot(menulist.getAttribute("tooltiptext"), "",
|
||||||
|
"The menulist should have a tooltip text attributed.");
|
||||||
|
|
||||||
|
closeDebuggerAndFinish();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
content.location = EXAMPLE_URL + "browser_dbg_iframes.html";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
registerCleanupFunction(function() {
|
||||||
|
removeTab(gTab);
|
||||||
|
gPane = null;
|
||||||
|
gTab = null;
|
||||||
|
gDebuggee = null;
|
||||||
|
gDebugger = null;
|
||||||
|
});
|
@ -191,6 +191,11 @@ function clear() {
|
|||||||
|
|
||||||
function write(text) {
|
function write(text) {
|
||||||
clear();
|
clear();
|
||||||
|
append(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function append(text) {
|
||||||
|
gSearchBox.focus();
|
||||||
|
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
EventUtils.sendChar(text[i]);
|
EventUtils.sendChar(text[i]);
|
||||||
|
@ -96,6 +96,8 @@ function secondSearch() {
|
|||||||
window.removeEventListener(aEvent.type, _onEvent);
|
window.removeEventListener(aEvent.type, _onEvent);
|
||||||
|
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
|
append("#" + token);
|
||||||
|
|
||||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||||
ok(gEditor.getCaretPosition().line == 5 &&
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
gEditor.getCaretPosition().col == 8 + token.length,
|
gEditor.getCaretPosition().col == 8 + token.length,
|
||||||
@ -103,6 +105,49 @@ function secondSearch() {
|
|||||||
is(gScripts.visibleItemsCount, 1,
|
is(gScripts.visibleItemsCount, 1,
|
||||||
"Not all the correct scripts are shown after the search. (2)");
|
"Not all the correct scripts are shown after the search. (2)");
|
||||||
|
|
||||||
|
waitForFirstScript();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gScripts.selectIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function waitForFirstScript() {
|
||||||
|
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||||
|
info("Current script url:\n" + aEvent.detail.url + "\n");
|
||||||
|
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||||
|
|
||||||
|
let url = aEvent.detail.url;
|
||||||
|
if (url.indexOf("-01.js") != -1) {
|
||||||
|
window.removeEventListener(aEvent.type, _onEvent);
|
||||||
|
|
||||||
|
executeSoon(function() {
|
||||||
|
thirdSearch();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gScripts.selectIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function thirdSearch() {
|
||||||
|
let token = "deb";
|
||||||
|
|
||||||
|
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||||
|
info("Current script url:\n" + aEvent.detail.url + "\n");
|
||||||
|
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||||
|
|
||||||
|
let url = aEvent.detail.url;
|
||||||
|
if (url.indexOf("-02.js") != -1) {
|
||||||
|
window.removeEventListener(aEvent.type, _onEvent);
|
||||||
|
|
||||||
|
executeSoon(function() {
|
||||||
|
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||||
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
|
gEditor.getCaretPosition().col == 8 + token.length,
|
||||||
|
"The editor didn't jump to the correct line. (3)");
|
||||||
|
is(gScripts.visibleItemsCount, 1,
|
||||||
|
"Not all the correct scripts are shown after the search. (3)");
|
||||||
|
|
||||||
finalCheck(0, "ugger;", token);
|
finalCheck(0, "ugger;", token);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,7 +160,7 @@ function finalCheck(i, string, token) {
|
|||||||
|
|
||||||
ok(gEditor.getCaretPosition().line == 5 &&
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||||
"The editor didn't remain at the correct token. (3)");
|
"The editor didn't remain at the correct token. (4)");
|
||||||
|
|
||||||
if (string[i]) {
|
if (string[i]) {
|
||||||
EventUtils.sendChar(string[i]);
|
EventUtils.sendChar(string[i]);
|
||||||
@ -126,7 +171,7 @@ function finalCheck(i, string, token) {
|
|||||||
clear();
|
clear();
|
||||||
ok(gEditor.getCaretPosition().line == 5 &&
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||||
"The editor didn't remain at the correct token. (4)");
|
"The editor didn't remain at the correct token. (5)");
|
||||||
|
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
||||||
@ -139,7 +184,7 @@ function finalCheck(i, string, token) {
|
|||||||
write("BOGUS");
|
write("BOGUS");
|
||||||
ok(gEditor.getCaretPosition().line == 5 &&
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||||
"The editor didn't remain at the correct token. (5)");
|
"The editor didn't remain at the correct token. (6)");
|
||||||
|
|
||||||
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
"The menulist should display a notice that no scripts match the searched token.");
|
"The menulist should display a notice that no scripts match the searched token.");
|
||||||
@ -151,7 +196,7 @@ function finalCheck(i, string, token) {
|
|||||||
clear();
|
clear();
|
||||||
ok(gEditor.getCaretPosition().line == 5 &&
|
ok(gEditor.getCaretPosition().line == 5 &&
|
||||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||||
"The editor didn't remain at the correct token. (6)");
|
"The editor didn't remain at the correct token. (7)");
|
||||||
|
|
||||||
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
"The menulist should not display a notice after the searchbox was emptied.");
|
"The menulist should not display a notice after the searchbox was emptied.");
|
||||||
@ -171,6 +216,11 @@ function clear() {
|
|||||||
|
|
||||||
function write(text) {
|
function write(text) {
|
||||||
clear();
|
clear();
|
||||||
|
append(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function append(text) {
|
||||||
|
gSearchBox.focus();
|
||||||
|
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
EventUtils.sendChar(text[i]);
|
EventUtils.sendChar(text[i]);
|
||||||
|
@ -550,7 +550,7 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
this._loadCallback = aLoadCallback;
|
this._loadCallback = aLoadCallback;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
<panel id="gcli-output"
|
<tooltip id="gcli-output"
|
||||||
noautofocus="true"
|
noautofocus="true"
|
||||||
noautohide="true"
|
noautohide="true"
|
||||||
class="gcli-panel">
|
class="gcli-panel">
|
||||||
@ -558,13 +558,15 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
id="gcli-output-frame"
|
id="gcli-output-frame"
|
||||||
src="chrome://browser/content/devtools/gclioutput.xhtml"
|
src="chrome://browser/content/devtools/gclioutput.xhtml"
|
||||||
flex="1"/>
|
flex="1"/>
|
||||||
</panel>
|
</tooltip>
|
||||||
*/
|
*/
|
||||||
this._panel = aChromeDoc.createElement("panel");
|
|
||||||
|
// TODO: Switch back from tooltip to panel when metacity focus issue is fixed:
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||||
|
this._panel = aChromeDoc.createElement("tooltip");
|
||||||
|
|
||||||
this._panel.id = "gcli-output";
|
this._panel.id = "gcli-output";
|
||||||
this._panel.classList.add("gcli-panel");
|
this._panel.classList.add("gcli-panel");
|
||||||
this._panel.setAttribute("noautofocus", "true");
|
|
||||||
this._panel.setAttribute("noautohide", "true");
|
|
||||||
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
||||||
|
|
||||||
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
||||||
@ -579,6 +581,10 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
this._frame.addEventListener("load", this._onload, true);
|
this._frame.addEventListener("load", this._onload, true);
|
||||||
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
this.canHide = false;
|
||||||
|
|
||||||
|
this._onpopuphiding = this._onpopuphiding.bind(this);
|
||||||
|
this._panel.addEventListener("popuphiding", this._onpopuphiding, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,6 +612,18 @@ OutputPanel.prototype._onload = function OP_onload()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent the popup from hiding if it is not permitted via this.canHide.
|
||||||
|
*/
|
||||||
|
OutputPanel.prototype._onpopuphiding = function OP_onpopuphiding(aEvent)
|
||||||
|
{
|
||||||
|
// TODO: When we switch back from tooltip to panel we can remove this hack:
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||||
|
if (!this.canHide) {
|
||||||
|
aEvent.preventDefault();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the OutputPanel.
|
* Display the OutputPanel.
|
||||||
*/
|
*/
|
||||||
@ -618,6 +636,8 @@ OutputPanel.prototype.show = function OP_show()
|
|||||||
this._resize();
|
this._resize();
|
||||||
}.bind(this), 0);
|
}.bind(this), 0);
|
||||||
|
|
||||||
|
this.canHide = false;
|
||||||
|
|
||||||
this._panel.openPopup(this._input, "before_start", 0, 0, false, false, null);
|
this._panel.openPopup(this._input, "before_start", 0, 0, false, false, null);
|
||||||
this._resize();
|
this._resize();
|
||||||
|
|
||||||
@ -677,6 +697,7 @@ OutputPanel.prototype.update = function OP_update()
|
|||||||
*/
|
*/
|
||||||
OutputPanel.prototype.remove = function OP_remove()
|
OutputPanel.prototype.remove = function OP_remove()
|
||||||
{
|
{
|
||||||
|
this.canHide = true;
|
||||||
this._panel.hidePopup();
|
this._panel.hidePopup();
|
||||||
|
|
||||||
if (this.displayedOutput) {
|
if (this.displayedOutput) {
|
||||||
@ -693,11 +714,15 @@ OutputPanel.prototype.destroy = function OP_destroy()
|
|||||||
{
|
{
|
||||||
this.remove();
|
this.remove();
|
||||||
|
|
||||||
|
this._panel.removeEventListener("popuphiding", this._onpopuphiding, true);
|
||||||
|
|
||||||
this._panel.removeChild(this._frame);
|
this._panel.removeChild(this._frame);
|
||||||
this._toolbar.parentElement.removeChild(this._panel);
|
this._toolbar.parentElement.removeChild(this._panel);
|
||||||
|
|
||||||
delete this._input;
|
delete this._input;
|
||||||
delete this._toolbar;
|
delete this._toolbar;
|
||||||
|
delete this._onload;
|
||||||
|
delete this._onpopuphiding;
|
||||||
delete this._panel;
|
delete this._panel;
|
||||||
delete this._frame;
|
delete this._frame;
|
||||||
delete this._content;
|
delete this._content;
|
||||||
@ -714,6 +739,7 @@ OutputPanel.prototype._visibilityChanged = function OP_visibilityChanged(aEvent)
|
|||||||
if (aEvent.outputVisible === true) {
|
if (aEvent.outputVisible === true) {
|
||||||
// this.show is called by _outputChanged
|
// this.show is called by _outputChanged
|
||||||
} else {
|
} else {
|
||||||
|
this.canHide = true;
|
||||||
this._panel.hidePopup();
|
this._panel.hidePopup();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -734,7 +760,7 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
this._onload = this._onload.bind(this);
|
this._onload = this._onload.bind(this);
|
||||||
this._loadCallback = aLoadCallback;
|
this._loadCallback = aLoadCallback;
|
||||||
/*
|
/*
|
||||||
<panel id="gcli-tooltip"
|
<tooltip id="gcli-tooltip"
|
||||||
type="arrow"
|
type="arrow"
|
||||||
noautofocus="true"
|
noautofocus="true"
|
||||||
noautohide="true"
|
noautohide="true"
|
||||||
@ -743,13 +769,15 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
id="gcli-tooltip-frame"
|
id="gcli-tooltip-frame"
|
||||||
src="chrome://browser/content/devtools/gclitooltip.xhtml"
|
src="chrome://browser/content/devtools/gclitooltip.xhtml"
|
||||||
flex="1"/>
|
flex="1"/>
|
||||||
</panel>
|
</tooltip>
|
||||||
*/
|
*/
|
||||||
this._panel = aChromeDoc.createElement("panel");
|
|
||||||
|
// TODO: Switch back from tooltip to panel when metacity focus issue is fixed:
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||||
|
this._panel = aChromeDoc.createElement("tooltip");
|
||||||
|
|
||||||
this._panel.id = "gcli-tooltip";
|
this._panel.id = "gcli-tooltip";
|
||||||
this._panel.classList.add("gcli-panel");
|
this._panel.classList.add("gcli-panel");
|
||||||
this._panel.setAttribute("noautofocus", "true");
|
|
||||||
this._panel.setAttribute("noautohide", "true");
|
|
||||||
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
||||||
|
|
||||||
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
||||||
@ -759,7 +787,12 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
|||||||
this._panel.appendChild(this._frame);
|
this._panel.appendChild(this._frame);
|
||||||
|
|
||||||
this._frame.addEventListener("load", this._onload, true);
|
this._frame.addEventListener("load", this._onload, true);
|
||||||
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
this.canHide = false;
|
||||||
|
|
||||||
|
this._onpopuphiding = this._onpopuphiding.bind(this);
|
||||||
|
this._panel.addEventListener("popuphiding", this._onpopuphiding, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -785,6 +818,18 @@ TooltipPanel.prototype._onload = function TP_onload()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent the popup from hiding if it is not permitted via this.canHide.
|
||||||
|
*/
|
||||||
|
TooltipPanel.prototype._onpopuphiding = function TP_onpopuphiding(aEvent)
|
||||||
|
{
|
||||||
|
// TODO: When we switch back from tooltip to panel we can remove this hack:
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||||
|
if (!this.canHide) {
|
||||||
|
aEvent.preventDefault();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the TooltipPanel.
|
* Display the TooltipPanel.
|
||||||
*/
|
*/
|
||||||
@ -802,6 +847,8 @@ TooltipPanel.prototype.show = function TP_show(aDimensions)
|
|||||||
this._resize();
|
this._resize();
|
||||||
}.bind(this), 0);
|
}.bind(this), 0);
|
||||||
|
|
||||||
|
this.canHide = false;
|
||||||
|
|
||||||
this._resize();
|
this._resize();
|
||||||
this._panel.openPopup(this._input, "before_start", aDimensions.start * 10, 0, false, false, null);
|
this._panel.openPopup(this._input, "before_start", aDimensions.start * 10, 0, false, false, null);
|
||||||
this._input.focus();
|
this._input.focus();
|
||||||
@ -845,6 +892,7 @@ TooltipPanel.prototype._resize = function TP_resize()
|
|||||||
*/
|
*/
|
||||||
TooltipPanel.prototype.remove = function TP_remove()
|
TooltipPanel.prototype.remove = function TP_remove()
|
||||||
{
|
{
|
||||||
|
this.canHide = true;
|
||||||
this._panel.hidePopup();
|
this._panel.hidePopup();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -855,6 +903,8 @@ TooltipPanel.prototype.destroy = function TP_destroy()
|
|||||||
{
|
{
|
||||||
this.remove();
|
this.remove();
|
||||||
|
|
||||||
|
this._panel.removeEventListener("popuphiding", this._onpopuphiding, true);
|
||||||
|
|
||||||
this._panel.removeChild(this._frame);
|
this._panel.removeChild(this._frame);
|
||||||
this._toolbar.parentElement.removeChild(this._panel);
|
this._toolbar.parentElement.removeChild(this._panel);
|
||||||
|
|
||||||
@ -862,6 +912,7 @@ TooltipPanel.prototype.destroy = function TP_destroy()
|
|||||||
delete this._dimensions;
|
delete this._dimensions;
|
||||||
delete this._input;
|
delete this._input;
|
||||||
delete this._onload;
|
delete this._onload;
|
||||||
|
delete this._onpopuphiding;
|
||||||
delete this._panel;
|
delete this._panel;
|
||||||
delete this._frame;
|
delete this._frame;
|
||||||
delete this._toolbar;
|
delete this._toolbar;
|
||||||
@ -879,6 +930,7 @@ TooltipPanel.prototype._visibilityChanged = function TP_visibilityChanged(aEvent
|
|||||||
if (aEvent.tooltipVisible === true) {
|
if (aEvent.tooltipVisible === true) {
|
||||||
this.show(aEvent.dimensions);
|
this.show(aEvent.dimensions);
|
||||||
} else {
|
} else {
|
||||||
|
this.canHide = true;
|
||||||
this._panel.hidePopup();
|
this._panel.hidePopup();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -25,10 +25,15 @@ function ThreadActor(aHooks)
|
|||||||
this._frameActors = [];
|
this._frameActors = [];
|
||||||
this._environmentActors = [];
|
this._environmentActors = [];
|
||||||
this._hooks = aHooks ? aHooks : {};
|
this._hooks = aHooks ? aHooks : {};
|
||||||
this._breakpointStore = {};
|
|
||||||
this._scripts = {};
|
this._scripts = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The breakpoint store must be shared across instances of ThreadActor so that
|
||||||
|
* page reloads don't blow away all of our breakpoints.
|
||||||
|
*/
|
||||||
|
ThreadActor._breakpointStore = {};
|
||||||
|
|
||||||
ThreadActor.prototype = {
|
ThreadActor.prototype = {
|
||||||
actorPrefix: "context",
|
actorPrefix: "context",
|
||||||
|
|
||||||
@ -36,6 +41,8 @@ ThreadActor.prototype = {
|
|||||||
|
|
||||||
get dbg() { return this._dbg; },
|
get dbg() { return this._dbg; },
|
||||||
|
|
||||||
|
get _breakpointStore() { return ThreadActor._breakpointStore; },
|
||||||
|
|
||||||
get threadLifetimePool() {
|
get threadLifetimePool() {
|
||||||
if (!this._threadLifetimePool) {
|
if (!this._threadLifetimePool) {
|
||||||
this._threadLifetimePool = new ActorPool(this.conn);
|
this._threadLifetimePool = new ActorPool(this.conn);
|
||||||
|
19
toolkit/devtools/debugger/tests/unit/test_breakpointstore.js
Normal file
19
toolkit/devtools/debugger/tests/unit/test_breakpointstore.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
// Note: Removing this test will regress bug 754251. See comment above
|
||||||
|
// ThreadActor._breakpointStore.
|
||||||
|
|
||||||
|
function run_test()
|
||||||
|
{
|
||||||
|
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
|
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||||
|
loader.loadSubScript("chrome://global/content/devtools/dbg-script-actors.js");
|
||||||
|
|
||||||
|
let instance1 = new ThreadActor();
|
||||||
|
let instance2 = new ThreadActor();
|
||||||
|
do_check_eq(instance1._breakpointStore, ThreadActor._breakpointStore);
|
||||||
|
do_check_eq(instance2._breakpointStore, ThreadActor._breakpointStore);
|
||||||
|
do_check_eq(instance1._breakpointStore, instance2._breakpointStore);
|
||||||
|
}
|
@ -60,3 +60,4 @@ tail =
|
|||||||
[test_framebindings-05.js]
|
[test_framebindings-05.js]
|
||||||
[test_pause_exceptions-01.js]
|
[test_pause_exceptions-01.js]
|
||||||
[test_pause_exceptions-02.js]
|
[test_pause_exceptions-02.js]
|
||||||
|
[test_breakpointstore.js]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user