func.js revision 1239:77609e069f9f
1189608Ssam/*
2189608Ssam * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
3189608Ssam * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4189608Ssam *
5189608Ssam * This code is free software; you can redistribute it and/or modify it
6189608Ssam * under the terms of the GNU General Public License version 2 only, as
7189608Ssam * published by the Free Software Foundation.  Oracle designates this
8189608Ssam * particular file as subject to the "Classpath" exception as provided
9189608Ssam * by Oracle in the LICENSE file that accompanied this code.
10189608Ssam *
11189608Ssam * This code is distributed in the hope that it will be useful, but WITHOUT
12189608Ssam * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13189608Ssam * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14189608Ssam * version 2 for more details (a copy is included in the LICENSE file that
15189608Ssam * accompanied this code).
16189608Ssam *
17189608Ssam * You should have received a copy of the GNU General Public License version
18189608Ssam * 2 along with this work; if not, write to the Free Software Foundation,
19189608Ssam * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20189608Ssam *
21189608Ssam * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22189608Ssam * or visit www.oracle.com if you need additional information or have any
23189608Ssam * questions.
24189608Ssam */
25189608Ssam
26189608Ssam// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
27189608Ssam
28189608Ssamvar scopeVar = 1;
29189608Ssamvar global = this;
30189608SsamundefGlobal = this;
31189608Ssam
32189608Ssamfunction scopeTest() {
33189608Ssam    if (this !== global) {
34189608Ssam        throw new Error("this !== global");
35189608Ssam    }
36189608Ssam    if (this !== undefGlobal) {
37189608Ssam        throw new Error("this !== undefinedGlobal")
38189608Ssam    }
39189608Ssam    return scopeVar;
40189608Ssam}
41189608Ssam
42189608SsamscopeTest();
43189608Ssam