mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
debfadcca4
- Bug 751387 - Fix crash caused by out-of-bounds accesses in command line options handling. r=bholley (240670c35) - Bug 1162187 - Pass around AutoJSAPI instead of cx to give us more control over error handling. r=glandium (702954016) - Bug 1162187 - Factor out single line argument processing into a helper. r=glandium (56efce591) - Bug 1162187 - Use the AutoJSAPI machinery to handle xpcshell exceptions. r=glandium (162309001) - Bug 1162187 - Remove the custom XPCShell error reporter. r=glandium (523d84539) - Bug 1162187 - Remove ignoreReportedErrors. r=glandium (072f247a3) - Bug 1161590 - xpcshell needs to initialize graphics prefs so that GfxInfo::GetFeatureStatus can check preferences. r=ehsan (5a8415817) - Bug 1166243 - Remove build() function from js and xpc shells. r=bholley,r=efaust (8537f2259) - Bug 1182357 - Implement support for optional size_is for arrays passed from JS. r=mrbkap (0d22d3f34) - missing profiler parts of Bug 1092311 - Fix IndexedDB profiler markers and logging (a68567bbb) - Bug 1086999 - CSP: Asterisk (*) wildcard should not allow blob:, data:, or filesystem: when matching source expressions (r=fabrice,pauljt) (7757a92ae) - Bug 1105827 - Part 1: Add stub PermissionStatus implementation. r=baku (2bd4c1dd3) - Bug 635134 - Adds X11 run-time check for Gtk3 backend. r=karlt (7e9304f5e) - Bug 994541 - Enable BasicCompositor OMTC on linux. r=Bas (c9a266beb) - Bug 1105827 - Part 2: Add stub Permissions implementation. r=baku (751f5e9e6) - Bug 1105827 - Part 3: Implement Permissions.query. r=baku (a30a48cbe) - Bug 1105827 - Part 4: Add Navigator.permissions. r=baku (0d70fc5e6) - Bug 1174861 - Remove unnecessary Rooted from Prefable::isEnabled(). r=bholley (a0893081d)
114 lines
3.9 KiB
C++
114 lines
3.9 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
*/
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "jsapi-tests/tests.h"
|
|
|
|
#include "jsobjinlines.h"
|
|
|
|
#include "vm/ArgumentsObject-inl.h"
|
|
|
|
using namespace js;
|
|
|
|
static const char NORMAL_ZERO[] =
|
|
"function f() { return arguments; }";
|
|
static const char NORMAL_ONE[] =
|
|
"function f(a) { return arguments; }";
|
|
static const char NORMAL_TWO[] =
|
|
"function f(a, b) { return arguments; }";
|
|
static const char NORMAL_THREE[] =
|
|
"function f(a, b, c) { return arguments; }";
|
|
|
|
static const char STRICT_ZERO[] =
|
|
"function f() { 'use strict'; return arguments; }";
|
|
static const char STRICT_ONE[] =
|
|
"function f() { 'use strict'; return arguments; }";
|
|
static const char STRICT_TWO[] =
|
|
"function f() { 'use strict'; return arguments; }";
|
|
static const char STRICT_THREE[] =
|
|
"function f() { 'use strict'; return arguments; }";
|
|
|
|
static const char * const CALL_CODES[] =
|
|
{ "f()", "f(0)", "f(0, 1)", "f(0, 1, 2)", "f(0, 1, 2, 3)", "f(0, 1, 2, 3, 4)" };
|
|
|
|
BEGIN_TEST(testArgumentsObject)
|
|
{
|
|
return ExhaustiveTest<0>(NORMAL_ZERO) &&
|
|
ExhaustiveTest<1>(NORMAL_ZERO) &&
|
|
ExhaustiveTest<2>(NORMAL_ZERO) &&
|
|
ExhaustiveTest<0>(NORMAL_ONE) &&
|
|
ExhaustiveTest<1>(NORMAL_ONE) &&
|
|
ExhaustiveTest<2>(NORMAL_ONE) &&
|
|
ExhaustiveTest<3>(NORMAL_ONE) &&
|
|
ExhaustiveTest<0>(NORMAL_TWO) &&
|
|
ExhaustiveTest<1>(NORMAL_TWO) &&
|
|
ExhaustiveTest<2>(NORMAL_TWO) &&
|
|
ExhaustiveTest<3>(NORMAL_TWO) &&
|
|
ExhaustiveTest<4>(NORMAL_TWO) &&
|
|
ExhaustiveTest<0>(NORMAL_THREE) &&
|
|
ExhaustiveTest<1>(NORMAL_THREE) &&
|
|
ExhaustiveTest<2>(NORMAL_THREE) &&
|
|
ExhaustiveTest<3>(NORMAL_THREE) &&
|
|
ExhaustiveTest<4>(NORMAL_THREE) &&
|
|
ExhaustiveTest<5>(NORMAL_THREE) &&
|
|
ExhaustiveTest<0>(STRICT_ZERO) &&
|
|
ExhaustiveTest<1>(STRICT_ZERO) &&
|
|
ExhaustiveTest<2>(STRICT_ZERO) &&
|
|
ExhaustiveTest<0>(STRICT_ONE) &&
|
|
ExhaustiveTest<1>(STRICT_ONE) &&
|
|
ExhaustiveTest<2>(STRICT_ONE) &&
|
|
ExhaustiveTest<3>(STRICT_ONE) &&
|
|
ExhaustiveTest<0>(STRICT_TWO) &&
|
|
ExhaustiveTest<1>(STRICT_TWO) &&
|
|
ExhaustiveTest<2>(STRICT_TWO) &&
|
|
ExhaustiveTest<3>(STRICT_TWO) &&
|
|
ExhaustiveTest<4>(STRICT_TWO) &&
|
|
ExhaustiveTest<0>(STRICT_THREE) &&
|
|
ExhaustiveTest<1>(STRICT_THREE) &&
|
|
ExhaustiveTest<2>(STRICT_THREE) &&
|
|
ExhaustiveTest<3>(STRICT_THREE) &&
|
|
ExhaustiveTest<4>(STRICT_THREE) &&
|
|
ExhaustiveTest<5>(STRICT_THREE);
|
|
}
|
|
|
|
static const size_t MAX_ELEMS = 6;
|
|
|
|
template<size_t ArgCount> bool
|
|
ExhaustiveTest(const char funcode[])
|
|
{
|
|
RootedValue v(cx);
|
|
EVAL(funcode, &v);
|
|
|
|
EVAL(CALL_CODES[ArgCount], &v);
|
|
Rooted<ArgumentsObject*> argsobj(cx, &v.toObjectOrNull()->as<ArgumentsObject>());
|
|
|
|
JS::AutoValueArray<MAX_ELEMS> elems(cx);
|
|
|
|
for (size_t i = 0; i <= ArgCount; i++) {
|
|
for (size_t j = 0; j <= ArgCount - i; j++) {
|
|
ClearElements(elems);
|
|
CHECK(argsobj->maybeGetElements(i, j, elems.begin()));
|
|
for (size_t k = 0; k < j; k++)
|
|
CHECK_SAME(elems[k], INT_TO_JSVAL(i + k));
|
|
for (size_t k = j; k < MAX_ELEMS - 1; k++)
|
|
CHECK(elems[k].isNull());
|
|
CHECK_SAME(elems[MAX_ELEMS - 1], INT_TO_JSVAL(42));
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
template <size_t N>
|
|
static void
|
|
ClearElements(JS::AutoValueArray<N>& elems)
|
|
{
|
|
for (size_t i = 0; i < elems.length() - 1; i++)
|
|
elems[i].setNull();
|
|
elems[elems.length() - 1].setInt32(42);
|
|
}
|
|
END_TEST(testArgumentsObject)
|