author | Bill McCloskey <wmccloskey@mozilla.com> |
Thu, 01 Aug 2013 17:44:03 -0700 | |
changeset 153313 | e42f623fd5741709d52e890872ef3595dc32484c |
parent 153312 | 64ed054f2b53a7c9e647b30e21d74eba57729501 |
child 153314 | 10468c8e4d75ff5dca0bf97c1c263907f595e298 |
push id | 2859 |
push user | akeybl@mozilla.com |
push date | Mon, 16 Sep 2013 19:14:59 +0000 |
treeherder | mozilla-beta@87d3c51cd2bf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 899804 |
milestone | 25.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
|
--- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -26,18 +26,16 @@ #include "nsPrintfCString.h" #include "mozilla/dom/HTMLObjectElement.h" #include "mozilla/dom/HTMLObjectElementBinding.h" #include "mozilla/dom/HTMLSharedObjectElement.h" #include "mozilla/dom/HTMLEmbedElementBinding.h" #include "mozilla/dom/HTMLAppletElementBinding.h" -#include "JavaScriptParent.h" - namespace mozilla { namespace dom { JSErrorFormatString ErrorFormatString[] = { #define MSG_DEF(_name, _argc, _str) \ { _str, _argc, JSEXN_TYPEERR }, #include "mozilla/dom/Errors.msg" #undef MSG_DEF @@ -1743,27 +1741,16 @@ InterfaceHasInstance(JSContext* cx, JS:: "ID?"); if (domClass && domClass->mInterfaceChain[clasp->mDepth] == clasp->mPrototypeID) { *bp = true; return true; } - JS::Rooted<JSObject*> unwrapped(cx, js::CheckedUnwrap(instance, true)); - if (unwrapped && jsipc::JavaScriptParent::IsCPOW(unwrapped)) { - bool boolp = false; - if (!jsipc::JavaScriptParent::DOMInstanceOf(unwrapped, clasp->mPrototypeID, - clasp->mDepth, &boolp)) { - return false; - } - *bp = boolp; - return true; - } - JS::Rooted<JS::Value> protov(cx); DebugOnly<bool> ok = JS_GetProperty(cx, obj, "prototype", &protov); MOZ_ASSERT(ok, "Someone messed with our prototype property?"); JS::Rooted<JSObject*> interfacePrototype(cx, &protov.toObject()); MOZ_ASSERT(IsDOMIfaceAndProtoClass(js::GetObjectClass(interfacePrototype)), "Someone messed with our prototype property?"); @@ -1795,31 +1782,16 @@ InterfaceHasInstance(JSContext* cx, JS:: *bp = false; return true; } JS::Rooted<JSObject*> instanceObject(cx, &vp.toObject()); return InterfaceHasInstance(cx, obj, instanceObject, bp); } -JSBool -InterfaceHasInstance(JSContext* cx, int prototypeID, int depth, - JS::Handle<JSObject*> instance, - JSBool* bp) -{ - const DOMClass* domClass = GetDOMClass(js::UncheckedUnwrap(instance)); - - MOZ_ASSERT(!domClass || prototypeID != prototypes::id::_ID_Count, - "Why do we have a hasInstance hook if we don't have a prototype " - "ID?"); - - *bp = (domClass && domClass->mInterfaceChain[depth] == prototypeID); - return true; -} - bool ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj) { GlobalObject global(cx, obj); if (global.Failed()) { return false; } nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(global.Get());
--- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2069,20 +2069,16 @@ ReparentWrapper(JSContext* aCx, JS::Hand */ JSBool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*> instance, JSBool* bp); JSBool InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp, JSBool* bp); -JSBool -InterfaceHasInstance(JSContext* cx, int prototypeID, int depth, - JS::Handle<JSObject*> instance, - JSBool* bp); // Helper for lenient getters/setters to report to console. If this // returns false, we couldn't even get a global. bool ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj); inline JSObject* GetUnforgeableHolder(JSObject* aGlobal, prototypes::ID aId)
--- a/dom/bindings/Makefile.in +++ b/dom/bindings/Makefile.in @@ -69,17 +69,16 @@ CPPSRCS = \ CallbackInterface.cpp \ CallbackObject.cpp \ DOMJSProxyHandler.cpp \ $(NULL) endif LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src \ -I$(topsrcdir)/js/xpconnect/wrappers \ - -I$(topsrcdir)/js/ipc \ -I$(topsrcdir)/content/canvas/src \ -I$(topsrcdir)/content/html/content/src \ -I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \ -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/dom/battery \ -I$(topsrcdir)/dom/indexedDB \ -I$(topsrcdir)/content/xslt/src/base \ -I$(topsrcdir)/content/xslt/src/xpath \
--- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -2,17 +2,16 @@ * vim: set ts=4 sw=4 et tw=80: * * 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 "JavaScriptChild.h" #include "mozilla/dom/ContentChild.h" -#include "mozilla/dom/BindingUtils.h" #include "nsContentUtils.h" #include "xpcprivate.h" #include "jsfriendapi.h" #include "nsCxPusher.h" using namespace JS; using namespace mozilla; using namespace mozilla::jsipc; @@ -621,32 +620,8 @@ JavaScriptChild::AnswerInstanceOf(const ConvertID(iid, &nsiid); nsresult rv = xpc::HasInstance(cx, obj, &nsiid, instanceof); if (rv != NS_OK) return fail(cx, rs); return ok(rs); } - -bool -JavaScriptChild::AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, - const int &depth, - ReturnStatus *rs, bool *instanceof) -{ - AutoSafeJSContext cx; - JSAutoRequest request(cx); - - *instanceof = false; - - RootedObject obj(cx, findObject(objId)); - if (!obj) - return false; - - JSAutoCompartment comp(cx, obj); - - JSBool tmp; - if (!mozilla::dom::InterfaceHasInstance(cx, prototypeID, depth, obj, &tmp)) - return fail(cx, rs); - *instanceof = tmp; - - return ok(rs); -}
--- a/js/ipc/JavaScriptChild.h +++ b/js/ipc/JavaScriptChild.h @@ -61,18 +61,16 @@ class JavaScriptChild bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, bool *result); bool AnswerClassName(const ObjectId &objId, nsString *result); bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray<nsString> *names); bool AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, ReturnStatus *rs, bool *instanceof); - bool AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth, - ReturnStatus *rs, bool *instanceof); protected: JSObject *unwrap(JSContext *cx, ObjectId id); private: bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); bool fail(JSContext *cx, ReturnStatus *rs); bool ok(ReturnStatus *rs);
--- a/js/ipc/JavaScriptParent.cpp +++ b/js/ipc/JavaScriptParent.cpp @@ -509,18 +509,17 @@ JavaScriptParent::init() return false; return true; } bool JavaScriptParent::makeId(JSContext *cx, JSObject *obj, ObjectId *idp) { - obj = js::CheckedUnwrap(obj, false); - if (!obj || !IsProxy(obj) || GetProxyHandler(obj) != &CPOWProxyHandler::singleton) { + if (!IsProxy(obj) || GetProxyHandler(obj) != &CPOWProxyHandler::singleton) { JS_ReportError(cx, "cannot ipc non-cpow object"); return false; } *idp = idOf(obj); return true; } @@ -652,29 +651,8 @@ JavaScriptParent::instanceOf(JSObject *o if (!CallInstanceOf(objId, iid, &status, bp)) return NS_ERROR_UNEXPECTED; if (!status.ok()) return NS_ERROR_UNEXPECTED; return NS_OK; } - -/* static */ bool -JavaScriptParent::DOMInstanceOf(JSObject *obj, int prototypeID, int depth, bool *bp) -{ - return ParentOf(obj)->domInstanceOf(obj, prototypeID, depth, bp); -} - -bool -JavaScriptParent::domInstanceOf(JSObject *obj, int prototypeID, int depth, bool *bp) -{ - ObjectId objId = idOf(obj); - - ReturnStatus status; - if (!CallDOMInstanceOf(objId, prototypeID, depth, &status, bp)) - return false; - - if (!status.ok()) - return false; - - return true; -}
--- a/js/ipc/JavaScriptParent.h +++ b/js/ipc/JavaScriptParent.h @@ -61,26 +61,19 @@ class JavaScriptParent void decref(); void incref(); void destroyFromContent(); void drop(JSObject *obj); static bool IsCPOW(JSObject *obj); - static nsresult InstanceOf(JSObject *obj, const nsID *id, bool *bp); - nsresult instanceOf(JSObject *obj, const nsID *id, bool *bp); - /* - * Check that |obj| is a DOM wrapper whose prototype chain contains - * |prototypeID| at depth |depth|. - */ - static bool DOMInstanceOf(JSObject *obj, int prototypeID, int depth, bool *bp); - bool domInstanceOf(JSObject *obj, int prototypeID, int depth, bool *bp); + nsresult instanceOf(JSObject *obj, const nsID *id, bool *bp); protected: JSObject *unwrap(JSContext *cx, ObjectId objId); private: bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); bool getPropertyNames(JSContext *cx, JS::HandleObject proxy, uint32_t flags, js::AutoIdVector &props); ObjectId idOf(JSObject *obj);
--- a/js/ipc/PJavaScript.ipdl +++ b/js/ipc/PJavaScript.ipdl @@ -36,16 +36,15 @@ child: urgent IsExtensible(uint64_t objId) returns (ReturnStatus rs, bool result); urgent Call(uint64_t objId, JSParam[] argv) returns (ReturnStatus rs, JSVariant result, JSParam[] outparams); urgent ObjectClassIs(uint64_t objId, uint32_t classValue) returns (bool result); urgent ClassName(uint64_t objId) returns (nsString name); urgent GetPropertyNames(uint64_t objId, uint32_t flags) returns (ReturnStatus rs, nsString[] names); urgent InstanceOf(uint64_t objId, JSIID iid) returns (ReturnStatus rs, bool instanceof); - urgent DOMInstanceOf(uint64_t objId, int prototypeID, int depth) returns (ReturnStatus rs, bool instanceof); parent: async __delete__(); }; } }