Reviewers: Michael Starzinger,
Description:
Put inherited readonliness behind a flag,
since it currently breaks WebKit bindings massively.
[email protected]
BUG=
TEST=
Please review this at https://chromiumcodereview.appspot.com/10535007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/flag-definitions.h
M src/objects.cc
M test/cctest/test-api.cc
M test/mjsunit/override-read-only-property.js
M test/mjsunit/readonly.js
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
fc9a1db4540703dd57d6fe8e4f58ae7053904f3b..705e53be82b670d1eb240e84d58fbc56646491ac
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -132,6 +132,8 @@ public:
// Flags for language modes and experimental language features.
DEFINE_bool(use_strict, false, "enforce strict mode")
+DEFINE_bool(es5_readonly, false,
+ "activate correct semantics for inheriting readonliness")
DEFINE_bool(es52_globals, false,
"activate new semantics for global var declarations")
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
d45af6041ca1095819697854efd80017d97109eb..85a40f6be6f0a996fe9ba90cca0eda3ad96e6087
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2134,6 +2134,7 @@ MaybeObject* JSObject::SetPropertyViaPrototypes(
}
// If we get here with *done true, we have encountered a read-only
property.
+ if (!FLAG_es5_readonly) *done = false;
if (*done) {
if (strict_mode == kNonStrictMode) return value;
Handle<Object> args[] = { Handle<Object>(name), Handle<Object>(this)};
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
e151d3d373c34fb7de7f3c94e83b219df66404f6..218e8300b3d9f5b486f412257945399cd50aa939
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -12151,6 +12151,7 @@ TEST(RegExpStringModification) {
// Test that we cannot set a property on the global object if there
// is a read-only property in the prototype chain.
TEST(ReadOnlyPropertyInGlobalProto) {
+ i::FLAG_es5_readonly = true;
v8::HandleScope scope;
v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New();
LocalContext context(0, templ);
Index: test/mjsunit/override-read-only-property.js
diff --git a/test/mjsunit/override-read-only-property.js
b/test/mjsunit/override-read-only-property.js
index
f8114a66016ca6a81ade6a865a341ae800b0588e..2876ae1f849999992245d9f41b5ea1b4e2e690ec
100644
--- a/test/mjsunit/override-read-only-property.js
+++ b/test/mjsunit/override-read-only-property.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --es5_readonly
+
// According to ECMA-262, sections 8.6.2.2 and 8.6.2.3 you're not
// allowed to override read-only properties, not even if the read-only
// property is in the prototype chain.
Index: test/mjsunit/readonly.js
diff --git a/test/mjsunit/readonly.js b/test/mjsunit/readonly.js
index
2f8778f79a7d9c5b78d5fe7eea446daf04fd1f6e..4d06b7cf43c31acb8a24ffe6d3adb04c30ec14fc
100644
--- a/test/mjsunit/readonly.js
+++ b/test/mjsunit/readonly.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --harmony-proxies
+// Flags: --allow-natives-syntax --harmony-proxies --es5_readonly
// Different ways to create an object.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev