Backed out 2 changesets (bug 871315) because different compilers have different standards on what is and is not C++

Backed out changeset d0d2e13e8b83 (bug 871315)
Backed out changeset be3976bd2d57 (bug 871315)

Landed on a CLOSED TREE
This commit is contained in:
Ehsan Akhgari 2013-05-13 14:42:03 -04:00
parent 3307a8e159
commit 7c06c8a034
10 changed files with 23 additions and 23 deletions

View File

@ -858,10 +858,11 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
options.setFileAndLine(url.get(), lineNo) options.setFileAndLine(url.get(), lineNo)
.setVersion(SCRIPTVERSION_DEFAULT); .setVersion(SCRIPTVERSION_DEFAULT);
JS::Rooted<JSObject*> handlerFun(cx); JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
result = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, JSObject *handlerFun = nullptr;
result = nsJSUtils::CompileFunction(cx, rootedNull, options,
nsAtomCString(aListenerStruct->mTypeAtom), nsAtomCString(aListenerStruct->mTypeAtom),
argCount, argNames, *body, handlerFun.address()); argCount, argNames, *body, &handlerFun);
NS_ENSURE_SUCCESS(result, result); NS_ENSURE_SUCCESS(result, result);
handler = handlerFun; handler = handlerFun;
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE); NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);

View File

