mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Bug 1319049 - fix RegExp previewer for worker debugging;r=ochameau
MozReview-Commit-ID: D8hRGV0MWoZ --HG-- extra : rebase_source : 7b24311401b9cf7241eead84ca8b3c0f95f6a0cd
This commit is contained in:
parent
52b4c327cc
commit
70997ce55a
@ -1,4 +1,4 @@
|
||||
// Check that the date previewer works in the console of a worker debugger.
|
||||
// Check that the date and regexp previewers work in the console of a worker debugger.
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -15,6 +15,11 @@ add_task(function* testPausedByConsole() {
|
||||
ok(executed.textContent.includes("1970-01-01T00:00:00.000Z"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
info("Check RegExp objects can be used in the console");
|
||||
executed = yield jsterm.execute("new RegExp('.*')");
|
||||
ok(executed.textContent.includes("/.*/"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
|
@ -84,7 +84,6 @@ support-files =
|
||||
test-console-output-04.html
|
||||
test-console-output-dom-elements.html
|
||||
test-console-output-events.html
|
||||
test-console-output-regexp.html
|
||||
test-console-column.html
|
||||
test-consoleiframes.html
|
||||
test-console-trace-async.html
|
||||
|
@ -3,19 +3,18 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test the webconsole output for various types of objects.
|
||||
// Test the webconsole output for a regexp object.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/test-console-output-regexp.html";
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test regexp output";
|
||||
|
||||
var inputTests = [
|
||||
// 0
|
||||
{
|
||||
input: "/foo/igym",
|
||||
output: "/foo/gimy",
|
||||
printOutput: "Error: source called",
|
||||
printOutput: "/foo/gimy",
|
||||
inspectable: true,
|
||||
},
|
||||
];
|
||||
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test the web console output for RegExp</title>
|
||||
<!--
|
||||
- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
<p>hello world!</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
Object.defineProperty(RegExp.prototype, "flags", {
|
||||
get: function() { throw Error("flags called"); }
|
||||
})
|
||||
Object.defineProperty(RegExp.prototype, "source", {
|
||||
get: function() { throw Error("source called"); },
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1158,7 +1158,11 @@ DebuggerServer.ObjectActorPreviewers = {
|
||||
}],
|
||||
|
||||
RegExp: [function ({obj, hooks}, grip) {
|
||||
let str = RegExp.prototype.toString.call(obj.unsafeDereference());
|
||||
let str = DevToolsUtils.callPropertyOnObject(obj, "toString");
|
||||
if (typeof str != "string") {
|
||||
return false;
|
||||
}
|
||||
|
||||
grip.displayString = hooks.createValueGrip(str);
|
||||
return true;
|
||||
}],
|
||||
|
Loading…
Reference in New Issue
Block a user