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

Unified Diff: test/mjsunit/object-seal.js

Issue 1011823003: [es6] don't throw if argument is non-object (O.freeze, O.seal, O.preventExtensions) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove phantom edit Created 5 years, 8 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 | « test/mjsunit/object-freeze.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/object-seal.js
diff --git a/test/mjsunit/object-seal.js b/test/mjsunit/object-seal.js
index 3c46ab236cda0154e0ba71311bcc04123eab2735..ef1b16d9061d0d9bb75539812d577aa29e4622c7 100644
--- a/test/mjsunit/object-seal.js
+++ b/test/mjsunit/object-seal.js
@@ -25,33 +25,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Tests the Object.seal and Object.isSealed methods - ES 15.2.3.9 and
-// ES 15.2.3.12
+// Tests the Object.seal and Object.isSealed methods - ES 19.1.2.17 and
+// ES 19.1.2.13
// Flags: --allow-natives-syntax --noalways-opt
-// Test that we throw an error if an object is not passed as argument.
-var non_objects = new Array(undefined, null, 1, -1, 0, 42.43);
+// Test that we return obj if non-object is passed as argument
+var non_objects = new Array(undefined, null, 1, -1, 0, 42.43, Symbol("test"));
for (var key in non_objects) {
- var exception = false;
- try {
- Object.seal(non_objects[key]);
- } catch(e) {
- exception = true;
- assertTrue(/Object.seal called on non-object/.test(e));
- }
- assertTrue(exception);
+ assertSame(non_objects[key], Object.seal(non_objects[key]));
}
+// Test that isFrozen always returns true for non-objects
for (var key in non_objects) {
- exception = false;
- try {
- Object.isSealed(non_objects[key]);
- } catch(e) {
- exception = true;
- assertTrue(/Object.isSealed called on non-object/.test(e));
- }
- assertTrue(exception);
+ assertTrue(Object.isSealed(non_objects[key]));
}
// Test normal data properties.
@@ -396,3 +383,9 @@ assertTrue(%HasFastProperties(obj));
Object.seal(obj);
assertTrue(%HasFastProperties(obj));
assertTrue(Object.isSealed(obj));
+
+function Sealed() {}
+Object.seal(Sealed);
+assertDoesNotThrow(function() { return new Sealed(); });
+Sealed.prototype.prototypeExists = true;
+assertTrue((new Sealed()).prototypeExists);
« no previous file with comments | « test/mjsunit/object-freeze.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698