All Downloads are FREE. Search and download functionalities are using the official Maven repository.

testsrc.jstests.608235.jstest Maven / Gradle / Ivy

Go to download

A distribution of rhino which releases snapshots from a submodule folder containing forked sources.

The newest version!
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// https://bugzilla.mozilla.org/show_bug.cgi?id=608235

function Try(f, expected) {
  try {
    f();
    throw "Expected error: " + expected;
  } catch (e) {
    if (e != expected) {
      throw "Expected error: " + expected;
    }
  }
}

Try(
  function(){ undefined[undefined] },
  'TypeError: Cannot read property "undefined" from undefined'
);

Try(
  function(){ undefined[undefined] = 1 },
  'TypeError: Cannot set property "undefined" of undefined to "1"'
);

Try(
  function(){ undefined[undefined] = {} },
  'TypeError: Cannot set property "undefined" of undefined to "[object Object]"'
);

Try(
  function(){ undefined[undefined] = [1,2,3] },
  'TypeError: Cannot set property "undefined" of undefined to "1,2,3"'
);

Try(
  function(){ delete undefined[undefined] },
  'TypeError: Cannot delete property "undefined" of undefined'
);

Try(
  function(){ undefined[undefined]() },
  'TypeError: Cannot call method "undefined" of undefined'
);

"success";




© 2015 - 2024 Weber Informatics LLC | Privacy Policy