Bug 498000 - Throw a better error when toString is called cross-origin on an XPCNativeWrapper from an unprivileged context. r+sr=bzbarsky
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 01 Jul 2009 12:12:04 -0700
changeset 29945 85acdb9128ce699374a725e7000cb9daff19f22e
parent 29944 8312b1fdc8519f4bee84812e92cd24082d53c471
child 29946 e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea
push idunknown
push userunknown
push dateunknown
bugs498000
milestone1.9.2a1pre
Bug 498000 - Throw a better error when toString is called cross-origin on an XPCNativeWrapper from an unprivileged context. r+sr=bzbarsky
js/src/xpconnect/src/XPCNativeWrapper.cpp
--- a/js/src/xpconnect/src/XPCNativeWrapper.cpp
+++ b/js/src/xpconnect/src/XPCNativeWrapper.cpp
@@ -1154,17 +1154,19 @@ XPC_NW_toString(JSContext *cx, JSObject 
 {
   while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
     obj = STOBJ_GET_PROTO(obj);
     if (!obj) {
       return ThrowException(NS_ERROR_UNEXPECTED, cx);
     }
   }
 
-  if (!EnsureLegalActivity(cx, obj)) {
+  if (!EnsureLegalActivity(cx, obj,
+                           GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING),
+                           XPCWrapper::sSecMgrGetProp)) {
     return JS_FALSE;
   }
 
   // Protected by EnsureLegalActivity.
   XPCWrappedNative *wrappedNative = XPCNativeWrapper::SafeGetWrappedNative(obj);
 
   if (!wrappedNative) {
     // toString() called on XPCNativeWrapper.prototype