Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: test/mjsunit/getter-in-prototype.js

Issue 7064027: Change calls to undefined property setters to not throw (fixes issue 1355). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/indexed-accessors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/getter-in-prototype.js
===================================================================
--- test/mjsunit/getter-in-prototype.js (revision 8026)
+++ test/mjsunit/getter-in-prototype.js (working copy)
@@ -25,8 +25,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test that exceptions are thrown when setting properties on object
-// that have only a getter in a prototype object.
+// Test that exceptions are not thrown when setting properties on object
+// that have only a getter in a prototype object, except when we are in strict
+// mode where exceptsions should be thrown.
var o = {};
var p = {};
@@ -34,25 +35,44 @@
p.__defineGetter__(0, function(){});
o.__proto__ = p;
-assertThrows("o.x = 42");
-assertThrows("o[0] = 42");
+assertDoesNotThrow("o.x = 42");
+assertDoesNotThrow("o[0] = 42");
+assertThrows(function() { 'use strict'; o.x = 42; });
+assertThrows(function() { 'use strict'; o[0] = 42; });
+
function f() {
with(o) {
x = 42;
}
}
-assertThrows("f()");
+assertDoesNotThrow(f);
+
__proto__ = p;
function g() {
eval('1');
x = 42;
}
-assertThrows("g()");
+function g_strict() {
+ 'use strict';
+ eval('1');
+ x = 42;
+}
+
+assertDoesNotThrow(g);
+assertThrows(g_strict);
+
__proto__ = p;
function g2() {
this[0] = 42;
}
-assertThrows("g2()");
+
+function g2_strict() {
+ 'use strict';
+ this[0] = 42;
+}
+
+assertDoesNotThrow(g2);
+assertThrows(g2_strict);
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/indexed-accessors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698