@ -95,7 +95,7 @@ nsEventListenerInfo::GetJSVal(JSContext* aCx,
nsCOMPtr<nsIJSEventListener> jsl = do_QueryInterface(mListener); nsCOMPtr<nsIJSEventListener> jsl = do_QueryInterface(mListener);
if (jsl) { if (jsl) {
JS::Handle<JSObject*> handler(jsl->GetHandler().Ptr()->Callable()); JSObject *handler = jsl->GetHandler().Ptr()->Callable();
if (handler) { if (handler) {
aAc.construct(aCx, handler); aAc.construct(aCx, handler);
*aJSVal = OBJECT_TO_JSVAL(handler); *aJSVal = OBJECT_TO_JSVAL(handler);

View File

@ -1566,9 +1566,9 @@ HTMLMediaElement::GetMozSampleRate(uint32_t* aMozSampleRate)
} }
// Helper struct with arguments for our hash iterator. // Helper struct with arguments for our hash iterator.
typedef struct MOZ_STACK_CLASS { typedef struct {
JSContext* cx; JSContext* cx;
JS::HandleObject tags; JSObject* tags;
bool error; bool error;
} MetadataIterCx; } MetadataIterCx;

View File

@ -1163,8 +1163,8 @@ UndoManager::DispatchTransactionEvent(JSContext* aCx, const nsAString& aType,
nsCOMArray<nsIVariant> keepAlive; nsCOMArray<nsIVariant> keepAlive;
nsTArray<nsIVariant*> transactionItems; nsTArray<nsIVariant*> transactionItems;
for (uint32_t i = 0; i < items.Length(); i++) { for (uint32_t i = 0; i < items.Length(); i++) {
JS::Rooted<JS::Value> txVal(aCx, JS::ObjectValue(*items[i]->Callback())); JS::Value txVal = JS::ObjectValue(*items[i]->Callback());
if (!JS_WrapValue(aCx, txVal.address())) { if (!JS_WrapValue(aCx, &txVal)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return; return;
} }

View File

@ -3122,8 +3122,8 @@ nsGenericHTMLElement::GetItemValue(JSContext* aCx, JSObject* aScope,
} }
if (ItemScope()) { if (ItemScope()) {
JS::Rooted<JS::Value> v(aCx); JS::Value v;
if (!mozilla::dom::WrapObject(aCx, scope, this, v.address())) { if (!mozilla::dom::WrapObject(aCx, scope, this, &v)) {
aError.Throw(NS_ERROR_FAILURE); aError.Throw(NS_ERROR_FAILURE);
return JS::UndefinedValue(); return JS::UndefinedValue();
} }

View File

@ -177,8 +177,8 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
AutoPushJSContext cx(aContext->GetNativeContext()); AutoPushJSContext cx(aContext->GetNativeContext());
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject()); JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper; nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
JS::Rooted<JS::Value> v(cx); JS::Value v;
rv = nsContentUtils::WrapNative(cx, global, aBoundElement, v.address(), rv = nsContentUtils::WrapNative(cx, global, aBoundElement, &v,
getter_AddRefs(wrapper)); getter_AddRefs(wrapper));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

View File

@ -3653,9 +3653,8 @@ XULDocument::ExecuteScript(nsIScriptContext * aContext, JSScript* aScriptObject)
NS_ENSURE_TRUE(mScriptGlobalObject, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mScriptGlobalObject, NS_ERROR_NOT_INITIALIZED);
// Execute the precompiled script with the given version // Execute the precompiled script with the given version
JS::Rooted<JSScript*> script(aContext->GetNativeContext(), aScriptObject);
JSObject* global = mScriptGlobalObject->GetGlobalJSObject(); JSObject* global = mScriptGlobalObject->GetGlobalJSObject();
return aContext->ExecuteScript(script, global); return aContext->ExecuteScript(aScriptObject, global);
} }
nsresult nsresult

View File

@ -1397,14 +1397,14 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
if (mDB) { if (mDB) {
// database // database
JS::Rooted<JS::Value> jsdatabase(jscontext); JS::Value jsdatabase;
rv = nsContentUtils::WrapNative(jscontext, scope, mDB, rv = nsContentUtils::WrapNative(jscontext, scope, mDB,
&NS_GET_IID(nsIRDFCompositeDataSource), &NS_GET_IID(nsIRDFCompositeDataSource),
jsdatabase.address(), getter_AddRefs(wrapper)); &jsdatabase, getter_AddRefs(wrapper));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
bool ok; bool ok;
ok = JS_SetProperty(jscontext, jselement, "database", jsdatabase.address()); ok = JS_SetProperty(jscontext, jselement, "database", &jsdatabase);
NS_ASSERTION(ok, "unable to set database property"); NS_ASSERTION(ok, "unable to set database property");
if (! ok) if (! ok)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -1412,16 +1412,16 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
{ {
// builder // builder
JS::Rooted<JS::Value> jsbuilder(jscontext); JS::Value jsbuilder;
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper; nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
rv = nsContentUtils::WrapNative(jscontext, jselement, rv = nsContentUtils::WrapNative(jscontext, jselement,
static_cast<nsIXULTemplateBuilder*>(this), static_cast<nsIXULTemplateBuilder*>(this),
&NS_GET_IID(nsIXULTemplateBuilder), &NS_GET_IID(nsIXULTemplateBuilder),
jsbuilder.address(), getter_AddRefs(wrapper)); &jsbuilder, getter_AddRefs(wrapper));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
bool ok; bool ok;
ok = JS_SetProperty(jscontext, jselement, "builder", jsbuilder.address()); ok = JS_SetProperty(jscontext, jselement, "builder", &jsbuilder);
if (! ok) if (! ok)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View File

@ -1754,8 +1754,8 @@ nsGlobalWindow::UnmarkGrayTimers()
Function* f = timeout->mScriptHandler->GetCallback(); Function* f = timeout->mScriptHandler->GetCallback();
if (f) { if (f) {
// Callable() already does xpc_UnmarkGrayObject. // Callable() already does xpc_UnmarkGrayObject.
DebugOnly<JS::Handle<JSObject*> > o = f->Callable(); DebugOnly<JSObject*> o = f->Callable();
MOZ_ASSERT(!xpc_IsGrayGCThing(o.value), "Should have been unmarked"); MOZ_ASSERT(!xpc_IsGrayGCThing(o), "Should have been unmarked");
} }
} }
} }

View File

@ -31,7 +31,7 @@ public:
MOZ_ASSERT(JS_ObjectIsCallable(nullptr, aCallable)); MOZ_ASSERT(JS_ObjectIsCallable(nullptr, aCallable));
} }
JS::Handle<JSObject*> Callable() const JSObject* Callable() const
{ {
return Callback(); return Callback();
} }