зеркало из https://github.com/mozilla/pjs.git
Bug 631615: suppress CSS parser diagnostics in ParseSelectorString. r=dbaron a2.0=dbaron
This commit is contained in:
Родитель
cfd1f8c19c
Коммит
ff869fa5b1
|
@ -459,6 +459,7 @@ _TEST_FILES2 = \
|
|||
test_bug466080.html \
|
||||
bug466080.sjs \
|
||||
test_bug625722.html \
|
||||
test_bug631615.html \
|
||||
$(NULL)
|
||||
|
||||
# This test fails on the Mac for some reason
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=631615
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 631615</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=631615">Mozilla Bug 631615</a>
|
||||
<pre id="monitor">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
|
||||
var consoleService =
|
||||
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
||||
|
||||
var messageCount = 0;
|
||||
var monitor = document.getElementById("monitor");
|
||||
|
||||
var listener = {
|
||||
observe: function(message) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
if (message.message === "sentinel") {
|
||||
is(messageCount, 0, "should have been no console messages");
|
||||
removeListener();
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
messageCount++;
|
||||
var err = "" + messageCount + ": " + message.message + "\n";
|
||||
monitor.appendChild(document.createTextNode(err));
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
if (iid.equals(Ci.nsIConsoleListener) ||
|
||||
iid.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Cr.NS_NOINTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
function addListener() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
consoleService.reset();
|
||||
consoleService.registerListener(listener);
|
||||
}
|
||||
|
||||
function removeListener() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
consoleService.unregisterListener(listener);
|
||||
}
|
||||
|
||||
function postSentinel() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
consoleService.logStringMessage("sentinel");
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function doTest() {
|
||||
var html = document.documentElement;
|
||||
var results;
|
||||
var matches = html.matchesSelector || html.mozMatchesSelector;
|
||||
|
||||
addListener();
|
||||
try {
|
||||
results = "return: " +
|
||||
matches.call(html, "[test!='']:sizzle") + "\n";
|
||||
} catch (e) {
|
||||
results = "throws: " + e + "\n";
|
||||
}
|
||||
|
||||
monitor.appendChild(document.createTextNode(results));
|
||||
is(results.slice(0, 6), "throws", "looking for an exception");
|
||||
|
||||
postSentinel();
|
||||
}
|
||||
doTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1259,7 +1259,15 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString,
|
|||
PRBool success = ParseSelectorList(*aSelectorList, PRUnichar(0));
|
||||
PRBool prefixErr = mFoundUnresolvablePrefix;
|
||||
|
||||
OUTPUT_ERROR();
|
||||
// We deliberately do not call OUTPUT_ERROR here, because all our
|
||||
// callers map a failure return to a JS exception, and if that JS
|
||||
// exception is caught, people don't want to see parser diagnostics;
|
||||
// see e.g. http://bugs.jquery.com/ticket/7535
|
||||
// It would be nice to be able to save the parser diagnostics into
|
||||
// the exception, so that if it _isn't_ caught we can report them
|
||||
// along with the usual uncaught-exception message, but we don't
|
||||
// have any way to do that at present; see bug 631621.
|
||||
CLEAR_ERROR();
|
||||
ReleaseScanner();
|
||||
|
||||
if (success) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче