tor-browser

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

delete-exported-init.js (1462B)


      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 initialized 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]
     15 ---*/
     16 
     17 import * as ns from './delete-exported-init.js';
     18 export var local1 = 333;
     19 var local2 = 444;
     20 export { local2 as renamed };
     21 export { local1 as indirect } from './delete-exported-init.js';
     22 
     23 assert.throws(TypeError, function() {
     24  delete ns.local1;
     25 }, 'delete: local1');
     26 assert.sameValue(
     27  Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
     28 );
     29 assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
     30 
     31 assert.throws(TypeError, function() {
     32  delete ns.renamed;
     33 }, 'delete: renamed');
     34 assert.sameValue(
     35  Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
     36 );
     37 assert.sameValue(ns.renamed, 444, '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.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
     48 
     49 reportCompare(0, 0);