8020380: __noSuchProperty__ defined in mozilla_compat.js script should be non-enumerable

Reviewed-by: jlaskey, hannesw, attila
This commit is contained in:
Athijegannathan Sundararajan 2013-07-11 18:23:13 +05:30
parent f0144d9d93
commit 80f5124f23
2 changed files with 42 additions and 1 deletions

View File

@ -48,7 +48,7 @@ Object.defineProperty(this, "importPackage", {
var _packages = [];
var global = this;
var oldNoSuchProperty = global.__noSuchProperty__;
global.__noSuchProperty__ = function(name) {
var __noSuchProperty__ = function(name) {
'use strict';
for (var i in _packages) {
try {
@ -69,6 +69,11 @@ Object.defineProperty(this, "importPackage", {
}
}
Object.defineProperty(global, "__noSuchProperty__", {
writable: true, configurable: true, enumerable: false,
value: __noSuchProperty__
});
var prefix = "[JavaPackage ";
return function() {
for (var i in arguments) {

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* JDK-8020380: __noSuchProperty__ defined in mozilla_compat.js script should be non-enumerable
*
* @test
* @run
*/
load("nashorn:mozilla_compat.js");
var desc = Object.getOwnPropertyDescriptor(this, "__noSuchProperty__");
if (typeof desc.enumerable != 'boolean' || desc.enumerable != false) {
fail("__noSuchProperty__ is enumerable");
}