Skip to content

Commit

Permalink
Remove JavaScript es5 builds (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Dec 19, 2023
1 parent 518158f commit 2c7c49b
Show file tree
Hide file tree
Showing 9 changed files with 7,818 additions and 5,718 deletions.
18 changes: 0 additions & 18 deletions js/.babelrc

This file was deleted.

30 changes: 1 addition & 29 deletions js/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ supported platforms.
- [Running the JavaScript Tests](#running-the-javascript-tests)
- [Browser Information](#browser-information)
- [Self-Signed Certificate](#self-signed-certificate)
- [Windows 8](#windows-8)
- [Secure WebSockets on iOS and Android](#secure-websockets-on-ios-and-android)
- [Installing Certificates on iOS](#installing-certificates-on-ios)
- [Installing Certificates on Android](#installing-certificates-on-android)
Expand Down Expand Up @@ -63,13 +62,6 @@ npm run build
Upon successful completion, the build generates libraries in the `lib`
subdirectory, including compressed and minified versions.

For older browsers that do not support all of the required ECMAScript 6
features used by Ice for JavaScript, we provide pre-compiled versions of
the libraries using the [Babel] JavaScript compiler. These libraries
depend on the [core-js] and [regenerator-runtime] packages
and are available in the `lib/es5` subdirectory with the same names as
the main libraries.

## Running the JavaScript Tests

Python is required to run the test suite. Additionally, the Glacier2 tests
Expand Down Expand Up @@ -109,17 +101,6 @@ Then open the test page (http://127.0.0.1:8080/start) using a web browser.
These tests require a web browser with ECMAScript 6 support, such as
a recent version of Chrome, Firefox, Microsoft Edge or Safari.

If you are using another web browser, such as Internet Explorer, you should
use instead:

```shell
python allTests.py --browser Manual --es5
```

Then open the test page (http://127.0.0.1:8080/es5/start)

This runs a version of the test suite transpiled to ECMAScript 5 using [Babel].

On macOS the first time you run the tests, you will be prompted for your
password. This is necessary to configure the trust setting for the HTTP
server certificate, which will enable you to connect to the HTTP server
Expand Down Expand Up @@ -150,20 +131,14 @@ depending on the browser you're using:
After closing the dialogs, reload the test page to continue. You should
uninstall this certificate after running the tests.

- Internet Explorer and Microsoft Edge
- Microsoft Edge
Run the management console (mmc.exe) and add the Certificates snap-in for
the computer account. Then select Console Root > Certificates (Local
Computer) > Trusted Root Certificate Authorities. In the Action menu, choose
All Tasks and Import. Navigate to the `cacert.der` file and import it into
the Trusted Root Certificate Authorities. Reload the test page to continue.
You should uninstall this certificate after running the tests.

#### Windows 8

On Windows 8, network isolation prevents Internet Explorer from
connecting to 127.0.0.1. To work around this limitation, you'll need to disable
Internet Explorer's "Protected Mode". Open the "Internet Options" dialog and in
the "Security" settings tab, deselect the "Enable Protected Mode" checkbox.

#### Secure WebSockets on iOS and Android

Expand Down Expand Up @@ -215,6 +190,3 @@ To use Ice for JavaScript with a browser, copy the appropriate JavaScript
library files located in the `lib` directory to your web server.

[binary distributions]: https://zeroc.com/downloads/ice
[Babel]: https://babeljs.io
[core-js]: https://www.npmjs.com/package/core-js
[regenerator-runtime]: https://www.npmjs.com/package/regenerator-runtime
48 changes: 5 additions & 43 deletions js/bin/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ function Init()
var libraries = ["/lib/Ice.js", "/lib/Ice.min.js",
"/lib/Glacier2.js", "/lib/Glacier2.min.js",
"/lib/IceStorm.js", "/lib/IceStorm.min.js",
"/lib/IceGrid.js", "/lib/IceGrid.min.js",
"/lib/es5/Ice.js", "/lib/es5/Ice.min.js",
"/lib/es5/Glacier2.js", "/lib/es5/Glacier2.min.js",
"/lib/es5/IceStorm.js", "/lib/es5/IceStorm.min.js",
"/lib/es5/IceGrid.js", "/lib/es5/IceGrid.min.js"];
"/lib/IceGrid.js", "/lib/IceGrid.min.js"];

var commonPath = path.join(__dirname, "..", "test", "Common");
TestData.TestSuites = fs.readFileSync(path.join(commonPath, "TestSuites.json"), "utf8");
Expand All @@ -65,18 +61,11 @@ function Init()
var matchController = req.url.pathname.match("^\/test/(.*)/controller\\.html");
if(matchController)
{
var es5 = matchController[1].indexOf("es5/") !== -1;
var m = es5 ? matchController[1].replace("es5/", "") : matchController[1];

var m = matchController[1];
var testpath = path.resolve(path.join(this._basePath, "test", matchController[1]))
var worker = req.url.query.worker == "True";
var scripts = es5 ? [
"/node_modules/core-js-bundle/minified.js",
"/node_modules/regenerator-runtime/runtime.js",
"/lib/es5/Ice.js",
"/test/es5/Common/TestHelper.js",
"/test/es5/Common/Controller.js",
"/test/es5/Common/ControllerI.js",
] : [
var scripts = [
"/lib/Ice.js",
"/test/Common/TestHelper.js",
"/test/Common/Controller.js",
Expand All @@ -91,10 +80,6 @@ function Init()
{
return "/test/" + matchController[1] + "/" + f;
}
else if(f.indexOf("/lib") === 0 && es5)
{
return f.replace("/lib", "/lib/es5");
}
else
{
return f;
Expand All @@ -109,12 +94,6 @@ function Init()
}));
}

if(worker)
{
// Do not include babel polyfill when using workers, it is bundle with the controllerwoker
TestData.workerScripts = TestData.scripts.filter(script => script.indexOf("/@babel/polyfill/") === -1);
}

res.writeHead(200, {"Content-Type": "text/html"});
res.end(controller.render(TestData))
console.log("HTTP/200 (Ok) " + req.method + " " + req.url.pathname);
Expand All @@ -127,14 +106,6 @@ function Init()
});
res.end();
}
else if(req.url.pathname === '/es5/start')
{
res.writeHead(302,
{
"Location": "/test/es5/Ice/acm/controller.html&port=15002"
});
res.end();
}
else
{
var iceLib = libraries.indexOf(req.url.pathname) !== -1;
Expand Down Expand Up @@ -165,21 +136,12 @@ function Init()
return;
}
var sourceMap;
if(filePath.indexOf("es5/") !== -1 && path.extname(filePath) != ".js")
{
// We only host JS files in the es5 subdirectory, other files
// (such as config/escapes.cfg are in test)
filePath = filePath.replace("es5/", "")
}
filePath = path.resolve(path.join(basePath, filePath))
if(iceLib)
{
sourceMap = req.url.pathname.replace(".js", ".js.map");
}
//
// If OPTIMIZE is set resolve Ice libraries to the corresponding minified
// versions.
//
// If OPTIMIZE is set resolve Ice libraries to the corresponding minified versions.
if(process.env.OPTIMIZE == "yes")
{
if(iceLib && filePath.substr(-7) !== ".min.js")
Expand Down
Loading

0 comments on commit 2c7c49b

Please sign in to comment.