2011-09-24 17:25:22 +02:00
|
|
|
// Copyright 2011 Google Inc. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2014-07-22 01:09:02 +02:00
|
|
|
A strict delete should either succeed, returning true, or it
|
|
|
|
should fail by throwing a TypeError. Under no circumstances
|
|
|
|
should a strict delete return false.
|
2020-09-11 17:58:45 +02:00
|
|
|
esid: sec-delete-operator-runtime-semantics-evaluation
|
2014-07-22 01:09:02 +02:00
|
|
|
description: >
|
|
|
|
See if a strict delete returns false when deleting a non-standard
|
|
|
|
property.
|
|
|
|
flags: [onlyStrict]
|
|
|
|
---*/
|
2011-09-24 17:25:22 +02:00
|
|
|
|
2011-09-26 00:11:03 +02:00
|
|
|
var reNames = Object.getOwnPropertyNames(RegExp);
|
|
|
|
for (var i = 0, len = reNames.length; i < len; i++) {
|
|
|
|
var reName = reNames[i];
|
|
|
|
if (reName !== 'prototype') {
|
|
|
|
var deleted = 'unassigned';
|
|
|
|
try {
|
|
|
|
deleted = delete RegExp[reName];
|
|
|
|
} catch (err) {
|
|
|
|
if (!(err instanceof TypeError)) {
|
|
|
|
$ERROR('#1: strict delete threw a non-TypeError: ' + err);
|
|
|
|
}
|
|
|
|
// fall through
|
|
|
|
}
|
|
|
|
if (deleted === false) {
|
|
|
|
$ERROR('#2: Strict delete returned false');
|
|
|
|
}
|
|
|
|
}
|
2011-09-24 17:25:22 +02:00
|
|
|
}
|