From 5aaebbd7d0c6bc11fa842c2e969bf93636a8f92d Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 16 Feb 2012 15:06:23 -0800 Subject: [PATCH] Bug 728411 - Make ReportReadOnly a static method, not part of the JSObject interface. r=bhackett --HG-- extra : rebase_source : b2e126907ed126d249830b7ee73e2411af5d32da --- js/src/jsobj.cpp | 12 ++++++------ js/src/jsobj.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 5976b3ba946..ba5c67c2d52 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -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; } } diff --git a/js/src/jsobj.h b/js/src/jsobj.h index bcbf23d9cf8..950b0552794 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -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);