Bug 989665 - Console API should clone objects propertly. Crash fixed, r=bz

This commit is contained in:
Andrea Marchesini 2014-04-02 10:09:29 +01:00
parent aa8fe650e6
commit e8e8e6036e
3 changed files with 23 additions and 1 deletions

View File

@ -74,7 +74,7 @@ ConsoleStructuredCloneCallbacksRead(JSContext* aCx,
}
nsTArray<nsString>* strings = static_cast<nsTArray<nsString>*>(aClosure);
MOZ_ASSERT(strings->Length() <= aData);
MOZ_ASSERT(strings->Length() > aData);
JS::Rooted<JS::Value> value(aCx);
if (!xpc::StringToJsval(aCx, strings->ElementAt(aData), &value)) {

View File

@ -14,6 +14,7 @@ support-files =
[test_bug913761.html]
[test_bug978522.html]
[test_bug979109.html]
[test_bug989665.html]
[test_clearTimeoutIntervalNoArg.html]
[test_consoleEmptyStack.html]
[test_constructor-assignment.html]

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=989665
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 989665</title>
<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=989665">Mozilla Bug 989665</a>
<script type="application/javascript">
w = new Worker("data:text/javascript;charset=UTF-8, console.log('%s', {toString: function() { throw 3 }}); ");
ok(true, "This test should not crash.");
</script>
</body>
</html>