1.1 --- a/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Thu Apr 21 08:58:57 2016 +0200
1.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Wed Apr 27 18:23:24 2016 +0200
1.3 @@ -234,6 +234,8 @@
1.4 )
1.5 static native String yesNo(Callable<Boolean> call);
1.6
1.7 + @JavaScriptBody(args = {}, body = "return globalString;")
1.8 + static native String readGlobalString();
1.9
1.10 static String problematicString() {
1.11 return "{\n" +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/GlobalString.java Wed Apr 27 18:23:24 2016 +0200
2.3 @@ -0,0 +1,52 @@
2.4 +/**
2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6 + *
2.7 + * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
2.8 + *
2.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2.10 + * Other names may be trademarks of their respective owners.
2.11 + *
2.12 + * The contents of this file are subject to the terms of either the GNU
2.13 + * General Public License Version 2 only ("GPL") or the Common
2.14 + * Development and Distribution License("CDDL") (collectively, the
2.15 + * "License"). You may not use this file except in compliance with the
2.16 + * License. You can obtain a copy of the License at
2.17 + * http://www.netbeans.org/cddl-gplv2.html
2.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.19 + * specific language governing permissions and limitations under the
2.20 + * License. When distributing the software, include this License Header
2.21 + * Notice in each file and include the License file at
2.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
2.23 + * particular file as subject to the "Classpath" exception as provided
2.24 + * by Oracle in the GPL Version 2 section of the License file that
2.25 + * accompanied this code. If applicable, add the following below the
2.26 + * License Header, with the fields enclosed by brackets [] replaced by
2.27 + * your own identifying information:
2.28 + * "Portions Copyrighted [year] [name of copyright owner]"
2.29 + *
2.30 + * Contributor(s):
2.31 + *
2.32 + * The Original Software is NetBeans. The Initial Developer of the Original
2.33 + * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
2.34 + *
2.35 + * If you wish your version of this file to be governed by only the CDDL
2.36 + * or only the GPL Version 2, indicate your decision by adding
2.37 + * "[Contributor] elects to include this software in this distribution
2.38 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
2.39 + * single choice of license, a recipient has the option to distribute
2.40 + * your version of this file under either the CDDL, the GPL Version 2 or
2.41 + * to extend the choice of license to its licensees as provided above.
2.42 + * However, if you add GPL Version 2 code and therefore, elected the GPL
2.43 + * Version 2 license, then the option applies only if the new code is
2.44 + * made subject to such option by the copyright holder.
2.45 + */
2.46 +package net.java.html.js.tests;
2.47 +
2.48 +import net.java.html.js.JavaScriptBody;
2.49 +import net.java.html.js.JavaScriptResource;
2.50 +
2.51 +@JavaScriptResource("global.js")
2.52 +class GlobalString {
2.53 + @JavaScriptBody(args = {}, body = "")
2.54 + public static native void init();
2.55 +}
3.1 --- a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Thu Apr 21 08:58:57 2016 +0200
3.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Wed Apr 27 18:23:24 2016 +0200
3.3 @@ -434,6 +434,12 @@
3.4 }
3.5 assertEquals(l.call, 42, "Method was called: " + l.call);
3.6 }
3.7 +
3.8 + @KOTest
3.9 + public void globalStringAvailable() throws Exception {
3.10 + GlobalString.init();
3.11 + assertEquals("HTML/Java", Bodies.readGlobalString());
3.12 + }
3.13
3.14 private static class R implements Runnable {
3.15 int cnt;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/json-tck/src/main/resources/net/java/html/js/tests/global.js Wed Apr 27 18:23:24 2016 +0200
4.3 @@ -0,0 +1,44 @@
4.4 +/*
4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 + *
4.7 + * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
4.8 + *
4.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
4.10 + * Other names may be trademarks of their respective owners.
4.11 + *
4.12 + * The contents of this file are subject to the terms of either the GNU
4.13 + * General Public License Version 2 only ("GPL") or the Common
4.14 + * Development and Distribution License("CDDL") (collectively, the
4.15 + * "License"). You may not use this file except in compliance with the
4.16 + * License. You can obtain a copy of the License at
4.17 + * http://www.netbeans.org/cddl-gplv2.html
4.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.19 + * specific language governing permissions and limitations under the
4.20 + * License. When distributing the software, include this License Header
4.21 + * Notice in each file and include the License file at
4.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
4.23 + * particular file as subject to the "Classpath" exception as provided
4.24 + * by Oracle in the GPL Version 2 section of the License file that
4.25 + * accompanied this code. If applicable, add the following below the
4.26 + * License Header, with the fields enclosed by brackets [] replaced by
4.27 + * your own identifying information:
4.28 + * "Portions Copyrighted [year] [name of copyright owner]"
4.29 + *
4.30 + * Contributor(s):
4.31 + *
4.32 + * The Original Software is NetBeans. The Initial Developer of the Original
4.33 + * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
4.34 + *
4.35 + * If you wish your version of this file to be governed by only the CDDL
4.36 + * or only the GPL Version 2, indicate your decision by adding
4.37 + * "[Contributor] elects to include this software in this distribution
4.38 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.39 + * single choice of license, a recipient has the option to distribute
4.40 + * your version of this file under either the CDDL, the GPL Version 2 or
4.41 + * to extend the choice of license to its licensees as provided above.
4.42 + * However, if you add GPL Version 2 code and therefore, elected the GPL
4.43 + * Version 2 license, then the option applies only if the new code is
4.44 + * made subject to such option by the copyright holder.
4.45 + */
4.46 +var globalString = 'HTML/Java';
4.47 +