Bug 761439 - Make IndirectProxyHandler::nativeCall indirect (r=sfink)
authorLuke Wagner <luke@mozilla.com>
Mon, 04 Jun 2012 16:34:45 -0700
changeset 95902 807490eb9bbd9bcc53f6c18e067ca95805efc54a
parent 95901 ae2b223b5e7c14f0bc0531ea2f7d9942a0844f94
child 95903 4cb9c03a380463a1026f03e93bf2f6d37890acdf
push id22859
push useremorley@mozilla.com
push dateWed, 06 Jun 2012 08:23:59 +0000
treeherdermozilla-central@a6c39a15557b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs761439
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 761439 - Make IndirectProxyHandler::nativeCall indirect (r=sfink)
js/src/jit-test/tests/basic/testBug761439.js
js/src/jsproxy.cpp
js/src/jswrapper.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testBug761439.js
@@ -0,0 +1,5 @@
+var b = new ArrayBuffer(4);
+var dv = new DataView(b);
+dv.setInt32(0, 42);
+var w = wrap(dv);
+assertEq(DataView.prototype.getInt32.call(w, 0), 42);
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -454,16 +454,17 @@ IndirectProxyHandler::construct(JSContex
         return InvokeConstructor(cx, GetCall(proxy), argc, argv, rval);
     return Invoke(cx, UndefinedValue(), fval, argc, argv, rval);
 }
 
 bool
 IndirectProxyHandler::nativeCall(JSContext *cx, JSObject *proxy, Class *clasp,
                                  Native native, CallArgs args)
 {
+    args.thisv() = ObjectValue(*GetProxyTargetObject(proxy));
     return CallJSNative(cx, native, args);
 }
 
 bool
 IndirectProxyHandler::hasInstance(JSContext *cx, JSObject *proxy, const Value *vp,
                                   bool *bp)
 {
     JSBool b;
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -701,17 +701,17 @@ CrossCompartmentWrapper::nativeCall(JSCo
     Value *srcend = srcArgs.array() + srcArgs.length();
     Value *dst = dstArgs.base();
     for (; src != srcend; ++src, ++dst) {
         *dst = *src;
         if (!call.destination->wrap(cx, dst))
             return false;
     }
 
-    if (!DirectWrapper::nativeCall(cx, wrapper, clasp, native, dstArgs))
+    if (!CallJSNative(cx, native, dstArgs))
         return false;
 
     srcArgs.rval() = dstArgs.rval();
     dstArgs.pop();
     call.leave();
     return call.origin->wrap(cx, &srcArgs.rval());
 }