Bug 942251: Rename Debugger.Script.prototype.elementProperty to elementAttributeName, and all related. r=sfink
authorJim Blandy <jimb@mozilla.com>
Wed, 22 Jan 2014 16:41:16 -0800
changeset 180781 8bcd545cf484d7036e67ddfb0dc152655bf2c29b
parent 180780 d5da9f1e91fe4c1874aab476395a292db428b089
child 180782 b89f28d7f0f925b59cb8348e8f04e11d9c980262
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs942251
milestone29.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 942251: Rename Debugger.Script.prototype.elementProperty to elementAttributeName, and all related. r=sfink
js/src/jit-test/tests/basic/offThreadCompileScript-02.js
js/src/jit-test/tests/debug/Source-elementAttributeName.js
js/src/jit-test/tests/debug/Source-elementProperty.js
js/src/jit-test/tests/debug/Source-surfaces.js
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsscript.cpp
js/src/jsscript.h
js/src/shell/js.cpp
js/src/vm/Debugger.cpp
--- a/js/src/jit-test/tests/basic/offThreadCompileScript-02.js
+++ b/js/src/jit-test/tests/basic/offThreadCompileScript-02.js
@@ -6,12 +6,12 @@ assertEq(!!runOffThreadScript().stack.ma
 offThreadCompileScript('Error()',
                        { fileName: "candelabra", lineNumber: 6502 });
 assertEq(!!runOffThreadScript().stack.match(/^@candelabra:6502\n/), true);
 
 var element = {};
 offThreadCompileScript('Error()', { element: element }); // shouldn't crash
 runOffThreadScript();
 
-var elementAttribute = "molybdenum";
-elementAttribute += elementAttribute + elementAttribute + elementAttribute;
-offThreadCompileScript('Error()', { elementProperty: elementAttribute }); // shouldn't crash
+var elementAttributeName = "molybdenum";
+elementAttributeName += elementAttributeName + elementAttributeName + elementAttributeName;
+offThreadCompileScript('Error()', { elementAttributeName: elementAttributeName }); // shouldn't crash
 runOffThreadScript();
rename from js/src/jit-test/tests/debug/Source-elementProperty.js
rename to js/src/jit-test/tests/debug/Source-elementAttributeName.js
--- a/js/src/jit-test/tests/debug/Source-elementProperty.js
+++ b/js/src/jit-test/tests/debug/Source-elementAttributeName.js
@@ -1,11 +1,11 @@
-// Source.prototype.elementProperty can be a string or undefined.
+// Source.prototype.elementAttributeName can be a string or undefined.
 
 var g = newGlobal('new-compartment');
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
-g.evaluate("function f(x) { return 2*x; }", {elementProperty: "src"});
+g.evaluate("function f(x) { return 2*x; }", {elementAttributeName: "src"});
 var fw = gw.getOwnPropertyDescriptor('f').value;
-assertEq(fw.script.source.elementProperty, "src");
+assertEq(fw.script.source.elementAttributeName, "src");
 g.evaluate("function f(x) { return 2*x; }");
 var fw = gw.getOwnPropertyDescriptor('f').value;
-assertEq(fw.script.source.elementProperty, undefined);
+assertEq(fw.script.source.elementAttributeName, undefined);
--- a/js/src/jit-test/tests/debug/Source-surfaces.js
+++ b/js/src/jit-test/tests/debug/Source-surfaces.js
@@ -18,16 +18,16 @@ assertThrowsInstanceOf(function () {
 assertThrowsInstanceOf(function () {
     Debugger.Source.prototype.element.call({})
 }, TypeError);
 assertThrowsInstanceOf(function () {
     Debugger.Source.prototype.element.call(Debugger.Source.prototype)
 }, TypeError);
 
 assertThrowsInstanceOf(function () {
-    Debugger.Source.prototype.elementProperty.call(42)
+    Debugger.Source.prototype.elementAttributeName.call(42)
 }, TypeError);
 assertThrowsInstanceOf(function () {
-    Debugger.Source.prototype.elementProperty.call({})
+    Debugger.Source.prototype.elementAttributeName.call({})
 }, TypeError);
 assertThrowsInstanceOf(function () {
-    Debugger.Source.prototype.elementProperty.call(Debugger.Source.prototype)
+    Debugger.Source.prototype.elementAttributeName.call(Debugger.Source.prototype)
 }, TypeError);
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4304,17 +4304,17 @@ JS::ReadOnlyCompileOptions::originPrinci
 {
     return NormalizeOriginPrincipals(principals_, originPrincipals_);
 }
 
 JS::OwningCompileOptions::OwningCompileOptions(JSContext *cx)
     : ReadOnlyCompileOptions(),
       runtime(GetRuntime(cx)),
       elementRoot(cx),
-      elementPropertyRoot(cx)
+      elementAttributeNameRoot(cx)
 {
 }
 
 JS::OwningCompileOptions::~OwningCompileOptions()
 {
     if (principals_)
         JS_DropPrincipals(runtime, principals_);
     if (originPrincipals_)
@@ -4382,43 +4382,43 @@ JS::OwningCompileOptions::setSourceMapUR
     return true;
 }
 
 bool
 JS::OwningCompileOptions::wrap(JSContext *cx, JSCompartment *compartment)
 {
     if (!compartment->wrap(cx, &elementRoot))
         return false;
-    if (elementPropertyRoot) {
-        if (!compartment->wrap(cx, elementPropertyRoot.address()))
+    if (elementAttributeNameRoot) {
+        if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
             return false;
     }
     return true;
 }
 
 JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
-    : ReadOnlyCompileOptions(), elementRoot(cx), elementPropertyRoot(cx)
+    : ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx)
 {
     this->version = (version != JSVERSION_UNKNOWN) ? version : cx->findVersion();
 
     compileAndGo = false;
     noScriptRval = cx->options().noScriptRval();
     strictOption = cx->options().strictMode();
     extraWarningsOption = cx->options().extraWarnings();
     werrorOption = cx->options().werror();
     asmJSOption = cx->options().asmJS();
 }
 
 bool
 JS::CompileOptions::wrap(JSContext *cx, JSCompartment *compartment)
 {
     if (!compartment->wrap(cx, &elementRoot))
         return false;
-    if (elementPropertyRoot) {
-        if (!compartment->wrap(cx, elementPropertyRoot.address()))
+    if (elementAttributeNameRoot) {
+        if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
             return false;
     }
     return true;
 }
 
 JSScript *
 JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
             const jschar *chars, size_t length)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -3477,17 +3477,17 @@ class JS_FRIEND_API(ReadOnlyCompileOptio
   public:
     // Read-only accessors for non-POD options. The proper way to set these
     // depends on the derived type.
     JSPrincipals *principals() const { return principals_; }
     JSPrincipals *originPrincipals() const;
     const char *filename() const { return filename_; }
     const jschar *sourceMapURL() const { return sourceMapURL_; }
     virtual JSObject *element() const = 0;
-    virtual JSString *elementProperty() const = 0;
+    virtual JSString *elementAttributeName() const = 0;
 
     // POD options.
     JSVersion version;
     bool versionSet;
     bool utf8;
     unsigned lineno;
     unsigned column;
     bool compileAndGo;
@@ -3527,41 +3527,47 @@ class JS_FRIEND_API(ReadOnlyCompileOptio
  * or indirectly, by a JavaScript object: if any value that this roots ever
  * comes to refer to the object that owns this, then the whole cycle, and
  * anything else it entrains, will never be freed.
  */
 class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
 {
     JSRuntime *runtime;
     PersistentRootedObject elementRoot;
-    PersistentRootedString elementPropertyRoot;
+    PersistentRootedString elementAttributeNameRoot;
 
   public:
     // A minimal constructor, for use with OwningCompileOptions::copy. This
     // leaves |this.version| set to JSVERSION_UNKNOWN; the instance
     // shouldn't be used until we've set that to something real (as |copy|
     // will).
     explicit OwningCompileOptions(JSContext *cx);
     ~OwningCompileOptions();
 
     JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
-    JSString *elementProperty() const MOZ_OVERRIDE { return elementPropertyRoot; }
+    JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
 
     // Set this to a copy of |rhs|. Return false on OOM.
     bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs);
 
     /* These setters make copies of their string arguments, and are fallible. */
     bool setFile(JSContext *cx, const char *f);
     bool setFileAndLine(JSContext *cx, const char *f, unsigned l);
     bool setSourceMapURL(JSContext *cx, const jschar *s);
 
     /* These setters are infallible, and can be chained. */
     OwningCompileOptions &setLine(unsigned l)             { lineno = l;              return *this; }
-    OwningCompileOptions &setElement(JSObject *e)         { elementRoot = e;         return *this; }
-    OwningCompileOptions &setElementProperty(JSString *p) { elementPropertyRoot = p; return *this; }
+    OwningCompileOptions &setElement(JSObject *e) {
+        elementRoot = e;
+        return *this;
+    }
+    OwningCompileOptions &setElementAttributeName(JSString *p) {
+        elementAttributeNameRoot = p;
+        return *this;
+    }
     OwningCompileOptions &setPrincipals(JSPrincipals *p) {
         if (p) JS_HoldPrincipals(p);
         if (principals_) JS_DropPrincipals(runtime, principals_);
         principals_ = p;
         return *this;
     }
     OwningCompileOptions &setOriginPrincipals(JSPrincipals *p) {
         if (p) JS_HoldPrincipals(p);
@@ -3591,45 +3597,51 @@ class JS_FRIEND_API(OwningCompileOptions
  * simply holds references to dynamically allocated resources (element;
  * filename; source map URL) that are owned by something else. If you
  * create an instance of this type, it's up to you to guarantee that
  * everything you store in it will outlive it.
  */
 class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOptions
 {
     RootedObject elementRoot;
-    RootedString elementPropertyRoot;
+    RootedString elementAttributeNameRoot;
 
   public:
     explicit CompileOptions(JSContext *cx, JSVersion version = JSVERSION_UNKNOWN);
     CompileOptions(js::ContextFriendFields *cx, const ReadOnlyCompileOptions &rhs)
-      : ReadOnlyCompileOptions(), elementRoot(cx), elementPropertyRoot(cx)
+      : ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx)
     {
         copyPODOptions(rhs);
 
         principals_ = rhs.principals();
         originPrincipals_ = rhs.originPrincipals();
         filename_ = rhs.filename();
         sourceMapURL_ = rhs.sourceMapURL();
         elementRoot = rhs.element();
-        elementPropertyRoot = rhs.elementProperty();
+        elementAttributeNameRoot = rhs.elementAttributeName();
     }
 
     JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
-    JSString *elementProperty() const MOZ_OVERRIDE { return elementPropertyRoot; }
+    JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
 
     CompileOptions &setFile(const char *f) { filename_ = f; return *this; }
     CompileOptions &setLine(unsigned l) { lineno = l; return *this; }
     CompileOptions &setFileAndLine(const char *f, unsigned l) {
         filename_ = f; lineno = l; return *this;
     }
     CompileOptions &setSourceMapURL(const jschar *s) { sourceMapURL_ = s;       return *this; }
     CompileOptions &setElement(JSObject *e)          { elementRoot = e;         return *this; }
-    CompileOptions &setElementProperty(JSString *p)  { elementPropertyRoot = p; return *this; }
-    CompileOptions &setPrincipals(JSPrincipals *p)   { principals_ = p;         return *this; }
+    CompileOptions &setElementAttributeName(JSString *p) {
+        elementAttributeNameRoot = p;
+        return *this;
+    }
+    CompileOptions &setPrincipals(JSPrincipals *p) {
+        principals_ = p;
+        return *this;
+    }
     CompileOptions &setOriginPrincipals(JSPrincipals *p) {
         originPrincipals_ = p;
         return *this;
     }
     CompileOptions &setVersion(JSVersion v) {
         version = v;
         versionSet = true;
         return *this;
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -569,17 +569,17 @@ js::XDRScript(XDRState<mode> *xdr, Handl
         RootedScriptSource sourceObject(cx);
         if (scriptBits & (1 << OwnSource)) {
             ScriptSource *ss = cx->new_<ScriptSource>(xdr->originPrincipals());
             if (!ss)
                 return false;
             /*
              * We use this CompileOptions only to initialize the
              * ScriptSourceObject. Most CompileOptions fields aren't used by
-             * ScriptSourceObject, and those that are (element; elementProperty)
+             * ScriptSourceObject, and those that are (element; elementAttributeName)
              * aren't preserved by XDR. So this can be simple.
              */
             CompileOptions options(cx);
             sourceObject = ScriptSourceObject::create(cx, ss, options);
             if (!sourceObject)
                 return false;
         } else {
             JS_ASSERT(enclosingScript);
@@ -993,17 +993,17 @@ ScriptSourceObject::element() const
 void
 ScriptSourceObject::initElement(HandleObject element)
 {
     JS_ASSERT(getReservedSlot(ELEMENT_SLOT).isNull());
     setReservedSlot(ELEMENT_SLOT, ObjectOrNullValue(element));
 }
 
 const Value &
-ScriptSourceObject::elementProperty() const
+ScriptSourceObject::elementAttributeName() const
 {
     const Value &prop = getReservedSlot(ELEMENT_PROPERTY_SLOT);
     JS_ASSERT(prop.isUndefined() || prop.isString());
     return prop;
 }
 
 void
 ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
@@ -1033,18 +1033,18 @@ ScriptSourceObject::create(ExclusiveCont
     RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, nullptr, cx->global()));
     if (!object)
         return nullptr;
     RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>());
 
     source->incref();
     sourceObject->initSlot(SOURCE_SLOT, PrivateValue(source));
     sourceObject->initSlot(ELEMENT_SLOT, ObjectOrNullValue(options.element()));
-    if (options.elementProperty())
-        sourceObject->initSlot(ELEMENT_PROPERTY_SLOT, StringValue(options.elementProperty()));
+    if (options.elementAttributeName())
+        sourceObject->initSlot(ELEMENT_PROPERTY_SLOT, StringValue(options.elementAttributeName()));
     else
         sourceObject->initSlot(ELEMENT_PROPERTY_SLOT, UndefinedValue());
 
     return sourceObject;
 }
 
 static const unsigned char emptySource[] = "";
 
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -493,18 +493,17 @@ class ScriptSourceObject : public JSObje
         AutoThreadSafeAccess ts2(lastProperty()->base());
         return static_cast<ScriptSource *>(getReservedSlot(SOURCE_SLOT).toPrivate());
     }
 
     void setSource(ScriptSource *source);
 
     JSObject *element() const;
     void initElement(HandleObject element);
-
-    const Value &elementProperty() const;
+    const Value &elementAttributeName() const;
 
   private:
     static const uint32_t SOURCE_SLOT = 0;
     static const uint32_t ELEMENT_SLOT = 1;
     static const uint32_t ELEMENT_PROPERTY_SLOT = 2;
     static const uint32_t RESERVED_SLOTS = 3;
 };
 
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -799,23 +799,23 @@ ParseCompileOptions(JSContext *cx, Compi
         options.setFile(fileName);
     }
 
     if (!JS_GetProperty(cx, opts, "element", &v))
         return false;
     if (v.isObject())
         options.setElement(&v.toObject());
 
-    if (!JS_GetProperty(cx, opts, "elementProperty", &v))
+    if (!JS_GetProperty(cx, opts, "elementAttributeName", &v))
         return false;
     if (!v.isUndefined()) {
         s = ToString(cx, v);
         if (!s)
             return false;
-        options.setElementProperty(s);
+        options.setElementAttributeName(s);
     }
 
     if (!JS_GetProperty(cx, opts, "lineNumber", &v))
         return false;
     if (!v.isUndefined()) {
         uint32_t u;
         if (!ToUint32(cx, v, &u))
             return false;
@@ -4063,19 +4063,19 @@ static const JSFunctionSpecWithHelp shel
 "         and restore it afterwards\n"
 "      catchTermination: if true, catch termination (failure without\n"
 "         an exception value, as for slow scripts or out-of-memory)\n"
 "         and return 'terminated'\n"
 "      element: if present with value |v|, convert |v| to an object |o| and\n"
 "         mark the source as being attached to the DOM element |o|. If the\n"
 "         property is omitted or |v| is null, don't attribute the source to\n"
 "         any DOM element.\n"
-"      elementProperty: if present and not undefined, the name of property\n"
-"         of 'element' that holds this code. This is what Debugger.Source\n"
-"         .prototype.elementProperty returns.\n"
+"      elementAttributeName: if present and not undefined, the name of\n"
+"         property of 'element' that holds this code. This is what\n"
+"         Debugger.Source.prototype.elementAttributeName returns.\n"
 "      sourceMapURL: if present with value |v|, convert |v| to a string, and\n"
 "         provide that as the code's source map URL. If omitted, attach no\n"
 "         source map URL to the code (although the code may provide one itself,\n"
 "         via a //#sourceMappingURL comment).\n"
 "      sourcePolicy: if present, the value converted to a string must be either\n"
 "         'NO_SOURCE', 'LAZY_SOURCE', or 'SAVE_SOURCE'; use the given source\n"
 "         retention policy for this compilation.\n"),
 
@@ -4265,19 +4265,19 @@ static const JSFunctionSpecWithHelp shel
 "  have properties saying how the code should be compiled:\n"
 "      noScriptRval: use the no-script-rval compiler option (default: false)\n"
 "      fileName: filename for error messages and debug info\n"
 "      lineNumber: starting line number for error messages and debug info\n"
 "      element: if present with value |v|, convert |v| to an object |o| and\n"
 "         mark the source as being attached to the DOM element |o|. If the\n"
 "         property is omitted or |v| is null, don't attribute the source to\n"
 "         any DOM element.\n"
-"      elementProperty: if present and not undefined, the name of property\n"
-"         of 'element' that holds this code. This is what Debugger.Source\n"
-"         .prototype.elementProperty returns.\n"),
+"      elementAttributeName: if present and not undefined, the name of\n"
+"         property of 'element' that holds this code. This is what\n"
+"         Debugger.Source.prototype.elementAttributeName returns.\n"),
 
     JS_FN_HELP("runOffThreadScript", runOffThreadScript, 0, 0,
 "runOffThreadScript()",
 "  Wait for off-thread compilation to complete. If an error occurred,\n"
 "  throw the appropriate exception; otherwise, run the script and return\n"
 "  its value."),
 
 #endif
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -3873,27 +3873,27 @@ DebuggerSource_getElement(JSContext *cx,
         args.rval().setUndefined();
     }
     return true;
 }
 
 static bool
 DebuggerSource_getElementProperty(JSContext *cx, unsigned argc, Value *vp)
 {
-    THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get elementProperty)", args, obj, sourceObject);
-    args.rval().set(sourceObject->elementProperty());
+    THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get elementAttributeName)", args, obj, sourceObject);
+    args.rval().set(sourceObject->elementAttributeName());
     return Debugger::fromChildJSObject(obj)->wrapDebuggeeValue(cx, args.rval());
 }
 
 static const JSPropertySpec DebuggerSource_properties[] = {
     JS_PSG("text", DebuggerSource_getText, 0),
     JS_PSG("url", DebuggerSource_getUrl, 0),
     JS_PSG("element", DebuggerSource_getElement, 0),
     JS_PSG("displayURL", DebuggerSource_getDisplayURL, 0),
-    JS_PSG("elementProperty", DebuggerSource_getElementProperty, 0),
+    JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0),
     JS_PS_END
 };
 
 static const JSFunctionSpec DebuggerSource_methods[] = {
     JS_FS_END
 };