Backed out 2 changesets (bug 969382) for potentially breaking the build on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 28 Feb 2014 14:33:22 -0800
changeset 171694 b8c1ff82160e557b0d08f75abd4161fa309df22d
parent 171693 cc06ddfe4b3a312b013bc1e48c37165fd3ae16da
child 171695 57cd2113f04409db47f71fa5f4f43a675e8d25a0
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs969382
milestone30.0a1
backs out70fcde1101a1a5fc5ffca4e40e6b66ee79ffadf6
8eb38600d76ab5e824f1de43027bc2ea237d8c1b
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)
js/src/jsapi-tests/moz.build
js/src/jsapi-tests/testUncaughtError.cpp
js/src/jsexn.cpp
js/src/jsobj.h
js/src/vm/ErrorObject-inl.h
js/src/vm/ErrorObject.cpp
js/src/vm/ErrorObject.h
js/src/vm/ObjectImpl.h
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -63,17 +63,16 @@ UNIFIED_SOURCES += [
     'testScriptObject.cpp',
     'testSetProperty.cpp',
     'testSourcePolicy.cpp',
     'testStringBuffer.cpp',
     'testStructuredClone.cpp',
     'testToIntWidth.cpp',
     'testTrap.cpp',
     'testTypedArrays.cpp',
-    'testUncaughtError.cpp',
     'testUTF8.cpp',
     'testXDR.cpp',
 ]
 
 if CONFIG['ENABLE_ION']:
     UNIFIED_SOURCES += [
         'testJitRValueAlloc.cpp',
     ]
deleted file mode 100644
--- a/js/src/jsapi-tests/testUncaughtError.cpp
+++ /dev/null
@@ -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)
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -27,18 +27,16 @@
 
 #include "gc/Marking.h"
 #include "vm/ErrorObject.h"
 #include "vm/GlobalObject.h"
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
-#include "vm/ErrorObject-inl.h"
-
 using namespace js;
 using namespace js::gc;
 using namespace js::types;
 
 using mozilla::ArrayLength;
 using mozilla::PodArrayZero;
 using mozilla::PodZero;
 
@@ -892,20 +890,20 @@ js_CopyErrorObject(JSContext *cx, Handle
         copyReport = CopyErrorReport(cx, errorReport);
         if (!copyReport)
             return nullptr;
     }
 
     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();
     uint32_t columnNumber = err->columnNumber();
     JSExnType errorType = err->type();
 
     // Create the Error object.
     return ErrorObject::create(cx, errorType, stack, fileName,
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -422,21 +422,16 @@ class JSObject : public js::ObjectImpl
     inline void nativeSetSlotWithType(js::ExclusiveContext *cx, js::Shape *shape,
                                       const js::Value &value);
 
     inline const js::Value &getReservedSlot(uint32_t index) const {
         JS_ASSERT(index < JSSLOT_FREE(getClass()));
         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);
     }
 
     void initReservedSlot(uint32_t index, const js::Value &v) {
         JS_ASSERT(index < JSSLOT_FREE(getClass()));
         initSlot(index, v);
deleted file mode 100644
--- a/js/src/vm/ErrorObject-inl.h
+++ /dev/null
@@ -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 */
--- a/js/src/vm/ErrorObject.cpp
+++ b/js/src/vm/ErrorObject.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sw=4 et tw=78:
  *
  * 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 "vm/ErrorObject-inl.h"
+#include "vm/ErrorObject.h"
 
 #include "jsexn.h"
 
 #include "vm/GlobalObject.h"
 
 #include "jsobjinlines.h"
 
 #include "vm/Shape-inl.h"
@@ -120,17 +120,17 @@ js::ErrorObject::getOrCreateErrorReport(
     PodZero(&report);
 
     // Type.
     JSExnType type_ = type();
     report.exnType = type_;
 
     // Filename.
     JSAutoByteString filenameStr;
-    if (!filenameStr.encodeLatin1(cx, fileName(cx)))
+    if (!filenameStr.encodeLatin1(cx, fileName()))
         return nullptr;
     report.filename = filenameStr.ptr();
 
     // Coordinates.
     report.lineno = lineNumber();
     report.column = columnNumber();
 
     // Message. Note that |new Error()| will result in an undefined |message|
--- a/js/src/vm/ErrorObject.h
+++ b/js/src/vm/ErrorObject.h
@@ -80,22 +80,33 @@ class ErrorObject : public JSObject
         const Value &slot = getReservedSlot(ERROR_REPORT_SLOT);
         if (slot.isUndefined())
             return nullptr;
         return static_cast<JSErrorReport*>(slot.toPrivate());
     }
 
     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;
     }
 };
 
 } // namespace js
 
 #endif // vm_ErrorObject_h_
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -1320,57 +1320,38 @@ class ObjectImpl : public gc::BarrieredC
     const Value &getSlot(uint32_t slot) const {
         MOZ_ASSERT(slotInRange(slot));
         uint32_t fixed = numFixedSlots();
         if (slot < fixed)
             return fixedSlots()[slot];
         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
          * 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);
     }
 
-    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);
     }
     const Value &nativeGetSlot(uint32_t slot) const {
         JS_ASSERT(isNative() && slot < slotSpan());
         return getSlot(slot);
     }