Bug 728411 - Make ReportReadOnly a static method, not part of the JSObject interface. r=bhackett

--HG--
extra : rebase_source : b2e126907ed126d249830b7ee73e2411af5d32da
This commit is contained in:
Jeff Walden 2012-02-16 15:06:23 -08:00
parent fbeca51a8c
commit 5aaebbd7d0
2 changed files with 6 additions and 7 deletions

View File

@ -5356,8 +5356,8 @@ js::CheckUndeclaredVarAssignment(JSContext *cx, JSString *propname)
JSMSG_UNDECLARED_VAR, bytes.ptr());
}
bool
JSObject::reportReadOnly(JSContext *cx, jsid id, uintN report)
static bool
ReportReadOnly(JSContext *cx, jsid id, uintN report)
{
return js_ReportValueErrorFlags(cx, report, JSMSG_READ_ONLY,
JSDVG_IGNORE_STACK, IdToValue(id), NULL,
@ -5448,9 +5448,9 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
if (pd.attrs & JSPROP_READONLY) {
if (strict)
return obj->reportReadOnly(cx, id);
return ReportReadOnly(cx, id, JSREPORT_ERROR);
if (cx->hasStrictOption())
return obj->reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
return ReportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
return true;
}
}
@ -5491,9 +5491,9 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
if (!shape->writable()) {
/* Error in strict mode code, warn with strict option, otherwise do nothing. */
if (strict)
return obj->reportReadOnly(cx, id);
return ReportReadOnly(cx, id, JSREPORT_ERROR);
if (cx->hasStrictOption())
return obj->reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
return ReportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
return JS_TRUE;
}
}

View File

@ -1031,7 +1031,6 @@ struct JSObject : public js::ObjectImpl
void freeSlot(JSContext *cx, uint32_t slot);
public:
bool reportReadOnly(JSContext* cx, jsid id, uintN report = JSREPORT_ERROR);
bool reportNotConfigurable(JSContext* cx, jsid id, uintN report = JSREPORT_ERROR);
bool reportNotExtensible(JSContext *cx, uintN report = JSREPORT_ERROR);