author | Brian Grinstead <bgrinstead@mozilla.com> |
Wed, 31 Aug 2016 15:31:59 -0700 | |
changeset 313145 | 62bde80d230d3e1f52d1faaf3769dc5682905525 |
parent 313144 | a1e635fc39e261b45e5799809a051b6b51a10f59 |
child 313146 | fb7c6b0343295392bac590c19b14e7e5dcccdc33 |
push id | 32127 |
push user | cbook@mozilla.com |
push date | Thu, 08 Sep 2016 10:52:18 +0000 |
treeherder | autoland@d00937cdf44d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 1298230 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/webconsole/test/browser_webconsole_exception_stackframe.js +++ b/devtools/client/webconsole/test/browser_webconsole_exception_stackframe.js @@ -45,17 +45,17 @@ function test() { webconsole: hud, messages: [{ text: "nonExistingMethodCall is not defined", category: CATEGORY_JS, severity: SEVERITY_ERROR, collapsible: true, stacktrace: stack, }, { - text: "An invalid or illegal string was specified", + text: "SyntaxError: 'buggy;selector' is not a valid selector", category: CATEGORY_JS, severity: SEVERITY_ERROR, collapsible: true, stacktrace: [{ file: TEST_FILE, fn: "domAPI", line: 25, }, {
--- a/devtools/client/webconsole/test/browser_webconsole_output_04.js +++ b/devtools/client/webconsole/test/browser_webconsole_output_04.js @@ -53,19 +53,18 @@ var inputTests = [ printOutput: '"TypeError: window.foobar is not a function"', inspectable: true, variablesViewLabel: "TypeError", }, // 4 { input: "testDOMException()", - output: 'DOMException [SyntaxError: "An invalid or illegal string was ' + - 'specified"', - printOutput: '"SyntaxError: An invalid or illegal string was specified"', + output: `DOMException [SyntaxError: "'foo;()bar!' is not a valid selector"`, + printOutput: `"SyntaxError: 'foo;()bar!' is not a valid selector"`, inspectable: true, variablesViewLabel: "SyntaxError", }, // 5 { input: "testCSSStyleDeclaration()", output: 'CSS2Properties { color: "green", font-size: "2em" }',
--- a/devtools/shared/webconsole/test/test_jsterm_queryselector.html +++ b/devtools/shared/webconsole/test/test_jsterm_queryselector.html @@ -87,22 +87,22 @@ let checkQuerySelectorAllNotExist = Task 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", + exceptionMessage: "SyntaxError: ':foo' is not a valid selector", exception: { preview: { kind: "DOMException", name: "SyntaxError", - message: "An invalid or illegal string was specified" + message: "':foo' is not a valid selector" } } }); nextTest(); }); function basicResultCheck(response, input, output) { checkObject(response, {
--- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -2701,33 +2701,43 @@ nsINode::ParseSelectorList(const nsAStri { nsIDocument* doc = OwnerDoc(); nsIDocument::SelectorCache& cache = doc->GetSelectorCache(); nsCSSSelectorList* selectorList = nullptr; bool haveCachedList = cache.GetList(aSelectorString, &selectorList); if (haveCachedList) { if (!selectorList) { // Invalid selector. - aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); + aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR, + NS_LITERAL_CSTRING("'") + NS_ConvertUTF16toUTF8(aSelectorString) + + NS_LITERAL_CSTRING("' is not a valid selector") + ); } return selectorList; } nsCSSParser parser(doc->CSSLoader()); aRv = parser.ParseSelectorString(aSelectorString, doc->GetDocumentURI(), 0, // XXXbz get the line number! &selectorList); if (aRv.Failed()) { // We hit this for syntax errors, which are quite common, so don't // use NS_ENSURE_SUCCESS. (For example, jQuery has an extended set // of selectors, but it sees if we can parse them first.) MOZ_ASSERT(aRv.ErrorCodeIs(NS_ERROR_DOM_SYNTAX_ERR), "Unexpected error, so cached version won't return it"); + + // Change the error message to match above. + aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR, + NS_LITERAL_CSTRING("'") + NS_ConvertUTF16toUTF8(aSelectorString) + + NS_LITERAL_CSTRING("' is not a valid selector") + ); + cache.CacheList(aSelectorString, nullptr); return nullptr; } // Filter out pseudo-element selectors from selectorList nsCSSSelectorList** slot = &selectorList; do { nsCSSSelectorList* cur = *slot;