Backed out 2 changesets (bug 969382) for potentially breaking the build on a CLOSED TREE

Backed out changeset 70fcde1101a1 (bug 969382)
Backed out changeset 8eb38600d76a (bug 969382)
This commit is contained in:
Wes Kocher 2014-02-28 14:33:22 -08:00
parent b3cc62388d
commit 1e96448b75
8 changed files with 21 additions and 137 deletions

View File

@ -68,7 +68,6 @@ UNIFIED_SOURCES += [
'testToIntWidth.cpp',
'testTrap.cpp',
'testTypedArrays.cpp',
'testUncaughtError.cpp',
'testUTF8.cpp',
'testXDR.cpp',
]

View File

@ -1,56 +0,0 @@
/* 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"
using JS::CreateTypeError;
using JS::Rooted;
using JS::ObjectValue;
using JS::Value;
static size_t uncaughtCount = 0;
BEGIN_TEST(testUncaughtError)
{
JSErrorReporter old = JS_SetErrorReporter(cx, UncaughtErrorReporter);
CHECK(uncaughtCount == 0);
Rooted<JSString*> empty(cx, JS_GetEmptyString(JS_GetRuntime(cx)));
if (!empty)
return false;
Rooted<Value> err(cx);
if (!CreateTypeError(cx, empty, empty, 0, 0, nullptr, empty, &err))
return false;
Rooted<JSObject*> errObj(cx, &err.toObject());
if (!JS_SetProperty(cx, errObj, "fileName", err))
return false;
if (!JS_SetProperty(cx, errObj, "lineNumber", err))
return false;
if (!JS_SetProperty(cx, errObj, "columnNumber", err))
return false;
if (!JS_SetProperty(cx, errObj, "stack", err))
return false;
if (!JS_SetProperty(cx, errObj, "message", err))
return false;
JS_SetPendingException(cx, err);
JS_ReportPendingException(cx);
CHECK(uncaughtCount == 1);
JS_SetErrorReporter(cx, old);
return true;
}
static void
UncaughtErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
{
uncaughtCount++;
}
END_TEST(testUncaughtError)

View File

@ -32,8 +32,6 @@
#include "jsobjinlines.h"
#include "vm/ErrorObject-inl.h"
using namespace js;
using namespace js::gc;
using namespace js::types;
@ -897,10 +895,10 @@ js_CopyErrorObject(JSContext *cx, Handle<ErrorObject*> err, HandleObject scope)
RootedString message(cx, err->getMessage());
if (message && !cx->compartment()->wrap(cx, message.address()))
return nullptr;
RootedString fileName(cx, err->fileName(cx));
RootedString fileName(cx, err->fileName());
if (!cx->compartment()->wrap(cx, fileName.address()))
return nullptr;
RootedString stack(cx, err->stack(cx));
RootedString stack(cx, err->stack());
if (!cx->compartment()->wrap(cx, stack.address()))
return nullptr;
uint32_t lineNumber = err->lineNumber();

View File

@ -427,11 +427,6 @@ class JSObject : public js::ObjectImpl
return getSlot(index);
}
inline const js::HeapSlot &getReservedSlotRef(uint32_t index) const {
JS_ASSERT(index < JSSLOT_FREE(getClass()));
return getSlotRef(index);
}
inline js::HeapSlot &getReservedSlotRef(uint32_t index) {
JS_ASSERT(index < JSSLOT_FREE(getClass()));
return getSlotRef(index);

View File

@ -1,44 +0,0 @@
/* -*- 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/. */
#ifndef vm_ErrorObject_inl_h
#define vm_ErrorObject_inl_h
#include "vm/ErrorObject.h"
#include "jscntxt.h"
inline JSString *
js::ErrorObject::fileName(JSContext *cx) const
{
const HeapSlot &slot = getReservedSlotRef(FILENAME_SLOT);
return slot.isString() ? slot.toString() : cx->names().empty;
}
inline uint32_t
js::ErrorObject::lineNumber() const
{
const HeapSlot &slot = getReservedSlotRef(LINENUMBER_SLOT);
return slot.isInt32() ? slot.toInt32() : 0;
}
inline uint32_t
js::ErrorObject::columnNumber() const
{
const HeapSlot &slot = getReservedSlotRef(COLUMNNUMBER_SLOT);
return slot.isInt32() ? slot.toInt32() : 0;
}
inline JSString *
js::ErrorObject::stack(JSContext *cx) const
{
const HeapSlot &slot = getReservedSlotRef(STACK_SLOT);
if (slot.isString())
return slot.toString();
return cx->names().empty;
}
#endif /* vm_ErrorObject_inl_h */

