[Pkg-javascript-commits] [uglifyjs] 124/491: workaround webkit parsing error (#2056)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:28 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 27c5284d3dc0ab131168a73035be7d87ebda30e9
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Tue Jun 6 04:06:42 2017 +0800

    workaround webkit parsing error (#2056)
    
    apply `webkit` to jetstream tests
---
 lib/output.js              |  8 ++++++++
 test/compress/functions.js | 26 ++++++++++++++++++++++++++
 test/jetstream.js          |  4 ++--
 test/mocha/release.js      |  1 +
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/lib/output.js b/lib/output.js
index 2fb7441..38f5853 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -70,6 +70,7 @@ function OutputStream(options) {
         semicolons       : true,
         shebang          : true,
         source_map       : null,
+        webkit           : false,
         width            : 80,
         wrap_iife        : false,
     }, true);
@@ -597,6 +598,13 @@ function OutputStream(options) {
             return true;
         }
 
+        if (output.option('webkit')) {
+            var p = output.parent();
+            if (p instanceof AST_PropAccess && p.expression === this) {
+                return true;
+            }
+        }
+
         if (output.option('wrap_iife')) {
             var p = output.parent();
             return p instanceof AST_Call && p.expression === this;
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 6a9f2ae..a9ca23f 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -267,3 +267,29 @@ issue_203: {
     }
     expect_stdout: "42"
 }
+
+no_webkit: {
+    beautify = {
+        webkit: false,
+    }
+    input: {
+        console.log(function() {
+            1 + 1;
+        }.a = 1);
+    }
+    expect_exact: "console.log(function(){1+1}.a=1);"
+    expect_stdout: "1"
+}
+
+webkit: {
+    beautify = {
+        webkit: true,
+    }
+    input: {
+        console.log(function() {
+            1 + 1;
+        }.a = 1);
+    }
+    expect_exact: "console.log((function(){1+1}).a=1);"
+    expect_stdout: "1"
+}
diff --git a/test/jetstream.js b/test/jetstream.js
index 4f13a28..cb8f111 100644
--- a/test/jetstream.js
+++ b/test/jetstream.js
@@ -12,14 +12,14 @@ if (typeof phantom == "undefined") {
     });
     var args = process.argv.slice(2);
     if (!args.length) {
-        args.push("-mc");
+        args.push("-mcb", "beautify=false,webkit");
     }
     args.push("--timings");
     var child_process = require("child_process");
     try {
         require("phantomjs-prebuilt");
     } catch(e) {
-        child_process.execSync("npm install phantomjs-prebuilt at 2.1.14");
+        child_process.execSync("npm install phantomjs-prebuilt at 2.1.14 --no-save");
     }
     var http = require("http");
     var server = http.createServer(function(request, response) {
diff --git a/test/mocha/release.js b/test/mocha/release.js
index b73a3df..c96a792 100644
--- a/test/mocha/release.js
+++ b/test/mocha/release.js
@@ -48,6 +48,7 @@ describe("test/jetstream.js", function() {
         it("Should pass with options " + options, function(done) {
             var args = options.split(/ /);
             args.unshift("test/jetstream.js");
+            args.push("-b", "beautify=false,webkit");
             run(process.argv[0], args, done);
         });
     });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list