Skip to content

Commit

Permalink
Backout changesets ded0d64f6786:03f041d03f24 and 30cbd1abde1a (bug 93…
Browse files Browse the repository at this point in the history
…5696, bug 933834 and bug 939194) for build bustage.
  • Loading branch information
Ms2ger committed Nov 17, 2013
1 parent 945fa9a commit cca4d45
Show file tree
Hide file tree
Showing 57 changed files with 535 additions and 310 deletions.
6 changes: 3 additions & 3 deletions caps/src/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ IDToString(JSContext *cx, jsid id_)
if (JSID_IS_STRING(id))
return JS_GetInternedStringChars(JSID_TO_STRING(id));

JS::Rooted<JS::Value> idval(cx);
if (!JS_IdToValue(cx, id, idval.address()))
JS::Value idval;
if (!JS_IdToValue(cx, id, &idval))
return nullptr;
JSString *str = JS::ToString(cx, idval);
JSString *str = JS_ValueToString(cx, idval);
if(!str)
return nullptr;
return JS_GetStringCharsZ(cx, str);
Expand Down
22 changes: 22 additions & 0 deletions content/base/public/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,28 @@ NS_IMETHOD MozRemove() MOZ_FINAL \
nsINode::Remove(); \
return NS_OK; \
} \
using nsINode::GetOnmouseenter; \
using nsINode::SetOnmouseenter; \
NS_IMETHOD GetOnmouseenter(JSContext* cx, JS::Value* aOnmouseenter) MOZ_FINAL \
{ \
return Element::GetOnmouseenter(cx, aOnmouseenter); \
} \
NS_IMETHOD SetOnmouseenter(JSContext* cx, \
const JS::Value& aOnmouseenter) MOZ_FINAL \
{ \
return Element::SetOnmouseenter(cx, aOnmouseenter); \
} \
using nsINode::GetOnmouseleave; \
using nsINode::SetOnmouseleave; \
NS_IMETHOD GetOnmouseleave(JSContext* cx, JS::Value* aOnmouseleave) MOZ_FINAL \
{ \
return Element::GetOnmouseleave(cx, aOnmouseleave); \
} \
NS_IMETHOD SetOnmouseleave(JSContext* cx, \
const JS::Value& aOnmouseleave) MOZ_FINAL \
{ \
return Element::SetOnmouseleave(cx, aOnmouseleave); \
} \
NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) MOZ_FINAL \
{ \
*_retval = Element::GetClientRects().get(); \
Expand Down
4 changes: 3 additions & 1 deletion content/base/public/nsINode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,9 @@ class nsINode : public mozilla::dom::EventTarget
*/
#define EVENT(name_, id_, type_, struct_) \
mozilla::dom::EventHandlerNonNull* GetOn##name_(); \
void SetOn##name_(mozilla::dom::EventHandlerNonNull* listener);
void SetOn##name_(mozilla::dom::EventHandlerNonNull* listener); \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
#define TOUCH_EVENT EVENT
#define DOCUMENT_ONLY_EVENT EVENT
#include "nsEventNameList.h"
Expand Down
7 changes: 7 additions & 0 deletions content/base/public/nsIXMLHttpRequest.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ interface nsIDOMBlob;
[scriptable, builtinclass, uuid(ac97e161-9f1d-4163-adc9-e9a59e18682c)]
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
// event handler attributes
[implicit_jscontext] attribute jsval onabort;
[implicit_jscontext] attribute jsval onerror;
[implicit_jscontext] attribute jsval onload;
[implicit_jscontext] attribute jsval onloadstart;
[implicit_jscontext] attribute jsval onprogress;
[implicit_jscontext] attribute jsval ontimeout;
[implicit_jscontext] attribute jsval onloadend;
};

[scriptable, builtinclass, uuid(df3796fa-d98a-4185-9dda-d2f2b56a5d38)]
Expand Down
6 changes: 3 additions & 3 deletions content/base/src/nsDOMBlobBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ nsDOMMultipartFile::ParseBlobArrayArgument(JSContext* aCx, JS::Value& aValue,
}