View File

@ -5,7 +5,7 @@
* 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 "vm/ErrorObject-inl.h"
#include "vm/ErrorObject.h"
#include "jsexn.h"
@ -125,7 +125,7 @@ js::ErrorObject::getOrCreateErrorReport(JSContext *cx)
// Filename.
JSAutoByteString filenameStr;
if (!filenameStr.encodeLatin1(cx, fileName(cx)))
if (!filenameStr.encodeLatin1(cx, fileName()))
return nullptr;
report.filename = filenameStr.ptr();

View File

@ -85,13 +85,24 @@ class ErrorObject : public JSObject
JSErrorReport * getOrCreateErrorReport(JSContext *cx);
inline JSString * fileName(JSContext *cx) const;
inline uint32_t lineNumber() const;
inline uint32_t columnNumber() const;
inline JSString * stack(JSContext *cx) const;
JSString * fileName() const {
return getReservedSlot(FILENAME_SLOT).toString();
}
uint32_t lineNumber() const {
return getReservedSlot(LINENUMBER_SLOT).toInt32();
}
uint32_t columnNumber() const {
return getReservedSlot(COLUMNNUMBER_SLOT).toInt32();
}
JSString * stack() const {
return getReservedSlot(STACK_SLOT).toString();
}
JSString * getMessage() const {
const HeapSlot &slot = getReservedSlotRef(MESSAGE_SLOT);
HeapSlot &slot = const_cast<ErrorObject*>(this)->getReservedSlotRef(MESSAGE_SLOT);
return slot.isString() ? slot.toString() : nullptr;
}
};

View File

@ -1325,17 +1325,13 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
return slots[slot - fixed];
}
const HeapSlot *getSlotAddressUnchecked(uint32_t slot) const {
HeapSlot *getSlotAddressUnchecked(uint32_t slot) {
uint32_t fixed = numFixedSlots();
if (slot < fixed)
return fixedSlots() + slot;
return slots + (slot - fixed);
}
HeapSlot *getSlotAddressUnchecked(uint32_t slot) {
return const_cast<ObjectImpl*>(this)->getSlotAddressUnchecked(slot);
}
HeapSlot *getSlotAddress(uint32_t slot) {
/*
* This can be used to get the address of the end of the slots for the
@ -1346,26 +1342,11 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
return getSlotAddressUnchecked(slot);
}
const HeapSlot *getSlotAddress(uint32_t slot) const {
/*
* This can be used to get the address of the end of the slots for the
* object, which may be necessary when fetching zero-length arrays of
* slots (e.g. for callObjVarArray).
*/
MOZ_ASSERT(slotInRange(slot, SENTINEL_ALLOWED));
return getSlotAddressUnchecked(slot);
}
HeapSlot &getSlotRef(uint32_t slot) {
MOZ_ASSERT(slotInRange(slot));
return *getSlotAddress(slot);
}
const HeapSlot &getSlotRef(uint32_t slot) const {
MOZ_ASSERT(slotInRange(slot));
return *getSlotAddress(slot);
}
HeapSlot &nativeGetSlotRef(uint32_t slot) {
JS_ASSERT(isNative() && slot < slotSpan());
return getSlotRef(slot);