1. ms2ger
  2. XPConnect patches

Commits

ms2ger  committed 374f2a8

Final cleanup.

  • Participants
  • Parent commits 8d29ec1
  • Branches default

Comments (0)

Files changed (5)

File AutoJSErrorAndExceptionEater

View file
  • Ignore whitespace
 new file mode 100644
 --- /dev/null
 +++ b/js/xpconnect/src/AutoJSErrorAndExceptionEater.h
-@@ -0,0 +1,32 @@
+@@ -0,0 +1,36 @@
++/* 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 AutoJSErrorAndExceptionEater_h
 +#define AutoJSErrorAndExceptionEater_h
 +
-+#include "mozilla/AutoRestore.h"
-+
-+#include "nscore.h"
++#include "mozilla/GuardObjects.h"
 +
 +#include "jsapi.h"
 +
 +public:
 +    AutoJSErrorAndExceptionEater(JSContext* aCX
 +                                 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-+        : mCX(aCX),
-+          mOldErrorReporter(JS_SetErrorReporter(mCX, nsnull)),
-+          mOldExceptionState(JS_SaveExceptionState(mCX)) {
++      : mCX(aCX)
++      , mOldErrorReporter(JS_SetErrorReporter(mCX, NULL))
++      , mOldExceptionState(JS_SaveExceptionState(mCX))
++    {
 +        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 +    }
 +    ~AutoJSErrorAndExceptionEater()
 +        JS_SetErrorReporter(mCX, mOldErrorReporter);
 +        JS_RestoreExceptionState(mCX, mOldExceptionState);
 +    }
++
 +private:
-+    JSContext*        mCX;
-+    JSErrorReporter   mOldErrorReporter;
-+    JSExceptionState* mOldExceptionState;
++    JSContext *mCX;
++    JSErrorReporter mOldErrorReporter;
++    JSExceptionState *mOldExceptionState;
 +    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 +};
 +
 diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h
 --- a/js/xpconnect/src/xpcprivate.h
 +++ b/js/xpconnect/src/xpcprivate.h
-@@ -491,40 +491,16 @@ extern JSBool
+@@ -489,40 +489,16 @@ extern JSBool
  xpc_DumpEvalInJSStackFrame(JSContext* cx, uint32_t frameno, const char* text);
  
  extern JSBool

File AutoMarkingPtr

View file
  • Ignore whitespace
 new file mode 100644
 --- /dev/null
 +++ b/js/xpconnect/src/AutoMarkingPtr.h
-@@ -0,0 +1,223 @@
+@@ -0,0 +1,227 @@
++/* 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 AutoMarkingPtr_h
 +#define AutoMarkingPtr_h
 +
 +class XPCMarkableJSVal
 +{
 +public:
-+    XPCMarkableJSVal(jsval val) : mVal(val), mValPtr(&mVal) {}
-+    XPCMarkableJSVal(jsval *pval) : mVal(JSVAL_VOID), mValPtr(pval) {}
++    XPCMarkableJSVal(JS::Value val) : mVal(val), mValPtr(&mVal) {}
++    XPCMarkableJSVal(JS::Value *pval) : mVal(JSVAL_VOID), mValPtr(pval) {}
 +    ~XPCMarkableJSVal() {}
 +    void Mark() {}
-+    void TraceJS(JSTracer* trc)
++    void TraceJS(JSTracer *trc)
 +    {
 +        JS_CALL_VALUE_TRACER(trc, *mValPtr, "XPCMarkableJSVal");
 +    }
-+    void AutoTrace(JSTracer* trc) {}
++    void AutoTrace(JSTracer *trc) {}
 +private:
 +    XPCMarkableJSVal(); // not implemented
-+    jsval  mVal;
-+    jsval* mValPtr;
++    JS::Value mVal;
++    JS::Value *mValPtr;
 +};
 +
 +/***************************************************************************/
 +class AutoMarkingPtr
 +{
 +public:
-+    AutoMarkingPtr(XPCCallContext& ccx)
-+        : mNext(nsnull), mTLS(ccx.GetThreadData())
++    AutoMarkingPtr(XPCCallContext &ccx)
++        : mNext(NULL), mTLS(ccx.GetThreadData())
 +    {
 +        Link();
 +    }
 +    AutoMarkingPtr()
-+        : mNext(nsnull), mTLS(nsnull)
++        : mNext(NULL), mTLS(NULL)
 +    {}
 +
 +    virtual ~AutoMarkingPtr()
 +        Unlink();
 +    }
 +
