author | Olli Pettay <Olli.Pettay@helsinki.fi> |
Wed, 14 Dec 2011 21:54:46 +0200 | |
changeset 82580 | 1ab5ed4f93bf3d395c025ea387858c21c4eb0bf4 |
parent 82579 | 01a26239462a99c30b0b153f128db081a959845a |
child 82581 | 141ae3a6ccd2dd8074ef3174e791f2831bb86d80 |
push id | 21672 |
push user | opettay@mozilla.com |
push date | Wed, 14 Dec 2011 20:37:16 +0000 |
treeherder | mozilla-central@0507a68e994b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jst |
bugs | 675884 |
milestone | 11.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/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -56,16 +56,17 @@ #include "nsGkAtoms.h" #include "nsMutationEvent.h" #include "nsContentUtils.h" #include "nsIURI.h" #include "nsIScriptSecurityManager.h" #include "nsIScriptError.h" #include "nsDOMPopStateEvent.h" #include "mozilla/Preferences.h" +#include "nsJSUtils.h" using namespace mozilla; static const char* const sEventNames[] = { "mousedown", "mouseup", "click", "dblclick", "mouseenter", "mouseleave", "mouseover", "mouseout", "MozMouseHittest", "mousemove", "contextmenu", "keydown", "keyup", "keypress", "focus", "blur", "load", "popstate", "beforescriptexecute", "afterscriptexecute", "beforeunload", "unload", @@ -400,25 +401,19 @@ nsDOMEvent::Initialize(nsISupports* aOwn JSAutoRequest ar(aCx); JSString* jsstr = JS_ValueToString(aCx, aArgv[0]); if (!jsstr) { return NS_ERROR_DOM_SYNTAX_ERR; } JS::Anchor<JSString*> deleteProtector(jsstr); - size_t length; - const jschar* chars = JS_GetStringCharsAndLength(aCx, jsstr, &length); - if (!chars) { - return NS_ERROR_OUT_OF_MEMORY; - } - nsAutoString type; - type.Assign(chars, length); - deleteProtector.clear(); + nsDependentJSString type; + NS_ENSURE_STATE(type.init(aCx, jsstr)); nsCOMPtr<nsISupports> dict; if (aArgc >= 2 && !JSVAL_IS_PRIMITIVE(aArgv[1])) { nsContentUtils::XPConnect()->WrapJS(aCx, JSVAL_TO_OBJECT(aArgv[1]), EventInitIID(), getter_AddRefs(dict)); } nsresult rv = InitFromCtor(type, dict);