tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

delete-exported-uninit.js (1853B)


      1 // |reftest| module
      2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-module-namespace-exotic-objects-delete-p
      6 description: >
      7    [[Delete]] behavior for a key that describes an uninitialized exported
      8    binding
      9 info: |
     10    [...]
     11    2. Let exports be the value of O's [[Exports]] internal slot.
     12    3. If P is an element of exports, return false.
     13 flags: [module]
     14 features: [Reflect, let]
     15 ---*/
     16 
     17 import * as ns from './delete-exported-uninit.js';
     18 
     19 assert.throws(TypeError, function() {
     20  delete ns.local1;
     21 }, 'delete: local1');
     22 assert.sameValue(
     23  Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
     24 );
     25 assert.throws(ReferenceError, function() {
     26  ns.local1;
     27 }, 'binding unmodified: local1');
     28 
     29 assert.throws(TypeError, function() {
     30  delete ns.renamed;
     31 }, 'delete: renamed');
     32 assert.sameValue(
     33  Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
     34 );
     35 assert.throws(ReferenceError, function() {
     36  ns.renamed;
     37 }, 'binding unmodified: renamed');
     38 
     39 assert.throws(TypeError, function() {
     40  delete ns.indirect;
     41 }, 'delete: indirect');
     42 assert.sameValue(
     43  Reflect.deleteProperty(ns, 'indirect'),
     44  false,
     45  'Reflect.deleteProperty: indirect'
     46 );
     47 assert.throws(ReferenceError, function() {
     48  ns.indirect;
     49 }, 'binding unmodified: indirect');
     50 
     51 assert.throws(TypeError, function() {
     52  delete ns.default;
     53 }, 'delete: default');
     54 assert.sameValue(
     55  Reflect.deleteProperty(ns, 'default'),
     56  false,
     57  'Reflect.deleteProperty: default'
     58 );
     59 assert.throws(ReferenceError, function() {
     60  ns.default;
     61 }, 'binding unmodified: default');
     62 
     63 export let local1 = 23;
     64 let local2 = 45;
     65 export { local2 as renamed };
     66 export { local1 as indirect } from './delete-exported-uninit.js';
     67 export default null;
     68 
     69 reportCompare(0, 0);