mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1173385 - Calling $$("") should throw an exception. r=fitzgen
This commit is contained in:
parent
09c0e2cd11
commit
d4141a4a01
@ -811,18 +811,14 @@ WebConsoleActor.prototype =
|
||||
if (evalResult) {
|
||||
if ("return" in evalResult) {
|
||||
result = evalResult.return;
|
||||
}
|
||||
else if ("yield" in evalResult) {
|
||||
} else if ("yield" in evalResult) {
|
||||
result = evalResult.yield;
|
||||
}
|
||||
else if ("throw" in evalResult) {
|
||||
} else if ("throw" in evalResult) {
|
||||
let error = evalResult.throw;
|
||||
errorGrip = this.createValueGrip(error);
|
||||
let errorToString = evalInfo.window
|
||||
.evalInGlobalWithBindings("ex + ''", {ex: error});
|
||||
if (errorToString && typeof errorToString.return == "string") {
|
||||
errorMessage = errorToString.return;
|
||||
}
|
||||
errorMessage = error && (typeof error === "object")
|
||||
? error.unsafeDereference().toString()
|
||||
: "" + error;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,11 @@ function startTest() {
|
||||
removeEventListener("load", startTest);
|
||||
attachConsole([], state => {
|
||||
gState = state;
|
||||
let tests = [checkQuerySelectorAll, checkQuerySelectorAllNotExist];
|
||||
let tests = [
|
||||
checkQuerySelectorAll,
|
||||
checkQuerySelectorAllNotExist,
|
||||
checkQuerySelectorAllException
|
||||
];
|
||||
runTests(tests, testEnd);
|
||||
}, true);
|
||||
}
|
||||
@ -54,6 +58,23 @@ let checkQuerySelectorAllNotExist = Task.async(function*() {
|
||||
nextTest();
|
||||
});
|
||||
|
||||
let checkQuerySelectorAllException = Task.async(function*() {
|
||||
info ("$$ returns an exception if an invalid selector was provided");
|
||||
let response = yield evaluateJS("$$(':foo')");
|
||||
checkObject(response, {
|
||||
input: "$$(':foo')",
|
||||
exceptionMessage: "SyntaxError: An invalid or illegal string was specified",
|
||||
exception: {
|
||||
preview: {
|
||||
kind: "DOMException",
|
||||
name: "SyntaxError",
|
||||
message: "An invalid or illegal string was specified"
|
||||
}
|
||||
}
|
||||
});
|
||||
nextTest();
|
||||
});
|
||||
|
||||
function basicResultCheck(response, input, output) {
|
||||
checkObject(response, {
|
||||
from: gState.actor,
|
||||
|
Loading…
Reference in New Issue
Block a user