commit rubygem-execjs for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package rubygem-execjs for openSUSE:Factory checked in at 2015-02-11 16:45:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-execjs (Old) and /work/SRC/openSUSE:Factory/.rubygem-execjs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-execjs" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-execjs/rubygem-execjs.changes 2014-10-18 09:09:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-execjs.new/rubygem-execjs.changes 2015-02-11 16:45:32.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Feb 9 07:16:53 UTC 2015 - coolo@suse.com + +- updated to version 2.3.0, no changelog + +------------------------------------------------------------------- Old: ---- execjs-2.2.2.gem New: ---- execjs-2.3.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-execjs.spec ++++++ --- /var/tmp/diff_new_pack.h66G6z/_old 2015-02-11 16:45:33.000000000 +0100 +++ /var/tmp/diff_new_pack.h66G6z/_new 2015-02-11 16:45:33.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-execjs # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,15 @@ # +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# + Name: rubygem-execjs -Version: 2.2.2 +Version: 2.3.0 Release: 0 %define mod_name execjs %define mod_full_name %{mod_name}-%{version} ++++++ execjs-2.2.2.gem -> execjs-2.3.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/README.md 2015-02-03 22:53:33.000000000 +0100 @@ -52,6 +52,25 @@ [commonjs.rb](https://github.com/cowboyd/commonjs.rb) designed to provide a consistent interface. +**Why can't I use `setTimeout`?** + +For similar reasons as modules, not all runtimes guarantee a full JavaScript +event loop. So `setTimeout`, `setInterval` and other timers are not defined. + +**Why can't I use ES5 features?** + +Some runtimes like Node will implement many of the latest ES5 features. However +older stock runtimes like JSC on OSX and JScript on Windows may not. You should +only count on ES3 features being available. Prefer feature checking these APIs +rather than hard coding support for specific runtimes. + +**Can I ExecJS be used to sandbox scripts?** + +No, ExecJS shouldn't be used for any security related sandboxing. Since runtimes +are automatically detected, each runtime has different sandboxing properties. +You shouldn't use `ExecJS.eval` on any inputs you wouldn't feel comfortable Ruby +`eval()`ing. + # License Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/external_runtime.rb new/lib/execjs/external_runtime.rb --- old/lib/execjs/external_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/external_runtime.rb 2015-02-03 22:53:33.000000000 +0100 @@ -9,6 +9,9 @@ @runtime = runtime @source = source + + # Test compile context source + exec("") end def eval(source, options = {}) @@ -166,6 +169,21 @@ arg }.join(" ") end + elsif RUBY_ENGINE == 'jruby' + require 'shellwords' + + def exec_runtime(filename) + command = "#{Shellwords.join(binary.split(' ') << filename)} 2>&1" + io = IO.popen(command, @popen_options) + output = io.read + io.close + + if $?.success? + output + else + raise RuntimeError, output + end + end else def exec_runtime(filename) io = IO.popen(binary.split(' ') << filename, @popen_options.merge({err: [:child, :out]})) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/johnson_runtime.rb new/lib/execjs/johnson_runtime.rb --- old/lib/execjs/johnson_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/johnson_runtime.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,104 +0,0 @@ -require "execjs/runtime" - -module ExecJS - class JohnsonRuntime < Runtime - class Context < Runtime::Context - def initialize(runtime, source = "") - source = encode(source) - - @runtime = Johnson::Runtime.new - @runtime.evaluate(source) - end - - def exec(source, options = {}) - source = encode(source) - - if /\S/ =~ source - eval "(function(){#{source}})()", options - end - end - - def eval(source, options = {}) - source = encode(source) - - if /\S/ =~ source - unbox @runtime.evaluate("(#{source})") - end - rescue Johnson::Error => e - if syntax_error?(e) - raise RuntimeError, e.message - else - raise ProgramError, e.message - end - end - - def call(properties, *args) - unbox @runtime.evaluate(properties).call(*args) - rescue Johnson::Error => e - if syntax_error?(e) - raise RuntimeError, e.message - else - raise ProgramError, e.message - end - end - - def unbox(value) - case - when function?(value) - nil - when string?(value) - value.force_encoding('UTF-8') - when array?(value) - value.map { |v| unbox(v) } - when object?(value) - value.inject({}) do |vs, (k, v)| - vs[k] = unbox(v) unless function?(v) - vs - end - else - value - end - end - - private - def syntax_error?(error) - error.message =~ /^syntax error at / - end - - def function?(value) - value.respond_to?(:function?) && value.function? - end - - def string?(value) - value.is_a?(String) - end - - def array?(value) - array_test.call(value) - end - - def object?(value) - value.respond_to?(:inject) - end - - def array_test - @array_test ||= @runtime.evaluate("(function(a) {return a instanceof [].constructor})") - end - end - - def name - "Johnson (SpiderMonkey)" - end - - def available? - require "johnson" - true - rescue LoadError - false - end - - def deprecated? - true - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/mustang_runtime.rb new/lib/execjs/mustang_runtime.rb --- old/lib/execjs/mustang_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/mustang_runtime.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ -require "execjs/runtime" - -module ExecJS - class MustangRuntime < Runtime - class Context < Runtime::Context - def initialize(runtime, source = "") - source = encode(source) - - @v8_context = ::Mustang::Context.new - @v8_context.eval(source) - end - - def exec(source, options = {}) - source = encode(source) - - if /\S/ =~ source - eval "(function(){#{source}})()", options - end - end - - def eval(source, options = {}) - source = encode(source) - - if /\S/ =~ source - unbox @v8_context.eval("(#{source})") - end - end - - def call(properties, *args) - unbox @v8_context.eval(properties).call(*args) - rescue NoMethodError => e - raise ProgramError, e.message - end - - def unbox(value) - case value - when Mustang::V8::Array - value.map { |v| unbox(v) } - when Mustang::V8::Boolean - value.to_bool - when Mustang::V8::NullClass, Mustang::V8::UndefinedClass - nil - when Mustang::V8::Function - nil - when Mustang::V8::SyntaxError - raise RuntimeError, value.message - when Mustang::V8::Error - raise ProgramError, value.message - when Mustang::V8::Object - value.inject({}) { |h, (k, v)| - v = unbox(v) - h[k] = v if v - h - } - else - value.respond_to?(:delegate) ? value.delegate : value - end - end - end - - def name - "Mustang (V8)" - end - - def available? - require "mustang" - true - rescue LoadError - false - end - - def deprecated? - true - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/ruby_racer_runtime.rb new/lib/execjs/ruby_racer_runtime.rb --- old/lib/execjs/ruby_racer_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/ruby_racer_runtime.rb 2015-02-03 22:53:33.000000000 +0100 @@ -8,7 +8,16 @@ lock do @v8_context = ::V8::Context.new - @v8_context.eval(source) + + begin + @v8_context.eval(source) + rescue ::V8::JSError => e + if e.value["name"] == "SyntaxError" + raise RuntimeError, e.value.to_s + else + raise ProgramError, e.value.to_s + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/ruby_rhino_runtime.rb new/lib/execjs/ruby_rhino_runtime.rb --- old/lib/execjs/ruby_rhino_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/ruby_rhino_runtime.rb 2015-02-03 22:53:33.000000000 +0100 @@ -9,6 +9,8 @@ @rhino_context = ::Rhino::Context.new fix_memory_limit! @rhino_context @rhino_context.eval(source) + rescue Exception => e + reraise_error(e) end def exec(source, options = {}) @@ -25,22 +27,14 @@ if /\S/ =~ source unbox @rhino_context.eval("(#{source})") end - rescue ::Rhino::JSError => e - if e.message =~ /^syntax error/ - raise RuntimeError, e.message - else - raise ProgramError, e.message - end + rescue Exception => e + reraise_error(e) end def call(properties, *args) unbox @rhino_context.eval(properties).call(*args) - rescue ::Rhino::JSError => e - if e.message == "syntax error" - raise RuntimeError, e.message - else - raise ProgramError, e.message - end + rescue Exception => e + reraise_error(e) end def unbox(value) @@ -64,6 +58,19 @@ end end + def reraise_error(e) + case e + when ::Rhino::JSError + if e.message == "syntax error" + raise RuntimeError, e.message + else + raise ProgramError, e.message + end + else + raise e + end + end + private # Disables bytecode compiling which limits you to 64K scripts def fix_memory_limit!(context) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/runtimes.rb new/lib/execjs/runtimes.rb --- old/lib/execjs/runtimes.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/runtimes.rb 2015-02-03 22:53:33.000000000 +0100 @@ -1,8 +1,6 @@ require "execjs/module" require "execjs/disabled_runtime" require "execjs/external_runtime" -require "execjs/johnson_runtime" -require "execjs/mustang_runtime" require "execjs/ruby_racer_runtime" require "execjs/ruby_rhino_runtime" @@ -14,10 +12,6 @@ RubyRhino = RubyRhinoRuntime.new - Johnson = JohnsonRuntime.new - - Mustang = MustangRuntime.new - Node = ExternalRuntime.new( name: "Node.js (V8)", command: ["nodejs", "node"], @@ -78,10 +72,8 @@ @runtimes ||= [ RubyRacer, RubyRhino, - Johnson, - Mustang, - Node, JavaScriptCore, + Node, SpiderMonkey, JScript ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/support/jsc_runner.js new/lib/execjs/support/jsc_runner.js --- old/lib/execjs/support/jsc_runner.js 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/support/jsc_runner.js 2015-02-03 22:53:33.000000000 +0100 @@ -1,5 +1,4 @@ -(function(program, execJS) { execJS(program) })(function() { - return eval(#{encode_source(source)}); +(function(program, execJS) { execJS(program) })(function() { #{source} }, function(program) { var output; try { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/support/node_runner.js new/lib/execjs/support/node_runner.js --- old/lib/execjs/support/node_runner.js 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/support/node_runner.js 2015-02-03 22:53:33.000000000 +0100 @@ -1,4 +1,4 @@ -(function(program, execJS) { execJS(program) })(function(module, exports, require, console) { #{source} +(function(program, execJS) { execJS(program) })(function(global, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source} }, function(program) { var output, print = function(string) { process.stdout.write('' + string); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/support/spidermonkey_runner.js new/lib/execjs/support/spidermonkey_runner.js --- old/lib/execjs/support/spidermonkey_runner.js 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/support/spidermonkey_runner.js 2015-02-03 22:53:33.000000000 +0100 @@ -1,6 +1,5 @@ (function(program, execJS) { execJS(program) })(function() { #{source} }, function(program) { - #{json2_source} var output; try { result = program(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/version.rb new/lib/execjs/version.rb --- old/lib/execjs/version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/version.rb 2015-02-03 22:53:33.000000000 +0100 @@ -1,3 +1,3 @@ module ExecJS - VERSION = "2.2.2" + VERSION = "2.3.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 2015-02-03 22:53:33.000000000 +0100 @@ -1,8 +1,7 @@ --- !ruby/object:Gem::Specification name: execjs version: !ruby/object:Gem::Version - version: 2.2.2 - prerelease: + version: 2.3.0 platform: ruby authors: - Sam Stephenson @@ -10,22 +9,20 @@ autorequire: bindir: bin cert_chain: [] -date: 2014-10-14 00:00:00.000000000 Z +date: 2015-02-03 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' description: ExecJS lets you run JavaScript code from Ruby. @@ -36,14 +33,13 @@ extensions: [] extra_rdoc_files: [] files: -- README.md - LICENSE +- README.md +- lib/execjs.rb - lib/execjs/disabled_runtime.rb - lib/execjs/encoding.rb - lib/execjs/external_runtime.rb -- lib/execjs/johnson_runtime.rb - lib/execjs/module.rb -- lib/execjs/mustang_runtime.rb - lib/execjs/ruby_racer_runtime.rb - lib/execjs/ruby_rhino_runtime.rb - lib/execjs/runtime.rb @@ -54,30 +50,28 @@ - lib/execjs/support/node_runner.js - lib/execjs/support/spidermonkey_runner.js - lib/execjs/version.rb -- lib/execjs.rb homepage: https://github.com/sstephenson/execjs licenses: - MIT +metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: -rubygems_version: 1.8.23 +rubygems_version: 2.2.2 signing_key: -specification_version: 3 +specification_version: 4 summary: Run JavaScript code from Ruby test_files: [] -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de