// coerce it to a string
JSString* str = JS::ToString(aCx, element);
JSString* str = JS_ValueToString(aCx, element);
NS_ENSURE_TRUE(str, NS_ERROR_TYPE_ERR);
blobSet.AppendString(str, aNativeEOL, aCx);
}
Expand Down Expand Up @@ -342,7 +342,7 @@ nsDOMMultipartFile::InitChromeFile(JSContext* aCx,
mIsFromNsiFile = true;
} else {
// It's a string
JSString* str = JS::ToString(aCx, JS::Handle<JS::Value>::fromMarkedLocation(&aArgv[0]));
JSString* str = JS_ValueToString(aCx, aArgv[0]);
NS_ENSURE_TRUE(str, NS_ERROR_XPC_BAD_CONVERT_JS);

nsDependentJSString xpcomStr;
Expand Down Expand Up @@ -397,7 +397,7 @@ nsDOMMultipartFile::InitFile(JSContext* aCx,
}

// File name
JSString* str = JS::ToString(aCx, JS::Handle<JS::Value>::fromMarkedLocation(&aArgv[1]));
JSString* str = JS_ValueToString(aCx, aArgv[1]);
NS_ENSURE_TRUE(str, NS_ERROR_XPC_BAD_CONVERT_JS);

nsDependentJSString xpcomStr;
Expand Down
15 changes: 15 additions & 0 deletions content/base/src/nsINode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,21 @@ nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
if (elm) { \
elm->SetEventHandler(nsGkAtoms::on##name_, EmptyString(), handler); \
} \
} \
NS_IMETHODIMP nsINode::GetOn##name_(JSContext *cx, JS::Value *vp) { \
EventHandlerNonNull* h = GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP nsINode::SetOn##name_(JSContext *cx, const JS::Value &v) { \
nsRefPtr<EventHandlerNonNull> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new EventHandlerNonNull(callable); \
} \
SetOn##name_(handler); \
return NS_OK; \
}
#define TOUCH_EVENT EVENT
#define DOCUMENT_ONLY_EVENT EVENT
Expand Down
8 changes: 8 additions & 0 deletions content/base/src/nsXMLHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)

NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadstart)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, progress)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, abort)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, error)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, load)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, timeout)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadend)

void
nsXHREventTarget::DisconnectFromOwner()
{
Expand Down
32 changes: 31 additions & 1 deletion content/html/content/src/HTMLBodyElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,32 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
// nsGenericHTMLElement::GetOnError returns
// already_AddRefed<EventHandlerNonNull> while other getters return
// EventHandlerNonNull*, so allow passing in the type to use here.
#define FORWARDED_EVENT_HELPER(name_, forwardto_, type_, getter_type_) \
NS_IMETHODIMP \
HTMLBodyElement::GetOn##name_(JSContext *cx, JS::Value *vp) \
{ \
getter_type_ h = forwardto_::GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP \
HTMLBodyElement::SetOn##name_(JSContext *cx, const JS::Value &v) \
{ \
nsRefPtr<type_> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new type_(callable); \
} \
forwardto_::SetOn##name_(handler); \
return NS_OK; \
}
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, EventHandlerNonNull, \
EventHandlerNonNull*)
#define ERROR_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, \
EventHandlerNonNull, nsCOMPtr<EventHandlerNonNull>)
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* \
HTMLBodyElement::GetOn##name_() \
Expand All @@ -508,7 +534,8 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
return globalWin->SetOn##name_(handler); \
}
} \
FORWARDED_EVENT_HELPER(name_, HTMLBodyElement, type_, type_*)
#define WINDOW_EVENT(name_, id_, type_, struct_) \
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
Expand All @@ -517,6 +544,9 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef ERROR_EVENT
#undef FORWARDED_EVENT
#undef FORWARDED_EVENT_HELPER
#undef EVENT

} // namespace dom
Expand Down
4 changes: 4 additions & 0 deletions content/html/content/src/HTMLBodyElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class HTMLBodyElement MOZ_FINAL : public nsGenericHTMLElement,
// Event listener stuff; we need to declare only the ones we need to
// forward to window that don't come from nsIDOMHTMLBodyElement.
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* GetOn##name_(); \
void SetOn##name_(type_* handler);
Expand All @@ -66,6 +69,7 @@ class HTMLBodyElement MOZ_FINAL : public nsGenericHTMLElement,
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef FORWARDED_EVENT
#undef EVENT

void GetText(nsString& aText)
Expand Down
32 changes: 31 additions & 1 deletion content/html/content/src/HTMLFrameSetElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,32 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
// nsGenericHTMLElement::GetOnError returns
// already_AddRefed<EventHandlerNonNull> while other getters return
// EventHandlerNonNull*, so allow passing in the type to use here.
#define FORWARDED_EVENT_HELPER(name_, forwardto_, type_, getter_type_) \
NS_IMETHODIMP \
HTMLFrameSetElement::GetOn##name_(JSContext *cx, JS::Value *vp) \
{ \
getter_type_ h = forwardto_::GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP \
HTMLFrameSetElement::SetOn##name_(JSContext *cx, const JS::Value &v) \
{ \
nsRefPtr<type_> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new type_(callable); \
} \
forwardto_::SetOn##name_(handler); \
return NS_OK; \
}
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, EventHandlerNonNull, \
EventHandlerNonNull*)
#define ERROR_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, \
EventHandlerNonNull, nsCOMPtr<EventHandlerNonNull>)
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* \
HTMLFrameSetElement::GetOn##name_() \
Expand All @@ -368,7 +394,8 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
return globalWin->SetOn##name_(handler); \
}
} \
FORWARDED_EVENT_HELPER(name_, HTMLFrameSetElement, type_, type_*)
#define WINDOW_EVENT(name_, id_, type_, struct_) \
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
Expand All @@ -377,6 +404,9 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef ERROR_EVENT
#undef FORWARDED_EVENT
#undef FORWARDED_EVENT_HELPER
#undef EVENT

} // namespace dom
Expand Down
4 changes: 4 additions & 0 deletions content/html/content/src/HTMLFrameSetElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ class HTMLFrameSetElement MOZ_FINAL : public nsGenericHTMLElement,
// Event listener stuff; we need to declare only the ones we need to
// forward to window that don't come from nsIDOMHTMLFrameSetElement.
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* GetOn##name_(); \
void SetOn##name_(type_* handler);
Expand All @@ -96,6 +99,7 @@ class HTMLFrameSetElement MOZ_FINAL : public nsGenericHTMLElement,
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef FORWARDED_EVENT
#undef EVENT