-+    void Init(XPCCallContext& ccx)
++    void Init(XPCCallContext &ccx)
 +    {
 +        NS_ASSERTION(!mTLS, "Already init'ed!");
 +        mTLS = ccx.GetThreadData();
 +    {
 +        if (!mTLS)
 +            return;
-+        AutoMarkingPtr** list = mTLS->GetAutoRootsAdr();
++        AutoMarkingPtr **list = mTLS->GetAutoRootsAdr();
 +        mNext = *list;
 +        *list = this;
 +    }
 +    {
 +        if (!mTLS)
 +            return;
-+        AutoMarkingPtr** cur = mTLS->GetAutoRootsAdr();
++        AutoMarkingPtr **cur = mTLS->GetAutoRootsAdr();
 +        while (*cur != this) {
 +            NS_ASSERTION(*cur, "This object not in list!");
 +            cur = &(*cur)->mNext;
 +        }
 +        *cur = mNext;
-+        mTLS = nsnull;
++        mTLS = NULL;
 +    }
 +
-+    AutoMarkingPtr* GetNext()
++    AutoMarkingPtr *GetNext()
 +    {
 +        return mNext;
 +    }
 +
-+    virtual void TraceJS(JSTracer* trc) = 0;
++    virtual void TraceJS(JSTracer *trc) = 0;
 +    virtual void MarkAfterJSFinalize() = 0;
 +
 +protected:
-+    AutoMarkingPtr* mNext;
-+    XPCPerThreadData* mTLS;
++    AutoMarkingPtr *mNext;
++    XPCPerThreadData *mTLS;
 +};
 +
 +// More joy of macros...
 +{                                                                             \
 +public:                                                                       \
 +    class_ ()                                                                 \
-+        : AutoMarkingPtr(), mPtr(nsnull) {}                                   \
-+    class_ (XPCCallContext& ccx, type_ * ptr = nsnull)                        \
++        : AutoMarkingPtr(), mPtr(NULL) {}                                   \
++    class_ (XPCCallContext& ccx, type_ * ptr = NULL)                        \
 +        : AutoMarkingPtr(ccx), mPtr(ptr) {}                                   \
 +    virtual ~ class_ () {}                                                    \
 +                                                                              \
 +{                                                                             \
 +public:                                                                       \
 +    class_ (XPCCallContext& ccx)                                              \
-+        : AutoMarkingPtr(ccx), mPtr(nsnull), mCount(0) {}                     \
++        : AutoMarkingPtr(ccx), mPtr(NULL), mCount(0) {}                     \
 +    class_ (XPCCallContext& ccx, type_** aPtr, PRUint32 aCount,               \
 +            bool aClear = false)                                              \
 +        : AutoMarkingPtr(ccx), mPtr(aPtr), mCount(aCount)                     \
 diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp
 --- a/js/xpconnect/src/XPCComponents.cpp
 +++ b/js/xpconnect/src/XPCComponents.cpp
-@@ -39,16 +39,17 @@
-  * the terms of any one of the MPL, the GPL or the LGPL.
-  *
+@@ -41,16 +41,17 @@
   * ***** END LICENSE BLOCK ***** */
  
  /* The "Components" xpcom objects for JavaScript. */
  
  #include "nsXPCComponents.h"
  
+ #include "mozilla/unused.h"
+ 
 +#include "AutoMarkingPtr.h"
  #include "nsJSCID.h"
  #include "nsJSID.h"
   *
   * ***** END LICENSE BLOCK ***** */
  
- /* Possibly shared proto object for XPCWrappedNative. */
+ /* Shared proto object for XPCWrappedNative. */
  
  #include "XPCWrappedNativeProto.h"
  
 diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h
 --- a/js/xpconnect/src/xpcprivate.h
 +++ b/js/xpconnect/src/xpcprivate.h
-@@ -492,193 +492,16 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx
+@@ -490,193 +490,16 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx
  
  extern JSBool
  xpc_DumpJSObject(JSObject* obj);

File AutoScriptEvaluate

View file
  • Ignore whitespace
 new file mode 100644
 --- /dev/null
 +++ b/js/xpconnect/src/AutoScriptEvaluate.h
-@@ -0,0 +1,53 @@
+@@ -0,0 +1,58 @@
++/* 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 AutoScriptEvaluate_h
 +#define AutoScriptEvaluate_h
 +
 +     * Saves the JSContext as well as initializing our state
 +     * @param cx The JSContext, this can be null, we don't do anything then
 +     */
-+    AutoScriptEvaluate(JSContext * cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
++    AutoScriptEvaluate(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
 +      : mJSContext(cx), mState(0), mErrorReporterSet(false)
 +      , mEvaluated(false), mContextHasThread(0)
 +    {
 +     * Does the post script evaluation and resets the error reporter
 +     */
 +    ~AutoScriptEvaluate();
++
 +private:
-+    JSContext* mJSContext;
-+    JSExceptionState* mState;
++    JSContext *mJSContext;
++    JSExceptionState *mState;
 +    bool mErrorReporterSet;
 +    bool mEvaluated;
-+    jsword mContextHasThread;
++    intptr_t mContextHasThread;
 +    JSAutoEnterCompartment mEnterCompartment;
 +    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 +
 diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h
 --- a/js/xpconnect/src/xpcprivate.h
 +++ b/js/xpconnect/src/xpcprivate.h
-@@ -493,59 +493,16 @@ extern JSBool
+@@ -489,59 +489,16 @@ extern JSBool
  xpc_DumpEvalInJSStackFrame(JSContext* cx, uint32_t frameno, const char* text);
  
  extern JSBool
 -    JSExceptionState* mState;
 -    bool mErrorReporterSet;
 -    bool mEvaluated;
--    jsword mContextHasThread;
+-    intptr_t mContextHasThread;
 -    JSAutoEnterCompartment mEnterCompartment;
 -    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 -

File PrincipalHolder

View file
  • Ignore whitespace
  		-I$(srcdir)/../wrappers \
  		-I$(srcdir)/../loader \
  		-I$(topsrcdir)/caps/include \
+diff --git a/js/xpconnect/src/PrincipalHolder.cpp b/js/xpconnect/src/PrincipalHolder.cpp
+new file mode 100644
+--- /dev/null
++++ b/js/xpconnect/src/PrincipalHolder.cpp
+@@ -0,0 +1,7 @@
++/* 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 "PrincipalHolder.h"
++
++NS_IMPL_THREADSAFE_ISUPPORTS1(PrincipalHolder, nsIScriptObjectPrincipal)
 diff --git a/js/xpconnect/src/PrincipalHolder.h b/js/xpconnect/src/PrincipalHolder.h
 new file mode 100644
 --- /dev/null

File nsScriptError

View file
  • Ignore whitespace
 new file mode 100644
 --- /dev/null
 +++ b/js/xpconnect/src/nsScriptError.h
-@@ -0,0 +1,35 @@
+@@ -0,0 +1,38 @@
++/* 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 nsScriptError_h
 +#define nsScriptError_h
 +
 +
 +// Definition of nsScriptError, defined here because we lack a place to put
 +// XPCOM objects associated with the JavaScript engine.
-+class nsScriptError : public nsIScriptError {
++class nsScriptError : public nsIScriptError
++{
 +public:
 +    nsScriptError();
 +
 +    virtual ~nsScriptError();
 +
-+  // TODO - do something reasonable on getting null from these babies.
-+
 +    NS_DECL_ISUPPORTS
 +    NS_DECL_NSICONSOLEMESSAGE
 +    NS_DECL_NSISCRIPTERROR
 diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h
 --- a/js/xpconnect/src/xpcprivate.h
 +++ b/js/xpconnect/src/xpcprivate.h
-@@ -495,45 +495,16 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx
+@@ -491,45 +491,16 @@ xpc_DumpEvalInJSStackFrame(JSContext* cx
  extern JSBool
  xpc_DumpJSObject(JSObject* obj);