// These override the SetAttr methods in nsGenericHTMLElement (need
Expand Down
4 changes: 2 additions & 2 deletions content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,8 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
JS::Rooted<JSObject*> jsobj(cx, holder->GetJSObject());
NS_ENSURE_STATE(jsobj);

JS::Rooted<JS::Value> v(cx, JS::ObjectValue(*jsobj));
JS::Rooted<JSString*> str(cx, JS::ToString(cx, v));
JS::Rooted<JSString*> str(cx,
JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);

nsDependentJSString value;
Expand Down
2 changes: 1 addition & 1 deletion dom/audiochannel/AudioChannelService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR
return NS_OK;
}

JS::Rooted<JSString*> jsKey(cx, JS::ToString(cx, key));
JS::Rooted<JSString*> jsKey(cx, JS_ValueToString(cx, key));
if (!jsKey) {
return NS_OK;
}
Expand Down
31 changes: 18 additions & 13 deletions dom/base/nsDOMClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,10 @@ IdToString(JSContext *cx, jsid id)
{
if (JSID_IS_STRING(id))
return JSID_TO_STRING(id);
JS::Rooted<JS::Value> idval(cx);
if (!::JS_IdToValue(cx, id, idval.address()))
jsval idval;
if (!::JS_IdToValue(cx, id, &idval))
return nullptr;
return JS::ToString(cx, idval);
return JS_ValueToString(cx, idval);
}

static inline nsresult
Expand Down Expand Up @@ -3292,7 +3292,7 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, JS::MutableHandle<JS::Value> vp
NS_ENSURE_SUCCESS(rv, rv);

// Grab the value we're being set to before we stomp on |vp|
JS::Rooted<JSString*> val(cx, JS::ToString(cx, vp));
JS::Rooted<JSString*> val(cx, ::JS_ValueToString(cx, vp));
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);

// Make sure |val| stays alive below
Expand Down Expand Up @@ -4198,10 +4198,9 @@ nsHTMLDocumentSH::ReleaseDocument(JSFreeOp *fop, JSObject *obj)
bool
nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
// Handle document.all("foo") style access to document.all.

if (args.length() != 1) {
if (argc != 1) {
// XXX: Should throw NS_ERROR_XPC_NOT_ENOUGH_ARGS for argc < 1,
// and create a new NS_ERROR_XPC_TOO_MANY_ARGS for argc > 1? IE
// accepts nothing other than one arg.
Expand All @@ -4211,17 +4210,18 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
}

// Convert all types to string.
JS::Rooted<JSString*> str(cx, JS::ToString(cx, args[0]));
JS::Rooted<JSString*> str(cx, ::JS_ValueToString(cx, JS_ARGV(cx, vp)[0]));
if (!str) {
return false;
}

// If we are called via document.all(id) instead of document.all.item(i) or
// another method, use the document.all callee object as self.
JSObject *self;
if (args.calleev().isObject() &&
JS_GetClass(&args.calleev().toObject()) == &sHTMLDocumentAllClass) {
self = &args.calleev().toObject();
JS::Value callee = JS_CALLEE(cx, vp);
if (callee.isObject() &&
JS_GetClass(&callee.toObject()) == &sHTMLDocumentAllClass) {
self = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
} else {
self = JS_THIS_OBJECT(cx, vp);
if (!self)
Expand All @@ -4235,7 +4235,13 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
return false;
}

return ::JS_GetUCProperty(cx, self, chars, length, args.rval());
JS::Rooted<JS::Value> value(cx);
if (!::JS_GetUCProperty(cx, self, chars, length, &value)) {
return false;
}

*vp = value;
return true;
}

// StringArray helper
Expand Down Expand Up @@ -4430,8 +4436,7 @@ nsStorage2SH::SetProperty(nsIXPConnectWrappedNative *wrapper,
nsDependentJSString keyStr;
NS_ENSURE_TRUE(keyStr.init(cx, key), NS_ERROR_UNEXPECTED);

JS::Rooted<JS::Value> val(cx, *vp);
JSString *value = JS::ToString(cx, val);
JSString *value = ::JS_ValueToString(cx, *vp);
NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);

nsDependentJSString valueStr;
Expand Down
Loading

0 comments on commit cca4d45

Please sign in to comment.