From 7594032fac713e5479c2b3b12b7450e3761641d5 Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Tue, 7 Nov 2017 15:10:55 +0100 Subject: [PATCH 001/379] doc: add hashseed to collaborators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16863/ Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ce40c348e4cce2..db22c07cd4333e 100644 --- a/README.md +++ b/README.md @@ -364,6 +364,8 @@ For more information about the governance of the Node.js project, see **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) * [gireeshpunathil](https://github.com/gireeshpunathil) - **Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) +* [hashseed](https://github.com/hashseed) - +**Yang Guo** <yangguo@chromium.org> (he/him) * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org> * [imran-iq](https://github.com/imran-iq) - From 3b1db7f54bc7dee4b40617573a77267a3f25dc1f Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 10 Nov 2017 14:38:38 -0500 Subject: [PATCH 002/379] test: flag known flake `test-inspector-async-hook-setup-at-signal` is also flaky on VS2017 --- test/sequential/sequential.status | 1 + 1 file changed, 1 insertion(+) diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status index 1c38070bef7519..cf4763b00129cc 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -10,6 +10,7 @@ prefix sequential test-inspector-async-call-stack : PASS, FLAKY test-inspector-bindings : PASS, FLAKY test-inspector-debug-end : PASS, FLAKY +test-inspector-async-hook-setup-at-signal: PASS, FLAKY [$system==linux] From 33c1e8b3d56fc4546a45489e05817725a95b53b9 Mon Sep 17 00:00:00 2001 From: joelostrowski Date: Fri, 15 Apr 2016 16:49:36 +0200 Subject: [PATCH 003/379] tls: implement clientCertEngine option Add an option 'clientCertEngine' to `tls.createSecureContext()` which gets wired up to OpenSSL function `SSL_CTX_set_client_cert_engine`. The option is passed through from `https.request()` as well. This allows using a custom OpenSSL engine to provide the client certificate. --- doc/api/errors.md | 6 ++ lib/_tls_common.js | 12 +++ lib/_tls_wrap.js | 4 + lib/https.js | 4 + lib/internal/errors.js | 2 + src/node_crypto.cc | 95 ++++++++++++++--- src/node_crypto.h | 7 ++ .../openssl-client-cert-engine/binding.gyp | 24 +++++ .../addons/openssl-client-cert-engine/test.js | 62 +++++++++++ .../openssl-client-cert-engine/testengine.cc | 100 ++++++++++++++++++ test/parallel/test-https-agent-getname.js | 4 +- 11 files changed, 305 insertions(+), 15 deletions(-) create mode 100644 test/addons/openssl-client-cert-engine/binding.gyp create mode 100644 test/addons/openssl-client-cert-engine/test.js create mode 100644 test/addons/openssl-client-cert-engine/testengine.cc diff --git a/doc/api/errors.md b/doc/api/errors.md index 0475cfb1e0954a..3455d03e68793e 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -631,6 +631,12 @@ Used when `Console` is instantiated without `stdout` stream or when `stdout` or Used when the native call from `process.cpuUsage` cannot be processed properly. + +### ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED + +Used when a client certificate engine is requested that is not supported by the +version of OpenSSL being used. + ### ERR_CRYPTO_ECDH_INVALID_FORMAT diff --git a/lib/_tls_common.js b/lib/_tls_common.js index 75eb6a2ec53449..fcb6de81669e23 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -208,6 +208,18 @@ exports.createSecureContext = function createSecureContext(options, context) { c.context.setFreeListLength(0); } + if (typeof options.clientCertEngine === 'string') { + if (c.context.setClientCertEngine) + c.context.setClientCertEngine(options.clientCertEngine); + else + throw new errors.Error('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED'); + } else if (options.clientCertEngine != null) { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', + 'options.clientCertEngine', + ['string', 'null', 'undefined'], + options.clientCertEngine); + } + return c; }; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 7a7371ae9eb8f5..3e6f2b06423f44 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -816,6 +816,7 @@ function tlsConnectionListener(rawSocket) { // - rejectUnauthorized. Boolean, default to true. // - key. string. // - cert: string. +// - clientCertEngine: string. // - ca: string or array of strings. // - sessionTimeout: integer. // @@ -859,6 +860,7 @@ function Server(options, listener) { key: this.key, passphrase: this.passphrase, cert: this.cert, + clientCertEngine: this.clientCertEngine, ca: this.ca, ciphers: this.ciphers, ecdhCurve: this.ecdhCurve, @@ -931,6 +933,8 @@ Server.prototype.setOptions = function(options) { if (options.key) this.key = options.key; if (options.passphrase) this.passphrase = options.passphrase; if (options.cert) this.cert = options.cert; + if (options.clientCertEngine) + this.clientCertEngine = options.clientCertEngine; if (options.ca) this.ca = options.ca; if (options.secureProtocol) this.secureProtocol = options.secureProtocol; if (options.crl) this.crl = options.crl; diff --git a/lib/https.js b/lib/https.js index f6e5a533b95084..5013791fe2de25 100644 --- a/lib/https.js +++ b/lib/https.js @@ -160,6 +160,10 @@ Agent.prototype.getName = function getName(options) { if (options.cert) name += options.cert; + name += ':'; + if (options.clientCertEngine) + name += options.clientCertEngine; + name += ':'; if (options.ciphers) name += options.ciphers; diff --git a/lib/internal/errors.js b/lib/internal/errors.js index b898c9fdce82d8..8da4e39f19dce6 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -155,6 +155,8 @@ E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received'); E('ERR_CONSOLE_WRITABLE_STREAM', 'Console expects a writable stream instance for %s'); E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s'); +E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', + 'Custom engines not supported by this OpenSSL'); E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s'); E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found'); E('ERR_CRYPTO_FIPS_FORCED', diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 2a641ad38017fb..ed2782e78978a1 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -361,6 +361,41 @@ static int PasswordCallback(char *buf, int size, int rwflag, void *u) { return 0; } +// Loads OpenSSL engine by engine id and returns it. The loaded engine +// gets a reference so remember the corresponding call to ENGINE_free. +// In case of error the appropriate js exception is scheduled +// and nullptr is returned. +#ifndef OPENSSL_NO_ENGINE +static ENGINE* LoadEngineById(const char* engine_id, char (*errmsg)[1024]) { + MarkPopErrorOnReturn mark_pop_error_on_return; + + ENGINE* engine = ENGINE_by_id(engine_id); + + if (engine == nullptr) { + // Engine not found, try loading dynamically. + engine = ENGINE_by_id("dynamic"); + if (engine != nullptr) { + if (!ENGINE_ctrl_cmd_string(engine, "SO_PATH", engine_id, 0) || + !ENGINE_ctrl_cmd_string(engine, "LOAD", nullptr, 0)) { + ENGINE_free(engine); + engine = nullptr; + } + } + } + + if (engine == nullptr) { + int err = ERR_get_error(); + if (err != 0) { + ERR_error_string_n(err, *errmsg, sizeof(*errmsg)); + } else { + snprintf(*errmsg, sizeof(*errmsg), + "Engine \"%s\" was not found", engine_id); + } + } + + return engine; +} +#endif // !OPENSSL_NO_ENGINE // This callback is used to avoid the default passphrase callback in OpenSSL // which will typically prompt for the passphrase. The prompting is designed @@ -505,6 +540,10 @@ void SecureContext::Initialize(Environment* env, Local target) { SecureContext::SetSessionTimeout); env->SetProtoMethod(t, "close", SecureContext::Close); env->SetProtoMethod(t, "loadPKCS12", SecureContext::LoadPKCS12); +#ifndef OPENSSL_NO_ENGINE + env->SetProtoMethod(t, "setClientCertEngine", + SecureContext::SetClientCertEngine); +#endif // !OPENSSL_NO_ENGINE env->SetProtoMethod(t, "getTicketKeys", SecureContext::GetTicketKeys); env->SetProtoMethod(t, "setTicketKeys", SecureContext::SetTicketKeys); env->SetProtoMethod(t, "setFreeListLength", SecureContext::SetFreeListLength); @@ -1302,6 +1341,46 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { } +#ifndef OPENSSL_NO_ENGINE +void SecureContext::SetClientCertEngine( + const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK_EQ(args.Length(), 1); + CHECK(args[0]->IsString()); + + SecureContext* sc = Unwrap(args.This()); + + MarkPopErrorOnReturn mark_pop_error_on_return; + + // SSL_CTX_set_client_cert_engine does not itself support multiple + // calls by cleaning up before overwriting the client_cert_engine + // internal context variable. + // Instead of trying to fix up this problem we in turn also do not + // support multiple calls to SetClientCertEngine. + if (sc->client_cert_engine_provided_) { + return env->ThrowError( + "Multiple calls to SetClientCertEngine are not allowed"); + } + + const node::Utf8Value engine_id(env->isolate(), args[0]); + char errmsg[1024]; + ENGINE* engine = LoadEngineById(*engine_id, &errmsg); + + if (engine == nullptr) { + return env->ThrowError(errmsg); + } + + int r = SSL_CTX_set_client_cert_engine(sc->ctx_, engine); + // Free reference (SSL_CTX_set_client_cert_engine took it via ENGINE_init). + ENGINE_free(engine); + if (r == 0) { + return ThrowCryptoError(env, ERR_get_error()); + } + sc->client_cert_engine_provided_ = true; +} +#endif // !OPENSSL_NO_ENGINE + + void SecureContext::GetTicketKeys(const FunctionCallbackInfo& args) { #if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_get_tlsext_ticket_keys) @@ -6124,20 +6203,10 @@ void SetEngine(const FunctionCallbackInfo& args) { ClearErrorOnReturn clear_error_on_return; + // Load engine. const node::Utf8Value engine_id(env->isolate(), args[0]); - ENGINE* engine = ENGINE_by_id(*engine_id); - - // Engine not found, try loading dynamically - if (engine == nullptr) { - engine = ENGINE_by_id("dynamic"); - if (engine != nullptr) { - if (!ENGINE_ctrl_cmd_string(engine, "SO_PATH", *engine_id, 0) || - !ENGINE_ctrl_cmd_string(engine, "LOAD", nullptr, 0)) { - ENGINE_free(engine); - engine = nullptr; - } - } - } + char errmsg[1024]; + ENGINE* engine = LoadEngineById(*engine_id, &errmsg); if (engine == nullptr) { int err = ERR_get_error(); diff --git a/src/node_crypto.h b/src/node_crypto.h index c3bc5d24c36dbd..a9719dec257d26 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -93,6 +93,9 @@ class SecureContext : public BaseObject { SSL_CTX* ctx_; X509* cert_; X509* issuer_; +#ifndef OPENSSL_NO_ENGINE + bool client_cert_engine_provided_ = false; +#endif // !OPENSSL_NO_ENGINE static const int kMaxSessionSize = 10 * 1024; @@ -135,6 +138,10 @@ class SecureContext : public BaseObject { const v8::FunctionCallbackInfo& args); static void Close(const v8::FunctionCallbackInfo& args); static void LoadPKCS12(const v8::FunctionCallbackInfo& args); +#ifndef OPENSSL_NO_ENGINE + static void SetClientCertEngine( + const v8::FunctionCallbackInfo& args); +#endif // !OPENSSL_NO_ENGINE static void GetTicketKeys(const v8::FunctionCallbackInfo& args); static void SetTicketKeys(const v8::FunctionCallbackInfo& args); static void SetFreeListLength( diff --git a/test/addons/openssl-client-cert-engine/binding.gyp b/test/addons/openssl-client-cert-engine/binding.gyp new file mode 100644 index 00000000000000..b069e43429c12b --- /dev/null +++ b/test/addons/openssl-client-cert-engine/binding.gyp @@ -0,0 +1,24 @@ +{ + 'targets': [ + { + 'target_name': 'testengine', + 'type': 'none', + 'conditions': [ + ['OS=="mac" and ' + 'node_use_openssl=="true" and ' + 'node_shared=="false" and ' + 'node_shared_openssl=="false"', { + 'type': 'shared_library', + 'sources': [ 'testengine.cc' ], + 'product_extension': 'engine', + 'include_dirs': ['../../../deps/openssl/openssl/include'], + 'link_settings': { + 'libraries': [ + '../../../../out/<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)' + ] + }, + }] + ] + } + ] +} diff --git a/test/addons/openssl-client-cert-engine/test.js b/test/addons/openssl-client-cert-engine/test.js new file mode 100644 index 00000000000000..d07b9c6a1c2c81 --- /dev/null +++ b/test/addons/openssl-client-cert-engine/test.js @@ -0,0 +1,62 @@ +'use strict'; +const common = require('../../common'); +const fixture = require('../../common/fixtures'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const fs = require('fs'); +const path = require('path'); + +const engine = path.join(__dirname, + `/build/${common.buildType}/testengine.engine`); + +if (!fs.existsSync(engine)) + common.skip('no client cert engine'); + +const assert = require('assert'); +const https = require('https'); + +const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem')); +const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem')); +const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem')); + +const port = common.PORT; + +const serverOptions = { + key: agentKey, + cert: agentCert, + ca: agentCa, + requestCert: true, + rejectUnauthorized: true +}; + +const server = https.createServer(serverOptions, (req, res) => { + res.writeHead(200); + res.end('hello world'); +}).listen(port, common.localhostIPv4, () => { + const clientOptions = { + method: 'GET', + host: common.localhostIPv4, + port: port, + path: '/test', + clientCertEngine: engine, // engine will provide key+cert + rejectUnauthorized: false, // prevent failing on self-signed certificates + headers: {} + }; + + const req = https.request(clientOptions, common.mustCall(function(response) { + let body = ''; + response.setEncoding('utf8'); + response.on('data', function(chunk) { + body += chunk; + }); + + response.on('end', common.mustCall(function() { + assert.strictEqual(body, 'hello world'); + server.close(); + })); + })); + + req.end(); +}); diff --git a/test/addons/openssl-client-cert-engine/testengine.cc b/test/addons/openssl-client-cert-engine/testengine.cc new file mode 100644 index 00000000000000..078695a0566691 --- /dev/null +++ b/test/addons/openssl-client-cert-engine/testengine.cc @@ -0,0 +1,100 @@ +#include +#include +#include + +#include +#include + +#include +#include +#include + +#ifndef ENGINE_CMD_BASE +# error did not get engine.h +#endif + +#define TEST_ENGINE_ID "testengine" +#define TEST_ENGINE_NAME "dummy test engine" + +#define AGENT_KEY "test/fixtures/keys/agent1-key.pem" +#define AGENT_CERT "test/fixtures/keys/agent1-cert.pem" + +namespace { + +int EngineInit(ENGINE* engine) { + return 1; +} + +int EngineFinish(ENGINE* engine) { + return 1; +} + +int EngineDestroy(ENGINE* engine) { + return 1; +} + +std::string LoadFile(const char* filename) { + std::ifstream file(filename); + return std::string(std::istreambuf_iterator(file), + std::istreambuf_iterator()); +} + + +int EngineLoadSSLClientCert(ENGINE* engine, + SSL* ssl, + STACK_OF(X509_NAME)* ca_dn, + X509** ppcert, + EVP_PKEY** ppkey, + STACK_OF(X509)** pother, + UI_METHOD* ui_method, + void* callback_data) { + if (ppcert != nullptr) { + std::string cert = LoadFile(AGENT_CERT); + if (cert.empty()) { + return 0; + } + + BIO* bio = BIO_new_mem_buf(cert.data(), cert.size()); + *ppcert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); + BIO_vfree(bio); + if (*ppcert == nullptr) { + printf("Could not read certificate\n"); + return 0; + } + } + + if (ppkey != nullptr) { + std::string key = LoadFile(AGENT_KEY); + if (key.empty()) { + return 0; + } + + BIO* bio = BIO_new_mem_buf(key.data(), key.size()); + *ppkey = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr); + BIO_vfree(bio); + if (*ppkey == nullptr) { + printf("Could not read private key\n"); + return 0; + } + } + + return 1; +} + +int bind_fn(ENGINE* engine, const char* id) { + ENGINE_set_id(engine, TEST_ENGINE_ID); + ENGINE_set_name(engine, TEST_ENGINE_NAME); + ENGINE_set_init_function(engine, EngineInit); + ENGINE_set_finish_function(engine, EngineFinish); + ENGINE_set_destroy_function(engine, EngineDestroy); + ENGINE_set_load_ssl_client_cert_function(engine, EngineLoadSSLClientCert); + + return 1; +} + +extern "C" { + IMPLEMENT_DYNAMIC_CHECK_FN(); + IMPLEMENT_DYNAMIC_BIND_FN(bind_fn); +} + +} // anonymous namespace diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 0986f8472de871..0cdc9568d84470 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -12,7 +12,7 @@ const agent = new https.Agent(); // empty options assert.strictEqual( agent.getName({}), - 'localhost::::::::::' + 'localhost:::::::::::' ); // pass all options arguments @@ -31,5 +31,5 @@ const options = { assert.strictEqual( agent.getName(options), - '0.0.0.0:443:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost:' + '0.0.0.0:443:192.168.1.1:ca:cert::ciphers:key:pfx:false:localhost:' ); From 7d49bd0045969fa504731009ef5ddcb6d4c4e130 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 17 Aug 2017 13:54:05 -0700 Subject: [PATCH 004/379] doc: add `clientCertEngine` to docs Added `clientCertEngine` option to `https` and `tls` docs. --- doc/api/https.md | 9 ++++++--- doc/api/tls.md | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/doc/api/https.md b/doc/api/https.md index 4740986170b39a..96ba80f29fa034 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -150,6 +150,9 @@ Global instance of [`https.Agent`][] for all HTTPS client requests. * `options` {Object} + * `clientCertEngine` {string} Optional name of an OpenSSL engine which can + provide the client certificate. * `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake does not finish in the specified number of milliseconds. Defaults to `120` seconds. A `'tlsClientError'` is emitted on the `tls.Server` object whenever From 121245f25f7ddd0a400d042f7d410d65ddb2cf57 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 22 Sep 2017 21:59:16 -0700 Subject: [PATCH 005/379] test: add tls clientcertengine tests --- ...t-tls-clientcertengine-invalid-arg-type.js | 15 ++++++++++ .../test-tls-clientcertengine-unsupported.js | 28 +++++++++++++++++++ ...-tls-server-setoptions-clientcertengine.js | 15 ++++++++++ 3 files changed, 58 insertions(+) create mode 100644 test/parallel/test-tls-clientcertengine-invalid-arg-type.js create mode 100644 test/parallel/test-tls-clientcertengine-unsupported.js create mode 100644 test/parallel/test-tls-server-setoptions-clientcertengine.js diff --git a/test/parallel/test-tls-clientcertengine-invalid-arg-type.js b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js new file mode 100644 index 00000000000000..35915bbde3e98f --- /dev/null +++ b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js @@ -0,0 +1,15 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const tls = require('tls'); + +{ + assert.throws( + () => { tls.createSecureContext({ clientCertEngine: 0 }); }, + common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', + message: / Received type number$/ })); +} diff --git a/test/parallel/test-tls-clientcertengine-unsupported.js b/test/parallel/test-tls-clientcertengine-unsupported.js new file mode 100644 index 00000000000000..aaa31b96303240 --- /dev/null +++ b/test/parallel/test-tls-clientcertengine-unsupported.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +// Monkey-patch SecureContext +const binding = process.binding('crypto'); +const NativeSecureContext = binding.SecureContext; + +binding.SecureContext = function() { + const rv = new NativeSecureContext(); + rv.setClientCertEngine = undefined; + return rv; +}; + +const assert = require('assert'); +const tls = require('tls'); + +{ + assert.throws( + () => { tls.createSecureContext({ clientCertEngine: 'Cannonmouth' }); }, + common.expectsError({ + code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', + message: 'Custom engines not supported by this OpenSSL' + }) + ); +} diff --git a/test/parallel/test-tls-server-setoptions-clientcertengine.js b/test/parallel/test-tls-server-setoptions-clientcertengine.js new file mode 100644 index 00000000000000..beafdd7c2be47b --- /dev/null +++ b/test/parallel/test-tls-server-setoptions-clientcertengine.js @@ -0,0 +1,15 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const tls = require('tls'); + +{ + const server = tls.createServer(); + assert.strictEqual(server.clientCertEngine, undefined); + server.setOptions({ clientCertEngine: 'Cannonmouth' }); + assert.strictEqual(server.clientCertEngine, 'Cannonmouth'); +} From 37a60a8c3c198c703ddc728090240d323a0183f9 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Sep 2017 13:05:48 +0200 Subject: [PATCH 006/379] src: prepare v8 platform for multi-isolate support This splits the task queue used for asynchronous tasks scheduled by V8 in per-isolate queues, so that multiple threads can be supported. Original-PR-URL: https://github.com/ayojs/ayo/pull/89 Original-Reviewed-By: Timothy Gu PR-URL: https://github.com/nodejs/node/pull/16700 Reviewed-By: James M Snell --- src/env-inl.h | 42 ++--------- src/env.cc | 52 ++++++++++++++ src/env.h | 10 ++- src/inspector_agent.cc | 2 +- src/node.cc | 41 ++++++++--- src/node.h | 24 ++++++- src/node_platform.cc | 120 +++++++++++++++++++++++++------- src/node_platform.h | 51 +++++++++++--- test/cctest/node_test_fixture.h | 4 +- test/cctest/test_environment.cc | 14 ++-- 10 files changed, 267 insertions(+), 93 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 745fb9224605c6..4dadf5ea2c1978 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -37,41 +37,9 @@ namespace node { -inline IsolateData::IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop, - uint32_t* zero_fill_field) : - -// Create string and private symbol properties as internalized one byte strings. -// -// Internalized because it makes property lookups a little faster and because -// the string is created in the old space straight away. It's going to end up -// in the old space sooner or later anyway but now it doesn't go through -// v8::Eternal's new space handling first. -// -// One byte because our strings are ASCII and we can safely skip V8's UTF-8 -// decoding step. It's a one-time cost, but why pay it when you don't have to? -#define V(PropertyName, StringValue) \ - PropertyName ## _( \ - isolate, \ - v8::Private::New( \ - isolate, \ - v8::String::NewFromOneByte( \ - isolate, \ - reinterpret_cast(StringValue), \ - v8::NewStringType::kInternalized, \ - sizeof(StringValue) - 1).ToLocalChecked())), - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V) -#undef V -#define V(PropertyName, StringValue) \ - PropertyName ## _( \ - isolate, \ - v8::String::NewFromOneByte( \ - isolate, \ - reinterpret_cast(StringValue), \ - v8::NewStringType::kInternalized, \ - sizeof(StringValue) - 1).ToLocalChecked()), - PER_ISOLATE_STRING_PROPERTIES(V) -#undef V - event_loop_(event_loop), zero_fill_field_(zero_fill_field) {} +inline v8::Isolate* IsolateData::isolate() const { + return isolate_; +} inline uv_loop_t* IsolateData::event_loop() const { return event_loop_; @@ -81,6 +49,10 @@ inline uint32_t* IsolateData::zero_fill_field() const { return zero_fill_field_; } +inline MultiIsolatePlatform* IsolateData::platform() const { + return platform_; +} + inline Environment::AsyncHooks::AsyncHooks(v8::Isolate* isolate) : isolate_(isolate), fields_(isolate, kFieldsCount), diff --git a/src/env.cc b/src/env.cc index a0d82986c9e231..af8a191f89c1a6 100644 --- a/src/env.cc +++ b/src/env.cc @@ -16,10 +16,62 @@ namespace node { using v8::Context; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Isolate; using v8::Local; using v8::Message; +using v8::Private; using v8::StackFrame; using v8::StackTrace; +using v8::String; + +IsolateData::IsolateData(Isolate* isolate, + uv_loop_t* event_loop, + MultiIsolatePlatform* platform, + uint32_t* zero_fill_field) : + +// Create string and private symbol properties as internalized one byte strings. +// +// Internalized because it makes property lookups a little faster and because +// the string is created in the old space straight away. It's going to end up +// in the old space sooner or later anyway but now it doesn't go through +// v8::Eternal's new space handling first. +// +// One byte because our strings are ASCII and we can safely skip V8's UTF-8 +// decoding step. It's a one-time cost, but why pay it when you don't have to? +#define V(PropertyName, StringValue) \ + PropertyName ## _( \ + isolate, \ + Private::New( \ + isolate, \ + String::NewFromOneByte( \ + isolate, \ + reinterpret_cast(StringValue), \ + v8::NewStringType::kInternalized, \ + sizeof(StringValue) - 1).ToLocalChecked())), + PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V) +#undef V +#define V(PropertyName, StringValue) \ + PropertyName ## _( \ + isolate, \ + String::NewFromOneByte( \ + isolate, \ + reinterpret_cast(StringValue), \ + v8::NewStringType::kInternalized, \ + sizeof(StringValue) - 1).ToLocalChecked()), + PER_ISOLATE_STRING_PROPERTIES(V) +#undef V + isolate_(isolate), + event_loop_(event_loop), + zero_fill_field_(zero_fill_field), + platform_(platform) { + if (platform_ != nullptr) + platform_->RegisterIsolate(this, event_loop); +} + +IsolateData::~IsolateData() { + if (platform_ != nullptr) + platform_->UnregisterIsolate(this); +} void Environment::Start(int argc, const char* const* argv, diff --git a/src/env.h b/src/env.h index 901a26e4e7995b..012155de1c49df 100644 --- a/src/env.h +++ b/src/env.h @@ -344,10 +344,13 @@ struct node_async_ids { class IsolateData { public: - inline IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop, - uint32_t* zero_fill_field = nullptr); + IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop, + MultiIsolatePlatform* platform = nullptr, + uint32_t* zero_fill_field = nullptr); + ~IsolateData(); inline uv_loop_t* event_loop() const; inline uint32_t* zero_fill_field() const; + inline MultiIsolatePlatform* platform() const; #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) @@ -360,6 +363,7 @@ class IsolateData { #undef VP std::unordered_map> http2_static_strs; + inline v8::Isolate* isolate() const; private: #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) @@ -372,8 +376,10 @@ class IsolateData { #undef VS #undef VP + v8::Isolate* const isolate_; uv_loop_t* const event_loop_; uint32_t* const zero_fill_field_; + MultiIsolatePlatform* platform_; DISALLOW_COPY_AND_ASSIGN(IsolateData); }; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index efc0ffc15c5b85..d5b3b43ec22979 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -309,7 +309,7 @@ class NodeInspectorClient : public V8InspectorClient { terminated_ = false; running_nested_loop_ = true; while (!terminated_ && channel_->waitForFrontendMessage()) { - platform_->FlushForegroundTasksInternal(); + platform_->FlushForegroundTasks(env_->isolate()); } terminated_ = false; running_nested_loop_ = false; diff --git a/src/node.cc b/src/node.cc index 6b0b07f9f38c8f..0b6d8530494004 100644 --- a/src/node.cc +++ b/src/node.cc @@ -262,10 +262,10 @@ node::DebugOptions debug_options; static struct { #if NODE_USE_V8_PLATFORM - void Initialize(int thread_pool_size, uv_loop_t* loop) { + void Initialize(int thread_pool_size) { tracing_agent_ = trace_enabled ? new tracing::Agent() : nullptr; - platform_ = new NodePlatform(thread_pool_size, loop, + platform_ = new NodePlatform(thread_pool_size, trace_enabled ? tracing_agent_->GetTracingController() : nullptr); V8::InitializePlatform(platform_); tracing::TraceEventHelper::SetTracingController( @@ -280,8 +280,8 @@ static struct { tracing_agent_ = nullptr; } - void DrainVMTasks() { - platform_->DrainBackgroundTasks(); + void DrainVMTasks(Isolate* isolate) { + platform_->DrainBackgroundTasks(isolate); } #if HAVE_INSPECTOR @@ -306,12 +306,16 @@ static struct { tracing_agent_->Stop(); } + NodePlatform* Platform() { + return platform_; + } + tracing::Agent* tracing_agent_; NodePlatform* platform_; #else // !NODE_USE_V8_PLATFORM - void Initialize(int thread_pool_size, uv_loop_t* loop) {} + void Initialize(int thread_pool_size) {} void Dispose() {} - void DrainVMTasks() {} + void DrainVMTasks(Isolate* isolate) {} bool StartInspector(Environment *env, const char* script_path, const node::DebugOptions& options) { env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0"); @@ -323,6 +327,10 @@ static struct { "so event tracing is not available.\n"); } void StopTracingAgent() {} + + NodePlatform* Platform() { + return nullptr; + } #endif // !NODE_USE_V8_PLATFORM #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR @@ -4769,7 +4777,14 @@ int EmitExit(Environment* env) { IsolateData* CreateIsolateData(Isolate* isolate, uv_loop_t* loop) { - return new IsolateData(isolate, loop); + return new IsolateData(isolate, loop, nullptr); +} + +IsolateData* CreateIsolateData( + Isolate* isolate, + uv_loop_t* loop, + MultiIsolatePlatform* platform) { + return new IsolateData(isolate, loop, platform); } @@ -4854,7 +4869,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, do { uv_run(env.event_loop(), UV_RUN_DEFAULT); - v8_platform.DrainVMTasks(); + v8_platform.DrainVMTasks(isolate); more = uv_loop_alive(env.event_loop()); if (more) @@ -4875,7 +4890,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, RunAtExit(&env); uv_key_delete(&thread_local_env); - v8_platform.DrainVMTasks(); + v8_platform.DrainVMTasks(isolate); WaitForInspectorDisconnect(&env); #if defined(LEAK_SANITIZER) __lsan_do_leak_check(); @@ -4918,7 +4933,11 @@ inline int Start(uv_loop_t* event_loop, Locker locker(isolate); Isolate::Scope isolate_scope(isolate); HandleScope handle_scope(isolate); - IsolateData isolate_data(isolate, event_loop, allocator.zero_fill_field()); + IsolateData isolate_data( + isolate, + event_loop, + v8_platform.Platform(), + allocator.zero_fill_field()); exit_code = Start(isolate, &isolate_data, argc, argv, exec_argc, exec_argv); } @@ -4965,7 +4984,7 @@ int Start(int argc, char** argv) { V8::SetEntropySource(crypto::EntropySource); #endif // HAVE_OPENSSL - v8_platform.Initialize(v8_thread_pool_size, uv_default_loop()); + v8_platform.Initialize(v8_thread_pool_size); // Enable tracing when argv has --trace-events-enabled. if (trace_enabled) { fprintf(stderr, "Warning: Trace event is an experimental feature " diff --git a/src/node.h b/src/node.h index aa8738a567c63c..0656428c0b1f6b 100644 --- a/src/node.h +++ b/src/node.h @@ -61,6 +61,7 @@ #endif #include "v8.h" // NOLINT(build/include_order) +#include "v8-platform.h" // NOLINT(build/include_order) #include "node_version.h" // NODE_MODULE_VERSION #define NODE_MAKE_VERSION(major, minor, patch) \ @@ -209,8 +210,27 @@ NODE_EXTERN void Init(int* argc, class IsolateData; class Environment; -NODE_EXTERN IsolateData* CreateIsolateData(v8::Isolate* isolate, - struct uv_loop_s* loop); +class MultiIsolatePlatform : public v8::Platform { + public: + virtual ~MultiIsolatePlatform() { } + virtual void DrainBackgroundTasks(v8::Isolate* isolate) = 0; + + // These will be called by the `IsolateData` creation/destruction functions. + virtual void RegisterIsolate(IsolateData* isolate_data, + struct uv_loop_s* loop) = 0; + virtual void UnregisterIsolate(IsolateData* isolate_data) = 0; +}; + +// If `platform` is passed, it will be used to register new Worker instances. +// It can be `nullptr`, in which case creating new Workers inside of +// Environments that use this `IsolateData` will not work. +NODE_EXTERN IsolateData* CreateIsolateData( + v8::Isolate* isolate, + struct uv_loop_s* loop); +NODE_EXTERN IsolateData* CreateIsolateData( + v8::Isolate* isolate, + struct uv_loop_s* loop, + MultiIsolatePlatform* platform); NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data); NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, diff --git a/src/node_platform.cc b/src/node_platform.cc index 56b13b8437a0d2..ec2fca6c414d45 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -1,6 +1,8 @@ #include "node_platform.h" #include "node_internals.h" +#include "env.h" +#include "env-inl.h" #include "util.h" namespace node { @@ -13,11 +15,6 @@ using v8::Platform; using v8::Task; using v8::TracingController; -static void FlushTasks(uv_async_t* handle) { - NodePlatform* platform = static_cast(handle->data); - platform->FlushForegroundTasksInternal(); -} - static void BackgroundRunner(void* data) { TaskQueue* background_tasks = static_cast*>(data); while (Task* task = background_tasks->BlockingPop()) { @@ -27,12 +24,51 @@ static void BackgroundRunner(void* data) { } } -NodePlatform::NodePlatform(int thread_pool_size, uv_loop_t* loop, - TracingController* tracing_controller) - : loop_(loop) { - CHECK_EQ(0, uv_async_init(loop, &flush_tasks_, FlushTasks)); - flush_tasks_.data = static_cast(this); - uv_unref(reinterpret_cast(&flush_tasks_)); +PerIsolatePlatformData::PerIsolatePlatformData( + v8::Isolate* isolate, uv_loop_t* loop) + : isolate_(isolate), loop_(loop) { + flush_tasks_ = new uv_async_t(); + CHECK_EQ(0, uv_async_init(loop, flush_tasks_, FlushTasks)); + flush_tasks_->data = static_cast(this); + uv_unref(reinterpret_cast(flush_tasks_)); +} + +void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { + auto platform_data = static_cast(handle->data); + platform_data->FlushForegroundTasksInternal(); +} + +void PerIsolatePlatformData::CallOnForegroundThread(Task* task) { + foreground_tasks_.Push(task); + uv_async_send(flush_tasks_); +} + +void PerIsolatePlatformData::CallDelayedOnForegroundThread( + Task* task, double delay_in_seconds) { + auto pair = new std::pair(task, delay_in_seconds); + foreground_delayed_tasks_.Push(pair); + uv_async_send(flush_tasks_); +} + +PerIsolatePlatformData::~PerIsolatePlatformData() { + FlushForegroundTasksInternal(); + + uv_close(reinterpret_cast(flush_tasks_), + [](uv_handle_t* handle) { + delete reinterpret_cast(handle); + }); +} + +void PerIsolatePlatformData::ref() { + ref_count_++; +} + +int PerIsolatePlatformData::unref() { + return --ref_count_; +} + +NodePlatform::NodePlatform(int thread_pool_size, + TracingController* tracing_controller) { if (tracing_controller) { tracing_controller_.reset(tracing_controller); } else { @@ -49,18 +85,35 @@ NodePlatform::NodePlatform(int thread_pool_size, uv_loop_t* loop, } } +void NodePlatform::RegisterIsolate(IsolateData* isolate_data, uv_loop_t* loop) { + Isolate* isolate = isolate_data->isolate(); + Mutex::ScopedLock lock(per_isolate_mutex_); + PerIsolatePlatformData* existing = per_isolate_[isolate]; + if (existing != nullptr) + existing->ref(); + else + per_isolate_[isolate] = new PerIsolatePlatformData(isolate, loop); +} + +void NodePlatform::UnregisterIsolate(IsolateData* isolate_data) { + Isolate* isolate = isolate_data->isolate(); + Mutex::ScopedLock lock(per_isolate_mutex_); + PerIsolatePlatformData* existing = per_isolate_[isolate]; + CHECK_NE(existing, nullptr); + if (existing->unref() == 0) { + delete existing; + per_isolate_.erase(isolate); + } +} + void NodePlatform::Shutdown() { background_tasks_.Stop(); for (size_t i = 0; i < threads_.size(); i++) { CHECK_EQ(0, uv_thread_join(threads_[i].get())); } - // uv_run cannot be called from the time before the beforeExit callback - // runs until the program exits unless the event loop has any referenced - // handles after beforeExit terminates. This prevents unrefed timers - // that happen to terminate during shutdown from being run unsafely. - // Since uv_run cannot be called, this handle will never be fully cleaned - // up. - uv_close(reinterpret_cast(&flush_tasks_), nullptr); + Mutex::ScopedLock lock(per_isolate_mutex_); + for (const auto& pair : per_isolate_) + delete pair.second; } size_t NodePlatform::NumberOfAvailableBackgroundThreads() { @@ -85,13 +138,19 @@ static void RunForegroundTask(uv_timer_t* handle) { }); } -void NodePlatform::DrainBackgroundTasks() { +void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { + PerIsolatePlatformData* per_isolate = ForIsolate(isolate); + do { + // Right now, there is no way to drain only background tasks associated with + // a specific isolate, so this sometimes does more work than necessary. + // In the long run, that functionality is probably going to be available + // anyway, though. background_tasks_.BlockingDrain(); - } while (FlushForegroundTasksInternal()); + } while (per_isolate->FlushForegroundTasksInternal()); } -bool NodePlatform::FlushForegroundTasksInternal() { +bool PerIsolatePlatformData::FlushForegroundTasksInternal() { bool did_work = false; while (auto delayed = foreground_delayed_tasks_.Pop()) { did_work = true; @@ -118,17 +177,26 @@ void NodePlatform::CallOnBackgroundThread(Task* task, background_tasks_.Push(task); } +PerIsolatePlatformData* NodePlatform::ForIsolate(Isolate* isolate) { + Mutex::ScopedLock lock(per_isolate_mutex_); + PerIsolatePlatformData* data = per_isolate_[isolate]; + CHECK_NE(data, nullptr); + return data; +} + void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) { - foreground_tasks_.Push(task); - uv_async_send(&flush_tasks_); + ForIsolate(isolate)->CallOnForegroundThread(task); } void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate, Task* task, double delay_in_seconds) { - auto pair = new std::pair(task, delay_in_seconds); - foreground_delayed_tasks_.Push(pair); - uv_async_send(&flush_tasks_); + ForIsolate(isolate)->CallDelayedOnForegroundThread(task, + delay_in_seconds); +} + +void NodePlatform::FlushForegroundTasks(v8::Isolate* isolate) { + ForIsolate(isolate)->FlushForegroundTasksInternal(); } bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return false; } diff --git a/src/node_platform.h b/src/node_platform.h index 04927fccc3df66..aa9bf327d7471f 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -2,14 +2,19 @@ #define SRC_NODE_PLATFORM_H_ #include +#include #include #include "libplatform/libplatform.h" +#include "node.h" #include "node_mutex.h" #include "uv.h" namespace node { +class NodePlatform; +class IsolateData; + template class TaskQueue { public: @@ -32,15 +37,38 @@ class TaskQueue { std::queue task_queue_; }; -class NodePlatform : public v8::Platform { +class PerIsolatePlatformData { public: - NodePlatform(int thread_pool_size, uv_loop_t* loop, - v8::TracingController* tracing_controller); - virtual ~NodePlatform() {} + PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); + ~PerIsolatePlatformData(); + + void CallOnForegroundThread(v8::Task* task); + void CallDelayedOnForegroundThread(v8::Task* task, double delay_in_seconds); + + void Shutdown(); + + void ref(); + int unref(); - void DrainBackgroundTasks(); // Returns true iff work was dispatched or executed. bool FlushForegroundTasksInternal(); + private: + static void FlushTasks(uv_async_t* handle); + + int ref_count_ = 1; + v8::Isolate* isolate_; + uv_loop_t* const loop_; + uv_async_t* flush_tasks_ = nullptr; + TaskQueue foreground_tasks_; + TaskQueue> foreground_delayed_tasks_; +}; + +class NodePlatform : public MultiIsolatePlatform { + public: + NodePlatform(int thread_pool_size, v8::TracingController* tracing_controller); + virtual ~NodePlatform() {} + + void DrainBackgroundTasks(v8::Isolate* isolate) override; void Shutdown(); // v8::Platform implementation. @@ -54,11 +82,16 @@ class NodePlatform : public v8::Platform { double MonotonicallyIncreasingTime() override; v8::TracingController* GetTracingController() override; + void FlushForegroundTasks(v8::Isolate* isolate); + + void RegisterIsolate(IsolateData* isolate_data, uv_loop_t* loop) override; + void UnregisterIsolate(IsolateData* isolate_data) override; + private: - uv_loop_t* const loop_; - uv_async_t flush_tasks_; - TaskQueue foreground_tasks_; - TaskQueue> foreground_delayed_tasks_; + PerIsolatePlatformData* ForIsolate(v8::Isolate* isolate); + + Mutex per_isolate_mutex_; + std::unordered_map per_isolate_; TaskQueue background_tasks_; std::vector> threads_; diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index 263f7b96f9daec..890fe9049994e9 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -73,6 +73,8 @@ class NodeTestFixture : public ::testing::Test { public: static uv_loop_t* CurrentLoop() { return ¤t_loop; } + node::MultiIsolatePlatform* Platform() const { return platform_; } + protected: v8::Isolate::CreateParams params_; ArrayBufferAllocator allocator_; @@ -84,7 +86,7 @@ class NodeTestFixture : public ::testing::Test { virtual void SetUp() { CHECK_EQ(0, uv_loop_init(¤t_loop)); - platform_ = new node::NodePlatform(8, ¤t_loop, nullptr); + platform_ = new node::NodePlatform(8, nullptr); v8::V8::InitializePlatform(platform_); v8::V8::Initialize(); params_.array_buffer_allocator = &allocator_; diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 8beacfa95ece7e..704efd7a88358f 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -26,11 +26,13 @@ class EnvironmentTest : public NodeTestFixture { public: Env(const v8::HandleScope& handle_scope, v8::Isolate* isolate, - const Argv& argv) { + const Argv& argv, + NodeTestFixture* test_fixture) { context_ = v8::Context::New(isolate); CHECK(!context_.IsEmpty()); isolate_data_ = CreateIsolateData(isolate, - NodeTestFixture::CurrentLoop()); + NodeTestFixture::CurrentLoop(), + test_fixture->Platform()); CHECK_NE(nullptr, isolate_data_); environment_ = CreateEnvironment(isolate_data_, context_, @@ -66,7 +68,7 @@ class EnvironmentTest : public NodeTestFixture { TEST_F(EnvironmentTest, AtExitWithEnvironment) { const v8::HandleScope handle_scope(isolate_); const Argv argv; - Env env {handle_scope, isolate_, argv}; + Env env {handle_scope, isolate_, argv, this}; AtExit(*env, at_exit_callback1); RunAtExit(*env); @@ -76,7 +78,7 @@ TEST_F(EnvironmentTest, AtExitWithEnvironment) { TEST_F(EnvironmentTest, AtExitWithArgument) { const v8::HandleScope handle_scope(isolate_); const Argv argv; - Env env {handle_scope, isolate_, argv}; + Env env {handle_scope, isolate_, argv, this}; std::string arg{"some args"}; AtExit(*env, at_exit_callback1, static_cast(&arg)); @@ -87,8 +89,8 @@ TEST_F(EnvironmentTest, AtExitWithArgument) { TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) { const v8::HandleScope handle_scope(isolate_); const Argv argv; - Env env1 {handle_scope, isolate_, argv}; - Env env2 {handle_scope, isolate_, argv}; + Env env1 {handle_scope, isolate_, argv, this}; + Env env2 {handle_scope, isolate_, argv, this}; AtExit(*env1, at_exit_callback1); AtExit(*env2, at_exit_callback2); From c2431d553b6c43bf0f44d1cfd13f7271ad5690a4 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 23 Oct 2017 00:52:55 +0200 Subject: [PATCH 007/379] src: cancel pending delayed platform tasks on exit Worker threads need an event loop without active libuv handles in order to shut down. One source of handles that was previously not accounted for were delayed V8 tasks; these create timers that would be standing in the way of clearing the event loop. To solve this, keep track of the scheduled tasks in a list and close their timer handles before the corresponding isolate/loop is removed from the platform. It is not clear from the V8 documentation what the expectation is with respect to pending background tasks at the end of the isolate lifetime; however, an alternative approach of executing these scheduled tasks when flushing them led to an infinite loop of tasks scheduling each other; so it seems safe to assume that the behaviour implemented in this patch is at least acceptable. Original-PR-URL: https://github.com/ayojs/ayo/pull/120 Original-Reviewed-By: Stephen Belanger PR-URL: https://github.com/nodejs/node/pull/16700 Reviewed-By: James M Snell --- src/node.cc | 6 +++++ src/node.h | 1 + src/node_platform.cc | 54 ++++++++++++++++++++++++++++++++------------ src/node_platform.h | 16 ++++++++++++- 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/src/node.cc b/src/node.cc index 0b6d8530494004..433ef0038499b1 100644 --- a/src/node.cc +++ b/src/node.cc @@ -284,6 +284,10 @@ static struct { platform_->DrainBackgroundTasks(isolate); } + void CancelVMTasks(Isolate* isolate) { + platform_->CancelPendingDelayedTasks(isolate); + } + #if HAVE_INSPECTOR bool StartInspector(Environment *env, const char* script_path, const node::DebugOptions& options) { @@ -316,6 +320,7 @@ static struct { void Initialize(int thread_pool_size) {} void Dispose() {} void DrainVMTasks(Isolate* isolate) {} + void CancelVMTasks(Isolate* isolate) {} bool StartInspector(Environment *env, const char* script_path, const node::DebugOptions& options) { env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0"); @@ -4891,6 +4896,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, uv_key_delete(&thread_local_env); v8_platform.DrainVMTasks(isolate); + v8_platform.CancelVMTasks(isolate); WaitForInspectorDisconnect(&env); #if defined(LEAK_SANITIZER) __lsan_do_leak_check(); diff --git a/src/node.h b/src/node.h index 0656428c0b1f6b..3cf5692f6b2975 100644 --- a/src/node.h +++ b/src/node.h @@ -214,6 +214,7 @@ class MultiIsolatePlatform : public v8::Platform { public: virtual ~MultiIsolatePlatform() { } virtual void DrainBackgroundTasks(v8::Isolate* isolate) = 0; + virtual void CancelPendingDelayedTasks(v8::Isolate* isolate) = 0; // These will be called by the `IsolateData` creation/destruction functions. virtual void RegisterIsolate(IsolateData* isolate_data, diff --git a/src/node_platform.cc b/src/node_platform.cc index ec2fca6c414d45..7cec43cbf44509 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -4,6 +4,7 @@ #include "env.h" #include "env-inl.h" #include "util.h" +#include namespace node { @@ -45,13 +46,17 @@ void PerIsolatePlatformData::CallOnForegroundThread(Task* task) { void PerIsolatePlatformData::CallDelayedOnForegroundThread( Task* task, double delay_in_seconds) { - auto pair = new std::pair(task, delay_in_seconds); - foreground_delayed_tasks_.Push(pair); + auto delayed = new DelayedTask(); + delayed->task = task; + delayed->platform_data = this; + delayed->timeout = delay_in_seconds; + foreground_delayed_tasks_.Push(delayed); uv_async_send(flush_tasks_); } PerIsolatePlatformData::~PerIsolatePlatformData() { FlushForegroundTasksInternal(); + CancelPendingDelayedTasks(); uv_close(reinterpret_cast(flush_tasks_), [](uv_handle_t* handle) { @@ -120,7 +125,7 @@ size_t NodePlatform::NumberOfAvailableBackgroundThreads() { return threads_.size(); } -static void RunForegroundTask(Task* task) { +void PerIsolatePlatformData::RunForegroundTask(Task* task) { Isolate* isolate = Isolate::GetCurrent(); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); @@ -130,14 +135,29 @@ static void RunForegroundTask(Task* task) { delete task; } -static void RunForegroundTask(uv_timer_t* handle) { - Task* task = static_cast(handle->data); - RunForegroundTask(task); - uv_close(reinterpret_cast(handle), [](uv_handle_t* handle) { - delete reinterpret_cast(handle); +void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { + DelayedTask* delayed = static_cast(handle->data); + auto& tasklist = delayed->platform_data->scheduled_delayed_tasks_; + auto it = std::find(tasklist.begin(), tasklist.end(), delayed); + CHECK_NE(it, tasklist.end()); + tasklist.erase(it); + RunForegroundTask(delayed->task); + uv_close(reinterpret_cast(&delayed->timer), + [](uv_handle_t* handle) { + delete static_cast(handle->data); }); } +void PerIsolatePlatformData::CancelPendingDelayedTasks() { + for (auto delayed : scheduled_delayed_tasks_) { + uv_close(reinterpret_cast(&delayed->timer), + [](uv_handle_t* handle) { + delete static_cast(handle->data); + }); + } + scheduled_delayed_tasks_.clear(); +} + void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { PerIsolatePlatformData* per_isolate = ForIsolate(isolate); @@ -152,18 +172,18 @@ void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { bool PerIsolatePlatformData::FlushForegroundTasksInternal() { bool did_work = false; + while (auto delayed = foreground_delayed_tasks_.Pop()) { did_work = true; uint64_t delay_millis = - static_cast(delayed->second + 0.5) * 1000; - uv_timer_t* handle = new uv_timer_t(); - handle->data = static_cast(delayed->first); - uv_timer_init(loop_, handle); + static_cast(delayed->timeout + 0.5) * 1000; + delayed->timer.data = static_cast(delayed); + uv_timer_init(loop_, &delayed->timer); // Timers may not guarantee queue ordering of events with the same delay if // the delay is non-zero. This should not be a problem in practice. - uv_timer_start(handle, RunForegroundTask, delay_millis, 0); - uv_unref(reinterpret_cast(handle)); - delete delayed; + uv_timer_start(&delayed->timer, RunForegroundTask, delay_millis, 0); + uv_unref(reinterpret_cast(&delayed->timer)); + scheduled_delayed_tasks_.push_back(delayed); } while (Task* task = foreground_tasks_.Pop()) { did_work = true; @@ -199,6 +219,10 @@ void NodePlatform::FlushForegroundTasks(v8::Isolate* isolate) { ForIsolate(isolate)->FlushForegroundTasksInternal(); } +void NodePlatform::CancelPendingDelayedTasks(v8::Isolate* isolate) { + ForIsolate(isolate)->CancelPendingDelayedTasks(); +} + bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return false; } double NodePlatform::MonotonicallyIncreasingTime() { diff --git a/src/node_platform.h b/src/node_platform.h index aa9bf327d7471f..73c2509e1a0052 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -14,6 +14,7 @@ namespace node { class NodePlatform; class IsolateData; +class PerIsolatePlatformData; template class TaskQueue { @@ -37,6 +38,13 @@ class TaskQueue { std::queue task_queue_; }; +struct DelayedTask { + v8::Task* task; + uv_timer_t timer; + double timeout; + PerIsolatePlatformData* platform_data; +}; + class PerIsolatePlatformData { public: PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); @@ -52,15 +60,20 @@ class PerIsolatePlatformData { // Returns true iff work was dispatched or executed. bool FlushForegroundTasksInternal(); + void CancelPendingDelayedTasks(); + private: static void FlushTasks(uv_async_t* handle); + static void RunForegroundTask(v8::Task* task); + static void RunForegroundTask(uv_timer_t* timer); int ref_count_ = 1; v8::Isolate* isolate_; uv_loop_t* const loop_; uv_async_t* flush_tasks_ = nullptr; TaskQueue foreground_tasks_; - TaskQueue> foreground_delayed_tasks_; + TaskQueue foreground_delayed_tasks_; + std::vector scheduled_delayed_tasks_; }; class NodePlatform : public MultiIsolatePlatform { @@ -69,6 +82,7 @@ class NodePlatform : public MultiIsolatePlatform { virtual ~NodePlatform() {} void DrainBackgroundTasks(v8::Isolate* isolate) override; + void CancelPendingDelayedTasks(v8::Isolate* isolate) override; void Shutdown(); // v8::Platform implementation. From 8522e2420da41791a6fa64557039cc66ef27264e Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Sun, 12 Nov 2017 16:23:31 +0100 Subject: [PATCH 008/379] src: use unique_ptr in platform implementation Replace raw pointers in task queues with std::unique_ptr. This makes ownership obvious. PR-URL: https://github.com/nodejs/node/pull/16970 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- src/node_platform.cc | 68 ++++++++++++++++++++++---------------------- src/node_platform.h | 17 +++++------ 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 7cec43cbf44509..51927cf7f9f792 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -18,9 +18,8 @@ using v8::TracingController; static void BackgroundRunner(void* data) { TaskQueue* background_tasks = static_cast*>(data); - while (Task* task = background_tasks->BlockingPop()) { + while (std::unique_ptr task = background_tasks->BlockingPop()) { task->Run(); - delete task; background_tasks->NotifyOfCompletion(); } } @@ -39,18 +38,19 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { platform_data->FlushForegroundTasksInternal(); } -void PerIsolatePlatformData::CallOnForegroundThread(Task* task) { - foreground_tasks_.Push(task); +void PerIsolatePlatformData::CallOnForegroundThread( + std::unique_ptr task) { + foreground_tasks_.Push(std::move(task)); uv_async_send(flush_tasks_); } void PerIsolatePlatformData::CallDelayedOnForegroundThread( - Task* task, double delay_in_seconds) { - auto delayed = new DelayedTask(); - delayed->task = task; + std::unique_ptr task, double delay_in_seconds) { + std::unique_ptr delayed(new DelayedTask()); + delayed->task = std::move(task); delayed->platform_data = this; delayed->timeout = delay_in_seconds; - foreground_delayed_tasks_.Push(delayed); + foreground_delayed_tasks_.Push(std::move(delayed)); uv_async_send(flush_tasks_); } @@ -125,14 +125,13 @@ size_t NodePlatform::NumberOfAvailableBackgroundThreads() { return threads_.size(); } -void PerIsolatePlatformData::RunForegroundTask(Task* task) { +void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr task) { Isolate* isolate = Isolate::GetCurrent(); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); InternalCallbackScope cb_scope(env, Local(), { 0, 0 }, InternalCallbackScope::kAllowEmptyResource); task->Run(); - delete task; } void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { @@ -141,7 +140,7 @@ void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { auto it = std::find(tasklist.begin(), tasklist.end(), delayed); CHECK_NE(it, tasklist.end()); tasklist.erase(it); - RunForegroundTask(delayed->task); + RunForegroundTask(std::move(delayed->task)); uv_close(reinterpret_cast(&delayed->timer), [](uv_handle_t* handle) { delete static_cast(handle->data); @@ -162,10 +161,10 @@ void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { PerIsolatePlatformData* per_isolate = ForIsolate(isolate); do { - // Right now, there is no way to drain only background tasks associated with - // a specific isolate, so this sometimes does more work than necessary. - // In the long run, that functionality is probably going to be available - // anyway, though. + // Right now, there is no way to drain only background tasks associated + // with a specific isolate, so this sometimes does more work than + // necessary. In the long run, that functionality is probably going to + // be available anyway, though. background_tasks_.BlockingDrain(); } while (per_isolate->FlushForegroundTasksInternal()); } @@ -173,28 +172,29 @@ void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { bool PerIsolatePlatformData::FlushForegroundTasksInternal() { bool did_work = false; - while (auto delayed = foreground_delayed_tasks_.Pop()) { + while (std::unique_ptr delayed = + foreground_delayed_tasks_.Pop()) { did_work = true; uint64_t delay_millis = static_cast(delayed->timeout + 0.5) * 1000; - delayed->timer.data = static_cast(delayed); + delayed->timer.data = static_cast(delayed.get()); uv_timer_init(loop_, &delayed->timer); // Timers may not guarantee queue ordering of events with the same delay if // the delay is non-zero. This should not be a problem in practice. uv_timer_start(&delayed->timer, RunForegroundTask, delay_millis, 0); uv_unref(reinterpret_cast(&delayed->timer)); - scheduled_delayed_tasks_.push_back(delayed); + scheduled_delayed_tasks_.push_back(delayed.release()); } - while (Task* task = foreground_tasks_.Pop()) { + while (std::unique_ptr task = foreground_tasks_.Pop()) { did_work = true; - RunForegroundTask(task); + RunForegroundTask(std::move(task)); } return did_work; } void NodePlatform::CallOnBackgroundThread(Task* task, ExpectedRuntime expected_runtime) { - background_tasks_.Push(task); + background_tasks_.Push(std::unique_ptr(task)); } PerIsolatePlatformData* NodePlatform::ForIsolate(Isolate* isolate) { @@ -205,14 +205,14 @@ PerIsolatePlatformData* NodePlatform::ForIsolate(Isolate* isolate) { } void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) { - ForIsolate(isolate)->CallOnForegroundThread(task); + ForIsolate(isolate)->CallOnForegroundThread(std::unique_ptr(task)); } void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate, Task* task, double delay_in_seconds) { - ForIsolate(isolate)->CallDelayedOnForegroundThread(task, - delay_in_seconds); + ForIsolate(isolate)->CallDelayedOnForegroundThread( + std::unique_ptr(task), delay_in_seconds); } void NodePlatform::FlushForegroundTasks(v8::Isolate* isolate) { @@ -240,34 +240,34 @@ TaskQueue::TaskQueue() outstanding_tasks_(0), stopped_(false), task_queue_() { } template -void TaskQueue::Push(T* task) { +void TaskQueue::Push(std::unique_ptr task) { Mutex::ScopedLock scoped_lock(lock_); outstanding_tasks_++; - task_queue_.push(task); + task_queue_.push(std::move(task)); tasks_available_.Signal(scoped_lock); } template -T* TaskQueue::Pop() { +std::unique_ptr TaskQueue::Pop() { Mutex::ScopedLock scoped_lock(lock_); - T* result = nullptr; - if (!task_queue_.empty()) { - result = task_queue_.front(); - task_queue_.pop(); + if (task_queue_.empty()) { + return std::unique_ptr(nullptr); } + std::unique_ptr result = std::move(task_queue_.front()); + task_queue_.pop(); return result; } template -T* TaskQueue::BlockingPop() { +std::unique_ptr TaskQueue::BlockingPop() { Mutex::ScopedLock scoped_lock(lock_); while (task_queue_.empty() && !stopped_) { tasks_available_.Wait(scoped_lock); } if (stopped_) { - return nullptr; + return std::unique_ptr(nullptr); } - T* result = task_queue_.front(); + std::unique_ptr result = std::move(task_queue_.front()); task_queue_.pop(); return result; } diff --git a/src/node_platform.h b/src/node_platform.h index 73c2509e1a0052..584506ae1f114a 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -22,9 +22,9 @@ class TaskQueue { TaskQueue(); ~TaskQueue() {} - void Push(T* task); - T* Pop(); - T* BlockingPop(); + void Push(std::unique_ptr task); + std::unique_ptr Pop(); + std::unique_ptr BlockingPop(); void NotifyOfCompletion(); void BlockingDrain(); void Stop(); @@ -35,11 +35,11 @@ class TaskQueue { ConditionVariable tasks_drained_; int outstanding_tasks_; bool stopped_; - std::queue task_queue_; + std::queue> task_queue_; }; struct DelayedTask { - v8::Task* task; + std::unique_ptr task; uv_timer_t timer; double timeout; PerIsolatePlatformData* platform_data; @@ -50,8 +50,9 @@ class PerIsolatePlatformData { PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); ~PerIsolatePlatformData(); - void CallOnForegroundThread(v8::Task* task); - void CallDelayedOnForegroundThread(v8::Task* task, double delay_in_seconds); + void CallOnForegroundThread(std::unique_ptr task); + void CallDelayedOnForegroundThread(std::unique_ptr task, + double delay_in_seconds); void Shutdown(); @@ -64,7 +65,7 @@ class PerIsolatePlatformData { private: static void FlushTasks(uv_async_t* handle); - static void RunForegroundTask(v8::Task* task); + static void RunForegroundTask(std::unique_ptr task); static void RunForegroundTask(uv_timer_t* timer); int ref_count_ = 1; From 4d0c70a6f6047606d1d7bc5b94e0d321c9e038ef Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 10 Nov 2017 17:31:46 -0500 Subject: [PATCH 009/379] tools: speed up lint-md-build by using package-lock.json PR-URL: https://github.com/nodejs/node/pull/16945 Fixes: https://github.com/nodejs/node/issues/16628 Reviewed-By: Gibson Fahnestock Reviewed-By: Daijiro Wachi Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Khaidi Chu Reviewed-By: James M Snell --- .gitignore | 4 +- tools/remark-cli/package-lock.json | 1145 +++++++++++++++++ .../remark-preset-lint-node/package-lock.json | 448 +++++++ 3 files changed, 1595 insertions(+), 2 deletions(-) create mode 100644 tools/remark-cli/package-lock.json create mode 100644 tools/remark-preset-lint-node/package-lock.json diff --git a/.gitignore b/.gitignore index 922ef6733e6816..5951901b653cb6 100644 --- a/.gitignore +++ b/.gitignore @@ -104,8 +104,8 @@ deps/npm/node_modules/.bin/ # test artifacts tools/faketime -tools/remark-cli -tools/remark-preset-lint-node +tools/remark-cli/node_modules +tools/remark-preset-lint-node/node_modules icu_config.gypi *.tap diff --git a/tools/remark-cli/package-lock.json b/tools/remark-cli/package-lock.json new file mode 100644 index 00000000000000..527bdf364fdfaf --- /dev/null +++ b/tools/remark-cli/package-lock.json @@ -0,0 +1,1145 @@ +{ + "name": "remark-cli", + "version": "3.0.1", + "lockfileVersion": 1, + "preserveSymlinks": "1", + "requires": true, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "requires": { + "micromatch": "2.3.11", + "normalize-path": "2.1.1" + } + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "array-iterate": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-1.1.1.tgz", + "integrity": "sha1-hlv3+K851rCYLGCQKRSsdrwBCPY=" + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" + }, + "bail": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.2.tgz", + "integrity": "sha1-99bBcxYwqfnw1NNe0fli4gdKF2Q=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "binary-extensions": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", + "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=" + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "ccount": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.2.tgz", + "integrity": "sha1-U7ai+BW7d7nChx97mnLDol8djok=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "character-entities": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.1.tgz", + "integrity": "sha1-92hxvl72bdt/j440eOzDdMJ9bco=" + }, + "character-entities-html4": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.1.tgz", + "integrity": "sha1-NZoqSg9+KdPcKsmb2+Ie45Q46lA=" + }, + "character-entities-legacy": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.1.tgz", + "integrity": "sha1-9Ad53xoQGHK7UQo9KV4fzPFHIC8=" + }, + "character-reference-invalid": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.1.tgz", + "integrity": "sha1-lCg191Dk7GGjCOYMLvjMEBEgLvw=" + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "requires": { + "anymatch": "1.3.2", + "async-each": "1.0.1", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "collapse-white-space": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.3.tgz", + "integrity": "sha1-S5BvZw5aljqHt2sOFolkM0G2Ajw=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=" + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "requires": { + "fill-range": "2.2.3" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } + }, + "fault": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.1.tgz", + "integrity": "sha1-3o01Df1IviS13BsChn4IcbkTUJI=", + "requires": { + "format": "0.2.2" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "fn-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fn-name/-/fn-name-2.0.1.tgz", + "integrity": "sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=" + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "requires": { + "for-in": "1.0.2" + } + }, + "format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "requires": { + "is-glob": "2.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "requires": { + "function-bind": "1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "ignore": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=" + }, + "is-alphabetical": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.1.tgz", + "integrity": "sha1-x3B5zJHU76x3W+EDS/LSQ/lebwg=" + }, + "is-alphanumeric": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphanumeric/-/is-alphanumeric-1.0.0.tgz", + "integrity": "sha1-Spzvcdr0wAHB2B1j0UDPU/1oifQ=" + }, + "is-alphanumerical": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.1.tgz", + "integrity": "sha1-37SqTRCF4zvbYcLe6cgOnGwZ9Ts=", + "requires": { + "is-alphabetical": "1.0.1", + "is-decimal": "1.0.1" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "requires": { + "binary-extensions": "1.10.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-decimal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.1.tgz", + "integrity": "sha1-9ftqlJlq2ejjdh+/vQkfH8qMToI=" + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=" + }, + "is-empty": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-empty/-/is-empty-1.2.0.tgz", + "integrity": "sha1-3pu1snhzigWgsJpX4ftNSjQan2s=" + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-hexadecimal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz", + "integrity": "sha1-bghLvJIGH7sJcexYts5tQE4k2mk=" + }, + "is-hidden": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-hidden/-/is-hidden-1.1.1.tgz", + "integrity": "sha512-175UKecS8+U4hh2PSY0j4xnm2GKYzvSKnbh+naC93JjuBA7LgIo6YxlbcsSo6seFBdQO3RuIcH980yvqqD/2cA==" + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "requires": { + "kind-of": "3.2.2" + } + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=" + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" + }, + "is-whitespace-character": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.1.tgz", + "integrity": "sha1-muAXbzKCtlRXoZks2whPil+DPjs=" + }, + "is-word-character": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.1.tgz", + "integrity": "sha1-WgP6HqkazopusMfNdw64bWXIvvs=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "load-plugin": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-2.2.1.tgz", + "integrity": "sha512-raqInsJNdPGpzZyb+FjjJYmXsjIm8fIiOjOmqmUTGPyCXDMeEK3p4x4Xm1ZCNp43UmfDTWvo7pZkB2fKbD5AAA==", + "requires": { + "npm-prefix": "1.2.0", + "resolve-from": "2.0.0" + } + }, + "longest-streak": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.2.tgz", + "integrity": "sha512-TmYTeEYxiAmSVdpbnQDXGtvYOIRsCMg89CVZzwzc2o7GFL1CjoiRPjH5ec0NFAVlAx3fVof9dX/t6KKRAo2OWA==" + }, + "markdown-escapes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.1.tgz", + "integrity": "sha1-GZTfLTr0gR3lmmcUk0wrIpJzRRg=" + }, + "markdown-extensions": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-1.1.0.tgz", + "integrity": "sha1-+6Dxouu09BI9JbepO8NXksEfUE4=" + }, + "markdown-table": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.1.tgz", + "integrity": "sha1-Sz3ToTPRUYuO8NvHCb8qG0gkvIw=" + }, + "mdast-util-compact": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.1.tgz", + "integrity": "sha1-zbX4TitqLTEU3zO9BdnLMuPECDo=", + "requires": { + "unist-util-modify-children": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "npm-prefix": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/npm-prefix/-/npm-prefix-1.2.0.tgz", + "integrity": "sha1-5hlFX3B0ulTMZtbQ033Z8b5ry8A=", + "requires": { + "rc": "1.2.2", + "shellsubstitute": "1.2.0", + "untildify": "2.1.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "parse-entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.1.tgz", + "integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=", + "requires": { + "character-entities": "1.2.1", + "character-entities-legacy": "1.1.1", + "character-reference-invalid": "1.1.1", + "is-alphanumerical": "1.0.1", + "is-decimal": "1.0.1", + "is-hexadecimal": "1.0.1" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "1.3.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "rc": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.2.tgz", + "integrity": "sha1-2M6ctX6NZNnHut2YdsfDTL48cHc=", + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "requires": { + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "readable-stream": "2.3.3", + "set-immediate-shim": "1.0.1" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "remark": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/remark/-/remark-7.0.1.tgz", + "integrity": "sha1-pd5NrPq/D2CkmCbvJMR5gH+QS/s=", + "requires": { + "remark-parse": "3.0.1", + "remark-stringify": "3.0.1", + "unified": "6.1.5" + } + }, + "remark-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-3.0.1.tgz", + "integrity": "sha1-G5+EGkTY9PvyJGhQJlRZpOs1TIA=", + "requires": { + "collapse-white-space": "1.0.3", + "has": "1.0.1", + "is-alphabetical": "1.0.1", + "is-decimal": "1.0.1", + "is-whitespace-character": "1.0.1", + "is-word-character": "1.0.1", + "markdown-escapes": "1.0.1", + "parse-entities": "1.1.1", + "repeat-string": "1.6.1", + "state-toggle": "1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "1.1.0", + "unherit": "1.1.0", + "unist-util-remove-position": "1.1.1", + "vfile-location": "2.0.2", + "xtend": "4.0.1" + } + }, + "remark-stringify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-3.0.1.tgz", + "integrity": "sha1-eSQr6+CnUggbWAlRb6DAbt7Aac8=", + "requires": { + "ccount": "1.0.2", + "is-alphanumeric": "1.0.0", + "is-decimal": "1.0.1", + "is-whitespace-character": "1.0.1", + "longest-streak": "2.0.2", + "markdown-escapes": "1.0.1", + "markdown-table": "1.1.1", + "mdast-util-compact": "1.0.1", + "parse-entities": "1.1.1", + "repeat-string": "1.6.1", + "state-toggle": "1.0.0", + "stringify-entities": "1.3.1", + "unherit": "1.1.0", + "xtend": "4.0.1" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" + }, + "resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, + "shellsubstitute": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shellsubstitute/-/shellsubstitute-1.2.0.tgz", + "integrity": "sha1-5PcCpQxRiw9v6YRRiQ1wWvKba3A=" + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "state-toggle": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.0.tgz", + "integrity": "sha1-0g+aYWu08MO5i5GSLSW2QKorxCU=" + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringify-entities": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.1.tgz", + "integrity": "sha1-sVDsLXKsTBtfMktR+2soyc3/BYw=", + "requires": { + "character-entities-html4": "1.1.1", + "character-entities-legacy": "1.1.1", + "is-alphanumerical": "1.0.1", + "is-hexadecimal": "1.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "to-vfile": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-2.1.2.tgz", + "integrity": "sha512-o8o2CXU2LDxh4OsvG9bGRXkIhcvk+bWKqWQECLcjfMNy2b8rl4kuFAZeTcPM5obK1mrvQ4iS3AcdopFDluq1jQ==", + "requires": { + "is-buffer": "1.1.6", + "vfile": "2.2.0" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "trim-trailing-lines": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz", + "integrity": "sha1-eu+7eAjfnWafbaLkOMrIxGradoQ=" + }, + "trough": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.1.tgz", + "integrity": "sha1-qf2LA5Swro//guBjOgo2zK1bX4Y=" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "unherit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.0.tgz", + "integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=", + "requires": { + "inherits": "2.0.3", + "xtend": "4.0.1" + } + }, + "unified": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.1.5.tgz", + "integrity": "sha1-cWk3hyYhpjE15iztLzrGoGPG+4c=", + "requires": { + "bail": "1.0.2", + "extend": "3.0.1", + "is-plain-obj": "1.1.0", + "trough": "1.0.1", + "vfile": "2.2.0", + "x-is-function": "1.0.4", + "x-is-string": "0.1.0" + } + }, + "unified-args": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unified-args/-/unified-args-3.1.1.tgz", + "integrity": "sha1-bM7oFbXEtYNCfM8pQ6Xp/Lw4zFE=", + "requires": { + "camelcase": "4.1.0", + "chalk": "1.1.3", + "chokidar": "1.7.0", + "minimist": "1.2.0", + "text-table": "0.2.0", + "unified-engine": "3.1.1" + } + }, + "unified-engine": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-3.1.1.tgz", + "integrity": "sha1-eSVBgm306XtkDM3ZDspiE1bkyec=", + "requires": { + "concat-stream": "1.6.0", + "debug": "2.6.9", + "fault": "1.0.1", + "fn-name": "2.0.1", + "glob": "7.1.2", + "has": "1.0.1", + "ignore": "3.3.7", + "is-empty": "1.2.0", + "is-hidden": "1.1.1", + "is-object": "1.0.1", + "js-yaml": "3.10.0", + "load-plugin": "2.2.1", + "parse-json": "2.2.0", + "to-vfile": "2.1.2", + "trough": "1.0.1", + "vfile-reporter": "3.1.0", + "vfile-statistics": "1.1.0", + "x-is-function": "1.0.4", + "x-is-string": "0.1.0", + "xtend": "4.0.1" + } + }, + "unist-util-modify-children": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-1.1.1.tgz", + "integrity": "sha1-ZtfmpEnm9nIguXarPLi166w55R0=", + "requires": { + "array-iterate": "1.1.1" + } + }, + "unist-util-remove-position": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz", + "integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=", + "requires": { + "unist-util-visit": "1.1.3" + } + }, + "unist-util-stringify-position": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz", + "integrity": "sha1-PMvcU2ee7W7PN3fdf14yKcG2qjw=" + }, + "unist-util-visit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", + "integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=" + }, + "untildify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-2.1.0.tgz", + "integrity": "sha1-F+soB5h/dpUunASF/DEdBqgmouA=", + "requires": { + "os-homedir": "1.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "vfile": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.2.0.tgz", + "integrity": "sha1-zkek+zNZIrIz5TXbD32BIdj87U4=", + "requires": { + "is-buffer": "1.1.6", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "1.1.1" + } + }, + "vfile-location": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.2.tgz", + "integrity": "sha1-02dcWch3SY5JK0dW/2Xkrxp1IlU=" + }, + "vfile-reporter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-3.1.0.tgz", + "integrity": "sha1-qbOYxebcvIqaCObPQl8JLoajcAA=", + "requires": { + "repeat-string": "1.6.1", + "string-width": "1.0.2", + "supports-color": "4.5.0", + "unist-util-stringify-position": "1.1.1", + "vfile-statistics": "1.1.0" + }, + "dependencies": { + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "vfile-statistics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-1.1.0.tgz", + "integrity": "sha1-AhBMYP3u0dEbH3OtZTMLdjSz2JU=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "x-is-function": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/x-is-function/-/x-is-function-1.0.4.tgz", + "integrity": "sha1-XSlNw9Joy90GJYDgxd93o5HR+h4=" + }, + "x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +} diff --git a/tools/remark-preset-lint-node/package-lock.json b/tools/remark-preset-lint-node/package-lock.json new file mode 100644 index 00000000000000..30008212f5520e --- /dev/null +++ b/tools/remark-preset-lint-node/package-lock.json @@ -0,0 +1,448 @@ +{ + "name": "remark-preset-lint-node", + "version": "1.0.0", + "lockfileVersion": 1, + "preserveSymlinks": "1", + "requires": true, + "dependencies": { + "co": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/co/-/co-3.1.0.tgz", + "integrity": "sha1-TqVOpaCJOBUxheFSEMaNkJK8G3g=" + }, + "irregular-plurals": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-1.4.0.tgz", + "integrity": "sha1-LKmwM2UREYVUEvFr5dd8YqRYp2Y=" + }, + "mdast-comment-marker": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.0.2.tgz", + "integrity": "sha1-Hd8O+BH7UkOQF8jSwLkiA18rp0o=" + }, + "mdast-util-heading-style": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-heading-style/-/mdast-util-heading-style-1.0.3.tgz", + "integrity": "sha1-77OQ28iqAWw89XegNJANsn7nJHw=" + }, + "mdast-util-to-string": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.0.4.tgz", + "integrity": "sha1-XEVch4yTVfDB5/PotxnPWDaRrPs=" + }, + "plur": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/plur/-/plur-2.1.2.tgz", + "integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=", + "requires": { + "irregular-plurals": "1.4.0" + } + }, + "remark-lint": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-6.0.1.tgz", + "integrity": "sha512-wvTTuB5O5pF8SxqahQjjrU3dtuhygYjaGcOZTw+4ACgSE4RBINDlNqN46HjcV3X0ib5GmObJUt5a2mmhtmuTqw==", + "requires": { + "remark-message-control": "4.0.1" + } + }, + "remark-lint-blockquote-indentation": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-1.0.1.tgz", + "integrity": "sha512-YrP99MJ3+dQ5JXzq39fUOcYzwcumva/xEM1eFtD2TrQcSdlMLoqYa7gj+aEEhZCjlA5BssTiVoWWW0RjyPPGZw==", + "requires": { + "mdast-util-to-string": "1.0.4", + "plur": "2.1.2", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-checkbox-character-style": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-1.0.1.tgz", + "integrity": "sha512-AF+1UrsVyrYYbK8Mg5TXr/IxaepgMspejPKuflK+TKOYKmMxOHUjdk2kIBBulj+hZCp+yz7lq3ifr8N2Vqg9BA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3", + "vfile-location": "2.0.2" + } + }, + "remark-lint-checkbox-content-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-1.0.1.tgz", + "integrity": "sha512-cCPzu1HSQUevFsfJ7mmwj/v76ZWYBSbBu/GmFJE57G10BCEv1pCHuxJYjGKbXPcQXU5NTvIH9fuHWRVdM3hwdA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3", + "vfile-location": "2.0.2" + } + }, + "remark-lint-code-block-style": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-1.0.1.tgz", + "integrity": "sha512-FRUMhhKwCruH4vkatdMhVO4WlYpysV1NmMILVoK/k+/7uFLSfgvlqo66nzhpMdWL8TQHqdo0LhiXuetGC2WjsQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-definition-spacing": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-1.0.1.tgz", + "integrity": "sha512-ewzdlFfpTSP11ZuiOln0yfz6Y03aWtgJmLVQNfF1spaT1gURaShjs8Hiilbo719bz96DgvXSZLP6UnkSiZL1vg==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-fenced-code-flag": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-1.0.1.tgz", + "integrity": "sha512-P24T9DRe/nnywPFRpE1UAXAVzN1CX6HmINr15UHbQZo1Cy8KYt7uV9YOR0/XzphtnO/AFenAqZyf7tchW5AUNQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-fenced-code-marker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-1.0.1.tgz", + "integrity": "sha512-mX7xAMl5m7xGX+YtOtyXIyv+egD4IQAm6DPGdfunI734QwODwcoBydtpTD56jrY+48nVcQ/anFYT1Blg3Xk3sQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-file-extension": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-1.0.1.tgz", + "integrity": "sha512-K1Pf5oviaFyCs0FhZqaNZ2odgd5KoV6AlA4nNAMxyylB0Y6t0mYpzECoLSS5Bgxf6f8Op9YbuM2cbjBAsv0dIA==", + "requires": { + "unified-lint-rule": "1.0.2" + } + }, + "remark-lint-final-definition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-1.0.1.tgz", + "integrity": "sha512-DK6bphJdQ0xSOQAn+8wOyLIVc3SZW2+ZzCMCLkQnVtHiQ9GHMzFiCkeE3Cq+OClsMI5Yn8wFTHZHPUn58VhNEQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-final-newline": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-1.0.1.tgz", + "integrity": "sha512-neztZuEBw2ka9N35Ap0ZfBqPPA/TNSksGQNq0G9VWL370+s+6k+GUEaq7cjcQACYt310oWl4bx5ukbmo/7L5WA==", + "requires": { + "unified-lint-rule": "1.0.2" + } + }, + "remark-lint-first-heading-level": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-first-heading-level/-/remark-lint-first-heading-level-1.1.1.tgz", + "integrity": "sha512-R11L8arXZy+uAZIioSRVWhp4f6Oere/Q071INTX8g4uvuZrC/uKDjxa3iZ6dlWCfLijC0z/s2JbeqwYbV5QrCA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-hard-break-spaces": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-1.0.2.tgz", + "integrity": "sha512-uh7LqHgRPCphiCvRzBVA4D0Ml2IqPaw89lWJdQ6HvYiV8ChB/OFLBapHi6OKW7NVVVPPJsElPMB/UPUsKFaPTg==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-heading-style": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-1.0.1.tgz", + "integrity": "sha512-m9Gqr091YdxUtG69xdXYH8fSd3+nsrsMamB/qSWpVSZuWQKZ1mRotr1LO9NphJh6vhw8IfBtG07wgEDn6b40sQ==", + "requires": { + "mdast-util-heading-style": "1.0.3", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-auto-link-without-protocol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-auto-link-without-protocol/-/remark-lint-no-auto-link-without-protocol-1.0.1.tgz", + "integrity": "sha512-MHl0hNtF8Rc0lg6iuVP7/0rnp4uZadm3S07/1TiFeqzU22KFxxzcC8980Q4+I8oPZE0d1x80h9DmkNAVFwhDjQ==", + "requires": { + "mdast-util-to-string": "1.0.4", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-blockquote-without-caret": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-caret/-/remark-lint-no-blockquote-without-caret-1.0.0.tgz", + "integrity": "sha1-gd0i3V8EVOupwqU3u6Jgh0ShrW8=", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3", + "vfile-location": "2.0.2" + } + }, + "remark-lint-no-duplicate-definitions": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-1.0.1.tgz", + "integrity": "sha512-3I0V3UVJ0gkDKZahSZ0xdFmklecr5SMwXcWbVBzXvHR59LqgjMVHFI7G/QZ6k2imOl1X22YVRz+mpMjacu2Ipw==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-file-name-articles": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-1.0.1.tgz", + "integrity": "sha512-SzebnFnilrsINA6QZP1YqPa3SrfSotrLkRWl5FUCoVshBvEFNKJFWXj6Xyt4NjWQ5tJWFtOMysAuHdGT+Odhjg==", + "requires": { + "unified-lint-rule": "1.0.2" + } + }, + "remark-lint-no-file-name-consecutive-dashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-1.0.1.tgz", + "integrity": "sha512-YP2HBwA00yeD7phvxp4ftiqbfBPfYHPgPfcEcb8oNa1WlUh/58cs9DbSHWKsZG+XLkvEaheC6qUQG02jEKZHPA==", + "requires": { + "unified-lint-rule": "1.0.2" + } + }, + "remark-lint-no-file-name-outer-dashes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-1.0.2.tgz", + "integrity": "sha512-BVEwLrA4kipalgKrxhncpgtmh6eUmHBH1ggC+X3csYR4X5vXv4vHQqpov4I1vMyWxMLMBnq7lTL3Iqp0CS4vwg==", + "requires": { + "unified-lint-rule": "1.0.2" + } + }, + "remark-lint-no-heading-content-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-1.0.1.tgz", + "integrity": "sha512-VHOqVx3Qb9tckHu/DkpQjBqlXQHcfabKaSuiXdeH+G0sfgWOxL0KCmA6fsUqUdj7xJ8Q7YpH/c3wb3nZ/85d+Q==", + "requires": { + "mdast-util-heading-style": "1.0.3", + "plur": "2.1.2", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-heading-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-1.0.1.tgz", + "integrity": "sha512-NbNZQj+/S6v510FscCTjg/du3KzI0p2CHzqlHRw+4Evryo1O9G7cgSaTT8TC4Eb/h4gGFAPwXuaSKW8noWWBcQ==", + "requires": { + "plur": "2.1.2", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-inline-padding": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-inline-padding/-/remark-lint-no-inline-padding-1.0.1.tgz", + "integrity": "sha512-nRl6vA45ZPdMz3/rVMZw7WRRqLFuMrzhdkrbrGLjwBovdIeD/IGCEbDA5NR60g2xT9V5dAmKogvHEH1bIr8SdQ==", + "requires": { + "mdast-util-to-string": "1.0.4", + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-multiple-toplevel-headings": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-1.0.1.tgz", + "integrity": "sha512-LFfgjF3NKFkt0tGNnJ8Exf8+DrVcMRwek5qu5mvh2KrZnmSpm5flYWzUy2UnnIyicDL3CZYC/r3Fjz6CeBYgZA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-shell-dollars": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-1.0.1.tgz", + "integrity": "sha512-YryHem73PTxjCkuC4HONJWHsmrLyXmF7r+cCH36Ys3vuWsfAbwkbOwpyuPB4KXn+6fHaTUfz/B5BPp3iwzJwyA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-shortcut-reference-image": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-1.0.1.tgz", + "integrity": "sha512-nUQ+4xB5hKZTCl9gvg7c+W1T3ddsnjgu4zwRza2Bn+21cKmUzx+z9dvlZ4aVuNGmxuWHbKI8/ZkKuB8Eu27vJw==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-table-indentation": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-1.0.1.tgz", + "integrity": "sha512-QrtT1GvJmAoNsWh+gmHFajFlM+ubm9rd3Cbz2OYPix8ZM6g907aIfG2NusJFXL9D8/CExQWYhlBvelFBbHgqbQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-no-tabs": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-1.0.1.tgz", + "integrity": "sha512-sFNCjz3MpX2TKo4vvo9s6iX8C0MsTmw10iC0F6mk3FKZ694bkHnEQOPhz5oyZIodV+QJ2wKqpZkuyXruIshjtA==", + "requires": { + "unified-lint-rule": "1.0.2", + "vfile-location": "2.0.2" + } + }, + "remark-lint-no-unused-definitions": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-1.0.1.tgz", + "integrity": "sha512-weNwWXvoSBmB3L2Yh8oxY0ylF6L5b/PjFbOhzBU4SlnpFOMfTn3rwNxOxbTrDS8MG2JTPVTaFn4ajXr/zkbH0Q==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-rule-style": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-1.0.1.tgz", + "integrity": "sha512-dzH+K6DcPIIMBq6LUQgE4dR9TiQGZrQOoULD7m0Y0lIb2EoR2FK5Zd4TgZg/LnvTs6fid37t0xFoaY4/lXV/5Q==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-strong-marker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-1.0.1.tgz", + "integrity": "sha512-+bwWKWAqDwqd21Vw+ndqVFh5V27Dp4MKhk9AUlKmcvgJYHuvQ8UfWQdpZcP218ps/4EbwTfyi33TaPyXqOTlXA==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-table-cell-padding": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-1.0.1.tgz", + "integrity": "sha512-o3WwC9YysXbQKf0D5nvhhJPcLagqedLwGdifukdgyaKvuIQVbtWbNv1/UOdB3LL+D+2fUrwrCmnQ8J3E1r0lBw==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-lint-table-pipes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-1.0.1.tgz", + "integrity": "sha512-VHfDRvcovLBl/cvSjwDoA0xRizdZU33A6F2qFD9A5hu1sDWgGxMLg5m2MOvFlRkUVxSwUv47cuD0/yxB4THYXQ==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-generated": "1.1.1", + "unist-util-position": "3.0.0", + "unist-util-visit": "1.1.3" + } + }, + "remark-message-control": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-4.0.1.tgz", + "integrity": "sha1-KRPNYLMW2fnzkKp/NGOdIM9VmW0=", + "requires": { + "mdast-comment-marker": "1.0.2", + "trim": "0.0.1", + "unist-util-visit": "1.1.3", + "vfile-location": "2.0.2" + } + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "unified-lint-rule": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-1.0.2.tgz", + "integrity": "sha512-WkqwMC1aijHE17W3Z1co7aTI+Dzo1jHdwhI66fTClU1yOTbzAsTqlOD6eeR/MI9235Y3nu2jMDcm8GCeq4gaLg==", + "requires": { + "wrapped": "1.0.1" + } + }, + "unist-util-generated": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.1.tgz", + "integrity": "sha1-mfFseJWayFTe58YVwpGSTIv03n8=" + }, + "unist-util-position": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.0.tgz", + "integrity": "sha1-5uHgPu64HF4a/lU+jUrfvXwNj4I=" + }, + "unist-util-visit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", + "integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=" + }, + "vfile-location": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.2.tgz", + "integrity": "sha1-02dcWch3SY5JK0dW/2Xkrxp1IlU=" + }, + "wrapped": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wrapped/-/wrapped-1.0.1.tgz", + "integrity": "sha1-x4PZ2Aeyc+mwHoUWgKk4yHyQckI=", + "requires": { + "co": "3.1.0", + "sliced": "1.0.1" + } + } + } +} From 4e3aa9a8998c9a6835c3970ef8a317a6a875e0e3 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 11 Nov 2017 22:58:26 -0500 Subject: [PATCH 010/379] tty: refactor exports This commit moves the tty module's exports to a single object, which is more aligned with other core modules. PR-URL: https://github.com/nodejs/node/pull/16959 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/tty.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tty.js b/lib/tty.js index cf020f529dae71..9595c79db39a33 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -29,9 +29,9 @@ const errnoException = util._errnoException; const errors = require('internal/errors'); const readline = require('readline'); -exports.isatty = function(fd) { +function isatty(fd) { return Number.isInteger(fd) && fd >= 0 && isTTY(fd); -}; +} function ReadStream(fd, options) { @@ -54,8 +54,6 @@ function ReadStream(fd, options) { } inherits(ReadStream, net.Socket); -exports.ReadStream = ReadStream; - ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; this._handle.setRawMode(flag); @@ -90,7 +88,6 @@ function WriteStream(fd) { } } inherits(WriteStream, net.Socket); -exports.WriteStream = WriteStream; WriteStream.prototype.isTTY = true; @@ -131,3 +128,6 @@ WriteStream.prototype.clearScreenDown = function() { WriteStream.prototype.getWindowSize = function() { return [this.columns, this.rows]; }; + + +module.exports = { isatty, ReadStream, WriteStream }; From f80cf5a33d9f18376854152da65c621f8df97c45 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 11 Nov 2017 23:03:57 -0500 Subject: [PATCH 011/379] test: add coverage to tty module PR-URL: https://github.com/nodejs/node/pull/16959 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- .../test-tty-stream-constructors.js | 21 +++++ .../test-tty-stream-constructors.out | 0 test/pseudo-tty/test-tty-window-size.js | 85 +++++++++++++++++++ test/pseudo-tty/test-tty-window-size.out | 0 4 files changed, 106 insertions(+) create mode 100644 test/pseudo-tty/test-tty-stream-constructors.js create mode 100644 test/pseudo-tty/test-tty-stream-constructors.out create mode 100644 test/pseudo-tty/test-tty-window-size.js create mode 100644 test/pseudo-tty/test-tty-window-size.out diff --git a/test/pseudo-tty/test-tty-stream-constructors.js b/test/pseudo-tty/test-tty-stream-constructors.js new file mode 100644 index 00000000000000..27c33bad1868d6 --- /dev/null +++ b/test/pseudo-tty/test-tty-stream-constructors.js @@ -0,0 +1,21 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { ReadStream, WriteStream } = require('tty'); + +{ + // Verify that tty.ReadStream can be constructed without new. + const stream = ReadStream(0); + + stream.unref(); + assert(stream instanceof ReadStream); + assert.strictEqual(stream.isTTY, true); +} + +{ + // Verify that tty.WriteStream can be constructed without new. + const stream = WriteStream(1); + + assert(stream instanceof WriteStream); + assert.strictEqual(stream.isTTY, true); +} diff --git a/test/pseudo-tty/test-tty-stream-constructors.out b/test/pseudo-tty/test-tty-stream-constructors.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/pseudo-tty/test-tty-window-size.js b/test/pseudo-tty/test-tty-window-size.js new file mode 100644 index 00000000000000..782b66802e3ada --- /dev/null +++ b/test/pseudo-tty/test-tty-window-size.js @@ -0,0 +1,85 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { WriteStream } = require('tty'); +const { TTY } = process.binding('tty_wrap'); +const getWindowSize = TTY.prototype.getWindowSize; + +function monkeyPatchGetWindowSize(fn) { + TTY.prototype.getWindowSize = function() { + TTY.prototype.getWindowSize = getWindowSize; + return fn.apply(this, arguments); + }; +} + +{ + // tty.WriteStream constructor does not define columns and rows if an error + // occurs while retrieving the window size from the handle. + monkeyPatchGetWindowSize(function() { + return -1; + }); + + const stream = WriteStream(1); + + assert(stream instanceof WriteStream); + assert.strictEqual(stream.columns, undefined); + assert.strictEqual(stream.rows, undefined); +} + +{ + // _refreshSize() emits an error if an error occurs while retrieving the + // window size from the handle. + const stream = WriteStream(1); + + stream.on('error', common.mustCall((err) => { + assert.strictEqual(err.syscall, 'getWindowSize'); + })); + + monkeyPatchGetWindowSize(function() { + return -1; + }); + + stream._refreshSize(); +} + +{ + // _refreshSize() emits a 'resize' event when the window size changes. + monkeyPatchGetWindowSize(function(size) { + size[0] = 80; + size[1] = 24; + return 0; + }); + + const stream = WriteStream(1); + + stream.on('resize', common.mustCall(() => { + assert.strictEqual(stream.columns, 82); + assert.strictEqual(stream.rows, 26); + })); + + assert.strictEqual(stream.columns, 80); + assert.strictEqual(stream.rows, 24); + + monkeyPatchGetWindowSize(function(size) { + size[0] = 82; + size[1] = 26; + return 0; + }); + + stream._refreshSize(); +} + +{ + // WriteStream.prototype.getWindowSize() returns the current columns and rows. + monkeyPatchGetWindowSize(function(size) { + size[0] = 99; + size[1] = 32; + return 0; + }); + + const stream = WriteStream(1); + + assert.strictEqual(stream.columns, 99); + assert.strictEqual(stream.rows, 32); + assert.deepStrictEqual(stream.getWindowSize(), [99, 32]); +} diff --git a/test/pseudo-tty/test-tty-window-size.out b/test/pseudo-tty/test-tty-window-size.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 From f6ec5fa4e8876af2f88f575da162b77aa09669d5 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 14 Nov 2017 10:18:32 +0100 Subject: [PATCH 012/379] src: fix bad sizeof expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was computing the size of the pointer, not the size of the pointed-to object. Introduced in commit 727b2911eca ("src,dns: refactor cares_wrap to avoid global state".) PR-URL: https://github.com/nodejs/node/pull/17014 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Franziska Hinkelmann Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Tobias Nießen --- src/cares_wrap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 7c09b01d80c570..f9072f2898052a 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -160,7 +160,7 @@ class ChannelWrap : public AsyncWrap { } inline node_ares_task_list* task_list() { return &task_list_; } - size_t self_size() const override { return sizeof(this); } + size_t self_size() const override { return sizeof(*this); } static void AresTimeout(uv_timer_t* handle); From 7ac760b603e6e3f97bbf7b499b788d0d917d3969 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 12 Nov 2017 15:16:36 +0100 Subject: [PATCH 013/379] src: fix SetClientCertEngine() nullptr dereference Introduced in commit 6ee985f311d ("tls: implement clientCertEngine option") which was merged November 11. PR-URL: https://github.com/nodejs/node/pull/16965 Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell --- src/node_crypto.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index ed2782e78978a1..4d894bba6fb0b3 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1348,7 +1348,8 @@ void SecureContext::SetClientCertEngine( CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsString()); - SecureContext* sc = Unwrap(args.This()); + SecureContext* sc; + ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); MarkPopErrorOnReturn mark_pop_error_on_return; From f32192157328605cf7e1e419fd6ce469b4e1de89 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 15 Oct 2017 22:40:00 +0200 Subject: [PATCH 014/379] tty: fix 'resize' event regression It's not wholly clear what commit introduced the regression but between v8.4.0 and v8.5.0 the 'resize' event stopped getting emitted when the tty was resized. The SIGWINCH event listener apparently was being installed before the support code for `process.on('SIGWINCH', ...)` was. Fix that by moving said support code to real early in the bootstrap process. This commit also seems to fix a Windows-only "write EINVAL" error for reasons even less well-understood... Fixes: https://github.com/nodejs/node/issues/16141 Fixes: https://github.com/nodejs/node/issues/16194 PR-URL: https://github.com/nodejs/node/pull/16225 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel Reviewed-By: Luigi Pinca Reviewed-By: Refael Ackermann Reviewed-By: Yuta Hiroto --- lib/internal/bootstrap_node.js | 2 +- test/pseudo-tty/pseudo-tty.status | 5 +++++ test/pseudo-tty/test-tty-stdout-resize.js | 11 +++++++++++ test/pseudo-tty/test-tty-stdout-resize.out | 0 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/pseudo-tty/test-tty-stdout-resize.js create mode 100644 test/pseudo-tty/test-tty-stdout-resize.out diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 62b6911cbf9062..9a2990fd473bed 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -33,6 +33,7 @@ const _process = NativeModule.require('internal/process'); _process.setupConfig(NativeModule._source); + _process.setupSignalHandlers(); NativeModule.require('internal/process/warning').setup(); NativeModule.require('internal/process/next_tick').setup(); NativeModule.require('internal/process/stdio').setup(); @@ -55,7 +56,6 @@ _process.setup_cpuUsage(); _process.setupMemoryUsage(); _process.setupKillAndExit(); - _process.setupSignalHandlers(); if (global.__coverage__) NativeModule.require('internal/process/write-coverage').setup(); diff --git a/test/pseudo-tty/pseudo-tty.status b/test/pseudo-tty/pseudo-tty.status index 13279019b6bd72..5c8114692d9447 100644 --- a/test/pseudo-tty/pseudo-tty.status +++ b/test/pseudo-tty/pseudo-tty.status @@ -3,3 +3,8 @@ prefix pseudo-tty [$system==aix] # being investigated under https://github.com/nodejs/node/issues/9728 test-tty-wrap : FAIL, PASS + +[$system==solaris] +# https://github.com/nodejs/node/pull/16225 - `ioctl(fd, TIOCGWINSZ)` seems +# to fail with EINVAL on SmartOS when `fd` is a pty from python's pty module. +test-tty-stdout-resize : FAIL, PASS diff --git a/test/pseudo-tty/test-tty-stdout-resize.js b/test/pseudo-tty/test-tty-stdout-resize.js new file mode 100644 index 00000000000000..c92db615020c78 --- /dev/null +++ b/test/pseudo-tty/test-tty-stdout-resize.js @@ -0,0 +1,11 @@ +'use strict'; +const { mustCall } = require('../common'); +const { notStrictEqual } = require('assert'); + +// tty.WriteStream#_refreshSize() only emits the 'resize' event when the +// window dimensions change. We cannot influence that from the script +// but we can set the old values to something exceedingly unlikely. +process.stdout.columns = 9001; +process.stdout.on('resize', mustCall()); +process.kill(process.pid, 'SIGWINCH'); +setImmediate(mustCall(() => notStrictEqual(process.stdout.columns, 9001))); diff --git a/test/pseudo-tty/test-tty-stdout-resize.out b/test/pseudo-tty/test-tty-stdout-resize.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 From edb98468846e1d0fcbca84d8002669a800b9d4dd Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Fri, 5 May 2017 15:57:57 +0200 Subject: [PATCH 015/379] stream: remove usage of *State.highWaterMark Replaced _readableState.highWaterMark with a .readableHighWaterMark getter and _writableState.highWaterMark with a .writableHighWaterMark getter. The getters are non-enumerable because they break some prototype manipulation that happen in the ecosystem. Ref: https://github.com/nodejs/node/issues/445. PR-URL: https://github.com/nodejs/node/pull/12860 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/stream.md | 16 +++++++++++++ lib/_http_server.js | 6 ++--- lib/_stream_duplex.js | 23 +++++++++++++++---- lib/_stream_readable.js | 9 ++++++++ lib/_stream_writable.js | 10 ++++++++ lib/fs.js | 2 +- test/parallel/test-http-pipeline-regr-3508.js | 2 +- test/parallel/test-stream-big-packet.js | 2 +- .../test-stream-readable-flow-recursion.js | 2 +- .../test-stream-transform-split-objectmode.js | 16 +++++++++---- test/parallel/test-stream2-unpipe-leak.js | 2 +- 11 files changed, 73 insertions(+), 17 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 6ee016466206d8..25a218cf130728 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -437,6 +437,14 @@ process.nextTick(() => { See also: [`writable.cork()`][]. +##### writable.writableHighWaterMark + + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + ##### writable.write(chunk[, encoding][, callback]) + +Return the value of `highWaterMark` passed when constructing this +`Readable`. + ##### readable.read([size]) + +* `path` {string|Buffer|URL} +* `options` {string|Object} + * `encoding` {string} **Default:** `'utf8'` +* `callback` {Function} + * `err` {Error} + * `resolvedPath` {string|Buffer} + +Asynchronous realpath(3). + +The `callback` gets two arguments `(err, resolvedPath)`. + +Only paths that can be converted to UTF8 strings are supported. + +The optional `options` argument can be a string specifying an encoding, or an +object with an `encoding` property specifying the character encoding to use for +the path passed to the callback. If the `encoding` is set to `'buffer'`, +the path returned will be passed as a `Buffer` object. + +*Note*: On Linux, when Node.js is linked against musl libc, the procfs file +system must be mounted on `/proc` in order for this function to work. Glibc +does not have this restriction. + ## fs.realpathSync(path[, options]) + +* `path` {string|Buffer|URL} +* `options` {string|Object} + * `encoding` {string} **Default:** `'utf8'` + +Synchronous realpath(3). + +Only paths that can be converted to UTF8 strings are supported. + +The optional `options` argument can be a string specifying an encoding, or an +object with an `encoding` property specifying the character encoding to use for +the path passed to the callback. If the `encoding` is set to `'buffer'`, +the path returned will be passed as a `Buffer` object. + +*Note*: On Linux, when Node.js is linked against musl libc, the procfs file +system must be mounted on `/proc` in order for this function to work. Glibc +does not have this restriction. + ## fs.rename(oldPath, newPath, callback) * `callbacks` {Object} The [Hook Callbacks][] to register diff --git a/doc/api/fs.md b/doc/api/fs.md index c282b418d3b6f9..e831dd94b1f1dc 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -316,7 +316,7 @@ argument to `fs.createReadStream()`. If `path` is passed as a string, then diff --git a/doc/api/http.md b/doc/api/http.md index b57445b13953f3..cb4eff07325d2d 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -161,7 +161,7 @@ socket/stream from this function, or by passing the socket/stream to `callback`. ### agent.keepSocketAlive(socket) * `socket` {net.Socket} @@ -181,7 +181,7 @@ it for use with the next request. ### agent.reuseSocket(socket, request) * `socket` {net.Socket} diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 1f4e23f2e4b543..0513699fb04252 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -397,7 +397,7 @@ class of the compressor/decompressor classes. ### zlib.bytesRead * {number} From 8366a74bbfec1670bcdcb62649c257e1fe7cc7cf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 14 Nov 2017 06:47:44 -0800 Subject: [PATCH 030/379] path: remove obsolete comment Remove commented-out code that is leftover from a refactoring. PR-URL: https://github.com/nodejs/node/pull/17023 Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: Lance Ball --- lib/path.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/path.js b/lib/path.js index e8dbf4c2eeaf4f..580d55f9fc0018 100644 --- a/lib/path.js +++ b/lib/path.js @@ -523,7 +523,6 @@ const win32 = { // This means that the user can use join to construct UNC paths from // a server name and a share name; for example: // path.join('//server', 'share') -> '\\\\server\\share\\') - //var firstPart = paths[0]; var needsReplace = true; var slashCount = 0; var code = firstPart.charCodeAt(0); From acf6f24ef2dbb4bfad9aff13af3b1f20ce99f99b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 16 Nov 2017 21:18:30 +0100 Subject: [PATCH 031/379] test: make REPL test pass in coverage mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make a REPL tab completion test pass in coverage mode by using `Uin` as the common prefix of all `Uint*Array` globals instead of `co` which could be a prefix for `console` and `coverage`, so it doesn't expand the way it's expected to in coverage mode. PR-URL: https://github.com/nodejs/node/pull/17082 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig --- test/parallel/test-repl-tab-complete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 8dd80464275bed..4bf6b7209d0bb4 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -519,8 +519,8 @@ const editor = repl.start({ editorStream.run(['.clear']); editorStream.run(['.editor']); -editor.completer('co', common.mustCall((error, data) => { - assert.deepStrictEqual(data, [['con'], 'co']); +editor.completer('Uin', common.mustCall((error, data) => { + assert.deepStrictEqual(data, [['Uint'], 'Uin']); })); editorStream.run(['.clear']); From 17e31dc66a00d7adb292f1685f823b59f8e9585a Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 8 Nov 2017 22:08:13 -0800 Subject: [PATCH 032/379] src: perf_hooks: fix wrong sized delete Depending on the allocator, existing code leaks memory. PR-URL: https://github.com/nodejs/node/pull/16898 Reviewed-By: Franziska Hinkelmann Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Khaidi Chu --- src/node_perf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_perf.cc b/src/node_perf.cc index 155f1e66e46bb9..a3b428bac94fc4 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -196,7 +196,9 @@ void PerformanceGCCallback(uv_async_t* handle) { cleanup: delete data; - auto closeCB = [](uv_handle_t* handle) { delete handle; }; + auto closeCB = [](uv_handle_t* handle) { + delete reinterpret_cast(handle); + }; uv_close(reinterpret_cast(handle), closeCB); } From 91385be239c91f077ed0b59a9fc995caa0e41b4e Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 15 Nov 2017 10:48:01 +0100 Subject: [PATCH 033/379] build: fix cctest target --with-dtrace Currently the cctest target will fail on linux when configured --with-dtrace: /node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o: In function `node::DTRACE_NET_SERVER_CONNECTION( v8::FunctionCallbackInfo const&)': node_dtrace.cc:(.text+0x103): undefined reference to `node_net__server__connection_semaphore' /node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o: In function `node::DTRACE_NET_STREAM_END( v8::FunctionCallbackInfo const&)': ... This is because node_dtrace_provider.o is not linked by the cctest target. This commit tries to fix and simplify the conditions in cctest target so that node_dtrace.o is included for all operating systems that support dtrace, include node_dtrace_ustack.o for all operating systems except mac and linux, and include node_dtrace_provider.o for all operating systems except mac. PR-URL: https://github.com/nodejs/node/pull/17039 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- node.gyp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/node.gyp b/node.gyp index 1e8121e0385159..9c1478cd8d3f34 100644 --- a/node.gyp +++ b/node.gyp @@ -879,7 +879,20 @@ [ 'node_use_dtrace=="true"', { 'libraries': [ '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)', - ] + ], + 'conditions': [ + ['OS!="mac" and OS!="linux"', { + 'libraries': [ + '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_provider.<(OBJ_SUFFIX)', + '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_ustack.<(OBJ_SUFFIX)', + ] + }], + ['OS=="linux"', { + 'libraries': [ + '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o', + ] + }], + ], }], [ 'OS=="win"', { 'libraries': [ @@ -890,16 +903,6 @@ '<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_posix.<(OBJ_SUFFIX)', ], }], - [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', { - 'copies': [{ - 'destination': '<(OBJ_DIR)/cctest/src', - 'files': [ - '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_ustack.<(OBJ_SUFFIX)', - '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_provider.<(OBJ_SUFFIX)', - '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)', - ]}, - ], - }], [ 'node_shared_zlib=="false"', { 'dependencies': [ 'deps/zlib/zlib.gyp:zlib', From da8414e09a4538eeb8301f99bb67dfaf10ec8dc9 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Sun, 12 Nov 2017 21:01:01 +0100 Subject: [PATCH 034/379] src: use smart pointer instead of new and delete Use an std::unique_ptr for variables that are deleted right after creation. Since the destructor of InspectorTimer is private but needed by the unique_ptr, define deleter_type as friend. PR-URL: https://github.com/nodejs/node/pull/17020 Reviewed-By: James M Snell Reviewed-By: Timothy Gu --- src/inspector_agent.cc | 8 +++++--- src/inspector_io.cc | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index d5b3b43ec22979..215e91873a3a70 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -261,10 +261,10 @@ class InspectorTimer { } static void TimerClosedCb(uv_handle_t* uvtimer) { - InspectorTimer* timer = + std::unique_ptr timer( node::ContainerOf(&InspectorTimer::timer_, - reinterpret_cast(uvtimer)); - delete timer; + reinterpret_cast(uvtimer))); + // Unique_ptr goes out of scope here and pointer is deleted. } ~InspectorTimer() {} @@ -272,6 +272,8 @@ class InspectorTimer { uv_timer_t timer_; V8InspectorClient::TimerCallback callback_; void* data_; + + friend std::unique_ptr::deleter_type; }; class InspectorTimerHandle { diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 73f0419ead6545..a870c0a2634452 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -114,9 +114,9 @@ int CloseAsyncAndLoop(uv_async_t* async) { // Delete main_thread_req_ on async handle close void ReleasePairOnAsyncClose(uv_handle_t* async) { - AsyncAndAgent* pair = node::ContainerOf(&AsyncAndAgent::first, - reinterpret_cast(async)); - delete pair; + std::unique_ptr pair(node::ContainerOf(&AsyncAndAgent::first, + reinterpret_cast(async))); + // Unique_ptr goes out of scope here and pointer is deleted. } } // namespace From 03803ee505a455131c5385a470a0691923461401 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Wed, 15 Nov 2017 19:01:23 +0100 Subject: [PATCH 035/379] doc: mention smart pointers in Cpp style guide Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr, to the Cpp style guide. Mostly copied from the Google style guide. PR-URL: https://github.com/nodejs/node/pull/17055 Ref: https://github.com/nodejs/node/pull/16970 Ref: https://github.com/nodejs/node/pull/16974 Ref: https://github.com/nodejs/node/pull/17000 Ref: https://github.com/nodejs/node/pull/17012 Ref: https://github.com/nodejs/node/pull/17020 Ref: https://github.com/nodejs/node/pull/17030 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- CPP_STYLE_GUIDE.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3c552fc2bf2a16..1dad8592f9694c 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -16,6 +16,7 @@ * [`nullptr` instead of `NULL` or `0`](#nullptr-instead-of-null-or-0) * [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included) * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods) +* [Ownership and Smart Pointers](#ownership-and-smart-pointers) Unfortunately, the C++ linter (based on [Google’s `cpplint`](https://github.com/google/styleguide)), which can be run @@ -168,3 +169,27 @@ A lot of code inside Node.js is written so that typechecking etc. is performed in JavaScript. Using C++ `throw` is not allowed. + +## Ownership and Smart Pointers + +"Smart" pointers are classes that act like pointers, e.g. +by overloading the `*` and `->` operators. Some smart pointer types can be +used to automate ownership bookkeeping, to ensure these responsibilities are +met. `std::unique_ptr` is a smart pointer type introduced in C++11, which +expresses exclusive ownership of a dynamically allocated object; the object +is deleted when the `std::unique_ptr` goes out of scope. It cannot be +copied, but can be moved to represent ownership transfer. +`std::shared_ptr` is a smart pointer type that expresses shared ownership of a +dynamically allocated object. `std::shared_ptr`s can be copied; ownership +of the object is shared among all copies, and the object +is deleted when the last `std::shared_ptr` is destroyed. + +Prefer to use `std::unique_ptr` to make ownership +transfer explicit. For example: + +```cpp +std::unique_ptr FooFactory(); +void FooConsumer(std::unique_ptr ptr); +``` + +Never use `std::auto_ptr`. Instead, use `std::unique_ptr`. From 1a8b0e9fa58013b20eb64f4a02ec96a7556dfae5 Mon Sep 17 00:00:00 2001 From: Vijayalakshmi Kannan Date: Tue, 14 Nov 2017 16:02:35 +0530 Subject: [PATCH 036/379] lib: replace string concatenation with template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16923 Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski --- lib/_http_client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 366a7b0712879c..5b568628006d68 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -116,7 +116,7 @@ function ClientRequest(options, cb) { var path; if (options.path) { - path = '' + options.path; + path = String(options.path); var invalidPath; if (path.length <= 39) { // Determined experimentally in V8 5.4 invalidPath = isInvalidPath(path); From 8ba513ee2e5af7ef24deb7ef727420c456a7a5ce Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 14 Nov 2017 13:34:52 +0100 Subject: [PATCH 037/379] src: rename async-wrap -> async_wrap This commit renames async-wrap to async_wrap for consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Anatoli Papirovski --- node.gyp | 8 ++++---- src/{async-wrap-inl.h => async_wrap-inl.h} | 2 +- src/{async-wrap.cc => async_wrap.cc} | 2 +- src/{async-wrap.h => async_wrap.h} | 0 src/cares_wrap.cc | 2 +- src/connect_wrap.h | 2 +- src/env.cc | 2 +- src/fs_event_wrap.cc | 2 +- src/handle_wrap.cc | 2 +- src/handle_wrap.h | 2 +- src/js_stream.cc | 2 +- src/js_stream.h | 2 +- src/node.cc | 2 +- src/node_crypto.cc | 2 +- src/node_crypto.h | 2 +- src/node_http_parser.cc | 2 +- src/node_stat_watcher.cc | 2 +- src/node_stat_watcher.h | 2 +- src/node_zlib.cc | 2 +- src/pipe_wrap.cc | 2 +- src/pipe_wrap.h | 2 +- src/req-wrap-inl.h | 2 +- src/req-wrap.h | 2 +- src/signal_wrap.cc | 2 +- src/stream_base.h | 2 +- src/tcp_wrap.h | 2 +- src/timer_wrap.cc | 2 +- src/tls_wrap.cc | 2 +- src/tls_wrap.h | 2 +- src/udp_wrap.h | 2 +- 30 files changed, 32 insertions(+), 32 deletions(-) rename src/{async-wrap-inl.h => async_wrap-inl.h} (98%) rename src/{async-wrap.cc => async_wrap.cc} (99%) rename src/{async-wrap.h => async_wrap.h} (100%) diff --git a/node.gyp b/node.gyp index 9c1478cd8d3f34..29a5aaf805d195 100644 --- a/node.gyp +++ b/node.gyp @@ -188,7 +188,7 @@ ], 'sources': [ - 'src/async-wrap.cc', + 'src/async_wrap.cc', 'src/cares_wrap.cc', 'src/connection_wrap.cc', 'src/connect_wrap.cc', @@ -242,8 +242,8 @@ 'src/uv.cc', # headers to make for a more pleasant IDE experience 'src/aliased_buffer.h', - 'src/async-wrap.h', - 'src/async-wrap-inl.h', + 'src/async_wrap.h', + 'src/async_wrap-inl.h', 'src/base-object.h', 'src/base-object-inl.h', 'src/connection_wrap.h', @@ -831,7 +831,7 @@ 'conditions': [ ['node_target_type!="static_library"', { 'libraries': [ - '<(OBJ_PATH)<(OBJ_SEPARATOR)async-wrap.<(OBJ_SUFFIX)', + '<(OBJ_PATH)<(OBJ_SEPARATOR)async_wrap.<(OBJ_SUFFIX)', '<(OBJ_PATH)<(OBJ_SEPARATOR)env.<(OBJ_SUFFIX)', '<(OBJ_PATH)<(OBJ_SEPARATOR)node.<(OBJ_SUFFIX)', '<(OBJ_PATH)<(OBJ_SEPARATOR)node_buffer.<(OBJ_SUFFIX)', diff --git a/src/async-wrap-inl.h b/src/async_wrap-inl.h similarity index 98% rename from src/async-wrap-inl.h rename to src/async_wrap-inl.h index 617d51dc59f037..219dfa71b6cdf0 100644 --- a/src/async-wrap-inl.h +++ b/src/async_wrap-inl.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "base-object-inl.h" #include "node_internals.h" diff --git a/src/async-wrap.cc b/src/async_wrap.cc similarity index 99% rename from src/async-wrap.cc rename to src/async_wrap.cc index ff7ad1b9819a79..ec3f68e76a1605 100644 --- a/src/async-wrap.cc +++ b/src/async_wrap.cc @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" diff --git a/src/async-wrap.h b/src/async_wrap.h similarity index 100% rename from src/async-wrap.h rename to src/async_wrap.h diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index f9072f2898052a..2a3620549c5bb3 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -21,7 +21,7 @@ #define CARES_STATICLIB #include "ares.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "node.h" #include "req-wrap-inl.h" diff --git a/src/connect_wrap.h b/src/connect_wrap.h index 7b16a5448745aa..59918078960016 100644 --- a/src/connect_wrap.h +++ b/src/connect_wrap.h @@ -5,7 +5,7 @@ #include "env.h" #include "req-wrap.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "v8.h" namespace node { diff --git a/src/env.cc b/src/env.cc index af8a191f89c1a6..c177deb67d129f 100644 --- a/src/env.cc +++ b/src/env.cc @@ -1,5 +1,5 @@ #include "node_internals.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "v8-profiler.h" #if defined(_MSC_VER) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index da39602c1bba36..cb011bcc0143b9 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" #include "node.h" diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 071f5ff873758a..7dcafa2ce6e842 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "handle_wrap.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" #include "node.h" diff --git a/src/handle_wrap.h b/src/handle_wrap.h index f8be356e1a730c..29e4f364603bda 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "util.h" #include "uv.h" #include "v8.h" diff --git a/src/js_stream.cc b/src/js_stream.cc index 9d28b90585048a..1b102451cd6d82 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -1,6 +1,6 @@ #include "js_stream.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "env-inl.h" #include "node_buffer.h" #include "stream_base-inl.h" diff --git a/src/js_stream.h b/src/js_stream.h index a4a67ae3372620..44bf7a06df7f8f 100644 --- a/src/js_stream.h +++ b/src/js_stream.h @@ -3,7 +3,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "stream_base.h" #include "v8.h" diff --git a/src/node.cc b/src/node.cc index 37fdd47ec176cc..a6c6017f149139 100644 --- a/src/node.cc +++ b/src/node.cc @@ -54,7 +54,7 @@ #endif #include "ares.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "handle_wrap.h" #include "http_parser.h" diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 95780444a9625f..4f089b940ee4b2 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -28,7 +28,7 @@ #include "node_mutex.h" #include "tls_wrap.h" // TLSWrap -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "string_bytes.h" #include "util-inl.h" diff --git a/src/node_crypto.h b/src/node_crypto.h index a9719dec257d26..4034afab6f208c 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -31,7 +31,7 @@ #include "node_buffer.h" #include "env.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "base-object-inl.h" #include "v8.h" diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 972982a4260ba4..06d6a488263a3d 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -22,7 +22,7 @@ #include "node.h" #include "node_buffer.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "http_parser.h" #include "stream_base-inl.h" diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index b8a395ef8deeab..cb48c652c97b29 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node_stat_watcher.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" diff --git a/src/node_stat_watcher.h b/src/node_stat_watcher.h index df15f339d128a2..55f4307fdbcd8c 100644 --- a/src/node_stat_watcher.h +++ b/src/node_stat_watcher.h @@ -25,7 +25,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "uv.h" #include "v8.h" diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 01f713afd728b8..975fbf0f8f5ee8 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -22,7 +22,7 @@ #include "node.h" #include "node_buffer.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 5a6eeaa3ebdeb8..94510ed44bbc0a 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -21,7 +21,7 @@ #include "pipe_wrap.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "connection_wrap.h" #include "env-inl.h" #include "handle_wrap.h" diff --git a/src/pipe_wrap.h b/src/pipe_wrap.h index 6db7f4561cb522..6f22038b918f76 100644 --- a/src/pipe_wrap.h +++ b/src/pipe_wrap.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "connection_wrap.h" #include "env.h" diff --git a/src/req-wrap-inl.h b/src/req-wrap-inl.h index 4cf8e425de3833..171160c2a15691 100644 --- a/src/req-wrap-inl.h +++ b/src/req-wrap-inl.h @@ -4,7 +4,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "req-wrap.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" diff --git a/src/req-wrap.h b/src/req-wrap.h index 0fddae67460d6f..83baf9d2a35285 100644 --- a/src/req-wrap.h +++ b/src/req-wrap.h @@ -3,7 +3,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "util.h" #include "v8.h" diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 70b831132bb735..59aa45078b3ae6 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "handle_wrap.h" #include "util-inl.h" diff --git a/src/stream_base.h b/src/stream_base.h index 20cb0155c9d7b9..94e4bfd73961da 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -4,7 +4,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "env.h" -#include "async-wrap.h" +#include "async_wrap.h" #include "req-wrap-inl.h" #include "node.h" #include "util.h" diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index 95c0b1c1e5b99e..fa6bac01386256 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "connection_wrap.h" diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index aabde9a6133ca2..eeaee70a02331c 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "env-inl.h" #include "handle_wrap.h" #include "util-inl.h" diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 3315267330afa2..d1cfcd9f17e81f 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tls_wrap.h" -#include "async-wrap-inl.h" +#include "async_wrap-inl.h" #include "node_buffer.h" // Buffer #include "node_crypto.h" // SecureContext #include "node_crypto_bio.h" // NodeBIO diff --git a/src/tls_wrap.h b/src/tls_wrap.h index 99d2dc9121f139..b782e7c3c23178 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -27,7 +27,7 @@ #include "node.h" #include "node_crypto.h" // SSLWrap -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "stream_wrap.h" #include "util.h" diff --git a/src/udp_wrap.h b/src/udp_wrap.h index fe9256bcc63a05..50a7455beb6a9e 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async-wrap.h" +#include "async_wrap.h" #include "env.h" #include "handle_wrap.h" #include "req-wrap-inl.h" From 5119bb1a6dbd4bcc7057f920af22f1f7d34051a7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 14 Nov 2017 13:34:52 +0100 Subject: [PATCH 038/379] src: rename base-object -> base_object This commit renames base-object to base_object for consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Anatoli Papirovski --- node.gyp | 4 ++-- src/async_wrap-inl.h | 2 +- src/async_wrap.h | 2 +- src/{base-object-inl.h => base_object-inl.h} | 2 +- src/{base-object.h => base_object.h} | 0 src/inspector_js_api.cc | 2 +- src/module_wrap.h | 2 +- src/node_contextify.cc | 2 +- src/node_crypto.h | 2 +- src/node_i18n.cc | 2 +- src/node_perf.h | 2 +- src/node_serdes.cc | 2 +- src/node_url.cc | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) rename src/{base-object-inl.h => base_object-inl.h} (99%) rename src/{base-object.h => base_object.h} (100%) diff --git a/node.gyp b/node.gyp index 29a5aaf805d195..77e3ad22ca75e3 100644 --- a/node.gyp +++ b/node.gyp @@ -244,8 +244,8 @@ 'src/aliased_buffer.h', 'src/async_wrap.h', 'src/async_wrap-inl.h', - 'src/base-object.h', - 'src/base-object-inl.h', + 'src/base_object.h', + 'src/base_object-inl.h', 'src/connection_wrap.h', 'src/connect_wrap.h', 'src/env.h', diff --git a/src/async_wrap-inl.h b/src/async_wrap-inl.h index 219dfa71b6cdf0..cc6377d82a0fee 100644 --- a/src/async_wrap-inl.h +++ b/src/async_wrap-inl.h @@ -25,7 +25,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async_wrap.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "node_internals.h" namespace node { diff --git a/src/async_wrap.h b/src/async_wrap.h index 3ff05825e75e77..98451ead3bc220 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "base-object.h" +#include "base_object.h" #include "v8.h" #include diff --git a/src/base-object-inl.h b/src/base_object-inl.h similarity index 99% rename from src/base-object-inl.h rename to src/base_object-inl.h index 480edd7463e7f0..74c1458b3d69ea 100644 --- a/src/base-object-inl.h +++ b/src/base_object-inl.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "base-object.h" +#include "base_object.h" #include "env-inl.h" #include "util-inl.h" #include "v8.h" diff --git a/src/base-object.h b/src/base_object.h similarity index 100% rename from src/base-object.h rename to src/base_object.h diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index f72517bac18c70..50374b7e24377b 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -1,4 +1,4 @@ -#include "base-object-inl.h" +#include "base_object-inl.h" #include "inspector_agent.h" #include "inspector_io.h" #include "node_internals.h" diff --git a/src/module_wrap.h b/src/module_wrap.h index 980c802c1f1952..a8dd89b790068a 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -7,7 +7,7 @@ #include #include #include "node_url.h" -#include "base-object-inl.h" +#include "base_object-inl.h" namespace node { namespace loader { diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 47806aa7f61786..7c705236a3d3d1 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -21,7 +21,7 @@ #include "node_internals.h" #include "node_watchdog.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "v8-debug.h" namespace node { diff --git a/src/node_crypto.h b/src/node_crypto.h index 4034afab6f208c..836144bf8be1a2 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -32,7 +32,7 @@ #include "env.h" #include "async_wrap-inl.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "v8.h" diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 30f421a8b8384b..7c769226062e5d 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -48,7 +48,7 @@ #include "node_buffer.h" #include "env-inl.h" #include "util-inl.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "v8.h" #include diff --git a/src/node_perf.h b/src/node_perf.h index ba7a326471d695..690f70830961bb 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -6,7 +6,7 @@ #include "node.h" #include "node_perf_common.h" #include "env.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "v8.h" #include "uv.h" diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 4e99513a5fd31c..449fe4a551a162 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -1,6 +1,6 @@ #include "node_internals.h" #include "node_buffer.h" -#include "base-object-inl.h" +#include "base_object-inl.h" namespace node { diff --git a/src/node_url.cc b/src/node_url.cc index 49c005a23bc2c7..337eb55f4427c0 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1,6 +1,6 @@ #include "node_url.h" #include "node_internals.h" -#include "base-object-inl.h" +#include "base_object-inl.h" #include "node_i18n.h" #include From d74c7c5461fcb6924a11842e265e7ce94121041b Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 14 Nov 2017 13:34:52 +0100 Subject: [PATCH 039/379] src: rename req-wrap -> req_wrap This commit renames req-wrap to req_wrap consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Anatoli Papirovski --- node.gyp | 4 ++-- src/cares_wrap.cc | 2 +- src/connect_wrap.cc | 2 +- src/connect_wrap.h | 2 +- src/env.h | 2 +- src/node.cc | 2 +- src/node_file.cc | 2 +- src/{req-wrap-inl.h => req_wrap-inl.h} | 2 +- src/{req-wrap.h => req_wrap.h} | 0 src/stream_base.h | 2 +- src/stream_wrap.cc | 2 +- src/tty_wrap.cc | 2 +- src/udp_wrap.cc | 2 +- src/udp_wrap.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) rename src/{req-wrap-inl.h => req_wrap-inl.h} (98%) rename src/{req-wrap.h => req_wrap.h} (100%) diff --git a/node.gyp b/node.gyp index 77e3ad22ca75e3..67c807ec1b2846 100644 --- a/node.gyp +++ b/node.gyp @@ -275,8 +275,8 @@ 'src/tty_wrap.h', 'src/tcp_wrap.h', 'src/udp_wrap.h', - 'src/req-wrap.h', - 'src/req-wrap-inl.h', + 'src/req_wrap.h', + 'src/req_wrap-inl.h', 'src/string_bytes.h', 'src/stream_base.h', 'src/stream_base-inl.h', diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 2a3620549c5bb3..85da8f573ee632 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -24,7 +24,7 @@ #include "async_wrap-inl.h" #include "env-inl.h" #include "node.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "util-inl.h" #include "uv.h" diff --git a/src/connect_wrap.cc b/src/connect_wrap.cc index 3dd3b40194ac28..f9ea987e05f5a3 100644 --- a/src/connect_wrap.cc +++ b/src/connect_wrap.cc @@ -1,7 +1,7 @@ #include "connect_wrap.h" #include "env-inl.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "util-inl.h" namespace node { diff --git a/src/connect_wrap.h b/src/connect_wrap.h index 59918078960016..506108668dfa3f 100644 --- a/src/connect_wrap.h +++ b/src/connect_wrap.h @@ -4,7 +4,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "env.h" -#include "req-wrap.h" +#include "req_wrap.h" #include "async_wrap.h" #include "v8.h" diff --git a/src/env.h b/src/env.h index 4f226ea7c29e42..e19ee01eed3bca 100644 --- a/src/env.h +++ b/src/env.h @@ -30,7 +30,7 @@ #include "inspector_agent.h" #endif #include "handle_wrap.h" -#include "req-wrap.h" +#include "req_wrap.h" #include "util.h" #include "uv.h" #include "v8.h" diff --git a/src/node.cc b/src/node.cc index a6c6017f149139..11bc86a4539a1a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -59,7 +59,7 @@ #include "handle_wrap.h" #include "http_parser.h" #include "nghttp2/nghttp2ver.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "string_bytes.h" #include "tracing/agent.h" #include "util.h" diff --git a/src/node_file.cc b/src/node_file.cc index 9da3fc7f2e0002..3593971ddaf26c 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -23,7 +23,7 @@ #include "node_internals.h" #include "node_stat_watcher.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "string_bytes.h" #include diff --git a/src/req-wrap-inl.h b/src/req_wrap-inl.h similarity index 98% rename from src/req-wrap-inl.h rename to src/req_wrap-inl.h index 171160c2a15691..76430439c948f3 100644 --- a/src/req-wrap-inl.h +++ b/src/req_wrap-inl.h @@ -3,7 +3,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "req-wrap.h" +#include "req_wrap.h" #include "async_wrap-inl.h" #include "env-inl.h" #include "util-inl.h" diff --git a/src/req-wrap.h b/src/req_wrap.h similarity index 100% rename from src/req-wrap.h rename to src/req_wrap.h diff --git a/src/stream_base.h b/src/stream_base.h index 94e4bfd73961da..87c7b0bc63eafd 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -5,7 +5,7 @@ #include "env.h" #include "async_wrap.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "node.h" #include "util.h" diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 01022c91741d09..43f8494f9d7241 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -27,7 +27,7 @@ #include "node_buffer.h" #include "node_counters.h" #include "pipe_wrap.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "tcp_wrap.h" #include "udp_wrap.h" #include "util-inl.h" diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 872a126c6d4ee4..17462f6d21e49a 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -25,7 +25,7 @@ #include "handle_wrap.h" #include "node_buffer.h" #include "node_wrap.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "stream_wrap.h" #include "util-inl.h" diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index b3702ea6e3feb2..87afdc4a4cec43 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -23,7 +23,7 @@ #include "env-inl.h" #include "node_buffer.h" #include "handle_wrap.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "util-inl.h" #include diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 50a7455beb6a9e..254ae76131252c 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -27,7 +27,7 @@ #include "async_wrap.h" #include "env.h" #include "handle_wrap.h" -#include "req-wrap-inl.h" +#include "req_wrap-inl.h" #include "uv.h" #include "v8.h" From 7fe6a8f5d5d5f6340907f4ffada961dd6bd6f621 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 1 Nov 2017 12:13:18 +0800 Subject: [PATCH 040/379] tools: try installing js-yaml only once PR-URL: https://github.com/nodejs/node/pull/16661 Fixes: https://github.com/nodejs/node/issues/16650 Reviewed-By: James M Snell Reviewed-By: Richard Lau --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e29b486cec57ef..fce5d7146ad3df 100644 --- a/Makefile +++ b/Makefile @@ -539,7 +539,8 @@ apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) -doc-only: $(apidocs_html) $(apidocs_json) +doc-targets: $(apidocs_html) $(apidocs_json) +doc-only: | install-yaml doc-targets doc: $(NODE_EXE) doc-only $(apidoc_dirs): @@ -556,15 +557,16 @@ gen-json = tools/doc/generate.js --format=json $< > $@ gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html \ --template=doc/template.html --analytics=$(DOCS_ANALYTICS) $< > $@ -gen-doc = \ +install-yaml: [ -e tools/doc/node_modules/js-yaml/package.json ] || \ [ -e tools/eslint/node_modules/js-yaml/package.json ] || \ if [ -x $(NODE) ]; then \ cd tools/doc && ../../$(NODE) ../../$(NPM) install; \ else \ cd tools/doc && node ../../$(NPM) install; \ - fi;\ - [ -x $(NODE) ] && $(NODE) $(1) || node $(1) + fi; + +gen-doc = [ -x $(NODE) ] && $(NODE) $(1) || node $(1) out/doc/api/%.json: doc/api/%.md @$(call gen-doc, $(gen-json)) @@ -1150,6 +1152,7 @@ lint-clean: install \ install-bin \ install-includes \ + install-yaml \ lint \ lint-clean \ lint-ci \ From 8dc05e4630cfd74a8d3ada44cb57cc74a72d5e85 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 2 Nov 2017 18:14:24 -0400 Subject: [PATCH 041/379] doc: document common pattern for instanceof checks PR-URL: https://github.com/nodejs/node/pull/16699 Fixes: https://github.com/nodejs/node/issues/13824 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/n-api.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index f877b6e6d633c0..7852454a9295c5 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3022,6 +3022,29 @@ constructor and methods can be called from JavaScript. callback, [`napi_unwrap`][] obtains the C++ instance that is the target of the call. +For wrapped objects it may be difficult to distinguish between a function +called on a class prototype and a function called on an instance of a class. +A common pattern used to address this problem is to save a persistent +reference to the class constructor for later `instanceof` checks. + +As an example: + +```C +napi_value MyClass_constructor = nullptr; +status = napi_get_reference_value(env, MyClass::es_constructor, &MyClass_constructor); +assert(napi_ok == status); +bool is_instance = false; +status = napi_instanceof(env, es_this, MyClass_constructor, &is_instance); +assert(napi_ok == status); +if (is_instance) { + // napi_unwrap() ... +} else { + // otherwise... +} +``` + +The reference must be freed once it is no longer needed. + ### *napi_define_class* +* `data` {any} +* `...args` {any} + +The `console.debug()` function is an alias for [`console.log()`][]. + ### console.dir(obj[, options]) -Process v8 profiler output generated using the v8 option `--prof`. +Process V8 profiler output generated using the V8 option `--prof`. ### `--v8-options` @@ -301,7 +301,7 @@ Process v8 profiler output generated using the v8 option `--prof`. added: v0.1.3 --> -Print v8 command line options. +Print V8 command line options. *Note*: V8 options allow words to be separated by both dashes (`-`) or underscores (`_`). diff --git a/doc/api/synopsis.md b/doc/api/synopsis.md index 3d680c33b554ba..7fddd6be3b9f09 100644 --- a/doc/api/synopsis.md +++ b/doc/api/synopsis.md @@ -3,7 +3,7 @@ -`node [options] [v8 options] [script.js | -e "script" | - ] [arguments]` +`node [options] [V8 options] [script.js | -e "script" | - ] [arguments]` Please see the [Command Line Options][] document for information about different options and ways to run scripts with Node.js. diff --git a/doc/guides/writing-and-running-benchmarks.md b/doc/guides/writing-and-running-benchmarks.md index 62df0af417c452..75435daf394898 100644 --- a/doc/guides/writing-and-running-benchmarks.md +++ b/doc/guides/writing-and-running-benchmarks.md @@ -104,7 +104,7 @@ buffers/buffer-tostring.js n=10000000 len=1024 arg=false: 4103857.0726124765 Each line represents a single benchmark with parameters specified as `${variable}=${value}`. Each configuration combination is executed in a separate process. This ensures that benchmark results aren't affected by the execution -order due to v8 optimizations. **The last number is the rate of operations +order due to V8 optimizations. **The last number is the rate of operations measured in ops/sec (higher is better).** Furthermore a subset of the configurations can be specified, by setting them in diff --git a/doc/node.1 b/doc/node.1 index 0fad250c6d5786..a4395c099b9600 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -181,13 +181,13 @@ Track heap object allocations for heap snapshots. .TP .BR \-\-prof\-process -Process v8 profiler output generated using the v8 option \fB\-\-prof\fR +Process V8 profiler output generated using the V8 option \fB\-\-prof\fR .TP .BR \-\-v8\-options -Print v8 command line options. +Print V8 command line options. -Note: v8 options allow words to be separated by both dashes (\fB-\fR) or +Note: V8 options allow words to be separated by both dashes (\fB-\fR) or underscores (\fB_\fR). For example, \fB\-\-stack\-trace\-limit\fR is equivalent to @@ -196,7 +196,7 @@ For example, \fB\-\-stack\-trace\-limit\fR is equivalent to .TP .BR \-\-v8\-pool\-size =\fInum\fR Set v8's thread pool size which will be used to allocate background jobs. -If set to 0 then v8 will choose an appropriate size of the thread pool based +If set to 0 then V8 will choose an appropriate size of the thread pool based on the number of online processors. If the value provided is larger than v8's max then the largest value will be chosen. From af63df80b4ae3e7d2126ff1431c06990bab92c4a Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Thu, 16 Nov 2017 15:50:39 +0100 Subject: [PATCH 069/379] src: use std::unique_ptr in base-object-inl.h Drive-by fix: delete superflouos nullptr in ptr.reset(). PR-URL: https://github.com/nodejs/node/pull/17079 Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu --- src/base_object-inl.h | 3 +-- src/env-inl.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/base_object-inl.h b/src/base_object-inl.h index 74c1458b3d69ea..900fc2b3edb9ca 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -65,9 +65,8 @@ inline Environment* BaseObject::env() const { template inline void BaseObject::WeakCallback( const v8::WeakCallbackInfo& data) { - Type* self = data.GetParameter(); + std::unique_ptr self(data.GetParameter()); self->persistent().Reset(); - delete self; } diff --git a/src/env-inl.h b/src/env-inl.h index 4dadf5ea2c1978..c11773ac2e8d1e 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -328,7 +328,7 @@ inline Environment::~Environment() { #if HAVE_INSPECTOR // Destroy inspector agent before erasing the context. The inspector // destructor depends on the context still being accessible. - inspector_agent_.reset(nullptr); + inspector_agent_.reset(); #endif context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex, From 1b76cfe3c2b72a496b20d33aa01abd8abddc08f3 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Sun, 12 Nov 2017 18:25:18 +0100 Subject: [PATCH 070/379] src: use unique_ptr for scheduled delayed tasks Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. PR-URL: https://github.com/nodejs/node/pull/17083 Reviewed-By: Anna Henningsen --- src/node_platform.cc | 34 +++++++++++++++++++--------------- src/node_platform.h | 8 +++++++- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 51927cf7f9f792..0c50e8468d0f44 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -134,26 +134,23 @@ void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr task) { task->Run(); } +void PerIsolatePlatformData::DeleteFromScheduledTasks(DelayedTask* task) { + auto it = std::find_if(scheduled_delayed_tasks_.begin(), + scheduled_delayed_tasks_.end(), + [task](const DelayedTaskPointer& delayed) -> bool { + return delayed.get() == task; + }); + CHECK_NE(it, scheduled_delayed_tasks_.end()); + scheduled_delayed_tasks_.erase(it); +} + void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { DelayedTask* delayed = static_cast(handle->data); - auto& tasklist = delayed->platform_data->scheduled_delayed_tasks_; - auto it = std::find(tasklist.begin(), tasklist.end(), delayed); - CHECK_NE(it, tasklist.end()); - tasklist.erase(it); RunForegroundTask(std::move(delayed->task)); - uv_close(reinterpret_cast(&delayed->timer), - [](uv_handle_t* handle) { - delete static_cast(handle->data); - }); + delayed->platform_data->DeleteFromScheduledTasks(delayed); } void PerIsolatePlatformData::CancelPendingDelayedTasks() { - for (auto delayed : scheduled_delayed_tasks_) { - uv_close(reinterpret_cast(&delayed->timer), - [](uv_handle_t* handle) { - delete static_cast(handle->data); - }); - } scheduled_delayed_tasks_.clear(); } @@ -183,7 +180,14 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { // the delay is non-zero. This should not be a problem in practice. uv_timer_start(&delayed->timer, RunForegroundTask, delay_millis, 0); uv_unref(reinterpret_cast(&delayed->timer)); - scheduled_delayed_tasks_.push_back(delayed.release()); + + scheduled_delayed_tasks_.emplace_back(delayed.release(), + [](DelayedTask* delayed) { + uv_close(reinterpret_cast(&delayed->timer), + [](uv_handle_t* handle) { + delete static_cast(handle->data); + }); + }); } while (std::unique_ptr task = foreground_tasks_.Pop()) { did_work = true; diff --git a/src/node_platform.h b/src/node_platform.h index 584506ae1f114a..9094b24c93586a 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -64,6 +64,8 @@ class PerIsolatePlatformData { void CancelPendingDelayedTasks(); private: + void DeleteFromScheduledTasks(DelayedTask* task); + static void FlushTasks(uv_async_t* handle); static void RunForegroundTask(std::unique_ptr task); static void RunForegroundTask(uv_timer_t* timer); @@ -74,7 +76,11 @@ class PerIsolatePlatformData { uv_async_t* flush_tasks_ = nullptr; TaskQueue foreground_tasks_; TaskQueue foreground_delayed_tasks_; - std::vector scheduled_delayed_tasks_; + + // Use a custom deleter because libuv needs to close the handle first. + typedef std::unique_ptr> + DelayedTaskPointer; + std::vector scheduled_delayed_tasks_; }; class NodePlatform : public MultiIsolatePlatform { From e16d833076fd16fb32644f6d6551b69abb532e19 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 17 Nov 2017 21:02:31 -0800 Subject: [PATCH 071/379] test: reduce benchmark cases in test-benchmark-buffer Specify `buffer=fast` so that we only run that and not that along with `buffer=slow` in two benchmarks. PR-URL: https://github.com/nodejs/node/pull/17111 Reviewed-By: Luigi Pinca Reviewed-By: Minwoo Jung Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/sequential/test-benchmark-buffer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/sequential/test-benchmark-buffer.js b/test/sequential/test-benchmark-buffer.js index 99a00c2ab84b31..26600cf4f26a87 100644 --- a/test/sequential/test-benchmark-buffer.js +++ b/test/sequential/test-benchmark-buffer.js @@ -8,6 +8,7 @@ runBenchmark('buffers', [ 'aligned=true', 'args=1', + 'buffer=fast', 'encoding=utf8', 'len=2', 'method=', From e9000901ca71335cea954c0ed866f2d0ce37ac58 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 19 Nov 2017 14:09:23 +0100 Subject: [PATCH 072/379] src: add missing include in node_platform.h PR-URL: https://github.com/nodejs/node/pull/17133 Refs: https://github.com/nodejs/node/pull/17083 Reviewed-By: Anatoli Papirovski --- src/node_platform.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_platform.h b/src/node_platform.h index 9094b24c93586a..48301a05a11d8c 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "libplatform/libplatform.h" #include "node.h" From 60423f5845f658d8bcf9685e0a106a19775bea13 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Thu, 16 Nov 2017 15:56:20 +0100 Subject: [PATCH 073/379] src: use unique_ptr for http2_state PR-URL: https://github.com/nodejs/node/pull/17078 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- src/env-inl.h | 10 +++++----- src/env.h | 4 ++-- src/node_http2.cc | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index c11773ac2e8d1e..a17e059ebec464 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -340,7 +340,6 @@ inline Environment::~Environment() { delete[] heap_statistics_buffer_; delete[] heap_space_statistics_buffer_; delete[] http_parser_buffer_; - delete http2_state_; free(performance_state_); } @@ -495,12 +494,13 @@ inline void Environment::set_http_parser_buffer(char* buffer) { } inline http2::http2_state* Environment::http2_state() const { - return http2_state_; + return http2_state_.get(); } -inline void Environment::set_http2_state(http2::http2_state* buffer) { - CHECK_EQ(http2_state_, nullptr); // Should be set only once. - http2_state_ = buffer; +inline void Environment::set_http2_state( + std::unique_ptr buffer) { + CHECK(!http2_state_); // Should be set only once. + http2_state_ = std::move(buffer); } inline double* Environment::fs_stats_field_array() const { diff --git a/src/env.h b/src/env.h index e19ee01eed3bca..289286a1452ab7 100644 --- a/src/env.h +++ b/src/env.h @@ -619,7 +619,7 @@ class Environment { inline void set_http_parser_buffer(char* buffer); inline http2::http2_state* http2_state() const; - inline void set_http2_state(http2::http2_state * state); + inline void set_http2_state(std::unique_ptr state); inline double* fs_stats_field_array() const; inline void set_fs_stats_field_array(double* fields); @@ -737,7 +737,7 @@ class Environment { double* heap_space_statistics_buffer_ = nullptr; char* http_parser_buffer_; - http2::http2_state* http2_state_ = nullptr; + std::unique_ptr http2_state_; double* fs_stats_field_array_; diff --git a/src/node_http2.cc b/src/node_http2.cc index dca2dde1f3142d..1c9a007252bc5f 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2069,8 +2069,7 @@ void Initialize(Local target, Isolate* isolate = env->isolate(); HandleScope scope(isolate); - http2_state* state = new http2_state(isolate); - env->set_http2_state(state); + std::unique_ptr state(new http2_state(isolate)); #define SET_STATE_TYPEDARRAY(name, field) \ target->Set(context, \ @@ -2092,6 +2091,8 @@ void Initialize(Local target, "optionsBuffer", state->options_buffer.GetJSArray()); #undef SET_STATE_TYPEDARRAY + env->set_http2_state(std::move(state)); + NODE_DEFINE_CONSTANT(target, PADDING_BUF_FRAME_LENGTH); NODE_DEFINE_CONSTANT(target, PADDING_BUF_MAX_PAYLOAD_LENGTH); NODE_DEFINE_CONSTANT(target, PADDING_BUF_RETURN_VALUE); From 9b16e15f446154077089ffa2bb301e07fd8a940f Mon Sep 17 00:00:00 2001 From: vladimir Date: Tue, 10 Oct 2017 22:40:43 +0200 Subject: [PATCH 074/379] domain: re-implement domain over async_hook Domain core module has been re-implemented over async_hook. PR-URL: https://github.com/nodejs/node/pull/16222 Reviewed-By: Andreas Madsen Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- lib/domain.js | 60 ++++++++++++++----- lib/internal/process/next_tick.js | 41 ------------- src/cares_wrap.cc | 6 -- src/env-inl.h | 26 --------- src/env.h | 24 -------- src/node.cc | 65 ++------------------- src/node_crypto.cc | 21 ------- src/req_wrap-inl.h | 2 - test/parallel/test-no-enter-tickcallback.js | 32 ---------- 9 files changed, 49 insertions(+), 228 deletions(-) delete mode 100644 test/parallel/test-no-enter-tickcallback.js diff --git a/lib/domain.js b/lib/domain.js index 676a9cb005b05c..dc3c550866c924 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -28,7 +28,7 @@ const util = require('util'); const EventEmitter = require('events'); -const { inherits } = util; +const { createHook } = require('async_hooks'); // communicate with events module, but don't require that // module to have to load this one, since this module has @@ -48,13 +48,54 @@ Object.defineProperty(process, 'domain', { } }); +const pairing = new Map(); +const asyncHook = createHook({ + init(asyncId, type, triggerAsyncId, resource) { + if (process.domain !== null && process.domain !== undefined) { + // if this operation is created while in a domain, let's mark it + pairing.set(asyncId, process.domain); + resource.domain = process.domain; + if (resource.promise !== undefined && + resource.promise instanceof Promise) { + // resource.promise instanceof Promise make sure that the + // promise comes from the same context + // see https://github.com/nodejs/node/issues/15673 + resource.promise.domain = process.domain; + } + } + }, + before(asyncId) { + const current = pairing.get(asyncId); + if (current !== undefined) { // enter domain for this cb + current.enter(); + } + }, + after(asyncId) { + const current = pairing.get(asyncId); + if (current !== undefined) { // exit domain for this cb + current.exit(); + } + }, + destroy(asyncId) { + pairing.delete(asyncId); // cleaning up + } +}); + // It's possible to enter one domain while already inside // another one. The stack is each entered domain. const stack = []; exports._stack = stack; +process._setupDomainUse(stack); + +class Domain extends EventEmitter { -// let the process know we're using domains -const _domain_flag = process._setupDomainUse(_domain, stack); + constructor() { + super(); + + this.members = []; + asyncHook.enable(); + } +} exports.Domain = Domain; @@ -64,19 +105,8 @@ exports.create = exports.createDomain = function() { // the active domain is always the one that we're currently in. exports.active = null; - - -inherits(Domain, EventEmitter); - -function Domain() { - EventEmitter.call(this); - - this.members = []; -} - Domain.prototype.members = undefined; - // Called by process._fatalException in case an error was thrown. Domain.prototype._errorHandler = function _errorHandler(er) { var caught = false; @@ -155,7 +185,6 @@ Domain.prototype.enter = function() { // to push it onto the stack so that we can pop it later. exports.active = process.domain = this; stack.push(this); - _domain_flag[0] = stack.length; }; @@ -166,7 +195,6 @@ Domain.prototype.exit = function() { // exit all domains until this one. stack.splice(index); - _domain_flag[0] = stack.length; exports.active = stack[stack.length - 1]; process.domain = exports.active; diff --git a/lib/internal/process/next_tick.js b/lib/internal/process/next_tick.js index ac0c0129ee308c..83a833dc596c24 100644 --- a/lib/internal/process/next_tick.js +++ b/lib/internal/process/next_tick.js @@ -73,7 +73,6 @@ function setupNextTick() { process.nextTick = nextTick; // Needs to be accessible from beyond this scope. process._tickCallback = _tickCallback; - process._tickDomainCallback = _tickDomainCallback; // Set the nextTick() function for internal usage. exports.nextTick = internalNextTick; @@ -190,46 +189,6 @@ function setupNextTick() { } while (tickInfo[kLength] !== 0); } - function _tickDomainCallback() { - do { - while (tickInfo[kIndex] < tickInfo[kLength]) { - ++tickInfo[kIndex]; - const tock = nextTickQueue.shift(); - const callback = tock.callback; - const domain = tock.domain; - const args = tock.args; - if (domain) - domain.enter(); - - // CHECK(Number.isSafeInteger(tock[async_id_symbol])) - // CHECK(tock[async_id_symbol] > 0) - // CHECK(Number.isSafeInteger(tock[trigger_async_id_symbol])) - // CHECK(tock[trigger_async_id_symbol] > 0) - - emitBefore(tock[async_id_symbol], tock[trigger_async_id_symbol]); - // TODO(trevnorris): See comment in _tickCallback() as to why this - // isn't a good solution. - if (async_hook_fields[kDestroy] > 0) - emitDestroy(tock[async_id_symbol]); - - // Using separate callback execution functions allows direct - // callback invocation with small numbers of arguments to avoid the - // performance hit associated with using `fn.apply()` - _combinedTickCallback(args, callback); - - emitAfter(tock[async_id_symbol]); - - if (kMaxCallbacksPerLoop < tickInfo[kIndex]) - tickDone(); - if (domain) - domain.exit(); - } - tickDone(); - _runMicrotasks(); - emitPendingUnhandledRejections(); - } while (tickInfo[kLength] !== 0); - } - class TickObject { constructor(callback, args, asyncId, triggerAsyncId) { this.callback = callback; diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 85da8f573ee632..71aefe7d479241 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -596,12 +596,6 @@ class QueryWrap : public AsyncWrap { QueryWrap(ChannelWrap* channel, Local req_wrap_obj) : AsyncWrap(channel->env(), req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP), channel_(channel) { - if (env()->in_domain()) { - req_wrap_obj->Set(env()->domain_string(), - env()->domain_array()->Get(env()->context(), 0) - .ToLocalChecked()); - } - Wrap(req_wrap_obj, this); // Make sure the channel object stays alive during the query lifetime. diff --git a/src/env-inl.h b/src/env-inl.h index a17e059ebec464..0ce13537995fd0 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -200,22 +200,6 @@ inline bool Environment::AsyncCallbackScope::in_makecallback() const { return env_->makecallback_cntr_ > 1; } -inline Environment::DomainFlag::DomainFlag() { - for (int i = 0; i < kFieldsCount; ++i) fields_[i] = 0; -} - -inline uint32_t* Environment::DomainFlag::fields() { - return fields_; -} - -inline int Environment::DomainFlag::fields_count() const { - return kFieldsCount; -} - -inline uint32_t Environment::DomainFlag::count() const { - return fields_[kCount]; -} - inline Environment::TickInfo::TickInfo() { for (int i = 0; i < kFieldsCount; ++i) fields_[i] = 0; @@ -347,12 +331,6 @@ inline v8::Isolate* Environment::isolate() const { return isolate_; } -inline bool Environment::in_domain() const { - // The const_cast is okay, it doesn't violate conceptual const-ness. - return using_domains() && - const_cast(this)->domain_flag()->count() > 0; -} - inline Environment* Environment::from_immediate_check_handle( uv_check_t* handle) { return ContainerOf(&Environment::immediate_check_handle_, handle); @@ -393,10 +371,6 @@ inline Environment::AsyncHooks* Environment::async_hooks() { return &async_hooks_; } -inline Environment::DomainFlag* Environment::domain_flag() { - return &domain_flag_; -} - inline Environment::TickInfo* Environment::tick_info() { return &tick_info_; } diff --git a/src/env.h b/src/env.h index 289286a1452ab7..248db2d9b93974 100644 --- a/src/env.h +++ b/src/env.h @@ -309,7 +309,6 @@ class ModuleWrap; V(internal_binding_cache_object, v8::Object) \ V(buffer_prototype_object, v8::Object) \ V(context, v8::Context) \ - V(domain_array, v8::Array) \ V(domains_stack_array, v8::Array) \ V(http2ping_constructor_template, v8::ObjectTemplate) \ V(http2stream_constructor_template, v8::ObjectTemplate) \ @@ -474,26 +473,6 @@ class Environment { DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope); }; - class DomainFlag { - public: - inline uint32_t* fields(); - inline int fields_count() const; - inline uint32_t count() const; - - private: - friend class Environment; // So we can call the constructor. - inline DomainFlag(); - - enum Fields { - kCount, - kFieldsCount - }; - - uint32_t fields_[kFieldsCount]; - - DISALLOW_COPY_AND_ASSIGN(DomainFlag); - }; - class TickInfo { public: inline uint32_t* fields(); @@ -562,7 +541,6 @@ class Environment { inline v8::Isolate* isolate() const; inline uv_loop_t* event_loop() const; - inline bool in_domain() const; inline uint32_t watched_providers() const; static inline Environment* from_immediate_check_handle(uv_check_t* handle); @@ -579,7 +557,6 @@ class Environment { inline void FinishHandleCleanup(uv_handle_t* handle); inline AsyncHooks* async_hooks(); - inline DomainFlag* domain_flag(); inline TickInfo* tick_info(); inline uint64_t timer_base() const; @@ -709,7 +686,6 @@ class Environment { uv_check_t idle_check_handle_; AsyncHooks async_hooks_; - DomainFlag domain_flag_; TickInfo tick_info_; const uint64_t timer_base_; bool using_domains_; diff --git a/src/node.cc b/src/node.cc index 11bc86a4539a1a..387e5d53285961 100644 --- a/src/node.cc +++ b/src/node.cc @@ -150,7 +150,6 @@ using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::Promise; -using v8::PromiseHookType; using v8::PromiseRejectMessage; using v8::PropertyCallbackInfo; using v8::ScriptOrigin; @@ -1178,7 +1177,6 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) { return isEmittingTopLevelDomainError || !DomainsStackHasErrorHandler(env); } - Local GetDomainProperty(Environment* env, Local object) { Local domain_v = object->GetPrivate(env->context(), env->domain_private_symbol()) @@ -1219,36 +1217,6 @@ void DomainExit(Environment* env, v8::Local object) { } } - -void DomainPromiseHook(PromiseHookType type, - Local promise, - Local parent, - void* arg) { - Environment* env = static_cast(arg); - Local context = env->context(); - - if (type == PromiseHookType::kInit && env->in_domain()) { - Local domain_obj = - env->domain_array()->Get(context, 0).ToLocalChecked(); - if (promise->CreationContext() == context) { - promise->Set(context, env->domain_string(), domain_obj).FromJust(); - } else { - // Do not expose object from another context publicly in promises created - // in non-main contexts. - promise->SetPrivate(context, env->domain_private_symbol(), domain_obj) - .FromJust(); - } - return; - } - - if (type == PromiseHookType::kBefore) { - DomainEnter(env, promise); - } else if (type == PromiseHookType::kAfter) { - DomainExit(env, promise); - } -} - - void SetupDomainUse(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); @@ -1259,38 +1227,13 @@ void SetupDomainUse(const FunctionCallbackInfo& args) { HandleScope scope(env->isolate()); Local process_object = env->process_object(); - Local tick_callback_function_key = env->tick_domain_cb_string(); - Local tick_callback_function = - process_object->Get(tick_callback_function_key).As(); - - if (!tick_callback_function->IsFunction()) { - fprintf(stderr, "process._tickDomainCallback assigned to non-function\n"); - ABORT(); - } - - process_object->Set(env->tick_callback_string(), tick_callback_function); - env->set_tick_callback_function(tick_callback_function); - CHECK(args[0]->IsArray()); - env->set_domain_array(args[0].As()); - - CHECK(args[1]->IsArray()); - env->set_domains_stack_array(args[1].As()); + env->set_domains_stack_array(args[0].As()); // Do a little housekeeping. env->process_object()->Delete( env->context(), FIXED_ONE_BYTE_STRING(args.GetIsolate(), "_setupDomainUse")).FromJust(); - - uint32_t* const fields = env->domain_flag()->fields(); - uint32_t const fields_count = env->domain_flag()->fields_count(); - - Local array_buffer = - ArrayBuffer::New(env->isolate(), fields, sizeof(*fields) * fields_count); - - env->AddPromiseHook(DomainPromiseHook, static_cast(env)); - - args.GetReturnValue().Set(Uint32Array::New(array_buffer, 0, fields_count)); } @@ -1414,7 +1357,8 @@ InternalCallbackScope::InternalCallbackScope(Environment* env, // If you hit this assertion, you forgot to enter the v8::Context first. CHECK_EQ(Environment::GetCurrent(env->isolate()), env); - if (env->using_domains() && !object_.IsEmpty()) { + if (asyncContext.async_id == 0 && env->using_domains() && + !object_.IsEmpty()) { DomainEnter(env, object_); } @@ -1447,7 +1391,8 @@ void InternalCallbackScope::Close() { AsyncWrap::EmitAfter(env_, async_context_.async_id); } - if (env_->using_domains() && !object_.IsEmpty()) { + if (async_context_.async_id == 0 && env_->using_domains() && + !object_.IsEmpty()) { DomainExit(env_, object_); } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 4f089b940ee4b2..56c25d0a0a6547 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5624,13 +5624,6 @@ void PBKDF2(const FunctionCallbackInfo& args) { if (args[5]->IsFunction()) { obj->Set(env->ondone_string(), args[5]); - if (env->in_domain()) { - obj->Set(env->context(), - env->domain_string(), - env->domain_array()->Get(env->context(), 0).ToLocalChecked()) - .FromJust(); - } - uv_queue_work(env->event_loop(), req.release()->work_req(), PBKDF2Request::Work, @@ -5819,13 +5812,6 @@ void RandomBytes(const FunctionCallbackInfo& args) { if (args[1]->IsFunction()) { obj->Set(env->ondone_string(), args[1]); - if (env->in_domain()) { - obj->Set(env->context(), - env->domain_string(), - env->domain_array()->Get(env->context(), 0).ToLocalChecked()) - .FromJust(); - } - uv_queue_work(env->event_loop(), req.release()->work_req(), RandomBytesWork, @@ -5865,13 +5851,6 @@ void RandomBytesBuffer(const FunctionCallbackInfo& args) { if (args[3]->IsFunction()) { obj->Set(env->context(), env->ondone_string(), args[3]).FromJust(); - if (env->in_domain()) { - obj->Set(env->context(), - env->domain_string(), - env->domain_array()->Get(env->context(), 0).ToLocalChecked()) - .FromJust(); - } - uv_queue_work(env->event_loop(), req.release()->work_req(), RandomBytesWork, diff --git a/src/req_wrap-inl.h b/src/req_wrap-inl.h index 76430439c948f3..6d0c57cd81d367 100644 --- a/src/req_wrap-inl.h +++ b/src/req_wrap-inl.h @@ -15,8 +15,6 @@ ReqWrap::ReqWrap(Environment* env, v8::Local object, AsyncWrap::ProviderType provider) : AsyncWrap(env, object, provider) { - if (env->in_domain()) - object->Set(env->domain_string(), env->domain_array()->Get(0)); // FIXME(bnoordhuis) The fact that a reinterpret_cast is needed is // arguably a good indicator that there should be more than one queue. diff --git a/test/parallel/test-no-enter-tickcallback.js b/test/parallel/test-no-enter-tickcallback.js deleted file mode 100644 index aab22c5f3edc72..00000000000000 --- a/test/parallel/test-no-enter-tickcallback.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -let allsGood = false; -let cntr = 0; - -process.on('exit', () => { - assert.ok(cntr > 0, '_tickDomainCallback was never called'); -}); - -/** - * This test relies upon the following internals to work as specified: - * - require('domain') causes node::Environment::set_tick_callback_function() - * to use process._tickDomainCallback() to process the nextTickQueue; - * replacing process._tickCallback(). - * - setImmediate() uses node::MakeCallback() instead of - * node::AsyncWrap::MakeCallback(). Otherwise the test will always pass. - * Have not found a way to verify that node::MakeCallback() is used. - */ -process._tickDomainCallback = function _tickDomainCallback() { - assert.ok(allsGood, '_tickDomainCallback should not have been called'); - cntr++; -}; - -setImmediate(common.mustCall(() => { - require('domain'); - setImmediate(common.mustCall(() => setImmediate(common.mustCall(() => { - allsGood = true; - process.nextTick(() => {}); - })))); -})); From 976ed7507b3fec112a514b36da82622eadafacb9 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 4 Nov 2017 09:08:46 +0100 Subject: [PATCH 075/379] doc: add missing introduced_in comments Add missing "introduced_in" comments for alternative version links. PR-URL: https://github.com/nodejs/node/pull/16741 Reviewed-By: Anatoli Papirovski --- doc/api/async_hooks.md | 2 ++ doc/api/deprecations.md | 2 ++ doc/api/esm.md | 2 +- doc/api/http2.md | 2 ++ doc/api/inspector.md | 2 ++ doc/api/intl.md | 2 ++ doc/api/n-api.md | 2 ++ doc/api/perf_hooks.md | 5 ++--- doc/api/tracing.md | 2 ++ 9 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index bc90b1683773b6..41352820816b3f 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -1,5 +1,7 @@ # Async Hooks + + > Stability: 1 - Experimental The `async_hooks` module provides an API to register callbacks tracking the diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index b8170f1e440309..adef224f982e64 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1,5 +1,7 @@ # Deprecated APIs + + Node.js may deprecate APIs when either: (a) use of the API is considered to be unsafe, (b) an improved alternative API has been made available, or (c) breaking changes to the API are expected in a future major release. diff --git a/doc/api/esm.md b/doc/api/esm.md index d8143da378f768..c33badf3af7fc9 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1,6 +1,6 @@ # ECMAScript Modules - + > Stability: 1 - Experimental diff --git a/doc/api/http2.md b/doc/api/http2.md index 231173bededf35..364c1650ee501e 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1,5 +1,7 @@ # HTTP2 + + > Stability: 1 - Experimental The `http2` module provides an implementation of the [HTTP/2][] protocol. It diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 32629af8c2fab0..a3426d4b5d9dc8 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -1,5 +1,7 @@ # Inspector + + > Stability: 1 - Experimental The `inspector` module provides an API for interacting with the V8 inspector. diff --git a/doc/api/intl.md b/doc/api/intl.md index c7ac7fd2b68cd2..224c00a62fe888 100644 --- a/doc/api/intl.md +++ b/doc/api/intl.md @@ -1,5 +1,7 @@ # Internationalization Support + + Node.js has many features that make it easier to write internationalized programs. Some of them are: diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 7852454a9295c5..df9038182fbf95 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1,5 +1,7 @@ # N-API + + > Stability: 1 - Experimental N-API (pronounced N as in the letter, followed by API) diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 09582cea80bb0a..08edafe5b7fb41 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -1,7 +1,6 @@ # Performance Timing API - + + > Stability: 1 - Experimental diff --git a/doc/api/tracing.md b/doc/api/tracing.md index 53c6dac55dac05..e03477b1adf20c 100644 --- a/doc/api/tracing.md +++ b/doc/api/tracing.md @@ -1,5 +1,7 @@ # Tracing + + Trace Event provides a mechanism to centralize tracing information generated by V8, Node core, and userspace code. From 90933929543d814841e753c08fba1955c8cab6c2 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 18 Nov 2017 01:19:22 +0800 Subject: [PATCH 076/379] build: do not build doc in source tarball PR-URL: https://github.com/nodejs/node/pull/17100 Fixes: https://github.com/nodejs/node/issues/16650 Reviewed-By: Refael Ackermann --- Makefile | 70 ++++++++++++++++++++++------------- test/doctool/test-make-doc.js | 2 +- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 7e4b33d571ee79..3bd71f43b43fdc 100644 --- a/Makefile +++ b/Makefile @@ -531,49 +531,68 @@ endif # generated .html files DOCS_ANALYTICS ?= +apidoc_dirs = out/doc out/doc/api out/doc/api/assets apidoc_sources = $(wildcard doc/api/*.md) -apidocs_html = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.html)) -apidocs_json = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.json)) - -apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets +apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html)) +apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json)) apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) -doc-targets: $(apidocs_html) $(apidocs_json) -doc-only: | install-yaml doc-targets +# This uses the locally built node if available, otherwise uses the global node +doc-only: $(apidoc_dirs) $(apiassets) +# If it's a source tarball, assets are already in doc/api/assets, +# no need to install anything, we have already copied the docs over + if [ ! -d doc/api/assets ]; then \ + $(MAKE) tools/doc/node_modules/js-yaml/package.json; \ + fi; + @$(MAKE) -s $(apidocs_html) $(apidocs_json) + doc: $(NODE_EXE) doc-only -$(apidoc_dirs): - @mkdir -p $@ +out/doc: + mkdir -p $@ + +# If it's a source tarball, doc/api already contains the generated docs. +# Just copy everything under doc/api over. +out/doc/api: doc/api + mkdir -p $@ + cp -r doc/api out/doc +# If it's a source tarball, assets are already in doc/api/assets +out/doc/api/assets: + mkdir -p $@ + if [ -d doc/api/assets ]; then cp -r doc/api/assets out/doc/api; fi; + +# If it's not a source tarball, we need to copy assets from doc/api_assets out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets @cp $< $@ -out/doc/%: doc/% - @cp -r $< $@ +# Use -e to double check in case it's a broken link +# Use $(PWD) so we can cd to anywhere before calling this +available-node = \ + if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \ + $(PWD)/$(NODE) $(1); \ + elif [ -x `which node` ] && [ -e `which node` ]; then \ + `which node` $(1); \ + else \ + echo "No available node, cannot run \"node $(1)\""; \ + exit 1; \ + fi; + +run-npm-install = $(PWD)/$(NPM) install + +tools/doc/node_modules/js-yaml/package.json: + cd tools/doc && $(call available-node,$(run-npm-install)) -# check if ./node is actually set, else use user pre-installed binary gen-json = tools/doc/generate.js --format=json $< > $@ gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html \ --template=doc/template.html --analytics=$(DOCS_ANALYTICS) $< > $@ -install-yaml: - [ -e tools/doc/node_modules/js-yaml/package.json ] || \ - [ -e tools/eslint/node_modules/js-yaml/package.json ] || \ - if [ -x $(NODE) ]; then \ - cd tools/doc && ../../$(NODE) ../../$(NPM) install; \ - else \ - cd tools/doc && node ../../$(NPM) install; \ - fi; - -gen-doc = [ -x $(NODE) ] && $(NODE) $(1) || node $(1) - out/doc/api/%.json: doc/api/%.md - @$(call gen-doc, $(gen-json)) + $(call available-node, $(gen-json)) -# check if ./node is actually set, else use user pre-installed binary out/doc/api/%.html: doc/api/%.md - @$(call gen-doc, $(gen-html)) + $(call available-node, $(gen-html)) docopen: $(apidocs_html) @$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html @@ -1152,7 +1171,6 @@ lint-clean: install \ install-bin \ install-includes \ - install-yaml \ lint \ lint-clean \ lint-ci \ diff --git a/test/doctool/test-make-doc.js b/test/doctool/test-make-doc.js index 06386c0c818bcb..ad372d7121283d 100644 --- a/test/doctool/test-make-doc.js +++ b/test/doctool/test-make-doc.js @@ -28,7 +28,7 @@ for (const html of linkedHtmls) { assert.ok(docs.includes(html), `${html} does not exist`); } -const excludes = ['.json', '_toc', 'assets']; +const excludes = ['.json', '.md', '_toc', 'assets']; const generatedHtmls = docs.filter(function(doc) { for (const exclude of excludes) { if (doc.includes(exclude)) { From e7db034571a64125b6929d56048d7b53182be0fe Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Thu, 2 Nov 2017 17:55:43 +0000 Subject: [PATCH 077/379] src: add NODE_VERSION_IS_LTS to node_version.h This is defined in LTS releases, but should really be defined in master too. PR-URL: https://github.com/nodejs/node/pull/16697 Reviewed-By: Colin Ihrig --- src/node_version.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_version.h b/src/node_version.h index b532d1611a83c2..2745709662abce 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -26,6 +26,9 @@ #define NODE_MINOR_VERSION 2 #define NODE_PATCH_VERSION 2 +#define NODE_VERSION_IS_LTS 0 +#define NODE_VERSION_LTS_CODENAME "" + #define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_STRINGIFY From 9914bcaae98f0896fe1b6ab5206dbb4dc51ad20a Mon Sep 17 00:00:00 2001 From: sgreylyn Date: Thu, 16 Nov 2017 22:46:14 -0800 Subject: [PATCH 078/379] test: replace assert.throws w/ common.expectsError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17091 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil --- test/parallel/test-next-tick-errors.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js index 989d02b4d9f3e4..acb7c497278429 100644 --- a/test/parallel/test-next-tick-errors.js +++ b/test/parallel/test-next-tick-errors.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const order = []; @@ -42,11 +42,15 @@ process.nextTick(function() { }); function testNextTickWith(val) { - assert.throws( + common.expectsError( function() { process.nextTick(val); }, - TypeError + { + code: 'ERR_INVALID_CALLBACK', + name: 'TypeError [ERR_INVALID_CALLBACK]', + type: TypeError + } ); } From 15b6bcf68b86b6a8d9c5a3f8d60623f24d6c1cfd Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Thu, 2 Nov 2017 10:56:27 +0000 Subject: [PATCH 079/379] test: make debugging of inspector-port-zero easier If the process was killed, then the exit code will be null, in which case knowing the signal is really helpful. PR-URL: https://github.com/nodejs/node/pull/16685 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Eugene Ostroukhov Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- test/sequential/test-inspector-port-zero.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/sequential/test-inspector-port-zero.js b/test/sequential/test-inspector-port-zero.js index a3eb08e5fb7a64..b7eb13ba13a68a 100644 --- a/test/sequential/test-inspector-port-zero.js +++ b/test/sequential/test-inspector-port-zero.js @@ -34,7 +34,10 @@ function test(arg, port = '') { }; proc.stdout.on('close', mustCall(() => onclose())); proc.stderr.on('close', mustCall(() => onclose())); - proc.on('exit', mustCall((exitCode) => assert.strictEqual(exitCode, 0))); + proc.on('exit', mustCall((exitCode, signal) => assert.strictEqual( + exitCode, + 0, + `exitCode: ${exitCode}, signal: ${signal}`))); } } From 4954eef48181ca2705c791654c534753962abbbd Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Mon, 30 Oct 2017 18:26:57 +0000 Subject: [PATCH 080/379] tools: allow running test.py without configuring If config.gypi isn't defined, assume Node was build the default way, i.e. with the inspector. PR-URL: https://github.com/nodejs/node/pull/16621 Refs: https://github.com/nodejs/node/pull/16436#issuecomment-340115175 Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius --- tools/test.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/tools/test.py b/tools/test.py index 4cb0bd631dcc23..ec8297812fccc0 100755 --- a/tools/test.py +++ b/tools/test.py @@ -889,8 +889,7 @@ class Context(object): def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail, timeout, processor, suppress_dialogs, - store_unexpected_output, repeat, abort_on_timeout, - v8_enable_inspector): + store_unexpected_output, repeat, abort_on_timeout): self.workspace = workspace self.buildspace = buildspace self.verbose = verbose @@ -902,7 +901,7 @@ def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail, self.store_unexpected_output = store_unexpected_output self.repeat = repeat self.abort_on_timeout = abort_on_timeout - self.v8_enable_inspector = v8_enable_inspector + self.v8_enable_inspector = True def GetVm(self, arch, mode): if arch == 'none': @@ -930,20 +929,6 @@ def RunTestCases(cases_to_run, progress, tasks, flaky_tests_mode): progress = PROGRESS_INDICATORS[progress](cases_to_run, flaky_tests_mode) return progress.Run(tasks) -def GetV8InspectorEnabledFlag(): - # The following block reads config.gypi to extract the v8_enable_inspector - # value. This is done to check if the inspector is disabled in which case - # the '--inspect' flag cannot be passed to the node process as it will - # cause node to exit and report the test as failed. The use case - # is currently when Node is configured --without-ssl and the tests should - # still be runnable but skip any tests that require ssl (which includes the - # inspector related tests). - with open('config.gypi', 'r') as f: - s = f.read() - config_gypi = ast.literal_eval(s) - return config_gypi['variables']['v8_enable_inspector'] - - # ------------------------------------------- # --- T e s t C o n f i g u r a t i o n --- # ------------------------------------------- @@ -1626,8 +1611,7 @@ def Main(): options.suppress_dialogs, options.store_unexpected_output, options.repeat, - options.abort_on_timeout, - GetV8InspectorEnabledFlag()) + options.abort_on_timeout) # Get status for tests sections = [ ] @@ -1670,6 +1654,12 @@ def Main(): all_cases += cases all_unused.append(unused_rules) + # We want to skip the inspector tests if node was built without the inspector. + has_inspector = Execute([vm, + "-p", "process.config.variables.v8_enable_inspector"], context) + if has_inspector.stdout.rstrip() == "0": + context.v8_enable_inspector = False + if options.cat: visited = set() for test in unclassified_tests: From 09bd797711413b5fdbc1c70ac83c0167966b73ef Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 6 Nov 2017 09:59:01 +0100 Subject: [PATCH 081/379] build: Allow linking against an external copy of nghttp2. The version of nghttp2 in deps/ does not build on CloudABI, even though the official version does. Though this is an issue on its own that needs to be resolved, it is currently a bit hard to work around this. There is no switch to link against an external version of nghttp2, even though we do provide this option for other libraries. This change adds configure flags, similar to the ones we have for OpenSSL, zlib, http_parser, libuv, etc. and makes the dependency on deps/nghttp2 optional. PR-URL: https://github.com/nodejs/node/pull/16788 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Refael Ackermann --- configure | 22 ++++++++++++++++++++++ node.gyp | 13 ++++++++++--- node.gypi | 4 ++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 5703a70cb2d520..3b6fc7347db22a 100755 --- a/configure +++ b/configure @@ -220,6 +220,27 @@ shared_optgroup.add_option('--shared-libuv-libpath', dest='shared_libuv_libpath', help='a directory to search for the shared libuv DLL') +shared_optgroup.add_option('--shared-nghttp2', + action='store_true', + dest='shared_nghttp2', + help='link to a shared nghttp2 DLL instead of static linking') + +shared_optgroup.add_option('--shared-nghttp2-includes', + action='store', + dest='shared_nghttp2_includes', + help='directory containing nghttp2 header files') + +shared_optgroup.add_option('--shared-nghttp2-libname', + action='store', + dest='shared_nghttp2_libname', + default='nghttp2', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-nghttp2-libpath', + action='store', + dest='shared_nghttp2_libpath', + help='a directory to search for the shared nghttp2 DLLs') + shared_optgroup.add_option('--shared-openssl', action='store_true', dest='shared_openssl', @@ -1415,6 +1436,7 @@ configure_library('zlib', output) configure_library('http_parser', output) configure_library('libuv', output) configure_library('libcares', output) +configure_library('nghttp2', output) # stay backwards compatible with shared cares builds output['variables']['node_shared_cares'] = \ output['variables'].pop('node_shared_libcares') diff --git a/node.gyp b/node.gyp index 67c807ec1b2846..3c2f0d332a1a49 100644 --- a/node.gyp +++ b/node.gyp @@ -16,6 +16,7 @@ 'node_shared_http_parser%': 'false', 'node_shared_cares%': 'false', 'node_shared_libuv%': 'false', + 'node_shared_nghttp2%': 'false', 'node_use_openssl%': 'true', 'node_shared_openssl%': 'false', 'node_v8_options%': '', @@ -173,7 +174,6 @@ 'dependencies': [ 'node_js2c#host', - 'deps/nghttp2/nghttp2.gyp:nghttp2' ], 'includes': [ @@ -183,8 +183,7 @@ 'include_dirs': [ 'src', 'tools/msvs/genfiles', - '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h - 'deps/nghttp2/lib/includes' + '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h ], 'sources': [ @@ -923,6 +922,14 @@ 'deps/uv/uv.gyp:libuv' ] }], + [ 'node_shared_nghttp2=="false"', { + 'dependencies': [ + 'deps/nghttp2/nghttp2.gyp:nghttp2' + ], + 'include_dirs': [ + 'deps/nghttp2/lib/includes' + ] + }], [ 'node_use_v8_platform=="true"', { 'dependencies': [ 'deps/v8/src/v8.gyp:v8_libplatform', diff --git a/node.gypi b/node.gypi index ec78df2a339203..3990c59ef98851 100644 --- a/node.gypi +++ b/node.gypi @@ -133,6 +133,10 @@ 'dependencies': [ 'deps/uv/uv.gyp:libuv' ], }], + [ 'node_shared_nghttp2=="false"', { + 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ], + }], + [ 'OS=="mac"', { # linking Corefoundation is needed since certain OSX debugging tools # like Instruments require it for some features From 39cfecd568259cc4122979c775ee9c95112926c7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 17 Nov 2017 13:57:36 -0800 Subject: [PATCH 082/379] doc: remove IRC node-dev link from README The IRC link is mentioned in CONTRIBUTING.md which is linked immediately above. We should encourage people to read that doc before hoping on the IRC channel. PR-URL: https://github.com/nodejs/node/pull/17106 Ref: https://github.com/nodejs/node/pull/16533#discussion_r147292940 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b01308fa7b1ed4..19a22dd5b3be5f 100644 --- a/README.md +++ b/README.md @@ -586,7 +586,6 @@ Information on the current Node.js Working Groups can be found in the ### Contributing to Node.js * [Contributing to the project][] -* IRC (node core development): [#node-dev on chat.freenode.net][] [npm]: https://www.npmjs.com [Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md @@ -595,4 +594,3 @@ Information on the current Node.js Working Groups can be found in the [Node.js Website]: https://nodejs.org/en/ [Questions tagged 'node.js' on StackOverflow]: https://stackoverflow.com/questions/tagged/node.js [#node.js channel on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4 -[#node-dev on chat.freenode.net]: https://webchat.freenode.net?channels=node-dev&uio=d4 From fa82f3a5c433df56f2fda9693365785c7d35cfa2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 17 Nov 2017 14:01:26 -0800 Subject: [PATCH 083/379] doc: merge Working Groups with Contributing to Node.js in README PR-URL: https://github.com/nodejs/node/pull/17106 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 19a22dd5b3be5f..24b6db2dff6851 100644 --- a/README.md +++ b/README.md @@ -578,14 +578,10 @@ Previous releases may also have been signed with one of the following GPG keys: * **Timothy J Fontaine** <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D` -### Working Groups - -Information on the current Node.js Working Groups can be found in the -[TSC repository](https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md). - ### Contributing to Node.js * [Contributing to the project][] +* [Working Groups][] [npm]: https://www.npmjs.com [Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md @@ -593,4 +589,5 @@ Information on the current Node.js Working Groups can be found in the [Node.js Help]: https://github.com/nodejs/help [Node.js Website]: https://nodejs.org/en/ [Questions tagged 'node.js' on StackOverflow]: https://stackoverflow.com/questions/tagged/node.js +[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md [#node.js channel on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4 From f1d19d5eb959e0ed6c1b3e3b169e1f130edfb028 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 17 Nov 2017 14:04:19 -0800 Subject: [PATCH 084/379] doc: add Contributing to Node.js to the README ToC PR-URL: https://github.com/nodejs/node/pull/17106 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 24b6db2dff6851..d996928051643f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ policies, and releases are managed under an * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) * [Collaborators](#collaborators) * [Release Team](#release-team) +* [Contributing to Node.js](#contributing-to-nodejs) ## Support @@ -578,7 +579,7 @@ Previous releases may also have been signed with one of the following GPG keys: * **Timothy J Fontaine** <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D` -### Contributing to Node.js +## Contributing to Node.js * [Contributing to the project][] * [Working Groups][] From 4c23e6a8c70151139bf0c924e027bdacc651d16d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 17 Nov 2017 14:07:01 -0800 Subject: [PATCH 085/379] doc: normalize ToC indentation with heading levels in README PR-URL: https://github.com/nodejs/node/pull/17106 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d996928051643f..fd1051d3d53f07 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ policies, and releases are managed under an * [API Documentation](#api-documentation) * [Verifying Binaries](#verifying-binaries) * [Building Node.js](#building-nodejs) - * [Security](#security) - * [Current Project Team Members](#current-project-team-members) - * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) - * [Collaborators](#collaborators) - * [Release Team](#release-team) +* [Security](#security) +* [Current Project Team Members](#current-project-team-members) + * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) + * [Collaborators](#collaborators) + * [Release Team](#release-team) * [Contributing to Node.js](#contributing-to-nodejs) ## Support @@ -90,7 +90,7 @@ The Node.js project maintains multiple types of releases: More information can be found in the [LTS README](https://github.com/nodejs/LTS/). -## Download +### Download Binaries, installers, and source tarballs are available at . From 7ecec6704f4a706455935bb71f37d4cdc52a4294 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 20 Nov 2017 23:37:50 +0100 Subject: [PATCH 086/379] src: abstract getpid() operation There are a few places where we paper over the fact that getpid() is called GetCurrentProcessId() on Windows. Let's move it into a function. PR-URL: https://github.com/nodejs/node/pull/17087 Reviewed-By: Colin Ihrig Reviewed-By: Eugene Ostroukhov Reviewed-By: Timothy Gu --- src/env.cc | 9 ++------- src/inspector_agent.cc | 7 ++++--- src/node.cc | 13 ++++--------- src/node_internals.h | 1 + src/util.cc | 16 ++++++++++++++++ 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/env.cc b/src/env.cc index c177deb67d129f..73d1e4fab1207c 100644 --- a/src/env.cc +++ b/src/env.cc @@ -2,12 +2,6 @@ #include "async_wrap.h" #include "v8-profiler.h" -#if defined(_MSC_VER) -#define getpid GetCurrentProcessId -#else -#include -#endif - #include #include @@ -182,7 +176,8 @@ void Environment::PrintSyncTrace() const { Local stack = StackTrace::CurrentStackTrace(isolate(), 10, StackTrace::kDetailed); - fprintf(stderr, "(node:%d) WARNING: Detected use of sync API\n", getpid()); + fprintf(stderr, "(node:%u) WARNING: Detected use of sync API\n", + GetProcessId()); for (int i = 0; i < stack->GetFrameCount() - 1; i++) { Local stack_frame = stack->GetFrame(i); diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 215e91873a3a70..798b80df866c57 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -13,8 +13,8 @@ #include #ifdef __POSIX__ -#include -#include // setuid, getuid +#include // PTHREAD_STACK_MIN +#include #endif // __POSIX__ namespace node { @@ -108,7 +108,8 @@ static int StartDebugSignalHandler() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); CHECK_EQ(0, pthread_attr_destroy(&attr)); if (err != 0) { - fprintf(stderr, "node[%d]: pthread_create: %s\n", getpid(), strerror(err)); + fprintf(stderr, "node[%u]: pthread_create: %s\n", + GetProcessId(), strerror(err)); fflush(stderr); // Leave SIGUSR1 blocked. We don't install a signal handler, // receiving the signal would terminate the process. diff --git a/src/node.cc b/src/node.cc index 387e5d53285961..ceae88570f145d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -99,7 +99,6 @@ #if defined(_MSC_VER) #include #include -#define getpid GetCurrentProcessId #define umask _umask typedef int mode_t; #else @@ -1995,13 +1994,8 @@ NO_RETURN void Assert(const char* const (*args)[4]) { if (uv_exepath(exepath, &exepath_size)) snprintf(exepath, sizeof(exepath), "node"); - char pid[12] = {0}; -#ifndef _WIN32 - snprintf(pid, sizeof(pid), "[%u]", getpid()); -#endif - - fprintf(stderr, "%s%s: %s:%s:%s%s Assertion `%s' failed.\n", - exepath, pid, filename, linenum, + fprintf(stderr, "%s[%u]: %s:%s:%s%s Assertion `%s' failed.\n", + exepath, GetProcessId(), filename, linenum, function, *function ? ":" : "", message); fflush(stderr); @@ -3532,7 +3526,8 @@ void SetupProcessObject(Environment* env, process_env_template->NewInstance(env->context()).ToLocalChecked(); process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "env"), process_env); - READONLY_PROPERTY(process, "pid", Integer::New(env->isolate(), getpid())); + READONLY_PROPERTY(process, "pid", + Integer::New(env->isolate(), GetProcessId())); READONLY_PROPERTY(process, "features", GetFeatures(env)); CHECK(process->SetAccessor(env->context(), diff --git a/src/node_internals.h b/src/node_internals.h index 5d2f996cc8c1c5..edd94de176b56c 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -166,6 +166,7 @@ void RegisterSignalHandler(int signal, bool reset_handler = false); #endif +uint32_t GetProcessId(); bool SafeGetenv(const char* key, std::string* text); template diff --git a/src/util.cc b/src/util.cc index ef93d16968e465..0fb897bc8e891c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -24,6 +24,14 @@ #include "node_internals.h" #include +#ifdef __POSIX__ +#include // getpid() +#endif + +#ifdef _MSC_VER +#include // GetCurrentProcessId() +#endif + namespace node { using v8::Isolate; @@ -105,4 +113,12 @@ void LowMemoryNotification() { } } +uint32_t GetProcessId() { +#ifdef _WIN32 + return GetCurrentProcessId(); +#else + return getpid(); +#endif +} + } // namespace node From 362b8c7d5d76b51c99a0dc14d04ceaeacd0032df Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 20 Nov 2017 23:37:50 +0100 Subject: [PATCH 087/379] src: inspector context name = program title + pid Report (for example) "node[1337]" as the human-readable name rather than the more generic and less helpful "Node.js Main Context." While not perfect yet, it should be an improvement to people that debug multiple processes from DevTools, VS Code, etc. PR-URL: https://github.com/nodejs/node/pull/17087 Reviewed-By: Colin Ihrig Reviewed-By: Eugene Ostroukhov Reviewed-By: Timothy Gu --- src/inspector_agent.cc | 3 ++- src/inspector_io.cc | 13 +------------ src/node.cc | 13 +++++-------- src/node_internals.h | 3 +++ src/util.cc | 12 ++++++++++++ test/sequential/test-inspector-contexts.js | 15 ++++++++++++--- 6 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 798b80df866c57..875c12efa02375 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -302,7 +302,8 @@ class NodeInspectorClient : public V8InspectorClient { : env_(env), platform_(platform), terminated_(false), running_nested_loop_(false) { client_ = V8Inspector::create(env->isolate(), this); - contextCreated(env->context(), "Node.js Main Context"); + // TODO(bnoordhuis) Make name configurable from src/node.cc. + contextCreated(env->context(), GetHumanReadableProcessName()); } void runMessageLoopOnPause(int context_group_id) override { diff --git a/src/inspector_io.cc b/src/inspector_io.cc index a870c0a2634452..538cbab3c9fe84 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -26,17 +26,6 @@ using v8_inspector::StringView; template using TransportAndIo = std::pair; -std::string GetProcessTitle() { - char title[2048]; - int err = uv_get_process_title(title, sizeof(title)); - if (err == 0) { - return title; - } else { - // Title is too long, or could not be retrieved. - return "Node.js"; - } -} - std::string ScriptPath(uv_loop_t* loop, const std::string& script_name) { std::string script_path; @@ -484,7 +473,7 @@ std::vector InspectorIoDelegate::GetTargetIds() { } std::string InspectorIoDelegate::GetTargetTitle(const std::string& id) { - return script_name_.empty() ? GetProcessTitle() : script_name_; + return script_name_.empty() ? GetHumanReadableProcessName() : script_name_; } std::string InspectorIoDelegate::GetTargetUrl(const std::string& id) { diff --git a/src/node.cc b/src/node.cc index ceae88570f145d..06c107c1be1942 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1989,14 +1989,11 @@ NO_RETURN void Assert(const char* const (*args)[4]) { auto message = (*args)[2]; auto function = (*args)[3]; - char exepath[256]; - size_t exepath_size = sizeof(exepath); - if (uv_exepath(exepath, &exepath_size)) - snprintf(exepath, sizeof(exepath), "node"); - - fprintf(stderr, "%s[%u]: %s:%s:%s%s Assertion `%s' failed.\n", - exepath, GetProcessId(), filename, linenum, - function, *function ? ":" : "", message); + char name[1024]; + GetHumanReadableProcessName(&name); + + fprintf(stderr, "%s: %s:%s:%s%s Assertion `%s' failed.\n", + name, filename, linenum, function, *function ? ":" : "", message); fflush(stderr); Abort(); diff --git a/src/node_internals.h b/src/node_internals.h index edd94de176b56c..9c8a80854a9932 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -169,6 +169,9 @@ void RegisterSignalHandler(int signal, uint32_t GetProcessId(); bool SafeGetenv(const char* key, std::string* text); +std::string GetHumanReadableProcessName(); +void GetHumanReadableProcessName(char (*name)[1024]); + template constexpr size_t arraysize(const T(&)[N]) { return N; } diff --git a/src/util.cc b/src/util.cc index 0fb897bc8e891c..2aa9fb026ea315 100644 --- a/src/util.cc +++ b/src/util.cc @@ -113,6 +113,18 @@ void LowMemoryNotification() { } } +std::string GetHumanReadableProcessName() { + char name[1024]; + GetHumanReadableProcessName(&name); + return name; +} + +void GetHumanReadableProcessName(char (*name)[1024]) { + char title[1024] = "Node.js"; + uv_get_process_title(title, sizeof(title)); + snprintf(*name, sizeof(*name), "%s[%u]", title, GetProcessId()); +} + uint32_t GetProcessId() { #ifdef _WIN32 return GetCurrentProcessId(); diff --git a/test/sequential/test-inspector-contexts.js b/test/sequential/test-inspector-contexts.js index 54acfab0d5cace..c7db962f2af006 100644 --- a/test/sequential/test-inspector-contexts.js +++ b/test/sequential/test-inspector-contexts.js @@ -23,9 +23,18 @@ async function testContextCreatedAndDestroyed() { session.post('Runtime.enable'); let contextCreated = await mainContextPromise; - strictEqual('Node.js Main Context', - contextCreated.params.context.name, - JSON.stringify(contextCreated)); + { + const { name } = contextCreated.params.context; + if (common.isSunOS || common.isWindows) { + // uv_get_process_title() is unimplemented on Solaris-likes, it returns + // an empy string. On the Windows CI buildbots it returns "Administrator: + // Windows PowerShell[42]" because of a GetConsoleTitle() quirk. Not much + // we can do about either, just verify that it contains the PID. + strictEqual(name.includes(`[${process.pid}]`), true); + } else { + strictEqual(`${process.argv0}[${process.pid}]`, name); + } + } const secondContextCreatedPromise = notificationPromise('Runtime.executionContextCreated'); From 84b707089e226267c547c103fd651810a263a72a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 17 Nov 2017 22:13:18 +0100 Subject: [PATCH 088/379] src: add helper for addons to get the event loop Add a utility functions for addons to use when they need a reference to the current event loop. Currently, `uv_default_loop()` works if the embedder is the single-threaded default node executable, but even without the presence of e.g. workers that might not really an API guarantee for when Node is embedded. PR-URL: https://github.com/nodejs/node/pull/17109 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/node.cc | 9 +++++++++ src/node.h | 4 ++++ test/addons/async-hello-world/binding.cc | 2 +- test/addons/callback-scope/binding.cc | 5 ++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 06c107c1be1942..a590184c31db3d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4670,6 +4670,15 @@ void RunAtExit(Environment* env) { } +uv_loop_t* GetCurrentEventLoop(v8::Isolate* isolate) { + HandleScope handle_scope(isolate); + auto context = isolate->GetCurrentContext(); + if (context.IsEmpty()) + return nullptr; + return Environment::GetCurrent(context)->event_loop(); +} + + static uv_key_t thread_local_env; diff --git a/src/node.h b/src/node.h index 5f74854891bd03..89dac0c0a8491d 100644 --- a/src/node.h +++ b/src/node.h @@ -248,6 +248,10 @@ NODE_EXTERN void EmitBeforeExit(Environment* env); NODE_EXTERN int EmitExit(Environment* env); NODE_EXTERN void RunAtExit(Environment* env); +// This may return nullptr if the current v8::Context is not associated +// with a Node instance. +NODE_EXTERN struct uv_loop_s* GetCurrentEventLoop(v8::Isolate* isolate); + /* Converts a unixtime to V8 Date */ #define NODE_UNIXTIME_V8(t) v8::Date::New(v8::Isolate::GetCurrent(), \ 1000 * static_cast(t)) diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index f773bfffcdb95d..5b3a800709f7d7 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -77,7 +77,7 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Local callback = v8::Local::Cast(args[1]); req->callback.Reset(isolate, callback); - uv_queue_work(uv_default_loop(), + uv_queue_work(node::GetCurrentEventLoop(isolate), &req->req, DoAsync, (uv_after_work_cb)AfterAsync); diff --git a/test/addons/callback-scope/binding.cc b/test/addons/callback-scope/binding.cc index f03d8a20d5333f..34d452bbb7c710 100644 --- a/test/addons/callback-scope/binding.cc +++ b/test/addons/callback-scope/binding.cc @@ -52,7 +52,10 @@ static void TestResolveAsync(const v8::FunctionCallbackInfo& args) { uv_work_t* req = new uv_work_t; - uv_queue_work(uv_default_loop(), req, [](uv_work_t*) {}, Callback); + uv_queue_work(node::GetCurrentEventLoop(isolate), + req, + [](uv_work_t*) {}, + Callback); } v8::Local local = From 8d222d42ab1471bb4bf2cd84e4df23f15b2091f3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 17 Nov 2017 22:16:43 +0100 Subject: [PATCH 089/379] n-api: add helper for addons to get the event loop Add a utility functions for addons to use when they need a reference to the current event loop. While the libuv API is not directly part of N-API, it provides a quite stable C API as well, and is tightly integrated with Node itself. As a particular use case, without access to the event loop it is hard to do something interesting from inside a N-API finalizer function, since calls into JS and therefore virtually all other N-API functions are not allowed. PR-URL: https://github.com/nodejs/node/pull/17109 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- doc/api/n-api.md | 17 ++++ src/node_api.cc | 28 ++++--- src/node_api.h | 6 ++ test/addons-napi/test_general/test.js | 2 +- test/addons-napi/test_uv_loop/binding.gyp | 8 ++ test/addons-napi/test_uv_loop/test.js | 5 ++ test/addons-napi/test_uv_loop/test_uv_loop.cc | 78 +++++++++++++++++++ 7 files changed, 134 insertions(+), 10 deletions(-) create mode 100644 test/addons-napi/test_uv_loop/binding.gyp create mode 100644 test/addons-napi/test_uv_loop/test.js create mode 100644 test/addons-napi/test_uv_loop/test_uv_loop.cc diff --git a/doc/api/n-api.md b/doc/api/n-api.md index df9038182fbf95..0e94396665ca25 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3686,6 +3686,23 @@ NAPI_EXTERN napi_status napi_run_script(napi_env env, - `[in] script`: A JavaScript string containing the script to execute. - `[out] result`: The value resulting from having executed the script. +## libuv event loop + +N-API provides a function for getting the current event loop associated with +a specific `napi_env`. + +### napi_get_uv_event_loop + +```C +NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, + uv_loop_t** loop); +``` + +- `[in] env`: The environment that the API is invoked under. +- `[out] loop`: The current libuv loop instance. + [Promises]: #n_api_promises [Simple Asynchronous Operations]: #n_api_simple_asynchronous_operations [Custom Asynchronous Operations]: #n_api_custom_asynchronous_operations diff --git a/src/node_api.cc b/src/node_api.cc index ad922d9ad195db..84e57d03d6237d 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -18,7 +18,7 @@ #include "node_api.h" #include "node_internals.h" -#define NAPI_VERSION 1 +#define NAPI_VERSION 2 static napi_status napi_set_last_error(napi_env env, napi_status error_code, @@ -28,8 +28,10 @@ static napi_status napi_clear_last_error(napi_env env); struct napi_env__ { - explicit napi_env__(v8::Isolate* _isolate): isolate(_isolate), - last_error() {} + explicit napi_env__(v8::Isolate* _isolate, uv_loop_t* _loop) + : isolate(_isolate), + last_error(), + loop(_loop) {} ~napi_env__() { last_exception.Reset(); wrap_template.Reset(); @@ -43,6 +45,7 @@ struct napi_env__ { v8::Persistent accessor_data_template; napi_extended_error_info last_error; int open_handle_scopes = 0; + uv_loop_t* loop = nullptr; }; #define ENV_OBJECT_TEMPLATE(env, prefix, destination, field_count) \ @@ -771,7 +774,7 @@ napi_env GetEnv(v8::Local context) { if (value->IsExternal()) { result = static_cast(value.As()->Value()); } else { - result = new napi_env__(isolate); + result = new napi_env__(isolate, node::GetCurrentEventLoop(isolate)); auto external = v8::External::New(isolate, result); // We must also stop hard if the result of assigning the env to the global @@ -3401,15 +3404,22 @@ napi_status napi_delete_async_work(napi_env env, napi_async_work work) { return napi_clear_last_error(env); } +napi_status napi_get_uv_event_loop(napi_env env, uv_loop_t** loop) { + CHECK_ENV(env); + CHECK_ARG(env, loop); + *loop = env->loop; + return napi_clear_last_error(env); +} + napi_status napi_queue_async_work(napi_env env, napi_async_work work) { CHECK_ENV(env); CHECK_ARG(env, work); - // Consider: Encapsulate the uv_loop_t into an opaque pointer parameter. - // Currently the environment event loop is the same as the UV default loop. - // Someday (if node ever supports multiple isolates), it may be better to get - // the loop from node::Environment::GetCurrent(env->isolate)->event_loop(); - uv_loop_t* event_loop = uv_default_loop(); + napi_status status; + uv_loop_t* event_loop = nullptr; + status = napi_get_uv_event_loop(env, &event_loop); + if (status != napi_ok) + return napi_set_last_error(env, status); uvimpl::Work* w = reinterpret_cast(work); diff --git a/src/node_api.h b/src/node_api.h index a3a07a64673366..8e5eef8a47728f 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -14,6 +14,8 @@ #include #include "node_api_types.h" +struct uv_loop_s; // Forward declaration. + #ifdef _WIN32 #ifdef BUILDING_NODE_EXTENSION #ifdef EXTERNAL_NAPI @@ -581,6 +583,10 @@ NAPI_EXTERN napi_status napi_run_script(napi_env env, napi_value script, napi_value* result); +// Return the current libuv event loop for a given environment +NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, + struct uv_loop_s** loop); + EXTERN_C_END #endif // SRC_NODE_API_H_ diff --git a/test/addons-napi/test_general/test.js b/test/addons-napi/test_general/test.js index 3ff57922c5372b..ee6618c8121289 100644 --- a/test/addons-napi/test_general/test.js +++ b/test/addons-napi/test_general/test.js @@ -34,7 +34,7 @@ assert.ok(test_general.testGetPrototype(baseObject) !== // test version management functions // expected version is currently 1 -assert.strictEqual(test_general.testGetVersion(), 1); +assert.strictEqual(test_general.testGetVersion(), 2); const [ major, minor, patch, release ] = test_general.testGetNodeVersion(); assert.strictEqual(process.version.split('-')[0], diff --git a/test/addons-napi/test_uv_loop/binding.gyp b/test/addons-napi/test_uv_loop/binding.gyp new file mode 100644 index 00000000000000..81fcfdc592a523 --- /dev/null +++ b/test/addons-napi/test_uv_loop/binding.gyp @@ -0,0 +1,8 @@ +{ + "targets": [ + { + "target_name": "test_uv_loop", + "sources": [ "test_uv_loop.cc" ] + } + ] +} diff --git a/test/addons-napi/test_uv_loop/test.js b/test/addons-napi/test_uv_loop/test.js new file mode 100644 index 00000000000000..4efc3c6fcd7001 --- /dev/null +++ b/test/addons-napi/test_uv_loop/test.js @@ -0,0 +1,5 @@ +'use strict'; +const common = require('../../common'); +const { SetImmediate } = require(`./build/${common.buildType}/test_uv_loop`); + +SetImmediate(common.mustCall()); diff --git a/test/addons-napi/test_uv_loop/test_uv_loop.cc b/test/addons-napi/test_uv_loop/test_uv_loop.cc new file mode 100644 index 00000000000000..44819f72bb6b9d --- /dev/null +++ b/test/addons-napi/test_uv_loop/test_uv_loop.cc @@ -0,0 +1,78 @@ +#include +#include +#include +#include +#include +#include "../common.h" + +template +void* SetImmediate(napi_env env, T&& cb) { + T* ptr = new T(std::move(cb)); + uv_loop_t* loop = nullptr; + uv_check_t* check = new uv_check_t; + check->data = ptr; + NAPI_ASSERT(env, + napi_get_uv_event_loop(env, &loop) == napi_ok, + "can get event loop"); + uv_check_init(loop, check); + uv_check_start(check, [](uv_check_t* check) { + std::unique_ptr ptr {static_cast(check->data)}; + T cb = std::move(*ptr); + uv_close(reinterpret_cast(check), [](uv_handle_t* handle) { + delete reinterpret_cast(handle); + }); + + assert(cb() != nullptr); + }); + return nullptr; +} + +static char dummy; + +napi_value SetImmediateBinding(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value argv[1]; + napi_value _this; + void* data; + NAPI_CALL(env, + napi_get_cb_info(env, info, &argc, argv, &_this, &data)); + NAPI_ASSERT(env, argc >= 1, "Not enough arguments, expected 1."); + + napi_valuetype t; + NAPI_CALL(env, napi_typeof(env, argv[0], &t)); + NAPI_ASSERT(env, t == napi_function, + "Wrong first argument, function expected."); + + napi_ref cbref; + NAPI_CALL(env, + napi_create_reference(env, argv[0], 1, &cbref)); + + SetImmediate(env, [=]() -> char* { + napi_value undefined; + napi_value callback; + napi_handle_scope scope; + NAPI_CALL(env, napi_open_handle_scope(env, &scope)); + NAPI_CALL(env, napi_get_undefined(env, &undefined)); + NAPI_CALL(env, napi_get_reference_value(env, cbref, &callback)); + NAPI_CALL(env, napi_delete_reference(env, cbref)); + NAPI_CALL(env, + napi_call_function(env, undefined, callback, 0, nullptr, nullptr)); + NAPI_CALL(env, napi_close_handle_scope(env, scope)); + return &dummy; + }); + + return nullptr; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor properties[] = { + DECLARE_NAPI_PROPERTY("SetImmediate", SetImmediateBinding) + }; + + NAPI_CALL(env, napi_define_properties( + env, exports, sizeof(properties) / sizeof(*properties), properties)); + + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) From a9be7bf35ba68781894207c74c9ba8ab5915d141 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 20 Nov 2017 09:29:35 -0500 Subject: [PATCH 090/379] src: remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a compiler warning. PR-URL: https://github.com/nodejs/node/pull/17150 Reviewed-By: Michael Dawson Reviewed-By: Anatoli Papirovski Reviewed-By: Anna Henningsen Reviewed-By: Tobias Nießen Reviewed-By: Timothy Gu Reviewed-By: James M Snell --- src/node.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index a590184c31db3d..21c2dc849a2dd9 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1224,7 +1224,6 @@ void SetupDomainUse(const FunctionCallbackInfo& args) { env->set_using_domains(true); HandleScope scope(env->isolate()); - Local process_object = env->process_object(); CHECK(args[0]->IsArray()); env->set_domains_stack_array(args[0].As()); From c4eb683020e880a78ef2a531f7af12c9f846f709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Nov 2017 18:26:51 +0100 Subject: [PATCH 091/379] tools: use built-in padStart instead of padString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17120 Reviewed-By: Timothy Gu Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- tools/lint-js.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tools/lint-js.js b/tools/lint-js.js index 5143aea0369112..202f0f062d5330 100644 --- a/tools/lint-js.js +++ b/tools/lint-js.js @@ -215,12 +215,12 @@ if (cluster.isMaster) { // Calculate and format the data for displaying const elapsed = process.hrtime(startTime)[0]; - const mins = padString(Math.floor(elapsed / 60), 2, '0'); - const secs = padString(elapsed % 60, 2, '0'); - const passed = padString(successes, 6, ' '); - const failed = padString(failures, 6, ' '); + const mins = `${Math.floor(elapsed / 60)}`.padStart(2, '0'); + const secs = `${elapsed % 60}`.padStart(2, '0'); + const passed = `${successes}`.padStart(6); + const failed = `${failures}`.padStart(6); var pct = Math.ceil(((totalPaths - paths.length) / totalPaths) * 100); - pct = padString(pct, 3, ' '); + pct = `${pct}`.padStart(3); var line = `[${mins}:${secs}|%${pct}|+${passed}|-${failed}]: ${curPath}`; @@ -233,13 +233,6 @@ if (cluster.isMaster) { outFn(line); } - - function padString(str, len, chr) { - str = `${str}`; - if (str.length >= len) - return str; - return chr.repeat(len - str.length) + str; - } } else { // Worker From 34bfbfece465567381262e22a5a35a7244916d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Nov 2017 19:15:20 +0100 Subject: [PATCH 092/379] tools: avoid using process.cwd in tools/lint-js The first occurrence of path.join() can easily be replaced with path.resolve(). The second occurrence should be unnecessary as ESLint will resolve the path internally, and the old check probably did not work as intended anyway. PR-URL: https://github.com/nodejs/node/pull/17121 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- tools/lint-js.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/lint-js.js b/tools/lint-js.js index 202f0f062d5330..a22fb9439c7e06 100644 --- a/tools/lint-js.js +++ b/tools/lint-js.js @@ -13,7 +13,6 @@ const totalCPUs = require('os').cpus().length; const CLIEngine = require('./eslint').CLIEngine; const glob = require('./eslint/node_modules/glob'); -const cwd = process.cwd(); const cliOptions = { rulePaths: rulesDirs, extensions: extensions, @@ -82,9 +81,7 @@ if (cluster.isMaster) { if (i !== -1) { if (!process.argv[i + 1]) throw new Error('Missing output filename'); - var outPath = process.argv[i + 1]; - if (!path.isAbsolute(outPath)) - outPath = path.join(cwd, outPath); + const outPath = path.resolve(process.argv[i + 1]); fd = fs.openSync(outPath, 'w'); outFn = function(str) { fs.writeSync(fd, str, 'utf8'); @@ -176,8 +173,6 @@ if (cluster.isMaster) { while (paths.length) { var dir = paths.shift(); curPath = dir; - if (dir.indexOf('/') > 0) - dir = path.join(cwd, dir); const patterns = cli.resolveFileGlobPatterns([dir]); dir = path.resolve(patterns[0]); files = glob.sync(dir, globOptions); From c8247a7c7d7cb0008a0338e9207d2083c4692a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Nov 2017 21:00:03 +0100 Subject: [PATCH 093/379] tools: remove useless function declaration PR-URL: https://github.com/nodejs/node/pull/17125 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- tools/doc/preprocess.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/doc/preprocess.js b/tools/doc/preprocess.js index 35348d583b0f0a..652f12a9f05472 100644 --- a/tools/doc/preprocess.js +++ b/tools/doc/preprocess.js @@ -10,11 +10,7 @@ const includeData = {}; function preprocess(inputFile, input, cb) { input = stripComments(input); - processIncludes(inputFile, input, function(err, data) { - if (err) return cb(err); - - cb(null, data); - }); + processIncludes(inputFile, input, cb); } function stripComments(input) { From 5247ab37926de1ccc03fcaa67387705a94d0d5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Nov 2017 21:04:05 +0100 Subject: [PATCH 094/379] tools: make doc tool a bit more readable PR-URL: https://github.com/nodejs/node/pull/17125 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- tools/doc/generate.js | 31 +++++++++++-------------------- tools/doc/html.js | 4 +--- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 906aa962196306..f369427a8aaf19 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -30,13 +30,13 @@ const fs = require('fs'); const args = process.argv.slice(2); let format = 'json'; let template = null; -let inputFile = null; +let filename = null; let nodeVersion = null; let analytics = null; args.forEach(function(arg) { if (!arg.startsWith('--')) { - inputFile = arg; + filename = arg; } else if (arg.startsWith('--format=')) { format = arg.replace(/^--format=/, ''); } else if (arg.startsWith('--template=')) { @@ -50,41 +50,32 @@ args.forEach(function(arg) { nodeVersion = nodeVersion || process.version; -if (!inputFile) { +if (!filename) { throw new Error('No input file specified'); } -fs.readFile(inputFile, 'utf8', function(er, input) { +fs.readFile(filename, 'utf8', (er, input) => { if (er) throw er; // process the input for @include lines - processIncludes(inputFile, input, next); + processIncludes(filename, input, next); }); function next(er, input) { if (er) throw er; switch (format) { case 'json': - require('./json.js')(input, inputFile, function(er, obj) { + require('./json.js')(input, filename, (er, obj) => { console.log(JSON.stringify(obj, null, 2)); if (er) throw er; }); break; case 'html': - require('./html.js')( - { - input: input, - filename: inputFile, - template: template, - nodeVersion: nodeVersion, - analytics: analytics, - }, - - function(er, html) { - if (er) throw er; - console.log(html); - } - ); + require('./html')({ input, filename, template, nodeVersion, analytics }, + (err, html) => { + if (err) throw err; + console.log(html); + }); break; default: diff --git a/tools/doc/html.js b/tools/doc/html.js index e25192599593f3..1c44c5f7d3c239 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -125,9 +125,7 @@ function toID(filename) { * opts: lexed, filename, template, nodeVersion. */ function render(opts, cb) { - var lexed = opts.lexed; - var filename = opts.filename; - var template = opts.template; + var { lexed, filename, template } = opts; const nodeVersion = opts.nodeVersion || process.version; // get the section From 94e0488a336767eea271702bea51f9eb10933aac Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 18 Nov 2017 16:37:07 +0100 Subject: [PATCH 095/379] inspector: no async tracking for promises `Promise` instances are already tracked by V8 itself. This fixes `sequential/test-inspector-async-stack-traces-promise-then` in debug mode (it previously crashed because our tracking and the V8 tracking were not properly nested). PR-URL: https://github.com/nodejs/node/pull/17118 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/707058 Fixes: https://github.com/nodejs/node/issues/17017 Reviewed-By: Timothy Gu Reviewed-By: Anatoli Papirovski Reviewed-By: Eugene Ostroukhov Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/internal/inspector_async_hook.js | 13 ++++++++++++- ...est-inspector-async-stack-traces-promise-then.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/internal/inspector_async_hook.js b/lib/internal/inspector_async_hook.js index 4ccf862697756d..b190ff90b8ea2c 100644 --- a/lib/internal/inspector_async_hook.js +++ b/lib/internal/inspector_async_hook.js @@ -16,22 +16,33 @@ const hook = createHook({ // in https://github.com/nodejs/node/pull/13870#discussion_r124515293, // this should be fine as long as we call asyncTaskCanceled() too. const recurring = true; - inspector.asyncTaskScheduled(type, asyncId, recurring); + if (type === 'PROMISE') + this.promiseIds.add(asyncId); + else + inspector.asyncTaskScheduled(type, asyncId, recurring); }, before(asyncId) { + if (this.promiseIds.has(asyncId)) + return; inspector.asyncTaskStarted(asyncId); }, after(asyncId) { + if (this.promiseIds.has(asyncId)) + return; inspector.asyncTaskFinished(asyncId); }, destroy(asyncId) { + if (this.promiseIds.has(asyncId)) + return this.promiseIds.delete(asyncId); inspector.asyncTaskCanceled(asyncId); }, }); +hook.promiseIds = new Set(); + function enable() { if (config.bits < 64) { // V8 Inspector stores task ids as (void*) pointers. diff --git a/test/sequential/test-inspector-async-stack-traces-promise-then.js b/test/sequential/test-inspector-async-stack-traces-promise-then.js index a321855b5ea613..9ed61d5ae13675 100644 --- a/test/sequential/test-inspector-async-stack-traces-promise-then.js +++ b/test/sequential/test-inspector-async-stack-traces-promise-then.js @@ -54,7 +54,7 @@ function debuggerPausedAt(msg, functionName, previousTickLocation) { `${Object.keys(msg.params)} contains "asyncStackTrace" property`); assert.strictEqual(msg.params.callFrames[0].functionName, functionName); - assert.strictEqual(msg.params.asyncStackTrace.description, 'PROMISE'); + assert.strictEqual(msg.params.asyncStackTrace.description, 'Promise.resolve'); const frameLocations = msg.params.asyncStackTrace.callFrames.map( (frame) => `${frame.functionName}:${frame.lineNumber}`); From 7b5a05bc0fc2f0abe530f6760fe1c336a01d091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 28 Oct 2017 14:55:04 +0200 Subject: [PATCH 096/379] doc: update AUTHORS list PR-URL: https://github.com/nodejs/node/pull/16571 Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- .mailmap | 49 +++++++++ AUTHORS | 320 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 361 insertions(+), 8 deletions(-) diff --git a/.mailmap b/.mailmap index 842d610df87b94..e7efb4f43ab794 100644 --- a/.mailmap +++ b/.mailmap @@ -1,8 +1,10 @@ Aaron Bieber Aaron Heckmann +Aayush Ahuja aayush.a Abe Fettig Akito Ito Alejandro Oviedo Garcia Alejandro Oviedo +Alex Gilbert agilbert Alex Hultman Alex Jordan AJ Jordan Alex Kocharin @@ -19,6 +21,7 @@ Andy Bettisworth Angel Stoyanov atstojanov Anna Henningsen Anna Magdalena Kedzierska AnnaMag +Antoine Amara Antoine AMARA Aria Stewart Arlo Breault Arnaud Lefebvre BlackYoup @@ -26,6 +29,7 @@ Artem Zaytsev Artur G Vieira Artur Vieira Arnout Kazemier <3rd-Eden@users.noreply.github.com> Asaf David asafdav2 +Ashley Maceli ashleyraymaceli Atsuo Fukaya Ben Lugavere blugavere Ben Noordhuis @@ -42,30 +46,37 @@ Beth Griggs Bethany N Griggs BethGriggs Bidisha Pyne Brad Decker brad-decker +Brad Larson BradLarson Bradley Meck Bradley Farias Brandon Benvie Brandon Kobel kobelb Brendan Ashworth +Brent Pendergraft penDerGraft Brian White Brian White Caleb Boyd Calvin Metcalf Calvin Metcalf +Caralyn Reisle creisle Charles Chew Choon Keat Charles Rudolph +Chris Andrews cpandrews8 Chris Johnson +Chris Young Claudio Rodriguez Colin Ihrig Christophe Naud-Dulude Chris911 Christopher Lenz Dan Kaplun Dan Williams Dan.Williams +Daniel Abrão Daniel Abrão > Daniel Bevenius daniel.bevenius Daniel Berger Daniel Chcouri <333222@gmail.com> Daniel Gröber Daniel Gröber +Daniel Paulino dpaulino Daniel Pihlström Daniel Wang firedfox Daniel Wang firedfox @@ -84,6 +95,7 @@ Eduard Burtescu Einar Otto Stangvik Elliott Cable Eric Phetteplace +Erwin W. Ramadhan erwinwahyura Eugene Obrezkov ghaiklor EungJun Yi Evan Larkin @@ -99,14 +111,21 @@ Felix Geisendörfer Flandre Scarlet Flandre Florian Margaine Florian MARGAINE Forrest L Norvell +Franziska Hinkelmann F. Hinkelmann Friedemann Altrock Fuji Goro Gabriel de Perthuis Gareth Ellis +Geoffrey Bugaisky gbugaisky Gibson Fahnestock Gil Pedersen Graham Fairweather Xotic750 Greg Sabia Tucker +Gregor Martynus Gregor +Guy Bedford guybedford +Halil İbrahim Şener hisener +Hannah Kim heeeunkimmm +Hendrik Schwalm hschwalm Hitesh Kanwathirtha Henry Chin Herbert Vojčík @@ -122,8 +141,10 @@ Italo A. Casas Jackson Tian Jake Verbaten Jamen Marzonie Jamen Marz +James Beavers Druotic James Hartig James M Snell +James Nimlos JamesNimlos Jan Krems Jenna Vuong JeongHoon Byun Outsider @@ -139,13 +160,17 @@ Johann Hofmann John Barboza jBarz John Barboza jBarz John Gardner Alhadis +John McGuirk jmcgui05 Johnny Ray Austin Johnny Ray Jon Tippens legalcodes Jonas Pfenniger +Jonathan Gourlay mrgorbo Jonathan Ong Jonathan Persson Jonathan Rentzsch +Jose Luis Vivero jlvivero Josh Erickson +Josh Hunter jopann Joshua S. Weinstein Joyee Cheung joyeecheung Juan Soto @@ -154,6 +179,7 @@ Julien Waechter julien.waechter Junliang Yan Junshu Okamoto jun-oka +Justin Beckwith Jérémy Lal Jérémy Lal Kai Sasaki Lewuathe @@ -172,17 +198,21 @@ Lydia Kats Lydia Katsamberis Maciej Małecki Malte-Thorben Bruns Malte-Thorben Bruns skenqbx +Manil Chowdhurian Chowdhurian Marcelo Gobelli decareano Marcin Cieślak Marcin Cieślak Marcin Zielinski marzelin Marti Martz Martial James Jefferson +Martijn Schrage Oblosys Matt Lang matt-in-a-hat +Matt Reed matthewreed26 Matthias Bastian piepmatz Mathias Buus Mathias Pettersson Matthew Lye +Maurice Hayward maurice_hayward Michael Bernstein Michael Dawson Michael Wilber @@ -192,6 +222,7 @@ Micheil Smith Micleusanu Nicu Miguel Angel Asencio Hurtado maasencioh Mikael Bourges-Sevenier +Mike Kaufman Minqi Pan P.S.V.R Minwoo Jung JungMinu Miroslav Bajtoš @@ -208,8 +239,11 @@ Onne Gorter Paul Querna Pedro Lima Pedro Victor Pedro Lima Pedro lima +Peng Lyu rebornix Peter Flannery +Peter Paugh Peter Phillip Johnsen +Rachel White rachelnicole Ratikesh Misra Ravindra Barthwal Ravindra barthwal Ray Morgan @@ -220,11 +254,14 @@ Refael Ackermann Reza Akhavan jedireza Ricardo Sánchez Gregorio richnologies Rick Olson +Rob Adelmann +Rob Adelmann adelmann Rod Machen Roman Klauke Roman Reiss Ron Korving Ron Korving ronkorving +Russell Dempsey Ryan Dahl Ryan Emery Ryan Scheel Ryan Scheel @@ -245,11 +282,14 @@ Scott Blomquist Segu Riluvan Sergey Kryzhanovsky Shannen Saez +Shaopeng Zhang szhang351 Shigeki Ohtsu Shigeki Ohtsu +Shiya Luo shiya Siddharth Mahendraker Simon Willison Siobhan O'Donovan justshiv +Siyuan Gao r1cebank solebox solebox <5013box@gmail.com> Sreepurna Jasti Sreepurna Jasti sreepurnajasti @@ -261,6 +301,7 @@ Steve Mao Steven R. Loomis Stewart X Addison Stewart Addison Stewart X Addison sxa555 +Suraiya Hameed suraiyah Suramya shah ss22ever Surya Panikkal surya panikkal Surya Panikkal suryagh @@ -268,6 +309,8 @@ Taehee Kang hugnosis Tanuja-Sawant Taylor Woll taylor.woll Thomas Watson Steen Thomas Watson +Timur Shemsedinov tshemsedinov +Toby Farley tobyfarley Toby Stableford toboid Todd Kennedy TJ Holowaychuk @@ -278,6 +321,8 @@ Tarun Batra Tarun Ted Young Thomas Lee Thomas Reggi +Tierney Cyren &! (bitandbang) +Tierney Cyren bitandbang Tim Caswell Tim Price Tim Smart @@ -285,6 +330,8 @@ Tim Smart Timothy Leverett Timothy Tom Hughes Tom Hughes-Croucher +Tom Purcell tpurcell +Tomoki Okahana umatoma Travis Meisenheimer Trevor Burnham Tyler Larson @@ -295,10 +342,12 @@ vsemozhetbyt Vse Mozhet Byt Wang Xinyong Weijia Wang <381152119@qq.com> starkwang <381152119@qq.com> Willi Eggeling +Wyatt Preul geek xiaoyu <306766053@qq.com> Poker <306766053@qq.com> Yazhong Liu Yazhong Liu Yazhong Liu Yorkie Yazhong Liu Yorkie +Yazhong Liu Yorkie Liu Yoshihiro KIKUCHI Yosuke Furukawa Yuichiro MASUI diff --git a/AUTHORS b/AUTHORS index 977f3b619f4b00..ae3d6864dfc8f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -710,7 +710,7 @@ Ryan Scheel Benjamin Gruenbaum Pavel Medvedev Russell Dempsey -&! (bitandbang) +Tierney Cyren h7lin Michael Dawson Ruben Verborgh @@ -957,7 +957,7 @@ Bogdan Lobor Mihai Potra Brendon Pierson Brad Hill -Mike Kaufman +Mike Kaufman Igor Kalashnikov Amery James Reggio @@ -1194,12 +1194,12 @@ scalkpdev Ashton Kinslow Kevin Zurawel Wes Tyler -shiya +Shiya Luo Joyee Cheung Greg Valdez Bidur Adhikari Kyle Carter -adelmann +Rob Adelmann Daniel Pittman Ian White Chris Bystrek @@ -1274,7 +1274,6 @@ Sam Shull Michael-Bryant Choa CodeVana Daniel Sims -Rob Adelmann Diego Paez Paul Graham Jared Young @@ -1401,7 +1400,7 @@ James Sumners Bradley Curran chiaki-yokoo Benjamin Fleischer -maurice_hayward +Maurice Hayward Ali BARIN Nemanja Stojanovic Jeroen Mandersloot @@ -1526,11 +1525,10 @@ realwakka Gergely Nemeth Samuel Reed Anshul Guleria -Justin Beckwith +Justin Beckwith Scott McKenzie Julien Klepatch Dan Homola -Chris Young cornholio <0@mcornholio.ru> Tamás Hódi DuanPengfei <2459714173@qq.com> @@ -1667,5 +1665,311 @@ George Bezerra Benjamin Coe Tim Costa Rahul Mishra +Damien O'Reilly +Tuan Anh Tran +Alex Gresnel <31708810+agresnel@users.noreply.github.com> +Will Young +Martijn Schrage +Halil İbrahim Şener +Guy Bedford +Antoine Amara +Mani Maghsoudlou +Bartek Szczepański +Roga Pria Sembada +Jussi Räsänen +Thomas Corbière +atvoicu +Peng Lyu +Yang-Kichang +JP Wesselink +Rami Moshe +Rimas Misevičius +Jack Horton +Trivikram Kamat +Jose Luis Vivero +John-David Dalton +Pavel Pomerantsev +Daniela Borges Matos de Carvalho +Bruce Fletcher +Greg Byram +Manil Chowdhurian +Jonathan Eskew +James M. Greene +Pooya Paridel +Paul Berry +Ruxandra Fediuc +Saeed H +Rachel White +Geoffrey Bugaisky +Sam Skjonsberg +Emily Marigold Klassen +Ashley Maceli +Thomas Schorn +John Miller +rhalldearn +Annie Weng +Sean Cox +Luke Greenleaf +Alec Ferguson +Laura Cabrera +Barry Tam +Eric Pemberton +Josh Hunter +BinarySo1o +Chris Budy +Emily Platzer +jacjam +Brant Barger +Daniel Paulino +Emily Ford +Luis Del Águila +Mujtaba Al-Tameemi +Govee91 +joanne-jjb +Brad Larson +Alice Tsui +Greg Matthews +Daniel Kostro +Faisal Yaqoob +Alex McKenzie +Hannah Kim +Paul Milham +Christopher Choi +Suraiya Hameed +Charlie Duong +Joe Grace +Justin Lee +Brent Pendergraft +Gene Wu +nodexpertsdev +Rob Paton +Daniele Lisi +Sushil Tailor +Ben Michel +John McGuirk +Colin Leong +Caralyn Reisle +Savio Lucena +Rafal Leszczynski +Ivan Etchart +Robin Lungwitz +ryshep111 +gitHubTracey +tabulatedreams +Charles T Wall III +Minya Liang +Kinnan Kwok +Adil L +Seth Holladay +Chris Andrews +Matt Reed +Joe Henry +Alireza Alidousti +James Beavers +Cameron Burwell +Jakub Mrowiec - Alkagar +Oliver Luebeck +Chris Jimenez +James Hodgskiss +Guilherme Akio Sakae +Martin Michaelis +Christopher Sidebottom +Edward Andrew Robinson +Nigel Kibodeaux +Shakeel Mohamed +Tobias Kieslich +Ruy Adorno +Stefania Sharp +Pawel Golda +Steven Scott +Alex Gilbert +Siyuan Gao +Nicola Del Gobbo +Josh Lim +Feon Sua +Shawn McGinty +Jason Walton +Jonathan Gourlay +Peter Paugh +Gregor Martynus +Joel Dart +Tri Nguyen +Kasim Doctor +Steve Jenkins +AlexeyM +Nicolas Chaulet +Adarsh Honawad +Tim Ermilov +ekulnivek +Ethan Brown +Lewis Zhang +Kat Rosario +jpaulptr +Donovan Buck +Toby Farley +Suresh Srinivas +Alberto Lopez de Lara +Jem Bezooyen +Bob Clewell +Raj Parekh +Tom Boutell +Cristian Peñarrieta +Christian Murphy +Dolapo Toki +Shaopeng Zhang +Matthew Meyer +Chad Zezula +Eric Freiberg +Mabry Cervin +shaohui.liu2000@gmail.com +Chi-chi Wang +Roger Jiang +Cheyenne Arrowsmith +Tim Chon +Michael Pal +Fadi Asfour +Christina Chan +Alessandro Vergani +Ali Groening +Mike Fleming +WeiPlanet +243083df <243083df@dispostable.com> +Komivi Agbakpem +Tyler Seabrook +Bear Trickey +NiveditN +Shaun Sweet +James Nimlos +Kim Gentes +Vladimir Ilic +Randal Hanford +Jean-Baptiste Brossard +Orta +Ben Hallion +twk-b +Lam Chan +Jenna Zeigen +Lukas +tejbirsingh +Hendrik Schwalm +Jeremy Huang +Michael Rueppel +David8472 +Luke Childs +Robert Nagy +Nikki St Onge +zhangzifa +hwaisiu +Thomas Karsten +Lance Barlaan +Alvaro Cruz +Jean-Philippe Blais +Oscar Funes +Kanika Shah +Jack Wang +Braden Whitten +Omar Gonzalez +Supamic +Nikhil Komawar +Daniel Abrão +elisa lee +mog422 +André Føyn Berge +Tom Purcell +Tomoki Okahana +Aayush Ahuja +Paul Marion Camantigue +Jayson D. Henkel +Nicolas 'Pixel' Noble +Ashish Kaila +c0b <14798161+c0b@users.noreply.github.com> +Damian +Alec Perkins +Teppei Sato +Jinwoo Lee +Peter Marton +Erwin W. Ramadhan +Mark Walker +sharkfisher +nhoel +Hadis-Fard +Scott J Beck +Raphael Rheault +Iryna Yaremtso +Casie Lynch +Matthew Cantelon +Ben Halverson +cPhost <23620441+cPhost@users.noreply.github.com> +dicearr +Lucas Azzola +Ken Takagi +Ed Schouten +Andrew Stucki +Anthony Nandaa +Mithun Sasidharan +Mattias Holmlund +Mark S. Everitt +Alexey Kuzmin +gowpen <33104741+gowpen@users.noreply.github.com> +Adam Wegrzynek +Sascha Tandel +Patrick Heneise +Dumitru Glavan +Giovanni Lela +Matthias Reis +John Byrne +Octavian Ionescu +Kevin Yu +Jimi van der Woning +Dara Hayes +Maring, Damian Lion +Attila Gonda +Brian O'Connell +Sean Karson +Nicolas Morel +fjau +SonaySevik +jonask +Delapouite +Mark McNelis +mbornath +Andres Kalle +Paul Blanche +Vipin Menon +woj +Adam Jeffery +Paul Ashfield +Katie Stockton Roberts +Mamatha J V +Neil Vass +Vidya Subramanyam +Swathi Kalahastri +Tanvi Kini +Sabari Lakshmi Krishnamoorthy +Kabir Islam +subrahmanya chari p +Suryanarayana Murthy N +Chandrakala +Jayashree S Kumar +Nayana Das K +Anawesha Khuntia +Maton Anthony +saiHemak +Deepthi Sebastian +Pawan Jangid +Stephan Smith +joelostrowski +Javier Blanco +Cyril Lakech <1169286+clakech@users.noreply.github.com> +Grant Gasparyan +Klemen Kogovsek +Gus Caplan +ka3e +ChrBergert +sercan yersen +Steve Kinney +Sebastian Mayr +Vijayalakshmi Kannan +Benjamin Zaslavsky # Generated by tools/update-authors.sh From 36281f400316f24087afef2cdaa5f7c65aa89676 Mon Sep 17 00:00:00 2001 From: Xavier Balloy Date: Tue, 21 Nov 2017 13:42:38 +0100 Subject: [PATCH 097/379] test: remove unused parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17188 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- test/sequential/test-async-wrap-getasyncid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index 3c82421706eebb..d6a7085d8907d2 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -173,7 +173,7 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check const tcp_wrap = process.binding('tcp_wrap'); const server = net.createServer(common.mustCall((socket) => { server.close(); - socket.on('data', (x) => { + socket.on('data', () => { socket.end(); socket.destroy(); }); From a08bcaeca9206c42cd3d0a611c2cca3a49eb6271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Descamps?= Date: Tue, 21 Nov 2017 13:21:18 +0100 Subject: [PATCH 098/379] test: remove unused parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17184 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/sequential/test-readline-interface.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/sequential/test-readline-interface.js b/test/sequential/test-readline-interface.js index 1e64d0aa934974..5c1a0e08a13ae7 100644 --- a/test/sequential/test-readline-interface.js +++ b/test/sequential/test-readline-interface.js @@ -97,9 +97,7 @@ FakeInput.prototype.end = () => {}; crlfDelay }); let callCount = 0; - rli.on('line', function(line) { - callCount++; - }); + rli.on('line', () => callCount++); fi.emit('data', '\r'); setTimeout(common.mustCall(() => { fi.emit('data', '\n'); From 2e311266f79401e4e10d145fb3a99b83e6925fcf Mon Sep 17 00:00:00 2001 From: Guillaume Flandre Date: Tue, 21 Nov 2017 13:20:43 +0100 Subject: [PATCH 099/379] test: remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17187 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/sequential/test-timers-block-eventloop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-timers-block-eventloop.js b/test/sequential/test-timers-block-eventloop.js index 78ecc9e31746f5..f6426e454e0882 100644 --- a/test/sequential/test-timers-block-eventloop.js +++ b/test/sequential/test-timers-block-eventloop.js @@ -16,7 +16,7 @@ const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), platformTimeout(200)); setTimeout(function() { - fs.stat('/dev/nonexistent', (err, stats) => { + fs.stat('/dev/nonexistent', () => { clearInterval(t1); clearInterval(t2); clearTimeout(t3); From 7812c93a41020a293ce6f4bdaf74126c83f59567 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 19 Nov 2017 14:35:59 +0100 Subject: [PATCH 100/379] deps: cherry-pick c690f54d95802 from V8 upstream Original commit message: [platform] Add TaskRunner to the platform API With the existing platform API it is not possible to post foreground tasks from background tasks. This is, however, required to implement asynchronous compilation for WebAssembly. With this CL we add the concept of a TaskRunner to the platform API. The TaskRunner contains all data needed to post a foreground task and can be used both from a foreground task and a background task. Eventually the TaskRunner should replace the existing API. In addition, this CL contains a default implementation of the TaskRunner. This implementation has tempory workaround for platforms which do not provide a TaskRunner implementation yet. This default implementation should be deleted again when all platforms provide a TaskRunner implementation. R=rmcilroy@chromium.org Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I6ea4a1c9da1eb9a19e8ce8f2163000dbc2598802 Reviewed-on: https://chromium-review.googlesource.com/741588 Commit-Queue: Andreas Haas Reviewed-by: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#49041} Refs: https://github.com/v8/v8/commit/c690f54d9580243c53f7d892fcff1ce6bae4bfc0 PR-URL: https://github.com/nodejs/node/pull/17134 Fixes: https://github.com/nodejs/node-v8/issues/24 Reviewed-By: Franziska Hinkelmann Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- deps/v8/include/v8-platform.h | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index ed2acc3a74e16c..b1a57c9e2c18a5 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -36,6 +36,51 @@ class IdleTask { virtual void Run(double deadline_in_seconds) = 0; }; +/** + * A TaskRunner allows scheduling of tasks. The TaskRunner may still be used to + * post tasks after the isolate gets destructed, but these tasks may not get + * executed anymore. All tasks posted to a given TaskRunner will be invoked in + * sequence. Tasks can be posted from any thread. + */ +class TaskRunner { + public: + /** + * Schedules a task to be invoked by this TaskRunner. The TaskRunner + * implementation takes ownership of |task|. + */ + virtual void PostTask(std::unique_ptr task) = 0; + + /** + * Schedules a task to be invoked by this TaskRunner. The task is scheduled + * after the given number of seconds |delay_in_seconds|. The TaskRunner + * implementation takes ownership of |task|. + */ + virtual void PostDelayedTask(std::unique_ptr task, + double delay_in_seconds) = 0; + + /** + * Schedules an idle task to be invoked by this TaskRunner. The task is + * scheduled when the embedder is idle. Requires that + * TaskRunner::SupportsIdleTasks(isolate) is true. Idle tasks may be reordered + * relative to other task types and may be starved for an arbitrarily long + * time if no idle time is available. The TaskRunner implementation takes + * ownership of |task|. + */ + virtual void PostIdleTask(std::unique_ptr task) = 0; + + /** + * Returns true if idle tasks are enabled for this TaskRunner. + */ + virtual bool IdleTasksEnabled() = 0; + + TaskRunner() = default; + virtual ~TaskRunner() = default; + + private: + TaskRunner(const TaskRunner&) = delete; + TaskRunner& operator=(const TaskRunner&) = delete; +}; + /** * The interface represents complex arguments to trace events. */ @@ -150,6 +195,28 @@ class Platform { */ virtual size_t NumberOfAvailableBackgroundThreads() { return 0; } + /** + * Returns a TaskRunner which can be used to post a task on the foreground. + * This function should only be called from a foreground thread. + */ + virtual std::unique_ptr GetForegroundTaskRunner( + Isolate* isolate) { + // TODO(ahaas): Make this function abstract after it got implemented on all + // platforms. + return {}; + } + + /** + * Returns a TaskRunner which can be used to post a task on a background. + * This function should only be called from a foreground thread. + */ + virtual std::unique_ptr GetBackgroundTaskRunner( + Isolate* isolate) { + // TODO(ahaas): Make this function abstract after it got implemented on all + // platforms. + return {}; + } + /** * Schedules a task to be invoked on a background thread. |expected_runtime| * indicates that the task will run a long time. The Platform implementation From 04115724dc79bba5d4b250a306ff6b92b367c515 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 19 Nov 2017 15:02:51 +0100 Subject: [PATCH 101/379] deps: cherry-pick 98c40a4bae915 from V8 upstream Original commit message: [platform] Return task runners as shared_ptr At the moment, task runners are returned as unique_ptr. This is inconvenient, however. In all implementations I did, the platform holds a shared pointer of the task runner and wraps it in a wrapper class just to return it as a unique_ptr. With this CL the platform API is changed to return a shared_ptr directly. R=rmcilroy@chromium.org Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: Ide278db855199ea239ad0ae14d97fd17349dac8c Reviewed-on: https://chromium-review.googlesource.com/768867 Commit-Queue: Andreas Haas Reviewed-by: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#49366} Refs: https://github.com/v8/v8/commit/98c40a4bae915a9762c73de3307300c61e4fd91a PR-URL: https://github.com/nodejs/node/pull/17134 Fixes: https://github.com/nodejs/node-v8/issues/24 Reviewed-By: Franziska Hinkelmann Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- deps/v8/include/v8-platform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index b1a57c9e2c18a5..6c3c4292c5c3c8 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -199,7 +199,7 @@ class Platform { * Returns a TaskRunner which can be used to post a task on the foreground. * This function should only be called from a foreground thread. */ - virtual std::unique_ptr GetForegroundTaskRunner( + virtual std::shared_ptr GetForegroundTaskRunner( Isolate* isolate) { // TODO(ahaas): Make this function abstract after it got implemented on all // platforms. @@ -210,7 +210,7 @@ class Platform { * Returns a TaskRunner which can be used to post a task on a background. * This function should only be called from a foreground thread. */ - virtual std::unique_ptr GetBackgroundTaskRunner( + virtual std::shared_ptr GetBackgroundTaskRunner( Isolate* isolate) { // TODO(ahaas): Make this function abstract after it got implemented on all // platforms. From 936c0b2b839537e3c5972be0b512df2ec1ca0394 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 19 Nov 2017 14:29:08 +0100 Subject: [PATCH 102/379] src: implement v8::TaskRunner API in NodePlatform V8 is switching APIs for scheduling tasks. Implement the new APIs. Fixes: https://github.com/nodejs/node-v8/issues/24 Refs: https://github.com/v8/v8/commit/c690f54d9580243c53f7d892fcff1ce6bae4bfc0 PR-URL: https://github.com/nodejs/node/pull/17134 Fixes: https://github.com/nodejs/node-v8/issues/24 Reviewed-By: Franziska Hinkelmann Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- src/node_platform.cc | 115 ++++++++++++++++++++++++++++++------------- src/node_platform.h | 48 ++++++++++++++---- 2 files changed, 119 insertions(+), 44 deletions(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 0c50e8468d0f44..65d1ef6c5dfe28 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -24,6 +24,43 @@ static void BackgroundRunner(void* data) { } } +BackgroundTaskRunner::BackgroundTaskRunner(int thread_pool_size) { + for (int i = 0; i < thread_pool_size; i++) { + std::unique_ptr t { new uv_thread_t() }; + if (uv_thread_create(t.get(), BackgroundRunner, &background_tasks_) != 0) + break; + threads_.push_back(std::move(t)); + } +} + +void BackgroundTaskRunner::PostTask(std::unique_ptr task) { + background_tasks_.Push(std::move(task)); +} + +void BackgroundTaskRunner::PostIdleTask(std::unique_ptr task) { + UNREACHABLE(); +} + +void BackgroundTaskRunner::PostDelayedTask(std::unique_ptr task, + double delay_in_seconds) { + UNREACHABLE(); +} + +void BackgroundTaskRunner::BlockingDrain() { + background_tasks_.BlockingDrain(); +} + +void BackgroundTaskRunner::Shutdown() { + background_tasks_.Stop(); + for (size_t i = 0; i < threads_.size(); i++) { + CHECK_EQ(0, uv_thread_join(threads_[i].get())); + } +} + +size_t BackgroundTaskRunner::NumberOfAvailableBackgroundThreads() const { + return threads_.size(); +} + PerIsolatePlatformData::PerIsolatePlatformData( v8::Isolate* isolate, uv_loop_t* loop) : isolate_(isolate), loop_(loop) { @@ -38,17 +75,20 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { platform_data->FlushForegroundTasksInternal(); } -void PerIsolatePlatformData::CallOnForegroundThread( - std::unique_ptr task) { +void PerIsolatePlatformData::PostIdleTask(std::unique_ptr task) { + UNREACHABLE(); +} + +void PerIsolatePlatformData::PostTask(std::unique_ptr task) { foreground_tasks_.Push(std::move(task)); uv_async_send(flush_tasks_); } -void PerIsolatePlatformData::CallDelayedOnForegroundThread( - std::unique_ptr task, double delay_in_seconds) { +void PerIsolatePlatformData::PostDelayedTask( + std::unique_ptr task, double delay_in_seconds) { std::unique_ptr delayed(new DelayedTask()); delayed->task = std::move(task); - delayed->platform_data = this; + delayed->platform_data = shared_from_this(); delayed->timeout = delay_in_seconds; foreground_delayed_tasks_.Push(std::move(delayed)); uv_async_send(flush_tasks_); @@ -80,49 +120,43 @@ NodePlatform::NodePlatform(int thread_pool_size, TracingController* controller = new TracingController(); tracing_controller_.reset(controller); } - for (int i = 0; i < thread_pool_size; i++) { - uv_thread_t* t = new uv_thread_t(); - if (uv_thread_create(t, BackgroundRunner, &background_tasks_) != 0) { - delete t; - break; - } - threads_.push_back(std::unique_ptr(t)); - } + background_task_runner_ = + std::make_shared(thread_pool_size); } void NodePlatform::RegisterIsolate(IsolateData* isolate_data, uv_loop_t* loop) { Isolate* isolate = isolate_data->isolate(); Mutex::ScopedLock lock(per_isolate_mutex_); - PerIsolatePlatformData* existing = per_isolate_[isolate]; - if (existing != nullptr) + std::shared_ptr existing = per_isolate_[isolate]; + if (existing) { existing->ref(); - else - per_isolate_[isolate] = new PerIsolatePlatformData(isolate, loop); + } else { + per_isolate_[isolate] = + std::make_shared(isolate, loop); + } } void NodePlatform::UnregisterIsolate(IsolateData* isolate_data) { Isolate* isolate = isolate_data->isolate(); Mutex::ScopedLock lock(per_isolate_mutex_); - PerIsolatePlatformData* existing = per_isolate_[isolate]; - CHECK_NE(existing, nullptr); + std::shared_ptr existing = per_isolate_[isolate]; + CHECK(existing); if (existing->unref() == 0) { - delete existing; per_isolate_.erase(isolate); } } void NodePlatform::Shutdown() { - background_tasks_.Stop(); - for (size_t i = 0; i < threads_.size(); i++) { - CHECK_EQ(0, uv_thread_join(threads_[i].get())); + background_task_runner_->Shutdown(); + + { + Mutex::ScopedLock lock(per_isolate_mutex_); + per_isolate_.clear(); } - Mutex::ScopedLock lock(per_isolate_mutex_); - for (const auto& pair : per_isolate_) - delete pair.second; } size_t NodePlatform::NumberOfAvailableBackgroundThreads() { - return threads_.size(); + return background_task_runner_->NumberOfAvailableBackgroundThreads(); } void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr task) { @@ -155,14 +189,14 @@ void PerIsolatePlatformData::CancelPendingDelayedTasks() { } void NodePlatform::DrainBackgroundTasks(Isolate* isolate) { - PerIsolatePlatformData* per_isolate = ForIsolate(isolate); + std::shared_ptr per_isolate = ForIsolate(isolate); do { // Right now, there is no way to drain only background tasks associated // with a specific isolate, so this sometimes does more work than // necessary. In the long run, that functionality is probably going to // be available anyway, though. - background_tasks_.BlockingDrain(); + background_task_runner_->BlockingDrain(); } while (per_isolate->FlushForegroundTasksInternal()); } @@ -198,24 +232,25 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { void NodePlatform::CallOnBackgroundThread(Task* task, ExpectedRuntime expected_runtime) { - background_tasks_.Push(std::unique_ptr(task)); + background_task_runner_->PostTask(std::unique_ptr(task)); } -PerIsolatePlatformData* NodePlatform::ForIsolate(Isolate* isolate) { +std::shared_ptr +NodePlatform::ForIsolate(Isolate* isolate) { Mutex::ScopedLock lock(per_isolate_mutex_); - PerIsolatePlatformData* data = per_isolate_[isolate]; - CHECK_NE(data, nullptr); + std::shared_ptr data = per_isolate_[isolate]; + CHECK(data); return data; } void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) { - ForIsolate(isolate)->CallOnForegroundThread(std::unique_ptr(task)); + ForIsolate(isolate)->PostTask(std::unique_ptr(task)); } void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate, Task* task, double delay_in_seconds) { - ForIsolate(isolate)->CallDelayedOnForegroundThread( + ForIsolate(isolate)->PostDelayedTask( std::unique_ptr(task), delay_in_seconds); } @@ -229,6 +264,16 @@ void NodePlatform::CancelPendingDelayedTasks(v8::Isolate* isolate) { bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return false; } +std::shared_ptr +NodePlatform::GetBackgroundTaskRunner(Isolate* isolate) { + return background_task_runner_; +} + +std::shared_ptr +NodePlatform::GetForegroundTaskRunner(Isolate* isolate) { + return ForIsolate(isolate); +} + double NodePlatform::MonotonicallyIncreasingTime() { // Convert nanos to seconds. return uv_hrtime() / 1e9; diff --git a/src/node_platform.h b/src/node_platform.h index 48301a05a11d8c..e5253cac10c3b0 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -43,17 +43,22 @@ struct DelayedTask { std::unique_ptr task; uv_timer_t timer; double timeout; - PerIsolatePlatformData* platform_data; + std::shared_ptr platform_data; }; -class PerIsolatePlatformData { +// This acts as the foreground task runner for a given Isolate. +class PerIsolatePlatformData : + public v8::TaskRunner, + public std::enable_shared_from_this { public: PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); ~PerIsolatePlatformData(); - void CallOnForegroundThread(std::unique_ptr task); - void CallDelayedOnForegroundThread(std::unique_ptr task, - double delay_in_seconds); + void PostTask(std::unique_ptr task) override; + void PostIdleTask(std::unique_ptr task) override; + void PostDelayedTask(std::unique_ptr task, + double delay_in_seconds) override; + bool IdleTasksEnabled() override { return false; }; void Shutdown(); @@ -84,6 +89,26 @@ class PerIsolatePlatformData { std::vector scheduled_delayed_tasks_; }; +// This acts as the single background task runner for all Isolates. +class BackgroundTaskRunner : public v8::TaskRunner { + public: + explicit BackgroundTaskRunner(int thread_pool_size); + + void PostTask(std::unique_ptr task) override; + void PostIdleTask(std::unique_ptr task) override; + void PostDelayedTask(std::unique_ptr task, + double delay_in_seconds) override; + bool IdleTasksEnabled() override { return false; }; + + void BlockingDrain(); + void Shutdown(); + + size_t NumberOfAvailableBackgroundThreads() const; + private: + TaskQueue background_tasks_; + std::vector> threads_; +}; + class NodePlatform : public MultiIsolatePlatform { public: NodePlatform(int thread_pool_size, v8::TracingController* tracing_controller); @@ -109,15 +134,20 @@ class NodePlatform : public MultiIsolatePlatform { void RegisterIsolate(IsolateData* isolate_data, uv_loop_t* loop) override; void UnregisterIsolate(IsolateData* isolate_data) override; + std::shared_ptr GetBackgroundTaskRunner( + v8::Isolate* isolate) override; + std::shared_ptr GetForegroundTaskRunner( + v8::Isolate* isolate) override; + private: - PerIsolatePlatformData* ForIsolate(v8::Isolate* isolate); + std::shared_ptr ForIsolate(v8::Isolate* isolate); Mutex per_isolate_mutex_; - std::unordered_map per_isolate_; - TaskQueue background_tasks_; - std::vector> threads_; + std::unordered_map> per_isolate_; std::unique_ptr tracing_controller_; + std::shared_ptr background_task_runner_; }; } // namespace node From c2b30a99b711df9efd849b5dafb698872ec33957 Mon Sep 17 00:00:00 2001 From: Pierre-Loic Doulcet Date: Tue, 21 Nov 2017 13:24:21 +0100 Subject: [PATCH 103/379] test: remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused variable err in test/sequential/test-http-writable-true-after-close.js PR-URL: https://github.com/nodejs/node/pull/17186 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Alexey Orlenko --- test/sequential/test-http-writable-true-after-close.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-http-writable-true-after-close.js b/test/sequential/test-http-writable-true-after-close.js index 49688a00ef57a9..d0972673fb95e7 100644 --- a/test/sequential/test-http-writable-true-after-close.js +++ b/test/sequential/test-http-writable-true-after-close.js @@ -34,7 +34,7 @@ const server = createServer(common.mustCall((req, res) => { })); }).listen(0, () => { external = get(`http://127.0.0.1:${server.address().port}`); - external.on('error', common.mustCall((err) => { + external.on('error', common.mustCall(() => { server.close(); internal.close(); })); From 2bbc1f070d058762edeae17648dfa3cdada7e77e Mon Sep 17 00:00:00 2001 From: Fran Herrero Date: Tue, 21 Nov 2017 13:55:39 +0100 Subject: [PATCH 104/379] test: remove unused parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17193 Reviewed-By: Anatoli Papirovski Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell Reviewed-By: Alexey Orlenko --- test/sequential/test-inspector-stops-no-file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-inspector-stops-no-file.js b/test/sequential/test-inspector-stops-no-file.js index 772063b279f5af..9ec09fb15d93b4 100644 --- a/test/sequential/test-inspector-stops-no-file.js +++ b/test/sequential/test-inspector-stops-no-file.js @@ -7,7 +7,7 @@ const child = spawn(process.execPath, [ '--inspect', 'no-such-script.js' ], { 'stdio': 'inherit' }); -function signalHandler(value) { +function signalHandler() { child.kill(); process.exit(1); } From b16d570395656b92450a5f9f9568292b3abe8264 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Tue, 21 Nov 2017 08:46:13 -0500 Subject: [PATCH 105/379] benchmark: set maxHeaderListPairs in h2 headers.js PR-URL: https://github.com/nodejs/node/pull/17194 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- benchmark/http2/headers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmark/http2/headers.js b/benchmark/http2/headers.js index 62156774caa49d..3c8d0465acb0d0 100644 --- a/benchmark/http2/headers.js +++ b/benchmark/http2/headers.js @@ -13,7 +13,9 @@ function main(conf) { const n = +conf.n; const nheaders = +conf.nheaders; const http2 = require('http2'); - const server = http2.createServer(); + const server = http2.createServer({ + maxHeaderListPairs: 20000 + }); const headersObject = { ':path': '/', @@ -34,7 +36,9 @@ function main(conf) { stream.end('Hi!'); }); server.listen(PORT, () => { - const client = http2.connect(`http://localhost:${PORT}/`); + const client = http2.connect(`http://localhost:${PORT}/`, { + maxHeaderListPairs: 20000 + }); function doRequest(remaining) { const req = client.request(headersObject); From 9c0c33625a372ad0c53f0090c9bf0eb805f7564a Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Tue, 21 Nov 2017 04:40:35 +0200 Subject: [PATCH 106/379] src: remove unprofessional slang in assertions Convert `CHECK(0 && "wtf?")` (sic) assertions to more suitable `UNREACHABLE()` macro invocations in `node_zlib.cc`. PR-URL: https://github.com/nodejs/node/pull/17166 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius Reviewed-By: Anatoli Papirovski --- src/node_zlib.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 975fbf0f8f5ee8..a614cdbe01da03 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -322,7 +322,7 @@ class ZCtx : public AsyncWrap { } break; default: - CHECK(0 && "wtf?"); + UNREACHABLE(); } // pass any errors back to the main thread to deal with. @@ -550,7 +550,7 @@ class ZCtx : public AsyncWrap { ->AdjustAmountOfExternalAllocatedMemory(kInflateContextSize); break; default: - CHECK(0 && "wtf?"); + UNREACHABLE(); } ctx->dictionary_ = reinterpret_cast(dictionary); From caff930d47eb722096634b3d074bfb0afce867b1 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 18 Nov 2017 01:39:02 -0500 Subject: [PATCH 107/379] module: replace default paths in require.resolve() Prior to this commit, the default search paths would be included in the require.resolve() process, even if user specified paths were provided. This commit causes the default paths to be omitted by using a fake parent module. Refs: https://github.com/nodejs/node/issues/5963 PR-URL: https://github.com/nodejs/node/pull/17113 Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- lib/module.js | 5 ++++- .../default/node_modules/dep/index.js | 0 .../resolve-paths/default/verify-paths.js | 21 +++++++++++++++++++ .../defined/node_modules/dep/index.js | 0 test/parallel/test-require-resolve.js | 1 + 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/resolve-paths/default/node_modules/dep/index.js create mode 100644 test/fixtures/resolve-paths/default/verify-paths.js create mode 100644 test/fixtures/resolve-paths/defined/node_modules/dep/index.js diff --git a/lib/module.js b/lib/module.js index e418a1a3e08440..0f63fe9a2ca2f5 100644 --- a/lib/module.js +++ b/lib/module.js @@ -518,11 +518,14 @@ Module._resolveFilename = function(request, parent, isMain, options) { if (typeof options === 'object' && options !== null && Array.isArray(options.paths)) { + const fakeParent = new Module('', null); + paths = []; for (var i = 0; i < options.paths.length; i++) { const path = options.paths[i]; - const lookupPaths = Module._resolveLookupPaths(path, parent, true); + fakeParent.paths = Module._nodeModulePaths(path); + const lookupPaths = Module._resolveLookupPaths(request, fakeParent, true); if (!paths.includes(path)) paths.push(path); diff --git a/test/fixtures/resolve-paths/default/node_modules/dep/index.js b/test/fixtures/resolve-paths/default/node_modules/dep/index.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/fixtures/resolve-paths/default/verify-paths.js b/test/fixtures/resolve-paths/default/verify-paths.js new file mode 100644 index 00000000000000..dee03fbfe3b6b4 --- /dev/null +++ b/test/fixtures/resolve-paths/default/verify-paths.js @@ -0,0 +1,21 @@ +'use strict'; +require('../../../common'); +const assert = require('assert'); +const path = require('path'); + +// By default, resolving 'dep' should return +// fixturesDir/resolve-paths/default/node_modules/dep/index.js. By setting +// the path to fixturesDir/resolve-paths/default, the 'default' directory +// structure should be ignored. + +assert.strictEqual( + require.resolve('dep'), + path.join(__dirname, 'node_modules', 'dep', 'index.js') +); + +const paths = [path.resolve(__dirname, '..', 'defined')]; + +assert.strictEqual( + require.resolve('dep', { paths }), + path.join(paths[0], 'node_modules', 'dep', 'index.js') +); diff --git a/test/fixtures/resolve-paths/defined/node_modules/dep/index.js b/test/fixtures/resolve-paths/defined/node_modules/dep/index.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index 6f2253a4e27083..4fbf697faf51b6 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -37,3 +37,4 @@ assert.strictEqual('path', require.resolve('path')); // Test configurable resolve() paths. require(fixtures.path('require-resolve.js')); +require(fixtures.path('resolve-paths', 'default', 'verify-paths.js')); From b2c10cad517c42876393c54a390bb73f30cd6ec4 Mon Sep 17 00:00:00 2001 From: Francois KY Date: Tue, 21 Nov 2017 13:09:12 +0100 Subject: [PATCH 108/379] test: remove unused parameter in test-next-tick-error-spin.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17185 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- test/sequential/test-next-tick-error-spin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-next-tick-error-spin.js b/test/sequential/test-next-tick-error-spin.js index dc3a3a115d3b99..8bc323510a4da6 100644 --- a/test/sequential/test-next-tick-error-spin.js +++ b/test/sequential/test-next-tick-error-spin.js @@ -42,7 +42,7 @@ if (process.argv[2] !== 'child') { process.maxTickDepth = 10; // in the error handler, we trigger several MakeCallback events - d.on('error', function(e) { + d.on('error', function() { console.log('a'); console.log('b'); console.log('c'); From 0b128842f69208b76f9d7be26d3e849502fe69fd Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 21 Nov 2017 10:34:59 -0500 Subject: [PATCH 109/379] src: fix compiler warning This commit fixes a -Winconsistent-missing-override warning. PR-URL: https://github.com/nodejs/node/pull/17195 Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- src/node_http2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_http2.h b/src/node_http2.h index f375a249b803b8..e4b6226e82f659 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -555,7 +555,7 @@ class Http2Stream : public AsyncWrap, int ReadStop() override; // Required for StreamBase - int DoShutdown(ShutdownWrap* req_wrap); + int DoShutdown(ShutdownWrap* req_wrap) override; // Initiate a response on this stream. inline int SubmitResponse(nghttp2_nv* nva, From 417e7d1ac2f6ec7446914575c3426f664674be45 Mon Sep 17 00:00:00 2001 From: suman-mitra Date: Tue, 21 Nov 2017 12:28:47 +0530 Subject: [PATCH 110/379] test: wrap callback in common.mustCall PR-URL: https://github.com/nodejs/node/pull/17173 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-cluster-message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js index 48bd7ee36ad0ad..5585a64d48149d 100644 --- a/test/parallel/test-cluster-message.js +++ b/test/parallel/test-cluster-message.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); @@ -132,9 +132,9 @@ if (cluster.isWorker) { worker.kill(); }); - worker.on('exit', function() { + worker.on('exit', common.mustCall(function() { process.exit(0); - }); + })); }); process.once('exit', function() { From 3f363d3cdacafda557d54b1d1ad115bd099774c1 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Tue, 21 Nov 2017 19:52:28 +0200 Subject: [PATCH 111/379] doc: add guybedford to collaborators PR-URL: https://github.com/nodejs/node/pull/17197 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Evan Lucas Reviewed-By: Refael Ackermann Reviewed-By: Timothy Gu Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fd1051d3d53f07..10982232a2a93c 100644 --- a/README.md +++ b/README.md @@ -366,6 +366,8 @@ For more information about the governance of the Node.js project, see **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) * [gireeshpunathil](https://github.com/gireeshpunathil) - **Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) +* [guybedford](https://github.com/guybedford) - +**Guy Bedford** <guybedford@gmail.com> (he/him) * [hashseed](https://github.com/hashseed) - **Yang Guo** <yangguo@chromium.org> (he/him) * [iarna](https://github.com/iarna) - From c2bb4b211e5137eeb8e428b5008907c5acbe9852 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 12 Nov 2017 15:10:22 -0500 Subject: [PATCH 112/379] test: bypass dns for IPv6 net tests PR-URL: https://github.com/nodejs/node/pull/16976 Refs: https://github.com/nodejs/node/pull/16248 Reviewed-By: Joyee Cheung --- .../test-https-connect-address-family.js | 32 ++++------ .../parallel/test-net-connect-options-ipv6.js | 64 ++++++------------- 2 files changed, 35 insertions(+), 61 deletions(-) diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index 28d47b3a967424..8b3584b3396551 100644 --- a/test/parallel/test-https-connect-address-family.js +++ b/test/parallel/test-https-connect-address-family.js @@ -1,4 +1,7 @@ 'use strict'; + +// Test that the family option of https.get is honored. + const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); @@ -9,21 +12,28 @@ if (!common.hasIPv6) const assert = require('assert'); const fixtures = require('../common/fixtures'); const https = require('https'); -const dns = require('dns'); -function runTest() { +{ + // Test that `https` machinery passes host name, and receives IP. + const hostAddrIPv6 = '::1'; + const HOSTNAME = 'dummy'; https.createServer({ cert: fixtures.readKey('agent1-cert.pem'), key: fixtures.readKey('agent1-key.pem'), }, common.mustCall(function(req, res) { this.close(); res.end(); - })).listen(0, '::1', common.mustCall(function() { + })).listen(0, hostAddrIPv6, common.mustCall(function() { const options = { - host: 'localhost', + host: HOSTNAME, port: this.address().port, family: 6, rejectUnauthorized: false, + lookup: common.mustCall((addr, opt, cb) => { + assert.strictEqual(addr, HOSTNAME); + assert.strictEqual(opt.family, 6); + cb(null, hostAddrIPv6, opt.family); + }) }; // Will fail with ECONNREFUSED if the address family is not honored. https.get(options, common.mustCall(function() { @@ -32,17 +42,3 @@ function runTest() { })); })); } - -dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { - if (err) { - if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN') - common.skip('localhost does not resolve to ::1'); - - throw err; - } - - if (addresses.some((val) => val.address === '::1')) - runTest(); - else - common.skip('localhost does not resolve to ::1'); -}); diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index aba07d9fcc8094..13381074ba46b7 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -19,6 +19,8 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +// Test that the family option of net.connect is honored. + 'use strict'; const common = require('../common'); if (!common.hasIPv6) @@ -27,63 +29,39 @@ if (!common.hasIPv6) const assert = require('assert'); const net = require('net'); -const hosts = common.localIPv6Hosts; -let hostIdx = 0; -let host = hosts[hostIdx]; -let localhostTries = 10; +const hostAddrIPv6 = '::1'; +const HOSTNAME = 'dummy'; -const server = net.createServer({ allowHalfOpen: true }, function(socket) { +const server = net.createServer({ allowHalfOpen: true }, (socket) => { socket.resume(); socket.on('end', common.mustCall()); socket.end(); }); -server.listen(0, '::1', tryConnect); - function tryConnect() { - const client = net.connect({ - host: host, + const connectOpt = { + host: HOSTNAME, port: server.address().port, family: 6, - allowHalfOpen: true - }, function() { - console.error('client connect cb'); + allowHalfOpen: true, + lookup: common.mustCall((addr, opt, cb) => { + assert.strictEqual(addr, HOSTNAME); + assert.strictEqual(opt.family, 6); + cb(null, hostAddrIPv6, opt.family); + }) + }; + // No `mustCall`, since test could skip, and it's the only path to `close`. + const client = net.connect(connectOpt, () => { client.resume(); - client.on('end', common.mustCall(function() { + client.on('end', () => { + // Wait for next uv tick and make sure the socket stream is writable. setTimeout(function() { assert(client.writable); client.end(); }, 10); - })); - client.on('close', function() { - server.close(); }); - }).on('error', function(err) { - // ENOTFOUND means we don't have the requested address. In this - // case we try the next one in the list and if we run out of - // candidates we assume IPv6 is not supported on the - // machine and skip the test. - // EAI_AGAIN means we tried to remotely resolve the address and - // timed out or hit some intermittent connectivity issue with the - // dns server. Although we are looking for local loopback addresses - // we may go remote since the list we search includes addresses that - // cover more than is available on any one distribution. The - // net is that if we get an EAI_AGAIN we were looking for an - // address which does not exist in this distribution so the error - // is not significant and we should just move on and try the - // next address in the list. - if ((err.syscall === 'getaddrinfo') && ((err.code === 'ENOTFOUND') || - (err.code === 'EAI_AGAIN'))) { - if (host !== 'localhost' || --localhostTries === 0) - host = hosts[++hostIdx]; - if (host) - tryConnect(); - else { - server.close(); - common.skip('no IPv6 localhost support'); - } - return; - } - throw err; + client.on('close', () => server.close()); }); } + +server.listen(0, hostAddrIPv6, tryConnect); From ef4c909335f7f3301c3217589c4d48149e73bcd4 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Sun, 19 Nov 2017 08:09:30 -0800 Subject: [PATCH 113/379] doc: update release table in V8 guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17136 Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- doc/guides/maintaining-V8.md | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md index 73ba14bf53acc5..350ecd0c72f61e 100644 --- a/doc/guides/maintaining-V8.md +++ b/doc/guides/maintaining-V8.md @@ -59,11 +59,11 @@ includes the following branches1: - Node.js v4.x + Node.js 4.x 2015-10-01 - 2018-04-01 + April 2018 4.5 @@ -73,11 +73,11 @@ includes the following branches1: - Node.js v6.x + Node.js 6.x 2016-04-01 - 2019-04-01 + April 2019 5.1 @@ -87,17 +87,31 @@ includes the following branches1: - Node.js v7.x + Node.js 8.x - 2016-10-01 + 2017-05-30 - 2017-04-01 + December 2019 - 5.5 + 6.1 (soon to be 6.2) - 2016-12-06 + 2017-10-17 (6.2) - 2017-01-24 + ~2017-12-05 (6.2) + + + + Node.js 9.x + + 2017-10-31 + + April 2018 + + 6.2 + + 2017-10-17 + + ~2017-12-05 @@ -107,11 +121,11 @@ includes the following branches1: N/A - 5.6 + 6.2 - 2017-01-31 + 2017-10-17 - 2017-03-07 + ~2017-12-05 From 68870161cc0b4dcd9b6792ffa920787becb0e61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Wed, 22 Nov 2017 10:05:35 +0100 Subject: [PATCH 114/379] doc: update mgol in AUTHORS.txt, add to .mailmap PR-URL: https://github.com/nodejs/node/pull/17239 Reviewed-By: Alexey Orlenko Reviewed-By: Myles Borins --- .mailmap | 1 + AUTHORS | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index e7efb4f43ab794..e5790b736e88de 100644 --- a/.mailmap +++ b/.mailmap @@ -218,6 +218,7 @@ Michael Dawson Michael Wilber Michaël Zasso Michael-Rainabba Richardson rainabba +Michał Gołębiowski-Owczarek Micheil Smith Micleusanu Nicu Miguel Angel Asencio Hurtado maasencioh diff --git a/AUTHORS b/AUTHORS index ae3d6864dfc8f9..7e48fe0aba2fa3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -791,7 +791,7 @@ Salman Aljammaz Thomas Reggi Laurent Fortin Fabio Oliveira -Michał Gołębiowski +Michał Gołębiowski-Owczarek Johann Hofmann Charles Rudolph Dave Eddy From 72e480d85ed4aa2ad5091ca00cead2884d468b53 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 20 Nov 2017 22:09:55 -0600 Subject: [PATCH 115/379] test: clean up inappropriate language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17170 Reviewed-By: Alexey Orlenko Reviewed-By: Gireesh Punathil Reviewed-By: Michaël Zasso Reviewed-By: Timothy Gu Reviewed-By: Franziska Hinkelmann Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- test/parallel/test-child-process-stdio-big-write-end.js | 2 +- test/parallel/test-process-exit-code.js | 2 +- test/parallel/test-process-raw-debug.js | 2 +- test/parallel/test-repl-syntax-error-handling.js | 2 +- test/sequential/test-net-GH-5504.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-child-process-stdio-big-write-end.js b/test/parallel/test-child-process-stdio-big-write-end.js index 2ba409b09898e4..00fc0471d235aa 100644 --- a/test/parallel/test-child-process-stdio-big-write-end.js +++ b/test/parallel/test-child-process-stdio-big-write-end.js @@ -30,7 +30,7 @@ switch (process.argv[2]) { case 'child': return child(); default: - throw new Error('wtf?'); + throw new Error('invalid'); } function parent() { diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js index 4deebb54a10784..55120f66926374 100644 --- a/test/parallel/test-process-exit-code.js +++ b/test/parallel/test-process-exit-code.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error('wtf'); + throw new Error('invalid'); } function child1() { diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 6f989e123e8916..1f1ec4c3803e2e 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -30,7 +30,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error(`wtf? ${process.argv[2]}`); + throw new Error(`invalid: ${process.argv[2]}`); } function parent() { diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index 79dd4814c57545..67bf5f6038bf63 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -29,7 +29,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error('wtf'); + throw new Error('invalid'); } function parent() { diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js index d744525710d2d5..ebe987d0443b6c 100644 --- a/test/sequential/test-net-GH-5504.js +++ b/test/sequential/test-net-GH-5504.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { case 'server': return server(); case 'client': return client(); case undefined: return parent(); - default: throw new Error('wtf'); + default: throw new Error('invalid'); } function server() { From 9832b8e206376b1c514f2e909df7217911ab7765 Mon Sep 17 00:00:00 2001 From: neta Date: Mon, 20 Nov 2017 21:41:56 +0200 Subject: [PATCH 116/379] src: add napi_handle_scope_mismatch to msg list PR-URL: https://github.com/nodejs/node/pull/17161 Reviewed-By: Timothy Gu Reviewed-By: Benjamin Gruenbaum Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Alexey Orlenko Reviewed-By: Franziska Hinkelmann --- src/node_api.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_api.cc b/src/node_api.cc index 84e57d03d6237d..59ea7635120fa8 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -901,7 +901,8 @@ const char* error_messages[] = {nullptr, "Unknown failure", "An exception is pending", "The async work item was cancelled", - "napi_escape_handle already called on scope"}; + "napi_escape_handle already called on scope", + "Invalid handle scope usage"}; static inline napi_status napi_clear_last_error(napi_env env) { env->last_error.error_code = napi_ok; @@ -932,9 +933,9 @@ napi_status napi_get_last_error_info(napi_env env, // We don't have a napi_status_last as this would result in an ABI // change each time a message was added. static_assert( - node::arraysize(error_messages) == napi_escape_called_twice + 1, + node::arraysize(error_messages) == napi_handle_scope_mismatch + 1, "Count of error messages must match count of error values"); - CHECK_LE(env->last_error.error_code, napi_escape_called_twice); + CHECK_LE(env->last_error.error_code, napi_handle_scope_mismatch); // Wait until someone requests the last error information to fetch the error // message string From 965051dc1450da83163d4db2b4953319b0ce961a Mon Sep 17 00:00:00 2001 From: Whien Date: Wed, 22 Nov 2017 16:34:04 +0800 Subject: [PATCH 117/379] test: use common.crashOnUnhandledRejection Add common.crashOnUnhandledRejection to test-microtask-queue-run-immediate.js PR-URL: https://github.com/nodejs/node/pull/17214 Reviewed-By: Myles Borins Reviewed-By: Daniel Bevenius Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-microtask-queue-run-immediate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index 4d998cf0b8a59c..1e26f4beebfbe4 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -20,9 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } From 25ff8bef18fbfa680250bb59d6f16eb0636215f2 Mon Sep 17 00:00:00 2001 From: Chiahao Lin Date: Wed, 22 Nov 2017 16:32:52 +0800 Subject: [PATCH 118/379] test: use crashOnUnhandledRejection Add common.crashOnUnhandledRejection to test-microtask-queue-integration.js PR-URL: https://github.com/nodejs/node/pull/17219 Reviewed-By: Myles Borins Reviewed-By: Daniel Bevenius Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-microtask-queue-integration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-microtask-queue-integration.js b/test/parallel/test-microtask-queue-integration.js index 57c384f8ba8177..a7241d99ee9395 100644 --- a/test/parallel/test-microtask-queue-integration.js +++ b/test/parallel/test-microtask-queue-integration.js @@ -20,9 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); +common.crashOnUnhandledRejection(); + const implementations = [ function(fn) { Promise.resolve().then(fn); From 5cfd4ea3eddce019908da0b90308b9f8679084da Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Tue, 21 Nov 2017 14:51:41 -0500 Subject: [PATCH 119/379] test: use arrow function instead of bind Using an arrow function here eliminates the need to call `bind()`. PR-URL: https://github.com/nodejs/node/pull/17202 Reviewed-By: James M Snell Reviewed-By: Evan Lucas Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Alexey Orlenko Reviewed-By: Colin Ihrig --- test/parallel/test-https-truncate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index d2a3179c0d178d..30a869c0707e44 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -67,6 +67,6 @@ const test = common.mustCall(function(res) { res.on('data', function(chunk) { bytes += chunk.length; this.pause(); - setTimeout(this.resume.bind(this), 1); + setTimeout(() => { this.resume() }, 1); }); }); From 582f1f01f89e4261f3f3209ceea12b721af4acfd Mon Sep 17 00:00:00 2001 From: esbb48 Date: Wed, 22 Nov 2017 16:34:58 +0800 Subject: [PATCH 120/379] test: use common.crashOnUnhandledRejection PR-URL: https://github.com/nodejs/node/pull/17218 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/parallel/test-http-agent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 062809f0614ad7..106f641db72a18 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -23,6 +23,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +common.crashOnUnhandledRejection(); const N = 4; const M = 4; From 9bf2da342968de4a09dc768eb3c1258252234561 Mon Sep 17 00:00:00 2001 From: Roth Peng Date: Wed, 22 Nov 2017 16:49:15 +0800 Subject: [PATCH 121/379] test: use crashOnUnhandledRejection Add common.crashOnUnhandledRejection to test/parallell/test-microtask-queue-run-domain.js PR-URL: https://github.com/nodejs/node/pull/17226 Reviewed-By: Myles Borins Reviewed-By: Gireesh Punathil Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-microtask-queue-run-domain.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js index 39baf930232411..a895504fc2972a 100644 --- a/test/parallel/test-microtask-queue-run-domain.js +++ b/test/parallel/test-microtask-queue-run-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,6 +30,8 @@ const assert = require('assert'); // removed. require('domain'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } From dc4aa89224ea143e60c09a2bab61274047ad0d04 Mon Sep 17 00:00:00 2001 From: jimliu7434 Date: Wed, 22 Nov 2017 16:45:34 +0800 Subject: [PATCH 122/379] test: use common.crashOnUnhandledRejection Add common.crashOnUnhandledRejection to test-async-wrap-promise-after-enabled.js PR-URL: https://github.com/nodejs/node/pull/17231 Reviewed-By: Myles Borins Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-async-wrap-promise-after-enabled.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/parallel/test-async-wrap-promise-after-enabled.js b/test/parallel/test-async-wrap-promise-after-enabled.js index 475411a3dae531..9535c080f246b7 100644 --- a/test/parallel/test-async-wrap-promise-after-enabled.js +++ b/test/parallel/test-async-wrap-promise-after-enabled.js @@ -9,6 +9,8 @@ const async_hooks = require('async_hooks'); const seenEvents = []; +common.crashOnUnhandledRejection(); + const p = new Promise((resolve) => resolve(1)); p.then(() => seenEvents.push('then')); From 63f9a1329900795c51a1b8b0e5b646119138d0d1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 22 Nov 2017 07:41:30 -0800 Subject: [PATCH 123/379] test: fix linting error Fast-tracked on landing to unbreak CI PR-URL: https://github.com/nodejs/node/pull/17251 Reviewed-By: Colin Ihrig --- test/parallel/test-https-truncate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index 30a869c0707e44..c549da1571b80c 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -67,6 +67,6 @@ const test = common.mustCall(function(res) { res.on('data', function(chunk) { bytes += chunk.length; this.pause(); - setTimeout(() => { this.resume() }, 1); + setTimeout(() => { this.resume(); }, 1); }); }); From c23254249408647df1615f104096f3ddb55d2fcb Mon Sep 17 00:00:00 2001 From: YuLun Shih Date: Wed, 22 Nov 2017 16:08:16 +0800 Subject: [PATCH 124/379] test: use crashOnUnhandledRejection Add common.crashOnUnhandledRejection to test/parallel/test-async-hooks-disable-during-promise.js PR-URL: https://github.com/nodejs/node/pull/17220 Reviewed-By: Myles Borins Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-async-hooks-disable-during-promise.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-async-hooks-disable-during-promise.js b/test/parallel/test-async-hooks-disable-during-promise.js index a81c4fbc40caf3..d6566661294734 100644 --- a/test/parallel/test-async-hooks-disable-during-promise.js +++ b/test/parallel/test-async-hooks-disable-during-promise.js @@ -1,6 +1,7 @@ 'use strict'; const common = require('../common'); const async_hooks = require('async_hooks'); +common.crashOnUnhandledRejection(); const hook = async_hooks.createHook({ init: common.mustCall(2), From caa59b9a47f2809d78828973507cf2fd05a94434 Mon Sep 17 00:00:00 2001 From: Kyle Yu Date: Wed, 22 Nov 2017 16:56:37 +0800 Subject: [PATCH 125/379] test: add common.crashOnUnhandledRejection() add common.crashOnUnhandledRejection() in test-wasm-simple.js PR-URL: https://github.com/nodejs/node/pull/17236 Reviewed-By: Gireesh Punathil Reviewed-By: Myles Borins Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-wasm-simple.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-wasm-simple.js b/test/parallel/test-wasm-simple.js index 6227875fd8a9df..02a97ec2c9455f 100644 --- a/test/parallel/test-wasm-simple.js +++ b/test/parallel/test-wasm-simple.js @@ -1,10 +1,11 @@ 'use strict'; -require('../common'); - +const common = require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); +common.crashOnUnhandledRejection(); + const buffer = fixtures.readSync('test.wasm'); assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); From 696c962bf3898790f0a6c42082d027c9359070d8 Mon Sep 17 00:00:00 2001 From: Ivan Wei Date: Wed, 22 Nov 2017 16:50:40 +0800 Subject: [PATCH 126/379] test: use common.crashOnUnhandledRejection() add common.crashOnUnhandledRejectio to test-http2-window-size.js PR-URL: https://github.com/nodejs/node/pull/17227 Reviewed-By: Myles Borins Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/parallel/test-http2-window-size.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-http2-window-size.js b/test/parallel/test-http2-window-size.js index d6c6bf3fed2af2..381416c0d23cc6 100644 --- a/test/parallel/test-http2-window-size.js +++ b/test/parallel/test-http2-window-size.js @@ -10,6 +10,7 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const h2 = require('http2'); +common.crashOnUnhandledRejection(); // Given a list of buffers and an initial window size, have a server write // each buffer to the HTTP2 Writable stream, and let the client verify that From bd1dbcef85940cfd14a7b5028e1ee5a532df74b8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 18 Nov 2017 14:09:05 -0800 Subject: [PATCH 127/379] doc: add capitalization styling to STYLE_GUIDE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is mostly an excuse to remind people that it's "V8" and not "v8" when referring to the JavaScript engine. PR-URL: https://github.com/nodejs/node/pull/17163 Reviewed-By: Michaël Zasso Reviewed-By: Vse Mozhet Byt Reviewed-By: Benjamin Gruenbaum Reviewed-By: Alexey Orlenko Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- doc/STYLE_GUIDE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 923cbb51001d32..9cdbf0d7b63631 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -69,6 +69,9 @@ * Function returns should use the following format: * * Returns: {type|type2} Optional description. * E.g. * Returns: {AsyncHook} A reference to `asyncHook`. +* Use official styling for capitalization in products and projects. + * OK: JavaScript, Google's V8 + * NOT OK: Javascript, Google's v8 [Em dashes]: https://en.wikipedia.org/wiki/Dash#Em_dash [Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types From 9dcf74800049780ffb89a66051ad98340f6b5be8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 18 Nov 2017 19:46:33 -0800 Subject: [PATCH 128/379] doc: prepare for v8/V8 linting in doc text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17163 Reviewed-By: Michaël Zasso Reviewed-By: Vse Mozhet Byt Reviewed-By: Benjamin Gruenbaum Reviewed-By: Alexey Orlenko Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- doc/api/all.md | 1 + doc/api/process.md | 6 +++--- doc/changelogs/CHANGELOG_ARCHIVE.md | 2 ++ doc/changelogs/CHANGELOG_IOJS.md | 2 ++ doc/changelogs/CHANGELOG_V010.md | 2 ++ doc/changelogs/CHANGELOG_V012.md | 2 ++ doc/changelogs/CHANGELOG_V4.md | 2 ++ doc/changelogs/CHANGELOG_V5.md | 2 ++ doc/changelogs/CHANGELOG_V6.md | 2 ++ doc/changelogs/CHANGELOG_V7.md | 2 ++ doc/changelogs/CHANGELOG_V8.md | 2 ++ doc/changelogs/CHANGELOG_V9.md | 2 ++ doc/guides/maintaining-V8.md | 33 ++++++++++++++++------------- 13 files changed, 42 insertions(+), 18 deletions(-) diff --git a/doc/api/all.md b/doc/api/all.md index b11661d2b7e916..d013f07bd328fc 100644 --- a/doc/api/all.md +++ b/doc/api/all.md @@ -1,3 +1,4 @@ + @include documentation @include synopsis @include assert diff --git a/doc/api/process.md b/doc/api/process.md index 01dc630869dd7a..178928c8b6a321 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1459,9 +1459,9 @@ tarball. * `lts` {string} a string label identifying the [LTS][] label for this release. This property only exists for LTS releases and is `undefined` for all other release types, including _Current_ releases. Currently the valid values are: - - `'Argon'` for the v4.x LTS line beginning with v4.2.0. - - `'Boron'` for the v6.x LTS line beginning with v6.9.0. - - `'Carbon'` for the v8.x LTS line beginning with v8.9.1. + - `'Argon'` for the 4.x LTS line beginning with 4.2.0. + - `'Boron'` for the 6.x LTS line beginning with 6.9.0. + - `'Carbon'` for the 8.x LTS line beginning with 8.9.1. For example: diff --git a/doc/changelogs/CHANGELOG_ARCHIVE.md b/doc/changelogs/CHANGELOG_ARCHIVE.md index ba1f385a7cfaa9..35d879064f0283 100644 --- a/doc/changelogs/CHANGELOG_ARCHIVE.md +++ b/doc/changelogs/CHANGELOG_ARCHIVE.md @@ -1,5 +1,7 @@ # Node.js ChangeLog Archive + + diff --git a/doc/changelogs/CHANGELOG_IOJS.md b/doc/changelogs/CHANGELOG_IOJS.md index 76f6fef8f64206..c419c534cac398 100644 --- a/doc/changelogs/CHANGELOG_IOJS.md +++ b/doc/changelogs/CHANGELOG_IOJS.md @@ -1,5 +1,7 @@ # io.js ChangeLog + +
v0.11
diff --git a/doc/changelogs/CHANGELOG_V010.md b/doc/changelogs/CHANGELOG_V010.md index ed9a7fe9bed12a..d9ad08acf0f8ba 100644 --- a/doc/changelogs/CHANGELOG_V010.md +++ b/doc/changelogs/CHANGELOG_V010.md @@ -1,5 +1,7 @@ # Node.js 0.10 ChangeLog + +
v3
diff --git a/doc/changelogs/CHANGELOG_V012.md b/doc/changelogs/CHANGELOG_V012.md index 93a65abf5084a7..a57773269814ee 100644 --- a/doc/changelogs/CHANGELOG_V012.md +++ b/doc/changelogs/CHANGELOG_V012.md @@ -1,5 +1,7 @@ # Node.js 0.12 ChangeLog + +
Stable
diff --git a/doc/changelogs/CHANGELOG_V4.md b/doc/changelogs/CHANGELOG_V4.md index ea6aba32b9b1c5..33b4d146ea2756 100644 --- a/doc/changelogs/CHANGELOG_V4.md +++ b/doc/changelogs/CHANGELOG_V4.md @@ -1,5 +1,7 @@ # Node.js 4 ChangeLog + +
Stable
diff --git a/doc/changelogs/CHANGELOG_V5.md b/doc/changelogs/CHANGELOG_V5.md index 198b7a71d6a099..4f223e62f79b73 100644 --- a/doc/changelogs/CHANGELOG_V5.md +++ b/doc/changelogs/CHANGELOG_V5.md @@ -1,5 +1,7 @@ # Node.js 5 ChangeLog + +
LTS 'Argon'
diff --git a/doc/changelogs/CHANGELOG_V6.md b/doc/changelogs/CHANGELOG_V6.md index eb8aafe9ede30e..ae20c09c6e379f 100644 --- a/doc/changelogs/CHANGELOG_V6.md +++ b/doc/changelogs/CHANGELOG_V6.md @@ -1,5 +1,7 @@ # Node.js 6 ChangeLog + +
Stable
diff --git a/doc/changelogs/CHANGELOG_V7.md b/doc/changelogs/CHANGELOG_V7.md index 4c0a81cd36dbc4..dd9fa4d269a8d6 100644 --- a/doc/changelogs/CHANGELOG_V7.md +++ b/doc/changelogs/CHANGELOG_V7.md @@ -1,5 +1,7 @@ # Node.js 7 ChangeLog + +
LTS 'Boron'
diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index 09b82b74b69ec3..fbbd2a18006ad0 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -1,5 +1,7 @@ # Node.js 8 ChangeLog + +
Current
diff --git a/doc/changelogs/CHANGELOG_V9.md b/doc/changelogs/CHANGELOG_V9.md index feeaee100ef96a..be756c2d1f9f1f 100644 --- a/doc/changelogs/CHANGELOG_V9.md +++ b/doc/changelogs/CHANGELOG_V9.md @@ -1,5 +1,7 @@ # Node.js 9 ChangeLog + +
LTS 'Carbon'
diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md index 350ecd0c72f61e..f101f95edc6928 100644 --- a/doc/guides/maintaining-V8.md +++ b/doc/guides/maintaining-V8.md @@ -181,16 +181,16 @@ to be cherry-picked in the Node.js repository and V8-CI must test the change. * For each abandoned V8 branch corresponding to an LTS branch that is affected by the bug: * Open a cherry-pick PR on nodejs/node targeting the appropriate *vY.x-staging* branch (e.g. *v6.x-staging* to fix an issue in V8-5.1). - * On Node.js < 9.0.0: Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version. + * On Node.js < 9.0.0: Increase the patch level version in `v8-version.h`. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version. * On Node.js >= 9.0.0: Increase the `v8_embedder_string` number in `common.gypi`. * In some cases the patch may require extra effort to merge in case V8 has changed substantially. For important issues we may be able to lean on the V8 team to get help with reimplementing the patch. * Run the Node.js [V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node.js CI](https://ci.nodejs.org/job/node-test-pull-request/). -An example for workflow how to cherry-pick consider the following bug: -https://crbug.com/v8/5199. From the bug we can see that it was merged by V8 into -5.2 and 5.3, and not into V8 5.1 (since it was already abandoned). Since Node.js -`v6.x` uses V8 5.1, the fix needed to cherry-picked. To cherry-pick, here's an -example workflow: +An example for workflow how to cherry-pick consider the bug +[RegExp show inconsistent result with other browsers](https://crbug.com/v8/5199). +From the bug we can see that it was merged by V8 into 5.2 and 5.3, and not into +V8 5.1 (since it was already abandoned). Since Node.js `v6.x` uses V8 5.1, the +fix needed to be cherry-picked. To cherry-pick, here's an example workflow: * Download and apply the commit linked-to in the issue (in this case a51f429). `curl -L https://github.com/v8/v8/commit/a51f429.patch | git am -3 --directory=deps/v8`. If the branches have diverged significantly, this may not apply cleanly. It may help to try to cherry-pick the merge to the oldest branch that was done upstream in V8. In this example, this would be the patch from the merge to 5.2. The hope is that this would be closer to the V8 5.1, and has a better chance of applying cleanly. If you're stuck, feel free to ping @ofrobots for help. * Modify the commit message to match the format we use for V8 backports and replace yourself as the author. `git commit --amend --reset-author`. You may want to add extra description if necessary to indicate the impact of the fix on Node.js. In this case the original issue was descriptive enough. Example: @@ -289,7 +289,7 @@ To audit for floating patches: git log --oneline deps/v8 ``` -To replace the copy of V8 in Node.js, use the '[update-v8](https://gist.github.com/targos/8da405e96e98fdff01a395bed365b816)' script2. For example, if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1 branch: +To replace the copy of V8 in Node.js, use the `[update-v8](https://gist.github.com/targos/8da405e96e98fdff01a395bed365b816)` script2. For example, if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1 branch: ```shell cd $NODE_DIR @@ -306,20 +306,23 @@ This should be followed up with manual refloating of all relevant patches. The fact that Node.js keeps a vendored, potentially edited copy of V8 in deps/ makes the above processes a bit complicated. An alternative proposal would be to -create a fork of V8 at nodejs/v8 that would be used to maintain the V8 branches. -This has several benefits: +create a fork of V8 at `nodejs/v8` that would be used to maintain the V8 +branches. This has several benefits: -* The process to update the version of V8 in Node.js could be automated to track the tips of various V8 branches in nodejs/v8. -* It would simplify cherry-picking and porting of fixes between branches as the version bumps in v8-version.h would happen as part of this update instead of on every change. +* The process to update the version of V8 in Node.js could be automated to track + the tips of various V8 branches in `nodejs/v8`. +* It would simplify cherry-picking and porting of fixes between branches as the version bumps in `v8-version.h` would happen as part of this update instead of on every change. * It would simplify the V8-CI and make it more automatable. -* The history of the V8 branch in nodejs/v8 becomes purer and it would make it easier to pull in the V8 team for help with reviewing. +* The history of the V8 branch in `nodejs/v8` becomes purer and it would make it + easier to pull in the V8 team for help with reviewing. * It would make it simpler to setup an automated build that tracks Node.js master + V8 lkgr integration build. This would require some tooling to: * A script that would update the V8 in a specific Node.js branch with V8 from upstream (dependent on branch abandoned vs. active). -* We need a script to bump V8 version numbers when a new version of V8 is promoted from nodejs/v8 to nodejs/node. -* Enabled the V8-CI build in Jenkins to build from the nodejs/v8 fork. +* We need a script to bump V8 version numbers when a new version of V8 is + promoted from `nodejs/v8` to `nodejs/node`. +* Enabled the V8-CI build in Jenkins to build from the `nodejs/v8` fork. ## Proposal: Dealing with the need to float patches to a stable/beta @@ -344,4 +347,4 @@ up working, we will investigate making this change upstream. 1Node.js 0.12 and older are intentionally omitted from this document as their support is ending soon. -2It seems that @targos is working on port of this script here https://github.com/targos/update-v8. +2@targos is working on [a port of this script](https://github.com/targos/update-v8). From 2fccf84015d1b3888238fce8b22d6383151ac4e7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 18 Nov 2017 20:01:57 -0800 Subject: [PATCH 129/379] doc: use "JavaScript" instead of "Javascript" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17163 Reviewed-By: Michaël Zasso Reviewed-By: Vse Mozhet Byt Reviewed-By: Benjamin Gruenbaum Reviewed-By: Alexey Orlenko Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- README.md | 4 ++-- doc/api/n-api.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10982232a2a93c..8fa367eba6ea47 100644 --- a/README.md +++ b/README.md @@ -197,8 +197,8 @@ us a report nonetheless. - [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain function can be used to cause segfaults_. Causing program termination using - either the public Javascript APIs or the private bindings layer APIs requires - the ability to execute arbitrary Javascript code, which is already the highest + either the public JavaScript APIs or the private bindings layer APIs requires + the ability to execute arbitrary JavaScript code, which is already the highest level of privilege possible. - [#12141](https://github.com/nodejs/node/pull/12141): _buffer: zero fill diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 0e94396665ca25..f1587f4848b807 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -204,7 +204,7 @@ typedef void (*napi_async_complete_callback)(napi_env env, ``` ## Error Handling -N-API uses both return values and Javascript exceptions for error handling. +N-API uses both return values and JavaScript exceptions for error handling. The following sections explain the approach for each case. ### Return values @@ -2863,7 +2863,7 @@ Returns `napi_ok` if the API succeeded. This API allows an add-on author to create a function object in native code. This is the primary mechanism to allow calling *into* the add-on's native code -*from* Javascript. +*from* JavaScript. *Note*: The newly created function is not automatically visible from script after this call. Instead, a property must be explicitly set on any From b36c726206eca78ae784c2b227d556a6dbc9935b Mon Sep 17 00:00:00 2001 From: Weijia Wang <381152119@qq.com> Date: Mon, 20 Nov 2017 17:13:50 +0800 Subject: [PATCH 130/379] stream: improve the error message of `ERR_INVALID_ARG_TYPE` The `expected` argument of `ERR_INVALID_ARG_TYPE` can be an array, which is better than a single string. PR-URL: https://github.com/nodejs/node/pull/17145 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Joyee Cheung --- lib/_stream_readable.js | 2 +- lib/_stream_writable.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 8e38030da85e4b..01d886e6cab2eb 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -285,7 +285,7 @@ function chunkInvalid(state, chunk) { chunk !== undefined && !state.objectMode) { er = new errors.TypeError('ERR_INVALID_ARG_TYPE', - 'chunk', 'string/Buffer/Uint8Array'); + 'chunk', ['string', 'Buffer', 'Uint8Array']); } return er; } diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 1735fafb5f34d3..02481739250635 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -252,7 +252,8 @@ function validChunk(stream, state, chunk, cb) { } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'chunk', 'string/buffer'); + er = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'chunk', + ['string', 'Buffer']); } if (er) { stream.emit('error', er); From 1a3aadb2e9f6db0deb106a49e83fc9c9e9535c5f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 19 Nov 2017 22:46:32 +0100 Subject: [PATCH 131/379] doc: use better terminology for build machines PR-URL: https://github.com/nodejs/node/pull/17142 Reviewed-By: Vse Mozhet Byt Reviewed-By: Gibson Fahnestock Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Michael Dawson --- doc/changelogs/CHANGELOG_IOJS.md | 4 ++-- doc/releases.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/changelogs/CHANGELOG_IOJS.md b/doc/changelogs/CHANGELOG_IOJS.md index c419c534cac398..daac573eab7031 100644 --- a/doc/changelogs/CHANGELOG_IOJS.md +++ b/doc/changelogs/CHANGELOG_IOJS.md @@ -2032,7 +2032,7 @@ will be removed at a later point. (Roman Reiss) [#1363](https://github.com/nodej ### Notable changes -* **tls**: A typo introduced in the TLSWrap changes in [#840](https://github.com/nodejs/node/pull/840) only encountered as a bug on Windows was not caught by the io.js CI system due to problems with the Windows build script and the Windows CI slave configuration, see Known Issues below. Fixed in [#994](https://github.com/nodejs/node/pull/994) & [#1004](https://github.com/nodejs/node/pull/1004). (Fedor Indutny) +* **tls**: A typo introduced in the TLSWrap changes in [#840](https://github.com/nodejs/node/pull/840) only encountered as a bug on Windows was not caught by the io.js CI system due to problems with the Windows build script and the Windows CI configuration, see Known Issues below. Fixed in [#994](https://github.com/nodejs/node/pull/994) & [#1004](https://github.com/nodejs/node/pull/1004). (Fedor Indutny) * **npm**: Upgrade npm to 2.6.1. See [npm CHANGELOG.md](https://github.com/npm/npm/blob/master/CHANGELOG.md#v260-2015-02-12) for details. Summary: * [`8b98f0e`](https://github.com/npm/npm/commit/8b98f0e709d77a8616c944aebd48ab726f726f76) [#4471](https://github.com/npm/npm/issues/4471) `npm outdated` (and only `npm @@ -2554,7 +2554,7 @@ _Note: version **1.4.0** was tagged and built but not released. A libuv bug was ## 2015-01-14, Version 1.0.1, @rvagg -Rebuild due to stale build slave git reflogs for 1.0.0 release +Rebuild due to stale build worker git reflogs for 1.0.0 release * doc: improve write style consistency (Rui Marinho) * win,msi: correct doc website link (Bert Belder) diff --git a/doc/releases.md b/doc/releases.md index faca396768e377..c3d21407acf298 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -22,7 +22,7 @@ The [Node.js build team](https://github.com/nodejs/build) is able to provide thi The _dist_ user on nodejs.org controls the assets available in . is an alias for . -The Jenkins release build slaves upload their artifacts to the web server as the _staging_ user. The _dist_ user has access to move these assets to public access while, for security, the _staging_ user does not. +The Jenkins release build workers upload their artifacts to the web server as the _staging_ user. The _dist_ user has access to move these assets to public access while, for security, the _staging_ user does not. Nightly builds are promoted automatically on the server by a cron task for the _dist_ user. @@ -204,17 +204,17 @@ This is particularly recommended if there has been recent work relating to the m Use **[iojs+release](https://ci-release.nodejs.org/job/iojs+release/)** to produce release artifacts. Enter the commit that you want to build from and select "release" for "disttype". -Artifacts from each slave are uploaded to Jenkins and are available if further testing is required. Use this opportunity particularly to test macOS and Windows installers if there are any concerns. Click through to the individual slaves for a run to find the artifacts. +Artifacts from each worker are uploaded to Jenkins and are available if further testing is required. Use this opportunity particularly to test macOS and Windows installers if there are any concerns. Click through to the individual workers for a run to find the artifacts. -All release slaves should achieve "SUCCESS" (and be green, not red). A release with failures should not be promoted as there are likely problems to be investigated. +All release workers should achieve "SUCCESS" (and be green, not red). A release with failures should not be promoted as there are likely problems to be investigated. You can rebuild the release as many times as you need prior to promoting them if you encounter problems. -If you have an error on Windows and need to start again, be aware that you'll get immediate failure unless you wait up to 2 minutes for the linker to stop from previous jobs. i.e. if a build fails after having started compiling, that slave will still have a linker process that's running for another couple of minutes which will prevent Jenkins from clearing the workspace to start a new one. This isn't a big deal, it's just a hassle because it'll result in another failed build if you start again! +If you have an error on Windows and need to start again, be aware that you'll get immediate failure unless you wait up to 2 minutes for the linker to stop from previous jobs. i.e. if a build fails after having started compiling, that worker will still have a linker process that's running for another couple of minutes which will prevent Jenkins from clearing the workspace to start a new one. This isn't a big deal, it's just a hassle because it'll result in another failed build if you start again! ARMv7 takes the longest to compile. Unfortunately ccache isn't as effective on release builds, I think it's because of the additional macro settings that go in to a release build that nullify previous builds. Also most of the release build machines are separate to the test build machines so they don't get any benefit from ongoing compiles between releases. You can expect 1.5 hours for the ARMv7 builder to complete and you should normally wait for this to finish. It is possible to rush a release out if you want and add additional builds later but we normally provide ARMv7 from initial promotion. -You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers and docs (both produced currently by an macOS slave). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. +You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers and docs (both produced currently by an macOS worker). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. ### 9. Test the Build From 7ebaf836026250bbc3a142d31e02b9d627b54e65 Mon Sep 17 00:00:00 2001 From: Weijia Wang <381152119@qq.com> Date: Mon, 20 Nov 2017 00:11:24 +0800 Subject: [PATCH 132/379] fs: use arrow functions instead of `.bind` and `self` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17137 Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/fs.js | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 01edc7411a5c02..a53290274c331e 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -2091,30 +2091,27 @@ ReadStream.prototype._read = function(n) { return this.push(null); // the actual read. - var self = this; - fs.read(this.fd, pool, pool.used, toRead, this.pos, onread); - - // move the pool positions, and internal position for reading. - if (this.pos !== undefined) - this.pos += toRead; - pool.used += toRead; - - function onread(er, bytesRead) { + fs.read(this.fd, pool, pool.used, toRead, this.pos, (er, bytesRead) => { if (er) { - if (self.autoClose) { - self.destroy(); + if (this.autoClose) { + this.destroy(); } - self.emit('error', er); + this.emit('error', er); } else { var b = null; if (bytesRead > 0) { - self.bytesRead += bytesRead; + this.bytesRead += bytesRead; b = thisPool.slice(start, start + bytesRead); } - self.push(b); + this.push(b); } - } + }); + + // move the pool positions, and internal position for reading. + if (this.pos !== undefined) + this.pos += toRead; + pool.used += toRead; }; ReadStream.prototype._destroy = function(err, cb) { @@ -2209,7 +2206,7 @@ fs.FileWriteStream = fs.WriteStream; // support the legacy name WriteStream.prototype.open = function() { - fs.open(this.path, this.flags, this.mode, function(er, fd) { + fs.open(this.path, this.flags, this.mode, (er, fd) => { if (er) { if (this.autoClose) { this.destroy(); @@ -2220,7 +2217,7 @@ WriteStream.prototype.open = function() { this.fd = fd; this.emit('open', fd); - }.bind(this)); + }); }; @@ -2234,15 +2231,14 @@ WriteStream.prototype._write = function(data, encoding, cb) { }); } - var self = this; - fs.write(this.fd, data, 0, data.length, this.pos, function(er, bytes) { + fs.write(this.fd, data, 0, data.length, this.pos, (er, bytes) => { if (er) { - if (self.autoClose) { - self.destroy(); + if (this.autoClose) { + this.destroy(); } return cb(er); } - self.bytesWritten += bytes; + this.bytesWritten += bytes; cb(); }); From 5c70cef403d1dbd73ee03dae1cd3df7d52f20a91 Mon Sep 17 00:00:00 2001 From: buji Date: Sun, 19 Nov 2017 00:33:07 +0800 Subject: [PATCH 133/379] test: dont need to remove nonexistent directory the TempDirection is empty , so tempdir/test1 and tempdir/test2 are nonexistent. we dont need to delete nonexistent directories. PR-URL: https://github.com/nodejs/node/pull/17119 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Daniel Bevenius --- test/parallel/test-fs-mkdir.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index 679e0b255ace92..21f8774e696aa7 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -36,8 +36,6 @@ common.refreshTmpDir(); { const pathname = `${common.tmpDir}/test1`; - unlink(pathname); - fs.mkdir(pathname, common.mustCall(function(err) { assert.strictEqual(err, null); assert.strictEqual(common.fileExists(pathname), true); @@ -51,8 +49,6 @@ common.refreshTmpDir(); { const pathname = `${common.tmpDir}/test2`; - unlink(pathname); - fs.mkdir(pathname, 0o777, common.mustCall(function(err) { assert.strictEqual(err, null); assert.strictEqual(common.fileExists(pathname), true); From 42a8f03a8b2344bc69df2e1447fe4554581a8a9b Mon Sep 17 00:00:00 2001 From: buji Date: Mon, 20 Nov 2017 09:04:28 +0800 Subject: [PATCH 134/379] test: remove unlink function which is needless PR-URL: https://github.com/nodejs/node/pull/17119 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Daniel Bevenius --- test/parallel/test-fs-mkdir.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index 21f8774e696aa7..54585a3f12a64b 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -24,13 +24,6 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -function unlink(pathname) { - try { - fs.rmdirSync(pathname); - } catch (e) { - } -} - common.refreshTmpDir(); { @@ -40,10 +33,6 @@ common.refreshTmpDir(); assert.strictEqual(err, null); assert.strictEqual(common.fileExists(pathname), true); })); - - process.on('exit', function() { - unlink(pathname); - }); } { @@ -53,21 +42,14 @@ common.refreshTmpDir(); assert.strictEqual(err, null); assert.strictEqual(common.fileExists(pathname), true); })); - - process.on('exit', function() { - unlink(pathname); - }); } { const pathname = `${common.tmpDir}/test3`; - unlink(pathname); fs.mkdirSync(pathname); const exists = common.fileExists(pathname); - unlink(pathname); - assert.strictEqual(exists, true); } From 57ee0dd5e34bee159dbdd2f59fa09f48c5d7e179 Mon Sep 17 00:00:00 2001 From: john Date: Wed, 15 Nov 2017 23:20:03 +0330 Subject: [PATCH 135/379] zlib: remove unnecessary else branch PR-URL: https://github.com/nodejs/node/pull/17057 Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann Reviewed-By: Luigi Pinca Reviewed-By: Evan Lucas Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell --- lib/zlib.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/zlib.js b/lib/zlib.js index 249011b1f0fd36..7580288102a443 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -121,8 +121,7 @@ function zlibBufferSync(engine, buffer) { buffer = processChunkSync(engine, buffer, engine._finishFlushFlag); if (engine._info) return { buffer, engine }; - else - return buffer; + return buffer; } function zlibOnError(message, errno) { From 74506f72e68db38692b074b6170f8e51c11ac80c Mon Sep 17 00:00:00 2001 From: Benjamin Zaslavsky Date: Tue, 14 Nov 2017 00:08:58 +0100 Subject: [PATCH 136/379] doc: add description for inspector-only console methods. Description inspired by dev tools reference and inspector err messages Added: * intro * console.debug() * console.dirxml() * console.markTimeline() * console.profile() * console.profileEnd() * console.table() * console.timeStamp() * console.timeline() * console.timelineEnd() PR-URL: https://github.com/nodejs/node/pull/17004 Fixes: https://github.com/nodejs/node/issues/16755 Reviewed-By: Khaidi Chu Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- doc/api/console.md | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/doc/api/console.md b/doc/api/console.md index 54d86cea161feb..ba1505ec1d0f21 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -241,6 +241,10 @@ undefined ### console.debug(data[, ...args]) * `data` {any} * `...args` {any} @@ -426,15 +430,110 @@ added: v0.1.100 The `console.warn()` function is an alias for [`console.error()`][]. +## Inspector only methods +The following methods are exposed by the V8 engine in the general API but do +not display anything unless used in conjunction with the [inspector][] +(`--inspect` flag). + +### console.dirxml(object) + +* `object` {string} + +This method does not display anything unless used in the inspector. The +`console.dirxml()` method displays in `stdout` an XML interactive tree +representation of the descendants of the specified `object` if possible, or the +JavaScript representation if not. Calling `console.dirxml()` on an HTML or XML +element is equivalent to calling `console.log()`. + +### console.markTimeline(label) + +* `label` {string} Defaults to `'default'`. + +This method does not display anything unless used in the inspector. The +`console.markTimeline()` method is the deprecated form of [`console.timeStamp()`][]. + +### console.profile([label]) + +* `label` {string} + +This method does not display anything unless used in the inspector. The +`console.profile()` method starts a JavaScript CPU profile with an optional +label until [`console.profileEnd()`][] is called. The profile is then added to +the **Profile** panel of the inspector. +```js +console.profile('MyLabel'); +// Some code +console.profileEnd(); +// Adds the profile 'MyLabel' to the Profiles panel of the inspector. +``` + +### console.profileEnd() + + +This method does not display anything unless used in the inspector. Stops the +current JavaScript CPU profiling session if one has been started and prints +the report to the **Profiles** panel of the inspector. See +[`console.profile()`][] for an example. + +### console.table(array[, columns]) + +* `array` {Array|Object} +* `columns` {Array} + +This method does not display anything unless used in the inspector. Prints to +`stdout` the array `array` formatted as a table. + +### console.timeStamp([label]) + +* `label` {string} + +This method does not display anything unless used in the inspector. The +`console.timeStamp()` method adds an event with the label `label` to the +**Timeline** panel of the inspector. + +### console.timeline([label]) + +* `label` {string} Defaults to `'default'`. + +This method does not display anything unless used in the inspector. The +`console.timeline()` method is the deprecated form of [`console.time()`][]. + +### console.timelineEnd([label]) + +* `label` {string} Defaults to `'default'`. + +This method does not display anything unless used in the inspector. The +`console.timelineEnd()` method is the deprecated form of [`console.timeEnd()`][]. + [`console.error()`]: #console_console_error_data_args [`console.group()`]: #console_console_group_label [`console.log()`]: #console_console_log_data_args +[`console.profile()`]: #console_console_profile_label +[`console.profileEnd()`]: #console_console_profileend [`console.time()`]: #console_console_time_label [`console.timeEnd()`]: #console_console_timeend_label +[`console.timeStamp()`]: #console_console_timestamp_label [`process.stderr`]: process.html#process_process_stderr [`process.stdout`]: process.html#process_process_stdout [`util.format()`]: util.html#util_util_format_format_args [`util.inspect()`]: util.html#util_util_inspect_object_options [customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors +[inspector]: debugger.html [note on process I/O]: process.html#process_a_note_on_process_i_o [web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert From 14ebda52184149f75e84db73054c787b5541d38a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 13 Nov 2017 11:41:20 +0900 Subject: [PATCH 137/379] src: add public API for managing NodePlatform PR-URL: https://github.com/nodejs/node/pull/16981 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/node.cc | 12 ++++++++++++ src/node.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/node.cc b/src/node.cc index 21c2dc849a2dd9..ad2e3df933dc23 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4769,6 +4769,18 @@ void FreeEnvironment(Environment* env) { } +MultiIsolatePlatform* CreatePlatform( + int thread_pool_size, + v8::TracingController* tracing_controller) { + return new NodePlatform(thread_pool_size, tracing_controller); +} + + +void FreePlatform(MultiIsolatePlatform* platform) { + delete platform; +} + + Local NewContext(Isolate* isolate, Local object_template) { auto context = Context::New(isolate, nullptr, object_template); diff --git a/src/node.h b/src/node.h index 89dac0c0a8491d..8ef97bbffa83ff 100644 --- a/src/node.h +++ b/src/node.h @@ -97,6 +97,11 @@ // Forward-declare libuv loop struct uv_loop_s; +// Forward-declare TracingController, used by CreatePlatform. +namespace v8 { +class TracingController; +} + // Forward-declare these functions now to stop MSVS from becoming // terminally confused when it's done in node_internals.h namespace node { @@ -244,6 +249,11 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, NODE_EXTERN void LoadEnvironment(Environment* env); NODE_EXTERN void FreeEnvironment(Environment* env); +NODE_EXTERN MultiIsolatePlatform* CreatePlatform( + int thread_pool_size, + v8::TracingController* tracing_controller); +NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform); + NODE_EXTERN void EmitBeforeExit(Environment* env); NODE_EXTERN int EmitExit(Environment* env); NODE_EXTERN void RunAtExit(Environment* env); From b6929e2aa99238d07f75eb32b361bc2d6ab7bb41 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 8 Oct 2017 10:26:55 -0700 Subject: [PATCH 138/379] test,doc: document where common modules go Keep the `require('../common')` separate from other common modules, as it's the only line that must be there. PR-URL: https://github.com/nodejs/node/pull/16089 Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- doc/guides/writing-tests.md | 53 ++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 19626799f73acb..7dc86facfd00c5 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -25,39 +25,44 @@ Let's analyze this basic test from the Node.js test suite: ```javascript 'use strict'; // 1 const common = require('../common'); // 2 - -// This test ensures that the http-parser can handle UTF-8 characters // 4 -// in the http header. // 5 - -const assert = require('assert'); // 7 -const http = require('http'); // 8 - -const server = http.createServer(common.mustCall((req, res) => { // 10 - res.end('ok'); // 11 -})); // 12 -server.listen(0, () => { // 13 - http.get({ // 14 - port: server.address().port, // 15 - headers: { 'Test': 'Düsseldorf' } // 16 - }, common.mustCall((res) => { // 17 - assert.strictEqual(res.statusCode, 200); // 18 - server.close(); // 19 - })); // 20 -}); // 21 +const fixtures = require('../common/fixtures'); // 3 + +// This test ensures that the http-parser can handle UTF-8 characters // 5 +// in the http header. // 6 + +const assert = require('assert'); // 8 +const http = require('http'); // 9 + +const server = http.createServer(common.mustCall((req, res) => { // 11 + res.end('ok'); // 12 +})); // 13 +server.listen(0, () => { // 14 + http.get({ // 15 + port: server.address().port, // 16 + headers: { 'Test': 'Düsseldorf' } // 17 + }, common.mustCall((res) => { // 18 + assert.strictEqual(res.statusCode, 200); // 19 + server.close(); // 20 + })); // 21 +}); // 22 +// ... // 23 ``` -### **Lines 1-2** +### **Lines 1-3** ```javascript 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); ``` The first line enables strict mode. All tests should be in strict mode unless the nature of the test requires that the test run without it. The second line loads the `common` module. The [`common` module][] is a helper -module that provides useful tools for the tests. +module that provides useful tools for the tests. Some common functionality has +been extracted into submodules, which are required separately like the fixtures +module here. Even if a test uses no functions or other properties exported by `common`, the test should still include the `common` module before any other modules. This @@ -70,7 +75,7 @@ assigning it to an identifier: require('../common'); ``` -### **Lines 4-5** +### **Lines 5-6** ```javascript // This test ensures that the http-parser can handle UTF-8 characters @@ -80,7 +85,7 @@ require('../common'); A test should start with a comment containing a brief description of what it is designed to test. -### **Lines 7-8** +### **Lines 8-9** ```javascript const assert = require('assert'); @@ -95,7 +100,7 @@ The require statements are sorted in [ASCII][] order (digits, upper case, `_`, lower case). -### **Lines 10-21** +### **Lines 11-22** This is the body of the test. This test is simple, it just tests that an HTTP server accepts `non-ASCII` characters in the headers of an incoming From 04c4c1f2606adc81e97968fe3cefccf468fab301 Mon Sep 17 00:00:00 2001 From: Jamie Davis Date: Mon, 20 Nov 2017 12:40:44 -0500 Subject: [PATCH 139/379] doc: fs.readFile is async but not partitioned This change was suggested during the discussion of #17054. PR-URL: https://github.com/nodejs/node/pull/17154 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil Reviewed-By: Vse Mozhet Byt --- doc/api/fs.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 5b975202dac4ab..600f6db59bef4e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1897,6 +1897,11 @@ Any specified file descriptor has to support reading. *Note*: If a file descriptor is specified as the `path`, it will not be closed automatically. +*Note*: `fs.readFile()` reads the entire file in a single threadpool request. +To minimize threadpool task length variation, prefer the partitioned APIs +`fs.read()` and `fs.createReadStream()` when reading files as part of +fulfilling a client request. + ## fs.readFileSync(path[, options]) -* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to - calculate the length of. +* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A + value to calculate the length of. * `encoding` {string} If `string` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {integer} The number of bytes contained within `string`. @@ -708,8 +708,8 @@ console.log(`${str}: ${str.length} characters, ` + `${Buffer.byteLength(str, 'utf8')} bytes`); ``` -When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`], the -actual byte length is returned. +When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`]/ +[`SharedArrayBuffer`], the actual byte length is returned. ### Class Method: Buffer.compare(buf1, buf2) -* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a - [`TypedArray`]. +* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], + [`SharedArrayBuffer`], or the `.buffer` property of a [`TypedArray`]. * `byteOffset` {integer} Index of first byte to expose. **Default:** `0` * `length` {integer} Number of bytes to expose. **Default:** `arrayBuffer.length - byteOffset` @@ -857,7 +857,8 @@ const buf = Buffer.from(ab, 0, 2); console.log(buf.length); ``` -A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`]. +A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`] or a +[`SharedArrayBuffer`]. ### Class Method: Buffer.from(buffer) ### Notes -1Node.js 0.12 and older are intentionally omitted from this document as their support is ending soon. - -2@targos is working on [a port of this script](https://github.com/targos/update-v8). +1Node.js 0.12 and older are intentionally omitted from this document +as their support has ended. + +[ChromiumReleaseCalendar]: https://www.chromium.org/developers/calendar +[Node.js `canary` branch]: https://github.com/nodejs/node-v8/tree/canary +[Node.js CI]: https://ci.nodejs.org/job/node-test-pull-request/ +[NodeJS-Backport-Approved-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Approved +[NodeJS-Backport-Approved-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Approved +[NodeJS-Backport-Done-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Done +[NodeJS-Backport-Done-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Done +[NodeJS-Backport-Rejected-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected +[NodeJS-Backport-Rejected-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected +[NodeJS-Backport-Review-Chromium]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Review +[NodeJS-Backport-Review-V8]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Review +[`update-v8`]: https://github.com/targos/update-v8 +[V8 CI]: https://ci.nodejs.org/job/node-test-commit-v8-linux/ +[V8ActiveBranches]: https://build.chromium.org/p/client.v8.branches/console +[V8Contributing]: https://github.com/v8/v8/wiki/Contributing +[V8MergingPatching]: https://github.com/v8/v8/wiki/Merging%20&%20Patching +[V8TemplateMergeRequest]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20merge%20request +[V8TemplateUpstreamBug]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20upstream%20bug From 94abefba93948a2801c5bf73497ddb95ddaf720f Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 26 Nov 2017 17:04:27 +0900 Subject: [PATCH 174/379] test: add test of stream Transform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a test case of Transform constructor without new. PR-URL: https://github.com/nodejs/node/pull/17303 Reviewed-By: Ron Korving Reviewed-By: Yosuke Furukawa Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso --- test/parallel/test-stream2-transform.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index 38f6bc64db35a7..819b088e2757f2 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -96,6 +96,13 @@ const Transform = require('_stream_transform'); assert(pt instanceof PassThrough); } +{ + // Verify transform constructor behavior + const pt = Transform(); + + assert(pt instanceof Transform); +} + { // Perform a simple transform const pt = new Transform(); From 284dad74680e0b3dd23ec7a3608fef21017c6ba5 Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Sun, 26 Nov 2017 17:03:38 +0900 Subject: [PATCH 175/379] test: use Number.isNaN() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17319 Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: Khaidi Chu Reviewed-By: James M Snell --- test/parallel/test-process-emit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-process-emit.js b/test/parallel/test-process-emit.js index f4f6d546f15cfa..8c2ad675cf8c62 100644 --- a/test/parallel/test-process-emit.js +++ b/test/parallel/test-process-emit.js @@ -19,4 +19,4 @@ process.emit('normal', 'normalData'); process.emit(sym, 'symbolData'); process.emit('SIGPIPE', 'signalData'); -assert.strictEqual(isNaN(process._eventsCount), false); +assert.strictEqual(Number.isNaN(process._eventsCount), false); From 078b4a625bfd02d8c7db97603cc01217edc37957 Mon Sep 17 00:00:00 2001 From: Leko Date: Sun, 26 Nov 2017 17:05:16 +0900 Subject: [PATCH 176/379] doc: replace function with arrow function PR-URL: https://github.com/nodejs/node/pull/17304 Reviewed-By: Joyee Cheung Reviewed-By: Ron Korving Reviewed-By: Yuta Hiroto Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- doc/api/util.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 3ba8cade5439e0..f116c840e315cc 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -419,7 +419,7 @@ but may return a value of any type that will be formatted accordingly by const util = require('util'); const obj = { foo: 'this will not show up in the inspect() output' }; -obj[util.inspect.custom] = function(depth) { +obj[util.inspect.custom] = (depth) => { return { bar: 'baz' }; }; @@ -529,7 +529,7 @@ function doSomething(foo, callback) { // ... } -doSomething[util.promisify.custom] = function(foo) { +doSomething[util.promisify.custom] = (foo) => { return getPromiseSomehow(); }; @@ -544,8 +544,8 @@ standard format of taking an error-first callback as the last argument. For example, with a function that takes in `(foo, onSuccessCallback, onErrorCallback)`: ```js -doSomething[util.promisify.custom] = function(foo) { - return new Promise(function(resolve, reject) { +doSomething[util.promisify.custom] = (foo) => { + return new Promise((resolve, reject) => { doSomething(foo, resolve, reject); }); }; From b420209fc637c7fa2eddd7b7dbf4c76dd09400fa Mon Sep 17 00:00:00 2001 From: Aqui Tsuchida Date: Sun, 26 Nov 2017 17:24:18 +0900 Subject: [PATCH 177/379] test: use common.hasIntl instead of typeof Intl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17311 Reviewed-By: Joyee Cheung Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-intl-v8BreakIterator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 4f501e6ef6db28..257d6b2a769083 100644 --- a/test/parallel/test-intl-v8BreakIterator.js +++ b/test/parallel/test-intl-v8BreakIterator.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const vm = require('vm'); -if (typeof Intl === 'undefined') +if (!common.hasIntl) common.skip('missing Intl'); assert(!('v8BreakIterator' in Intl)); From d8e4d9593b8708ed9924d12d63da7b666ed339d7 Mon Sep 17 00:00:00 2001 From: koooge Date: Sun, 26 Nov 2017 12:30:34 +0000 Subject: [PATCH 178/379] test: use arrow function PR-URL: https://github.com/nodejs/node/pull/17318 Reviewed-By: Vse Mozhet Byt Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-writeuint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-writeuint.js b/test/parallel/test-writeuint.js index 3ba4456beaaa38..0863135b2b8b05 100644 --- a/test/parallel/test-writeuint.js +++ b/test/parallel/test-writeuint.js @@ -154,10 +154,10 @@ function testUint(clazz) { type: RangeError, message: /^The value "[^"]*" is invalid for option "value"$/ }, 2); - assert.throws(function() { + assert.throws(() => { data.writeUIntBE(val, 0, i); }, errMsg); - assert.throws(function() { + assert.throws(() => { data.writeUIntLE(val, 0, i); }, errMsg); val *= 0x100; From 3f4d0fc76b165dca2c06cd595e48492ccef2a54b Mon Sep 17 00:00:00 2001 From: kou-hin Date: Sun, 26 Nov 2017 17:07:45 +0900 Subject: [PATCH 179/379] test: replace function with arrow function PR-URL: https://github.com/nodejs/node/pull/17305 Reviewed-By: Yosuke Furukawa Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-http.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index d9fa581f3b55ce..52bebc476e1510 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -72,33 +72,33 @@ server.on('listening', function() { Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ] }, agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: foo=bar; bar=baz; baz=quux']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /hello'); })); })); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'PUT', path: '/there', agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /there'); })); })); @@ -106,7 +106,7 @@ server.on('listening', function() { req.end(); }), 1); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'POST', @@ -115,7 +115,7 @@ server.on('listening', function() { ['Cookie', 'def=456'], ['Cookie', 'ghi=789'] ], agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: abc=123', @@ -124,8 +124,8 @@ server.on('listening', function() { assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /world'); })); })); From f51cb1c0cd602ca8732da7eddfeb6d4db28d88c8 Mon Sep 17 00:00:00 2001 From: Hiroaki KARASAWA Date: Sun, 26 Nov 2017 17:34:16 +0900 Subject: [PATCH 180/379] test: replace function with arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17308 Reviewed-By: Joyee Cheung Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-timers.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-timers.js b/test/parallel/test-timers.js index 120e07a05fa9dd..9a93c55eff5989 100644 --- a/test/parallel/test-timers.js +++ b/test/parallel/test-timers.js @@ -54,12 +54,12 @@ const inputs = [ const timeouts = []; const intervals = []; -inputs.forEach(function(value, index) { - setTimeout(function() { +inputs.forEach((value, index) => { + setTimeout(() => { timeouts[index] = true; }, value); - const handle = setInterval(function() { + const handle = setInterval(() => { clearInterval(handle); // disarm timer or we'll never finish intervals[index] = true; }, value); @@ -68,9 +68,9 @@ inputs.forEach(function(value, index) { // All values in inputs array coerce to 1 ms. Therefore, they should all run // before a timer set here for 2 ms. -setTimeout(common.mustCall(function() { +setTimeout(common.mustCall(() => { // assert that all other timers have run - inputs.forEach(function(value, index) { + inputs.forEach((value, index) => { assert(timeouts[index]); assert(intervals[index]); }); From 0b1448897d3db6accac936f27d3cfc9cada2ac2b Mon Sep 17 00:00:00 2001 From: narirou Date: Sun, 26 Nov 2017 17:28:21 +0900 Subject: [PATCH 181/379] doc: replace function with arrow function in vm.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17307 Reviewed-By: Joyee Cheung Reviewed-By: Yosuke Furukawa Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- doc/api/vm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 209302b450bc09..609ee6b895c91a 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -474,7 +474,7 @@ to the `http` module passed to it. For instance: const vm = require('vm'); const code = ` -(function(require) { +((require) => { const http = require('http'); http.createServer((request, response) => { From e35acedca5d7baa7baa5e0e0399214f3ddbd194f Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 26 Nov 2017 17:51:21 +0900 Subject: [PATCH 182/379] test: refactor using template string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use template string where it's appropriate. PR-URL: https://github.com/nodejs/node/pull/17314 Reviewed-By: Daijiro Wachi Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/abort/test-zlib-invalid-internals-usage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/abort/test-zlib-invalid-internals-usage.js b/test/abort/test-zlib-invalid-internals-usage.js index c076c7df5e4410..c218a5ee956f19 100644 --- a/test/abort/test-zlib-invalid-internals-usage.js +++ b/test/abort/test-zlib-invalid-internals-usage.js @@ -13,8 +13,8 @@ if (process.argv[2] === 'child') { assert.strictEqual(child.stdout.toString(), ''); assert.ok(child.stderr.includes( 'WARNING: You are likely using a version of node-tar or npm that ' + - 'is incompatible with this version of Node.js.' + os.EOL + + `is incompatible with this version of Node.js.${os.EOL}` + 'Please use either the version of npm that is bundled with Node.js, or ' + 'a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is ' + - 'compatible with Node.js 9 and above.' + os.EOL)); + `compatible with Node.js 9 and above.${os.EOL}`)); } From 2bd241e974f1a4161b06f7cf05f826ba558b497b Mon Sep 17 00:00:00 2001 From: Leko Date: Sun, 26 Nov 2017 17:54:26 +0900 Subject: [PATCH 183/379] doc: replace string with template string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17316 Reviewed-By: Vse Mozhet Byt Reviewed-By: Yosuke Furukawa Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- doc/api/stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 25a218cf130728..f8d9df9e6ac3ba 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -764,7 +764,7 @@ available data. In the latter case, [`stream.read()`][stream-read] will return const fs = require('fs'); const rr = fs.createReadStream('foo.txt'); rr.on('readable', () => { - console.log('readable:', rr.read()); + console.log(`readable: ${rr.read()}`); }); rr.on('end', () => { console.log('end'); From 120d756e4764877b94e8463017c2f6f533762544 Mon Sep 17 00:00:00 2001 From: Antonio V Date: Sun, 26 Nov 2017 17:13:20 +0900 Subject: [PATCH 184/379] benchmark: refactor to use template string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17313 Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- benchmark/zlib/creation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/zlib/creation.js b/benchmark/zlib/creation.js index 8dd6f85a85775c..5046ef50ecff06 100644 --- a/benchmark/zlib/creation.js +++ b/benchmark/zlib/creation.js @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { function main(conf) { const n = +conf.n; - const fn = zlib['create' + conf.type]; + const fn = zlib[`create${conf.type}`]; if (typeof fn !== 'function') throw new Error('Invalid zlib type'); var i = 0; From 97a279e375bc079eef9809c18daebab3d9328203 Mon Sep 17 00:00:00 2001 From: spring_raining Date: Sun, 26 Nov 2017 17:45:11 +0900 Subject: [PATCH 185/379] test: replace function with arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace some classic functions with arrow functions in test-child-process-send-cb.js PR-URL: https://github.com/nodejs/node/pull/17312 Reviewed-By: Ron Korving Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-child-process-send-cb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-child-process-send-cb.js b/test/parallel/test-child-process-send-cb.js index d65a1abd204a04..daecd722533f57 100644 --- a/test/parallel/test-child-process-send-cb.js +++ b/test/parallel/test-child-process-send-cb.js @@ -4,15 +4,15 @@ const assert = require('assert'); const fork = require('child_process').fork; if (process.argv[2] === 'child') { - process.send('ok', common.mustCall(function(err) { + process.send('ok', common.mustCall((err) => { assert.strictEqual(err, null); })); } else { const child = fork(process.argv[1], ['child']); - child.on('message', common.mustCall(function(message) { + child.on('message', common.mustCall((message) => { assert.strictEqual(message, 'ok'); })); - child.on('exit', common.mustCall(function(exitCode, signalCode) { + child.on('exit', common.mustCall((exitCode, signalCode) => { assert.strictEqual(exitCode, 0); assert.strictEqual(signalCode, null); })); From 91e21171c7d4900d904b14dfc79c83aad04aac17 Mon Sep 17 00:00:00 2001 From: Hiromu Yoshiwara Date: Sun, 26 Nov 2017 17:38:27 +0900 Subject: [PATCH 186/379] test: make use of Number.isNaN to test-readfloat.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17310 Reviewed-By: Yosuke Furukawa Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-readfloat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-readfloat.js b/test/parallel/test-readfloat.js index 137eb732678233..bd64bbefb22fda 100644 --- a/test/parallel/test-readfloat.js +++ b/test/parallel/test-readfloat.js @@ -50,7 +50,7 @@ function test(clazz) { buffer[1] = 0xff; buffer[2] = 0x7f; buffer[3] = 0x7f; - assert.ok(isNaN(buffer.readFloatBE(0))); + assert.ok(Number.isNaN(buffer.readFloatBE(0))); assert.strictEqual(3.4028234663852886e+38, buffer.readFloatLE(0)); buffer[0] = 0xab; From 1adccc6a6a1fdd01674e32f77d07a59e0d9fd7a0 Mon Sep 17 00:00:00 2001 From: yuza yuko Date: Sun, 26 Nov 2017 17:30:40 +0900 Subject: [PATCH 187/379] test: fix isNAN->Number.isNAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17309 Reviewed-By: Yosuke Furukawa Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-writedouble.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-writedouble.js b/test/parallel/test-writedouble.js index b6a53842044340..cb1b0701531f06 100644 --- a/test/parallel/test-writedouble.js +++ b/test/parallel/test-writedouble.js @@ -189,8 +189,8 @@ function test(clazz) { // Darwin ia32 does the other kind of NaN. // Compiler bug. No one really cares. assert(0x7F === buffer[15] || 0xFF === buffer[15]); - assert.ok(isNaN(buffer.readDoubleBE(0))); - assert.ok(isNaN(buffer.readDoubleLE(8))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleLE(8))); } From 0f727c07b969fd954c02caca4fd4e0b571808c20 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Sun, 19 Nov 2017 23:05:31 -0800 Subject: [PATCH 188/379] build: remove empty VCLibrarianTool entry PR-URL: https://github.com/nodejs/node/pull/17191 Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock Reviewed-By: Bartosz Sosnowski Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen --- common.gypi | 2 -- 1 file changed, 2 deletions(-) diff --git a/common.gypi b/common.gypi index 5cc75d763f975c..0ff4779ebb8c98 100644 --- a/common.gypi +++ b/common.gypi @@ -212,8 +212,6 @@ 'DisableSpecificWarnings': ['4267'], 'WarnAsError': 'false', }, - 'VCLibrarianTool': { - }, 'VCLinkerTool': { 'conditions': [ ['target_arch=="ia32"', { From 63f6947a41cddad3e712c576874def0b53f8438a Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 21 Nov 2017 10:33:40 +0100 Subject: [PATCH 189/379] src: make base64.h self-contained This commit includes stdint.h (for uint8_t, uint32_t, and int8_t) to make it self-contained. PR-URL: https://github.com/nodejs/node/pull/17177 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Alexey Orlenko Reviewed-By: Timothy Gu --- src/base64.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/base64.h b/src/base64.h index 89c6251ef8fea6..a19d11f71c65f5 100644 --- a/src/base64.h +++ b/src/base64.h @@ -6,6 +6,7 @@ #include "util.h" #include +#include namespace node { //// Base 64 //// From a0acd91470a1ecc355bda48b0ee1c186fd10fa98 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 11:12:03 -0800 Subject: [PATCH 190/379] doc: caution against removing pseudoheaders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17329 Fixes: https://github.com/nodejs/node/issues/15312 Reviewed-By: Anna Henningsen Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Refael Ackermann Reviewed-By: Tobias Nießen Reviewed-By: Timothy Gu --- doc/api/http2.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 364c1650ee501e..d7bbbc1d132ceb 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2127,6 +2127,18 @@ console.log(request.headers); See [Headers Object][]. +*Note*: In HTTP/2, the request path, host name, protocol, and method are +represented as special headers prefixed with the `:` character (e.g. `':path'`). +These special headers will be included in the `request.headers` object. Care +must be taken not to inadvertently modify these special headers or errors may +occur. For instance, removing all headers from the request will cause errors +to occur: + +```js +removeAllHeaders(request.headers); +assert(request.url); // Fails because the :path header has been removed +``` + #### request.httpVersion `Buffer` instances are also [`Uint8Array`] instances. However, there are subtle -incompatibilities with the TypedArray specification in ECMAScript 2015. +incompatibilities with the TypedArray specification in [`ECMAScript 2015`]. For example, while [`ArrayBuffer#slice()`] creates a copy of the slice, the implementation of [`Buffer#slice()`][`buf.slice()`] creates a view over the existing `Buffer` without copying, making [`Buffer#slice()`][`buf.slice()`] far @@ -291,7 +291,7 @@ function: ## Buffers and ES6 iteration -`Buffer` instances can be iterated over using the ECMAScript 2015 (ES6) `for..of` +`Buffer` instances can be iterated over using the [`ECMAScript 2015`] (ES6) `for..of` syntax. Example: @@ -2755,4 +2755,5 @@ This value may depend on the JS engine that is being used. [RFC1345]: https://tools.ietf.org/html/rfc1345 [RFC4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5 [WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/ +[`ECMAScript 2015`]: https://www.ecma-international.org/ecma-262/6.0/index.html [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols From 7ae7124039e6a9c7af8a2d53d8b209d12031a7c4 Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Fri, 24 Nov 2017 16:29:38 -0500 Subject: [PATCH 193/379] module: add builtinModules Provides list of all builtin modules in Node. Includes modules of all types: - prefixed (ex: _tls_common) - deprecated (ex: sys) - regular (ex: vm) PR-URL: https://github.com/nodejs/node/pull/16386 Refs: https://github.com/nodejs/node/issues/3307 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- doc/api/modules.md | 22 ++++++++++++++++++++++ lib/module.js | 6 ++++++ test/parallel/test-module-builtin.js | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 test/parallel/test-module-builtin.js diff --git a/doc/api/modules.md b/doc/api/modules.md index 0b0e62b5bc3402..f9f311d241ce92 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -817,6 +817,28 @@ The `module.require` method provides a way to load a module as if `module` is typically *only* available within a specific module's code, it must be explicitly exported in order to be used. +## The `Module` Object + + + +* {Object} + +Provides general utility methods when interacting with instances of +`Module` -- the `module` variable often seen in file modules. Accessed +via `require('module')`. + +### module.builtinModules + + +* {string[]} + +A list of the names of all modules provided by Node.js. Can be used to verify +if a module is maintained by a third-party module or not. + [`__dirname`]: #modules_dirname [`__filename`]: #modules_filename [`Error`]: errors.html#errors_class_error diff --git a/lib/module.js b/lib/module.js index 0f63fe9a2ca2f5..7d4e2f31812bcc 100644 --- a/lib/module.js +++ b/lib/module.js @@ -74,6 +74,12 @@ function Module(id, parent) { } module.exports = Module; +const builtinModules = Object.keys(NativeModule._source) + .filter(NativeModule.nonInternalExists); + +Object.freeze(builtinModules); +Module.builtinModules = builtinModules; + Module._cache = Object.create(null); Module._pathCache = Object.create(null); Module._extensions = Object.create(null); diff --git a/test/parallel/test-module-builtin.js b/test/parallel/test-module-builtin.js new file mode 100644 index 00000000000000..3897d71ecf4405 --- /dev/null +++ b/test/parallel/test-module-builtin.js @@ -0,0 +1,14 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { builtinModules } = require('module'); + +// Includes modules in lib/ (even deprecated ones) +assert(builtinModules.includes('http')); +assert(builtinModules.includes('sys')); + +// Does not include internal modules +assert.deepStrictEqual( + builtinModules.filter((mod) => mod.startsWith('internal/')), + [] +); From 1e3aed0be3e9c283a8427dc6c36baf1bfb16cfda Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 27 Nov 2017 22:55:14 +0100 Subject: [PATCH 194/379] test: fix flaky parallel/test-http2-client-upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In parallel/test-http2-client-upload, the `client.destroy()` call could terminate the connection before all data was sent over the wire successfully. Using `client.shutdown()` removes the flakiness. Also, listen on `req.on('finish')` rather than the file stream’s `end` event, since we’re not interested in when the source stream finishes, but rather when the HTTP/2 stream finishes. PR-URL: https://github.com/nodejs/node/pull/17361 Refs: https://github.com/nodejs/node/pull/17356 Reviewed-By: James M Snell Reviewed-By: Kyle Farnung Reviewed-By: Refael Ackermann Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss --- test/parallel/test-http2-client-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http2-client-upload.js b/test/parallel/test-http2-client-upload.js index cfba97696ce227..8fb5f369ca4cb7 100644 --- a/test/parallel/test-http2-client-upload.js +++ b/test/parallel/test-http2-client-upload.js @@ -38,7 +38,7 @@ fs.readFile(loc, common.mustCall((err, data) => { function maybeClose() { if (--remaining === 0) { server.close(); - client.destroy(); + client.shutdown(); } } @@ -47,7 +47,7 @@ fs.readFile(loc, common.mustCall((err, data) => { req.resume(); req.on('end', common.mustCall(maybeClose)); const str = fs.createReadStream(loc); - str.on('end', common.mustCall(maybeClose)); + req.on('finish', common.mustCall(maybeClose)); str.pipe(req); })); })); From 5756d67f95f667b0eba3c575303b3f8081fec7f3 Mon Sep 17 00:00:00 2001 From: Leko Date: Mon, 27 Nov 2017 20:47:27 +0900 Subject: [PATCH 195/379] doc: fix typo occuring -> occurring PR-URL: https://github.com/nodejs/node/pull/17350 Reviewed-By: Yosuke Furukawa Reviewed-By: Richard Lau Reviewed-By: Gireesh Punathil Reviewed-By: Daniel Bevenius Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: Colin Ihrig --- doc/api/util.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index f116c840e315cc..ba570749888c88 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -672,7 +672,7 @@ supported encodings or an alias. * Returns: {string} Decodes the `input` and returns a string. If `options.stream` is `true`, any -incomplete byte sequences occuring at the end of the `input` are buffered +incomplete byte sequences occurring at the end of the `input` are buffered internally and emitted after the next call to `textDecoder.decode()`. If `textDecoder.fatal` is `true`, decoding errors that occur will result in a From 5a4b6c4bc07de353c9726169d0304f4eda26763c Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Sun, 26 Nov 2017 20:23:13 -0500 Subject: [PATCH 196/379] http: do not assign intermediate variable No need for binding, it's only used in the next line to declare more variables :) PR-URL: https://github.com/nodejs/node/pull/17335 Reviewed-By: Anna Henningsen Reviewed-By: Yuta Hiroto Reviewed-By: Daniel Bevenius --- lib/_http_common.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_http_common.js b/lib/_http_common.js index 6f5378fbe275e8..ad0dec520d1210 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -21,8 +21,7 @@ 'use strict'; -const binding = process.binding('http_parser'); -const { methods, HTTPParser } = binding; +const { methods, HTTPParser } = process.binding('http_parser'); const FreeList = require('internal/freelist'); const { ondrain } = require('internal/http'); From 4a749c3a709a99571fdfd7a0c77d3731b31d14c4 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Date: Sun, 26 Nov 2017 22:27:00 +0530 Subject: [PATCH 197/379] test: Update test-http-client-agent to use countdown timer PR-URL: https://github.com/nodejs/node/pull/17325 Refs: https://github.com/nodejs/node/issues/17169 Reviewed-By: James M Snell Reviewed-By: Jon Moss Reviewed-By: Anna Henningsen --- test/parallel/test-http-client-agent.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js index f2d1b612b5af82..3ae906f09c92ae 100644 --- a/test/parallel/test-http-client-agent.js +++ b/test/parallel/test-http-client-agent.js @@ -23,10 +23,10 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); let name; const max = 3; -let count = 0; const server = http.Server(common.mustCall((req, res) => { if (req.url === '/0') { @@ -45,6 +45,12 @@ server.listen(0, common.mustCall(() => { request(i); })); +const countdown = new Countdown(max, () => { + assert(!http.globalAgent.sockets.hasOwnProperty(name)); + assert(!http.globalAgent.requests.hasOwnProperty(name)); + server.close(); +}); + function request(i) { const req = http.get({ port: server.address().port, @@ -52,14 +58,10 @@ function request(i) { }, function(res) { const socket = req.socket; socket.on('close', common.mustCall(() => { - ++count; - if (count < max) { + countdown.dec(); + if (countdown.remaining > 0) { assert.strictEqual(http.globalAgent.sockets[name].includes(socket), false); - } else { - assert(!http.globalAgent.sockets.hasOwnProperty(name)); - assert(!http.globalAgent.requests.hasOwnProperty(name)); - server.close(); } })); res.resume(); From b033d38022cab1d52c6f4c13f8bb3f7b983e77a1 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Date: Sun, 26 Nov 2017 19:29:34 +0530 Subject: [PATCH 198/379] test: Update test-http-parser-free to use countdown timer PR-URL: https://github.com/nodejs/node/pull/17322 Refs: https://github.com/nodejs/node/issues/17169 Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- test/parallel/test-http-parser-free.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-http-parser-free.js b/test/parallel/test-http-parser-free.js index 1ead3c14928d88..935d4d2ef443b0 100644 --- a/test/parallel/test-http-parser-free.js +++ b/test/parallel/test-http-parser-free.js @@ -23,13 +23,15 @@ require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const N = 100; -let responses = 0; const server = http.createServer(function(req, res) { res.end('Hello'); }); +const countdown = new Countdown(N, () => server.close()); + server.listen(0, function() { http.globalAgent.maxSockets = 1; let parser; @@ -42,15 +44,9 @@ server.listen(0, function() { assert.strictEqual(req.parser, parser); } - if (++responses === N) { - server.close(); - } + countdown.dec(); res.resume(); }); })(i); } }); - -process.on('exit', function() { - assert.strictEqual(responses, N); -}); From 46c1d999d9e60e11bb964aeee52b30ff3d427653 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 24 Nov 2017 10:50:19 +0800 Subject: [PATCH 199/379] build: add make lint-js-fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17283 Reviewed-By: Gibson Fahnestock Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Michaël Zasso --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 746b88486bff7a..d1f3f661835d5f 100644 --- a/Makefile +++ b/Makefile @@ -1031,6 +1031,13 @@ LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \ --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \ $(LINT_JS_TARGETS) +lint-js-fix: + @if [ -x $(NODE) ]; then \ + $(NODE) $(LINT_JS_CMD) --fix; \ + else \ + node $(LINT_JS_CMD) --fix; \ + fi + lint-js: @echo "Running JS linter..." @if [ -x $(NODE) ]; then \ @@ -1177,6 +1184,7 @@ lint-clean: lint-cpp \ lint-js \ lint-js-ci \ + lint-js-fix \ list-gtests \ lint-md \ lint-md-build \ From 24d08fee4557a7af4404efaebd83de12921a8b36 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 22 Nov 2017 15:39:07 +0530 Subject: [PATCH 200/379] test: refactored http test to use countdown PR-URL: https://github.com/nodejs/node/pull/17241 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Anatoli Papirovski Reviewed-By: Anna Henningsen --- test/parallel/test-http-end-throw-socket-handling.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-end-throw-socket-handling.js b/test/parallel/test-http-end-throw-socket-handling.js index b6da0a96eaf335..956096270ecc1b 100644 --- a/test/parallel/test-http-end-throw-socket-handling.js +++ b/test/parallel/test-http-end-throw-socket-handling.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const Countdown = require('../common/countdown'); // Make sure that throwing in 'end' handler doesn't lock // up the socket forever. @@ -29,10 +30,10 @@ const common = require('../common'); // the same, we should not be so brittle and easily broken. const http = require('http'); +const countdown = new Countdown(10, () => server.close()); -let n = 0; const server = http.createServer((req, res) => { - if (++n === 10) server.close(); + countdown.dec(); res.end('ok'); }); From 0443909848fa6cd8ed32a02e0420c441b03cf622 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Mon, 23 Oct 2017 19:37:43 -0400 Subject: [PATCH 201/379] doc: move Code of Conduct to admin repo The CoC and moderation guidelines now live in the Admin repo. This PR updates the copy of CODE_OF_CONDUCT.md and references in other documents to the proper location. PR-URL: https://github.com/nodejs/node/pull/17301 Reviewed-By: Jon Moss Reviewed-By: Joyee Cheung --- CODE_OF_CONDUCT.md | 5 ++++- CONTRIBUTING.md | 2 +- README.md | 2 +- doc/onboarding.md | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d9ad342881c1a9..5a935352a1f9f0 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,5 +1,8 @@ # Code of Conduct The Node.js Code of Conduct document has moved to -https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md. Please update +https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. Please update links to this document accordingly. + +The Node.js Moderation policy can be found at +https://github.com/nodejs/admin/blob/master/Moderation-Policy.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 633b28e3b32795..9cd14793ef58a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -862,7 +862,7 @@ By making a contribution to this project, I certify that: [benchmark results]: ./doc/guides/writing-and-running-benchmarks.md [Building guide]: ./BUILDING.md [CI (Continuous Integration) test run]: #ci-testing -[Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md +[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [https://ci.nodejs.org/]: https://ci.nodejs.org/ [IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 [Node.js help repository]: https://github.com/nodejs/help/issues diff --git a/README.md b/README.md index fdff7d217262aa..388ad68097b4eb 100644 --- a/README.md +++ b/README.md @@ -589,7 +589,7 @@ Previous releases may also have been signed with one of the following GPG keys: * [Working Groups][] [npm]: https://www.npmjs.com -[Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md +[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [Contributing to the project]: CONTRIBUTING.md [Node.js Help]: https://github.com/nodejs/help [Node.js Website]: https://nodejs.org/en/ diff --git a/doc/onboarding.md b/doc/onboarding.md index 09cbb432a2bb85..dd3c4028478661 100644 --- a/doc/onboarding.md +++ b/doc/onboarding.md @@ -178,6 +178,6 @@ onboarding session. accommodation, transportation, visa fees etc. if needed. Check out the [summit](https://github.com/nodejs/summit) repository for details. -[Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md +[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [`core-validate-commit`]: https://github.com/evanlucas/core-validate-commit [`node-core-utils`]: https://github.com/nodejs/node-core-utils From 048878288bf9a5350be895a3a5c62c50dfc824f8 Mon Sep 17 00:00:00 2001 From: Jamie Davis Date: Wed, 22 Nov 2017 10:03:17 -0500 Subject: [PATCH 202/379] doc: non-partitioned async crypto operations Neither crypto.randomBytes nor crypto.randomFill partitions the work submitted to the threadpool. This change was suggested during the discussion of #17054. See also #17154. PR-URL: https://github.com/nodejs/node/pull/17250 Refs: https://github.com/nodejs/node/pull/17154 Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Anna Henningsen --- doc/api/crypto.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 5a3a69215cc729..9d6e344667520e 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1826,6 +1826,11 @@ Note that this API uses libuv's threadpool, which can have surprising and negative performance implications for some applications, see the [`UV_THREADPOOL_SIZE`][] documentation for more information. +*Note*: The asynchronous version of `crypto.randomBytes()` is carried out +in a single threadpool request. To minimize threadpool task length variation, +partition large `randomBytes` requests when doing so as part of fulfilling a +client request. + ### crypto.randomFillSync(buffer[, offset][, size]) 0.42261 -// 256 --> 0.57851 -// 512 --> 0.74851 -// 1024 --> 0.89384 -// 2048 --> 0.97583 -// -// Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 -// Random Distribution Ration = 512/(5401-512)=0.105 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR - -jschardet.BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75; - -//Char to FreqOrder table -jschardet.BIG5_TABLE_SIZE = 5376; - -jschardet.Big5CharToFreqOrder = [ - 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, // 16 -3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, // 32 -1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, // 48 - 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, // 64 -3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, // 80 -4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, // 96 -5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, // 112 - 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, // 128 - 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, // 144 - 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, // 160 -2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, // 176 -1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, // 192 -3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, // 208 - 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, // 224 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, // 240 -3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, // 256 -2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, // 272 - 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, // 288 -3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, // 304 -1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, // 320 -5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, // 336 - 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, // 352 -5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, // 368 -1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, // 384 - 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, // 400 - 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, // 416 -3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, // 432 -3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, // 448 - 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, // 464 -2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, // 480 -2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, // 496 - 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, // 512 - 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, // 528 -3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, // 544 -1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, // 560 -1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, // 576 -1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, // 592 -2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, // 608 - 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, // 624 -4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, // 640 -1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, // 656 -5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, // 672 -2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, // 688 - 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, // 704 - 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, // 720 - 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, // 736 - 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, // 752 -5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, // 768 - 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, // 784 -1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, // 800 - 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, // 816 - 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, // 832 -5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, // 848 -1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, // 864 - 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, // 880 -3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, // 896 -4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, // 912 -3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, // 928 - 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, // 944 - 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, // 960 -1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, // 976 -4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, // 992 -3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, // 1008 -3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, // 1024 -2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, // 1040 -5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, // 1056 -3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, // 1072 -5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, // 1088 -1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, // 1104 -2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, // 1120 -1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, // 1136 - 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, // 1152 -1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, // 1168 -4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, // 1184 -3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, // 1200 - 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, // 1216 - 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, // 1232 - 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, // 1248 -2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, // 1264 -5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, // 1280 -1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, // 1296 -2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, // 1312 -1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, // 1328 -1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, // 1344 -5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, // 1360 -5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, // 1376 -5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, // 1392 -3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, // 1408 -4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, // 1424 -4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, // 1440 -2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, // 1456 -5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, // 1472 -3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, // 1488 - 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, // 1504 -5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, // 1520 -5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, // 1536 -1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, // 1552 -2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, // 1568 -3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, // 1584 -4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, // 1600 -5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, // 1616 -3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, // 1632 -4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, // 1648 -1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, // 1664 -1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, // 1680 -4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, // 1696 -1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, // 1712 - 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, // 1728 -1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, // 1744 -1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, // 1760 -3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, // 1776 - 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, // 1792 -5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, // 1808 -2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, // 1824 -1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, // 1840 -1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, // 1856 -5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, // 1872 - 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, // 1888 -4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, // 1904 - 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, // 1920 -2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, // 1936 - 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, // 1952 -1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, // 1968 -1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, // 1984 - 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, // 2000 -4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, // 2016 -4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, // 2032 -1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, // 2048 -3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, // 2064 -5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, // 2080 -5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, // 2096 -1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, // 2112 -2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, // 2128 -1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, // 2144 -3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, // 2160 -2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, // 2176 -3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, // 2192 -2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, // 2208 -4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, // 2224 -4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, // 2240 -3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, // 2256 - 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, // 2272 -3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, // 2288 - 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, // 2304 -3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, // 2320 -4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, // 2336 -3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, // 2352 -1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, // 2368 -5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, // 2384 - 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, // 2400 -5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, // 2416 -1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, // 2432 - 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, // 2448 -4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, // 2464 -4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, // 2480 - 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, // 2496 -2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, // 2512 -2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, // 2528 -3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, // 2544 -1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, // 2560 -4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, // 2576 -2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, // 2592 -1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, // 2608 -1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, // 2624 -2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, // 2640 -3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, // 2656 -1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, // 2672 -5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, // 2688 -1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, // 2704 -4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, // 2720 -1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, // 2736 - 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, // 2752 -1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, // 2768 -4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, // 2784 -4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, // 2800 -2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, // 2816 -1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, // 2832 -4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, // 2848 - 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, // 2864 -5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, // 2880 -2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, // 2896 -3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, // 2912 -4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, // 2928 - 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, // 2944 -5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, // 2960 -5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, // 2976 -1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, // 2992 -4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, // 3008 -4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, // 3024 -2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, // 3040 -3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, // 3056 -3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, // 3072 -2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, // 3088 -1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, // 3104 -4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, // 3120 -3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, // 3136 -3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, // 3152 -2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, // 3168 -4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, // 3184 -5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, // 3200 -3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, // 3216 -2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, // 3232 -3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, // 3248 -1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, // 3264 -2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, // 3280 -3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, // 3296 -4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, // 3312 -2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, // 3328 -2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, // 3344 -5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, // 3360 -1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, // 3376 -2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, // 3392 -1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, // 3408 -3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, // 3424 -4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, // 3440 -2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, // 3456 -3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, // 3472 -3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, // 3488 -2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, // 3504 -4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, // 3520 -2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, // 3536 -3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, // 3552 -4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, // 3568 -5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, // 3584 -3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, // 3600 - 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, // 3616 -1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, // 3632 -4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, // 3648 -1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, // 3664 -4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, // 3680 -5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, // 3696 - 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, // 3712 -5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, // 3728 -5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, // 3744 -2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, // 3760 -3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, // 3776 -2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, // 3792 -2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, // 3808 - 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, // 3824 -1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, // 3840 -4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, // 3856 -3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, // 3872 -3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, // 3888 - 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, // 3904 -2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, // 3920 - 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, // 3936 -2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, // 3952 -4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, // 3968 -1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, // 3984 -4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, // 4000 -1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, // 4016 -3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, // 4032 - 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, // 4048 -3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, // 4064 -5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, // 4080 -5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, // 4096 -3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, // 4112 -3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, // 4128 -1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, // 4144 -2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, // 4160 -5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, // 4176 -1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, // 4192 -1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, // 4208 -3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, // 4224 - 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, // 4240 -1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, // 4256 -4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, // 4272 -5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, // 4288 -2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, // 4304 -3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, // 4320 - 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, // 4336 -1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, // 4352 -2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, // 4368 -2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, // 4384 -5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, // 4400 -5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, // 4416 -5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, // 4432 -2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, // 4448 -2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, // 4464 -1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, // 4480 -4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, // 4496 -3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, // 4512 -3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, // 4528 -4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, // 4544 -4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, // 4560 -2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, // 4576 -2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, // 4592 -5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, // 4608 -4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, // 4624 -5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, // 4640 -4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, // 4656 - 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, // 4672 - 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, // 4688 -1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, // 4704 -3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, // 4720 -4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, // 4736 -1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, // 4752 -5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, // 4768 -2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, // 4784 -2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, // 4800 -3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, // 4816 -5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, // 4832 -1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, // 4848 -3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, // 4864 -5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, // 4880 -1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, // 4896 -5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, // 4912 -2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, // 4928 -3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, // 4944 -2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, // 4960 -3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, // 4976 -3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, // 4992 -3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, // 5008 -4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, // 5024 - 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, // 5040 -2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, // 5056 -4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, // 5072 -3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, // 5088 -5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, // 5104 -1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, // 5120 -5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, // 5136 - 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, // 5152 -1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, // 5168 - 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, // 5184 -4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, // 5200 -1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, // 5216 -4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, // 5232 -1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, // 5248 - 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, // 5264 -3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, // 5280 -4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, // 5296 -5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, // 5312 - 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, // 5328 -3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, // 5344 - 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, // 5360 -2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, // 5376 //last 512 -//Everything below is of no interest for detection purpose -2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, // 5392 -2500,3034,3800,5803,5804,2195,4814,5805,2163,5806,5807,5808,5809,5810,5811,5812, // 5408 -5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828, // 5424 -5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844, // 5440 -5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860, // 5456 -5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876, // 5472 -5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892, // 5488 -5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908, // 5504 -5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924, // 5520 -5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940, // 5536 -5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956, // 5552 -5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972, // 5568 -5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988, // 5584 -5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004, // 5600 -6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020, // 5616 -6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036, // 5632 -6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052, // 5648 -6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068, // 5664 -6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084, // 5680 -6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100, // 5696 -6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116, // 5712 -6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132, // 5728 -6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148, // 5744 -6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164, // 5760 -6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180, // 5776 -6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196, // 5792 -6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212, // 5808 -6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,3670,6224,6225,6226,6227, // 5824 -6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243, // 5840 -6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259, // 5856 -6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275, // 5872 -6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,4815,6286,6287,6288,6289,6290, // 5888 -6291,6292,4816,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305, // 5904 -6306,6307,6308,6309,6310,6311,4817,4818,6312,6313,6314,6315,6316,6317,6318,4819, // 5920 -6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334, // 5936 -6335,6336,6337,4820,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349, // 5952 -6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365, // 5968 -6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381, // 5984 -6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397, // 6000 -6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,3441,6411,6412, // 6016 -6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,4440,6426,6427, // 6032 -6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443, // 6048 -6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,4821,6455,6456,6457,6458, // 6064 -6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474, // 6080 -6475,6476,6477,3947,3948,6478,6479,6480,6481,3272,4441,6482,6483,6484,6485,4442, // 6096 -6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,4822,6497,6498,6499,6500, // 6112 -6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516, // 6128 -6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532, // 6144 -6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548, // 6160 -6549,6550,6551,6552,6553,6554,6555,6556,2784,6557,4823,6558,6559,6560,6561,6562, // 6176 -6563,6564,6565,6566,6567,6568,6569,3949,6570,6571,6572,4824,6573,6574,6575,6576, // 6192 -6577,6578,6579,6580,6581,6582,6583,4825,6584,6585,6586,3950,2785,6587,6588,6589, // 6208 -6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605, // 6224 -6606,6607,6608,6609,6610,6611,6612,4826,6613,6614,6615,4827,6616,6617,6618,6619, // 6240 -6620,6621,6622,6623,6624,6625,4164,6626,6627,6628,6629,6630,6631,6632,6633,6634, // 6256 -3547,6635,4828,6636,6637,6638,6639,6640,6641,6642,3951,2984,6643,6644,6645,6646, // 6272 -6647,6648,6649,4165,6650,4829,6651,6652,4830,6653,6654,6655,6656,6657,6658,6659, // 6288 -6660,6661,6662,4831,6663,6664,6665,6666,6667,6668,6669,6670,6671,4166,6672,4832, // 6304 -3952,6673,6674,6675,6676,4833,6677,6678,6679,4167,6680,6681,6682,3198,6683,6684, // 6320 -6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,4834,6698,6699, // 6336 -6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715, // 6352 -6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731, // 6368 -6732,6733,6734,4443,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,4444, // 6384 -6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761, // 6400 -6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777, // 6416 -6778,6779,6780,6781,4168,6782,6783,3442,6784,6785,6786,6787,6788,6789,6790,6791, // 6432 -4169,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806, // 6448 -6807,6808,6809,6810,6811,4835,6812,6813,6814,4445,6815,6816,4446,6817,6818,6819, // 6464 -6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835, // 6480 -3548,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,4836,6847,6848,6849, // 6496 -6850,6851,6852,6853,6854,3953,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864, // 6512 -6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,3199,6878,6879, // 6528 -6880,6881,6882,4447,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894, // 6544 -6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,4170,6905,6906,6907,6908,6909, // 6560 -6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925, // 6576 -6926,6927,4837,6928,6929,6930,6931,6932,6933,6934,6935,6936,3346,6937,6938,4838, // 6592 -6939,6940,6941,4448,6942,6943,6944,6945,6946,4449,6947,6948,6949,6950,6951,6952, // 6608 -6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968, // 6624 -6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984, // 6640 -6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,3671,6995,6996,6997,6998,4839, // 6656 -6999,7000,7001,7002,3549,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013, // 6672 -7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029, // 6688 -7030,4840,7031,7032,7033,7034,7035,7036,7037,7038,4841,7039,7040,7041,7042,7043, // 6704 -7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059, // 6720 -7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,2985,7071,7072,7073,7074, // 6736 -7075,7076,7077,7078,7079,7080,4842,7081,7082,7083,7084,7085,7086,7087,7088,7089, // 6752 -7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105, // 6768 -7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,4450,7119,7120, // 6784 -7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136, // 6800 -7137,7138,7139,7140,7141,7142,7143,4843,7144,7145,7146,7147,7148,7149,7150,7151, // 6816 -7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167, // 6832 -7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183, // 6848 -7184,7185,7186,7187,7188,4171,4172,7189,7190,7191,7192,7193,7194,7195,7196,7197, // 6864 -7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213, // 6880 -7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229, // 6896 -7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245, // 6912 -7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261, // 6928 -7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277, // 6944 -7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293, // 6960 -7294,7295,7296,4844,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308, // 6976 -7309,7310,7311,7312,7313,7314,7315,7316,4451,7317,7318,7319,7320,7321,7322,7323, // 6992 -7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339, // 7008 -7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,4173,7354, // 7024 -7355,4845,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369, // 7040 -7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385, // 7056 -7386,7387,7388,4846,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400, // 7072 -7401,7402,7403,7404,7405,3672,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415, // 7088 -7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431, // 7104 -7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447, // 7120 -7448,7449,7450,7451,7452,7453,4452,7454,3200,7455,7456,7457,7458,7459,7460,7461, // 7136 -7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,4847,7475,7476, // 7152 -7477,3133,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491, // 7168 -7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,3347,7503,7504,7505,7506, // 7184 -7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,4848, // 7200 -7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537, // 7216 -7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,3801,4849,7550,7551, // 7232 -7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, // 7248 -7568,7569,3035,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582, // 7264 -7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598, // 7280 -7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614, // 7296 -7615,7616,4850,7617,7618,3802,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628, // 7312 -7629,7630,7631,7632,4851,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643, // 7328 -7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659, // 7344 -7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,4453,7671,7672,7673,7674, // 7360 -7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690, // 7376 -7691,7692,7693,7694,7695,7696,7697,3443,7698,7699,7700,7701,7702,4454,7703,7704, // 7392 -7705,7706,7707,7708,7709,7710,7711,7712,7713,2472,7714,7715,7716,7717,7718,7719, // 7408 -7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,3954,7732,7733,7734, // 7424 -7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750, // 7440 -3134,7751,7752,4852,7753,7754,7755,4853,7756,7757,7758,7759,7760,4174,7761,7762, // 7456 -7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778, // 7472 -7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794, // 7488 -7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,4854,7806,7807,7808,7809, // 7504 -7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825, // 7520 -4855,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7536 -7841,7842,7843,7844,7845,7846,7847,3955,7848,7849,7850,7851,7852,7853,7854,7855, // 7552 -7856,7857,7858,7859,7860,3444,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870, // 7568 -7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886, // 7584 -7887,7888,7889,7890,7891,4175,7892,7893,7894,7895,7896,4856,4857,7897,7898,7899, // 7600 -7900,2598,7901,7902,7903,7904,7905,7906,7907,7908,4455,7909,7910,7911,7912,7913, // 7616 -7914,3201,7915,7916,7917,7918,7919,7920,7921,4858,7922,7923,7924,7925,7926,7927, // 7632 -7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943, // 7648 -7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959, // 7664 -7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975, // 7680 -7976,7977,7978,7979,7980,7981,4859,7982,7983,7984,7985,7986,7987,7988,7989,7990, // 7696 -7991,7992,7993,7994,7995,7996,4860,7997,7998,7999,8000,8001,8002,8003,8004,8005, // 7712 -8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,4176,8017,8018,8019,8020, // 7728 -8021,8022,8023,4861,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035, // 7744 -8036,4862,4456,8037,8038,8039,8040,4863,8041,8042,8043,8044,8045,8046,8047,8048, // 7760 -8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064, // 7776 -8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080, // 7792 -8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096, // 7808 -8097,8098,8099,4864,4177,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110, // 7824 -8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,4178,8121,8122,8123,8124,8125, // 7840 -8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141, // 7856 -8142,8143,8144,8145,4865,4866,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155, // 7872 -8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,4179,8166,8167,8168,8169,8170, // 7888 -8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,4457,8182,8183,8184,8185, // 7904 -8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201, // 7920 -8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217, // 7936 -8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233, // 7952 -8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249, // 7968 -8250,8251,8252,8253,8254,8255,8256,3445,8257,8258,8259,8260,8261,8262,4458,8263, // 7984 -8264,8265,8266,8267,8268,8269,8270,8271,8272,4459,8273,8274,8275,8276,3550,8277, // 8000 -8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,4460,8290,8291,8292, // 8016 -8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,4867, // 8032 -8308,8309,8310,8311,8312,3551,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322, // 8048 -8323,8324,8325,8326,4868,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337, // 8064 -8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353, // 8080 -8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,4869,4461,8364,8365,8366,8367, // 8096 -8368,8369,8370,4870,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382, // 8112 -8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398, // 8128 -8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,4871,8411,8412,8413, // 8144 -8414,8415,8416,8417,8418,8419,8420,8421,8422,4462,8423,8424,8425,8426,8427,8428, // 8160 -8429,8430,8431,8432,8433,2986,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443, // 8176 -8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459, // 8192 -8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475, // 8208 -8476,8477,8478,4180,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490, // 8224 -8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506, // 8240 -8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522, // 8256 -8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538, // 8272 -8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554, // 8288 -8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,4872,8565,8566,8567,8568,8569, // 8304 -8570,8571,8572,8573,4873,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584, // 8320 -8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600, // 8336 -8601,8602,8603,8604,8605,3803,8606,8607,8608,8609,8610,8611,8612,8613,4874,3804, // 8352 -8614,8615,8616,8617,8618,8619,8620,8621,3956,8622,8623,8624,8625,8626,8627,8628, // 8368 -8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,2865,8639,8640,8641,8642,8643, // 8384 -8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,4463,8657,8658, // 8400 -8659,4875,4876,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672, // 8416 -8673,8674,8675,8676,8677,8678,8679,8680,8681,4464,8682,8683,8684,8685,8686,8687, // 8432 -8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, // 8448 -8704,8705,8706,8707,8708,8709,2261,8710,8711,8712,8713,8714,8715,8716,8717,8718, // 8464 -8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,4181, // 8480 -8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749, // 8496 -8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,4877,8764, // 8512 -8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780, // 8528 -8781,8782,8783,8784,8785,8786,8787,8788,4878,8789,4879,8790,8791,8792,4880,8793, // 8544 -8794,8795,8796,8797,8798,8799,8800,8801,4881,8802,8803,8804,8805,8806,8807,8808, // 8560 -8809,8810,8811,8812,8813,8814,8815,3957,8816,8817,8818,8819,8820,8821,8822,8823, // 8576 -8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839, // 8592 -8840,8841,8842,8843,8844,8845,8846,8847,4882,8848,8849,8850,8851,8852,8853,8854, // 8608 -8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870, // 8624 -8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,3202,8885, // 8640 -8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901, // 8656 -8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917, // 8672 -8918,8919,8920,8921,8922,8923,8924,4465,8925,8926,8927,8928,8929,8930,8931,8932, // 8688 -4883,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,2214,8944,8945,8946, // 8704 -8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962, // 8720 -8963,8964,8965,4884,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977, // 8736 -8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,4885, // 8752 -8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008, // 8768 -9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,4182,9022,9023, // 8784 -9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039, // 8800 -9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055, // 8816 -9056,9057,9058,9059,9060,9061,9062,9063,4886,9064,9065,9066,9067,9068,9069,4887, // 8832 -9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085, // 8848 -9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101, // 8864 -9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117, // 8880 -9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133, // 8896 -9134,9135,9136,9137,9138,9139,9140,9141,3958,9142,9143,9144,9145,9146,9147,9148, // 8912 -9149,9150,9151,4888,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163, // 8928 -9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,4889,9176,9177,9178, // 8944 -9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194, // 8960 -9195,9196,9197,9198,9199,9200,9201,9202,9203,4890,9204,9205,9206,9207,9208,9209, // 8976 -9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,4466,9223,9224, // 8992 -9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240, // 9008 -9241,9242,9243,9244,9245,4891,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255, // 9024 -9256,9257,4892,9258,9259,9260,9261,4893,4894,9262,9263,9264,9265,9266,9267,9268, // 9040 -9269,9270,9271,9272,9273,4467,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283, // 9056 -9284,9285,3673,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298, // 9072 -9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314, // 9088 -9315,9316,9317,9318,9319,9320,9321,9322,4895,9323,9324,9325,9326,9327,9328,9329, // 9104 -9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345, // 9120 -9346,9347,4468,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360, // 9136 -9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,4896,9374,4469, // 9152 -9375,9376,9377,9378,9379,4897,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389, // 9168 -9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405, // 9184 -9406,4470,9407,2751,9408,9409,3674,3552,9410,9411,9412,9413,9414,9415,9416,9417, // 9200 -9418,9419,9420,9421,4898,9422,9423,9424,9425,9426,9427,9428,9429,3959,9430,9431, // 9216 -9432,9433,9434,9435,9436,4471,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446, // 9232 -9447,9448,9449,9450,3348,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461, // 9248 -9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,4899,9473,9474,9475,9476, // 9264 -9477,4900,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,3349,9489,9490, // 9280 -9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506, // 9296 -9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,4901,9521, // 9312 -9522,9523,9524,9525,9526,4902,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536, // 9328 -9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552, // 9344 -9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568, // 9360 -9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584, // 9376 -3805,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599, // 9392 -9600,9601,9602,4903,9603,9604,9605,9606,9607,4904,9608,9609,9610,9611,9612,9613, // 9408 -9614,4905,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628, // 9424 -9629,9630,9631,9632,4906,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643, // 9440 -4907,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658, // 9456 -9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,4183,9673, // 9472 -9674,9675,9676,9677,4908,9678,9679,9680,9681,4909,9682,9683,9684,9685,9686,9687, // 9488 -9688,9689,9690,4910,9691,9692,9693,3675,9694,9695,9696,2945,9697,9698,9699,9700, // 9504 -9701,9702,9703,9704,9705,4911,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715, // 9520 -9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731, // 9536 -9732,9733,9734,9735,4912,9736,9737,9738,9739,9740,4913,9741,9742,9743,9744,9745, // 9552 -9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,4914,9759,9760, // 9568 -9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776, // 9584 -9777,9778,9779,9780,9781,9782,4915,9783,9784,9785,9786,9787,9788,9789,9790,9791, // 9600 -9792,9793,4916,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806, // 9616 -9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822, // 9632 -9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838, // 9648 -9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854, // 9664 -9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,4917,9869, // 9680 -9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885, // 9696 -9886,9887,9888,9889,9890,9891,9892,4472,9893,9894,9895,9896,9897,3806,9898,9899, // 9712 -9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,4918, // 9728 -9915,9916,9917,4919,9918,9919,9920,9921,4184,9922,9923,9924,9925,9926,9927,9928, // 9744 -9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944, // 9760 -9945,9946,4920,9947,9948,9949,9950,9951,9952,9953,9954,9955,4185,9956,9957,9958, // 9776 -9959,9960,9961,9962,9963,9964,9965,4921,9966,9967,9968,4473,9969,9970,9971,9972, // 9792 -9973,9974,9975,9976,9977,4474,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987, // 9808 -9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003, // 9824 -10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019, // 9840 -10020,10021,4922,10022,4923,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033, // 9856 -10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,4924, // 9872 -10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064, // 9888 -10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080, // 9904 -10081,10082,10083,10084,10085,10086,10087,4475,10088,10089,10090,10091,10092,10093,10094,10095, // 9920 -10096,10097,4476,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110, // 9936 -10111,2174,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125, // 9952 -10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,3807, // 9968 -4186,4925,10141,10142,10143,10144,10145,10146,10147,4477,4187,10148,10149,10150,10151,10152, // 9984 -10153,4188,10154,10155,10156,10157,10158,10159,10160,10161,4926,10162,10163,10164,10165,10166, //10000 -10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182, //10016 -10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,3203,10193,10194,10195,10196,10197, //10032 -10198,10199,10200,4478,10201,10202,10203,10204,4479,10205,10206,10207,10208,10209,10210,10211, //10048 -10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227, //10064 -10228,10229,10230,10231,10232,10233,10234,4927,10235,10236,10237,10238,10239,10240,10241,10242, //10080 -10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258, //10096 -10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,4480, //10112 -4928,4929,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287, //10128 -10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303, //10144 -10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319, //10160 -10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,4930, //10176 -10335,10336,10337,10338,10339,10340,10341,10342,4931,10343,10344,10345,10346,10347,10348,10349, //10192 -10350,10351,10352,10353,10354,10355,3088,10356,2786,10357,10358,10359,10360,4189,10361,10362, //10208 -10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,4932,10376,10377, //10224 -10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,4933, //10240 -10393,10394,10395,4934,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407, //10256 -10408,10409,10410,10411,10412,3446,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422, //10272 -10423,4935,10424,10425,10426,10427,10428,10429,10430,4936,10431,10432,10433,10434,10435,10436, //10288 -10437,10438,10439,10440,10441,10442,10443,4937,10444,10445,10446,10447,4481,10448,10449,10450, //10304 -10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466, //10320 -10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482, //10336 -10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498, //10352 -10499,10500,10501,10502,10503,10504,10505,4938,10506,10507,10508,10509,10510,2552,10511,10512, //10368 -10513,10514,10515,10516,3447,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527, //10384 -10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543, //10400 -4482,10544,4939,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557, //10416 -10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,3676,4483,10568,10569,10570,10571, //10432 -10572,3448,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586, //10448 -10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602, //10464 -10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618, //10480 -10619,10620,10621,10622,10623,10624,10625,10626,10627,4484,10628,10629,10630,10631,10632,4940, //10496 -10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648, //10512 -10649,10650,10651,10652,10653,10654,10655,10656,4941,10657,10658,10659,2599,10660,10661,10662, //10528 -10663,10664,10665,10666,3089,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677, //10544 -10678,10679,10680,4942,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692, //10560 -10693,10694,10695,10696,10697,4485,10698,10699,10700,10701,10702,10703,10704,4943,10705,3677, //10576 -10706,10707,10708,10709,10710,10711,10712,4944,10713,10714,10715,10716,10717,10718,10719,10720, //10592 -10721,10722,10723,10724,10725,10726,10727,10728,4945,10729,10730,10731,10732,10733,10734,10735, //10608 -10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751, //10624 -10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,4946,10762,10763,10764,10765,10766, //10640 -10767,4947,4948,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780, //10656 -10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796, //10672 -10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812, //10688 -10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828, //10704 -10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844, //10720 -10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860, //10736 -10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876, //10752 -10877,10878,4486,10879,10880,10881,10882,10883,10884,10885,4949,10886,10887,10888,10889,10890, //10768 -10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906, //10784 -10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,4487,10920,10921, //10800 -10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,4950,10933,10934,10935,10936, //10816 -10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,4488,10950,10951, //10832 -10952,10953,10954,10955,10956,10957,10958,10959,4190,10960,10961,10962,10963,10964,10965,10966, //10848 -10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982, //10864 -10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998, //10880 -10999,11000,11001,11002,11003,11004,11005,11006,3960,11007,11008,11009,11010,11011,11012,11013, //10896 -11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029, //10912 -11030,11031,11032,4951,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044, //10928 -11045,11046,11047,4489,11048,11049,11050,11051,4952,11052,11053,11054,11055,11056,11057,11058, //10944 -4953,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,4954,11072, //10960 -11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088, //10976 -11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104, //10992 -11105,11106,11107,11108,11109,11110,11111,11112,11113,11114,11115,3808,11116,11117,11118,11119, //11008 -11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,4955, //11024 -11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150, //11040 -11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,4956,11162,11163,11164,11165, //11056 -11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,4957, //11072 -11181,11182,11183,11184,11185,11186,4958,11187,11188,11189,11190,11191,11192,11193,11194,11195, //11088 -11196,11197,11198,11199,11200,3678,11201,11202,11203,11204,11205,11206,4191,11207,11208,11209, //11104 -11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225, //11120 -11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241, //11136 -11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,4959,11252,11253,11254,11255,11256, //11152 -11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272, //11168 -11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288, //11184 -11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304, //11200 -11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,3679,11315,11316,11317,11318,4490, //11216 -11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334, //11232 -11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,4960,11348,11349, //11248 -11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365, //11264 -11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,3961,4961,11378,11379, //11280 -11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395, //11296 -11396,11397,4192,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410, //11312 -11411,4962,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425, //11328 -11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441, //11344 -11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457, //11360 -11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,4963,11470,11471,4491, //11376 -11472,11473,11474,11475,4964,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486, //11392 -11487,11488,11489,11490,11491,11492,4965,11493,11494,11495,11496,11497,11498,11499,11500,11501, //11408 -11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517, //11424 -11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,3962,11530,11531,11532, //11440 -11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548, //11456 -11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564, //11472 -4193,4194,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578, //11488 -11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,4966,4195,11592, //11504 -11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,3090,11605,11606,11607, //11520 -11608,11609,11610,4967,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622, //11536 -11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638, //11552 -11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653,11654, //11568 -11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670, //11584 -11671,11672,11673,11674,4968,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685, //11600 -11686,11687,11688,11689,11690,11691,11692,11693,3809,11694,11695,11696,11697,11698,11699,11700, //11616 -11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716, //11632 -11717,11718,3553,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,4969, //11648 -11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,4492,11741,11742,11743,11744,11745, //11664 -11746,11747,11748,11749,11750,11751,11752,4970,11753,11754,11755,11756,11757,11758,11759,11760, //11680 -11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776, //11696 -11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,4971,11791, //11712 -11792,11793,11794,11795,11796,11797,4972,11798,11799,11800,11801,11802,11803,11804,11805,11806, //11728 -11807,11808,11809,11810,4973,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821, //11744 -11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,3680,3810,11835, //11760 -11836,4974,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850, //11776 -11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866, //11792 -11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882, //11808 -11883,11884,4493,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897, //11824 -11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913, //11840 -11914,11915,4975,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928, //11856 -11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944, //11872 -11945,11946,11947,11948,11949,4976,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959, //11888 -11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975, //11904 -11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,4196,11988,11989,11990, //11920 -11991,11992,4977,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005, //11936 -12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021, //11952 -12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037, //11968 -12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053, //11984 -12054,12055,12056,12057,12058,12059,12060,12061,4978,12062,12063,12064,12065,12066,12067,12068, //12000 -12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084, //12016 -12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100, //12032 -12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116, //12048 -12117,12118,12119,12120,12121,12122,12123,4979,12124,12125,12126,12127,12128,4197,12129,12130, //12064 -12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146, //12080 -12147,12148,12149,12150,12151,12152,12153,12154,4980,12155,12156,12157,12158,12159,12160,4494, //12096 -12161,12162,12163,12164,3811,12165,12166,12167,12168,12169,4495,12170,12171,4496,12172,12173, //12112 -12174,12175,12176,3812,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188, //12128 -12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204, //12144 -12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220, //12160 -12221,4981,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235, //12176 -4982,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,4983,12246,12247,12248,12249, //12192 -4984,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264, //12208 -4985,12265,4497,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278, //12224 -12279,12280,12281,12282,12283,12284,12285,12286,12287,4986,12288,12289,12290,12291,12292,12293, //12240 -12294,12295,12296,2473,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308, //12256 -12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,3963,12320,12321,12322,12323, //12272 -12324,12325,12326,12327,12328,12329,12330,12331,12332,4987,12333,12334,12335,12336,12337,12338, //12288 -12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354, //12304 -12355,12356,12357,12358,12359,3964,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, //12320 -12370,3965,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, //12336 -12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400, //12352 -12401,12402,12403,12404,12405,12406,12407,12408,4988,12409,12410,12411,12412,12413,12414,12415, //12368 -12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, //12384 -12432,12433,12434,12435,12436,12437,12438,3554,12439,12440,12441,12442,12443,12444,12445,12446, //12400 -12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, //12416 -12463,12464,4989,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477, //12432 -12478,12479,12480,4990,12481,12482,12483,12484,12485,12486,12487,12488,12489,4498,12490,12491, //12448 -12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, //12464 -12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523, //12480 -12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539, //12496 -12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,4991,12552,12553,12554, //12512 -12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570, //12528 -12571,12572,12573,12574,12575,12576,12577,12578,3036,12579,12580,12581,12582,12583,3966,12584, //12544 -12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600, //12560 -12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616, //12576 -12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632, //12592 -12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,4499,12647, //12608 -12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663, //12624 -12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679, //12640 -12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695, //12656 -12696,12697,12698,4992,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710, //12672 -12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726, //12688 -12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742, //12704 -12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758, //12720 -12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774, //12736 -12775,12776,12777,12778,4993,2175,12779,12780,12781,12782,12783,12784,12785,12786,4500,12787, //12752 -12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803, //12768 -12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, //12784 -12820,12821,12822,12823,12824,12825,12826,4198,3967,12827,12828,12829,12830,12831,12832,12833, //12800 -12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849, //12816 -12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,4199,12862,12863,12864, //12832 -12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880, //12848 -12881,12882,12883,12884,12885,12886,12887,4501,12888,12889,12890,12891,12892,12893,12894,12895, //12864 -12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911, //12880 -12912,4994,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926, //12896 -12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942, //12912 -12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,1772,12957, //12928 -12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973, //12944 -12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989, //12960 -12990,12991,12992,12993,12994,12995,12996,12997,4502,12998,4503,12999,13000,13001,13002,13003, //12976 -4504,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018, //12992 -13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,3449,13030,13031,13032,13033, //13008 -13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049, //13024 -13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065, //13040 -13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081, //13056 -13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097, //13072 -13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113, //13088 -13114,13115,13116,13117,13118,3968,13119,4995,13120,13121,13122,13123,13124,13125,13126,13127, //13104 -4505,13128,13129,13130,13131,13132,13133,13134,4996,4506,13135,13136,13137,13138,13139,4997, //13120 -13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155, //13136 -13156,13157,13158,13159,4998,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170, //13152 -13171,13172,13173,13174,13175,13176,4999,13177,13178,13179,13180,13181,13182,13183,13184,13185, //13168 -13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201, //13184 -13202,13203,13204,13205,13206,5000,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216, //13200 -13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,4200,5001,13228,13229,13230, //13216 -13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,3969,13241,13242,13243,13244,3970, //13232 -13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260, //13248 -13261,13262,13263,13264,13265,13266,13267,13268,3450,13269,13270,13271,13272,13273,13274,13275, //13264 -13276,5002,13277,13278,13279,13280,13281,13282,13283,13284,13285,13286,13287,13288,13289,13290, //13280 -13291,13292,13293,13294,13295,13296,13297,13298,13299,13300,13301,13302,3813,13303,13304,13305, //13296 -13306,13307,13308,13309,13310,13311,13312,13313,13314,13315,13316,13317,13318,13319,13320,13321, //13312 -13322,13323,13324,13325,13326,13327,13328,4507,13329,13330,13331,13332,13333,13334,13335,13336, //13328 -13337,13338,13339,13340,13341,5003,13342,13343,13344,13345,13346,13347,13348,13349,13350,13351, //13344 -13352,13353,13354,13355,13356,13357,13358,13359,13360,13361,13362,13363,13364,13365,13366,13367, //13360 -5004,13368,13369,13370,13371,13372,13373,13374,13375,13376,13377,13378,13379,13380,13381,13382, //13376 -13383,13384,13385,13386,13387,13388,13389,13390,13391,13392,13393,13394,13395,13396,13397,13398, //13392 -13399,13400,13401,13402,13403,13404,13405,13406,13407,13408,13409,13410,13411,13412,13413,13414, //13408 -13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430, //13424 -13431,13432,4508,13433,13434,13435,4201,13436,13437,13438,13439,13440,13441,13442,13443,13444, //13440 -13445,13446,13447,13448,13449,13450,13451,13452,13453,13454,13455,13456,13457,5005,13458,13459, //13456 -13460,13461,13462,13463,13464,13465,13466,13467,13468,13469,13470,4509,13471,13472,13473,13474, //13472 -13475,13476,13477,13478,13479,13480,13481,13482,13483,13484,13485,13486,13487,13488,13489,13490, //13488 -13491,13492,13493,13494,13495,13496,13497,13498,13499,13500,13501,13502,13503,13504,13505,13506, //13504 -13507,13508,13509,13510,13511,13512,13513,13514,13515,13516,13517,13518,13519,13520,13521,13522, //13520 -13523,13524,13525,13526,13527,13528,13529,13530,13531,13532,13533,13534,13535,13536,13537,13538, //13536 -13539,13540,13541,13542,13543,13544,13545,13546,13547,13548,13549,13550,13551,13552,13553,13554, //13552 -13555,13556,13557,13558,13559,13560,13561,13562,13563,13564,13565,13566,13567,13568,13569,13570, //13568 -13571,13572,13573,13574,13575,13576,13577,13578,13579,13580,13581,13582,13583,13584,13585,13586, //13584 -13587,13588,13589,13590,13591,13592,13593,13594,13595,13596,13597,13598,13599,13600,13601,13602, //13600 -13603,13604,13605,13606,13607,13608,13609,13610,13611,13612,13613,13614,13615,13616,13617,13618, //13616 -13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,13630,13631,13632,13633,13634, //13632 -13635,13636,13637,13638,13639,13640,13641,13642,5006,13643,13644,13645,13646,13647,13648,13649, //13648 -13650,13651,5007,13652,13653,13654,13655,13656,13657,13658,13659,13660,13661,13662,13663,13664, //13664 -13665,13666,13667,13668,13669,13670,13671,13672,13673,13674,13675,13676,13677,13678,13679,13680, //13680 -13681,13682,13683,13684,13685,13686,13687,13688,13689,13690,13691,13692,13693,13694,13695,13696, //13696 -13697,13698,13699,13700,13701,13702,13703,13704,13705,13706,13707,13708,13709,13710,13711,13712, //13712 -13713,13714,13715,13716,13717,13718,13719,13720,13721,13722,13723,13724,13725,13726,13727,13728, //13728 -13729,13730,13731,13732,13733,13734,13735,13736,13737,13738,13739,13740,13741,13742,13743,13744, //13744 -13745,13746,13747,13748,13749,13750,13751,13752,13753,13754,13755,13756,13757,13758,13759,13760, //13760 -13761,13762,13763,13764,13765,13766,13767,13768,13769,13770,13771,13772,13773,13774,3273,13775, //13776 -13776,13777,13778,13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789,13790,13791, //13792 -13792,13793,13794,13795,13796,13797,13798,13799,13800,13801,13802,13803,13804,13805,13806,13807, //13808 -13808,13809,13810,13811,13812,13813,13814,13815,13816,13817,13818,13819,13820,13821,13822,13823, //13824 -13824,13825,13826,13827,13828,13829,13830,13831,13832,13833,13834,13835,13836,13837,13838,13839, //13840 -13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13854,13855, //13856 -13856,13857,13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,13869,13870,13871, //13872 -13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,13884,13885,13886,13887, //13888 -13888,13889,13890,13891,13892,13893,13894,13895,13896,13897,13898,13899,13900,13901,13902,13903, //13904 -13904,13905,13906,13907,13908,13909,13910,13911,13912,13913,13914,13915,13916,13917,13918,13919, //13920 -13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, //13936 -13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, //13952 -13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, //13968 -13968,13969,13970,13971,13972]; //13973 - -}(require('./init')); - -},{"./init":20}],3:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.Big5Prober = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.Big5SMModel); - self._mDistributionAnalyzer = new jschardet.Big5DistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "Big5"; - } - - init(); -} -jschardet.Big5Prober.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],4:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharDistributionAnalysis = function() { - var ENOUGH_DATA_THRESHOLD = 1024; - var SURE_YES = 0.99; - var SURE_NO = 0.01; - var MINIMUM_DATA_THRESHOLD = 3; - - var self = this; - - function init() { - self._mCharToFreqOrder = null; // Mapping table to get frequency order from char order (get from GetOrder()) - self._mTableSize = null; // Size of above table - self._mTypicalDistributionRatio = null; // This is a constant value which varies from language to language, used in calculating confidence. See http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html for further detail. - self.reset(); - } - - /** - * reset analyser, clear any state - */ - this.reset = function() { - this._mDone = false; // If this flag is set to constants.True, detection is done and conclusion has been made - this._mTotalChars = 0; // Total characters encountered - this._mFreqChars = 0; // The number of characters whose frequency order is less than 512 - } - - /** - * feed a character with known length - */ - this.feed = function(aStr, aCharLen) { - if( aCharLen == 2 ) { - // we only care about 2-bytes character in our distribution analysis - var order = this.getOrder(aStr); - } else { - order = -1; - } - if( order >= 0 ) { - this._mTotalChars++; - // order is valid - if( order < this._mTableSize ) { - if( 512 > this._mCharToFreqOrder[order] ) { - this._mFreqChars++; - } - } - } - } - - /** - * return confidence based on existing data - */ - this.getConfidence = function() { - // if we didn't receive any character in our consideration range, return negative answer - if( this._mTotalChars <= 0 || this._mFreqChars <= MINIMUM_DATA_THRESHOLD) { - return SURE_NO; - } - if( this._mTotalChars != this._mFreqChars ) { - var r = this._mFreqChars / ((this._mTotalChars - this._mFreqChars) * this._mTypicalDistributionRatio); - if( r < SURE_YES ) { - return r; - } - } - - // normalize confidence (we don't want to be 100% sure) - return SURE_YES; - } - - this.gotEnoughData = function() { - // It is not necessary to receive all data to draw conclusion. For charset detection, - // certain amount of data is enough - return this._mTotalChars > ENOUGH_DATA_THRESHOLD; - } - - this.getOrder = function(aStr) { - // We do not handle characters based on the original encoding string, but - // convert this encoding string to a number, here called order. - // This allows multiple encodings of a language to share one frequency table. - return -1; - } - - init(); -} - -jschardet.EUCTWDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.EUCTWCharToFreqOrder; - self._mTableSize = jschardet.EUCTW_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.EUCTW_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-TW encoding, we are interested - // first byte range: 0xc4 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xC4 ) { - return 94 * (aStr.charCodeAt(0) - 0xC4) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCTWDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.EUCKRDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.EUCKRCharToFreqOrder; - self._mTableSize = jschardet.EUCKR_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.EUCKR_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-KR encoding, we are interested - // first byte range: 0xb0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xB0 ) { - return 94 * (aStr.charCodeAt(0) - 0xB0) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCKRDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.GB2312DistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.GB2312CharToFreqOrder; - self._mTableSize = jschardet.GB2312_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.GB2312_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for GB2312 encoding, we are interested - // first byte range: 0xb0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xB0 && aStr.charCodeAt(1) >= 0xA1 ) { - return 94 * (aStr.charCodeAt(0) - 0xB0) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.GB2312DistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.Big5DistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.Big5CharToFreqOrder; - self._mTableSize = jschardet.BIG5_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.BIG5_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for big5 encoding, we are interested - // first byte range: 0xa4 -- 0xfe - // second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xA4 ) { - if( aStr.charCodeAt(1) >= 0xA1 ) { - return 157 * (aStr.charCodeAt(0) - 0xA4) + aStr.charCodeAt(1) - 0xA1 + 63; - } else { - return 157 * (aStr.charCodeAt(0) - 0xA4) + aStr.charCodeAt(1) - 0x40; - } - } else { - return -1; - } - } - - init(); -} -jschardet.Big5DistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.SJISDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.JISCharToFreqOrder; - self._mTableSize = jschardet.JIS_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for sjis encoding, we are interested - // first byte range: 0x81 -- 0x9f , 0xe0 -- 0xef - // second byte range: 0x40 -- 0x7e, 0x80 -- 0xfc - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) { - var order = 188 * (aStr.charCodeAt(0) - 0x81); - } else if( aStr.charCodeAt(0) >= 0xE0 && aStr.charCodeAt(0) <= 0xEF ) { - order = 188 * (aStr.charCodeAt(0) - 0xE0 + 31); - } else { - return -1; - } - order += aStr.charCodeAt(1) - 0x40; - if( aStr.charCodeAt(1) < 0x40 || aStr.charCodeAt(1) === 0x7F || aStr.charCodeAt(1) > 0xFC) { - order = -1; - } - return order; - } - - init(); -} -jschardet.SJISDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.EUCJPDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.JISCharToFreqOrder; - self._mTableSize = jschardet.JIS_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-JP encoding, we are interested - // first byte range: 0xa0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr[0] >= "\xA0" ) { - return 94 * (aStr.charCodeAt(0) - 0xA1) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCJPDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -}(require('./init')); - -},{"./init":20}],5:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharSetGroupProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mActiveNum = 0; - self._mProbers = []; - self._mBestGuessProber = null; - } - - this.reset = function() { - jschardet.CharSetGroupProber.prototype.reset.apply(this); - this._mActiveNum = 0; - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( prober ) { - prober.reset(); - prober.active = true; - this._mActiveNum++; - } - } - this._mBestGuessProber = null; - } - - this.getCharsetName = function() { - if( !this._mBestGuessProber ) { - this.getConfidence(); - if( !this._mBestGuessProber ) return null; - } - return this._mBestGuessProber.getCharsetName(); - } - - this.feed = function(aBuf) { - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( !prober || !prober.active ) continue; - var st = prober.feed(aBuf); - if( !st ) continue; - if( st == jschardet.Constants.foundIt ) { - this._mBestGuessProber = prober; - return this.getState(); - } else if( st == jschardet.Constants.notMe ) { - prober.active = false; - this._mActiveNum--; - if( this._mActiveNum <= 0 ) { - this._mState = jschardet.Constants.notMe; - return this.getState(); - } - } - } - return this.getState(); - } - - this.getConfidence = function() { - var st = this.getState(); - if( st == jschardet.Constants.foundIt ) { - return 0.99; - } else if( st == jschardet.Constants.notMe ) { - return 0.01; - } - var bestConf = 0.0; - this._mBestGuessProber = null; - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( !prober ) continue; - if( !prober.active ) { - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " not active\n"); - } - continue; - } - var cf = prober.getConfidence(); - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " confidence = " + cf + "\n"); - } - if( bestConf < cf ) { - bestConf = cf; - this._mBestGuessProber = prober; - } - } - if( !this._mBestGuessProber ) return 0.0; - return bestConf; - } - - init(); -} -jschardet.CharSetGroupProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}],6:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharSetProber = function() { - this.reset = function() { - this._mState = jschardet.Constants.detecting; - } - - this.getCharsetName = function() { - return null; - } - - this.feed = function(aBuf) { - } - - this.getState = function() { - return this._mState; - } - - this.getConfidence = function() { - return 0.0; - } - - this.filterHighBitOnly = function(aBuf) { - aBuf = aBuf.replace(/[\x00-\x7F]+/g, " "); - return aBuf; - } - - this.filterWithoutEnglishLetters = function(aBuf) { - aBuf = aBuf.replace(/[A-Za-z]+/g, " "); - return aBuf; - } - - // Input: aBuf is a string containing all different types of characters - // Output: a string that contains all alphabetic letters, high-byte characters, and word immediately preceding `>`, but nothing else within `<>` - // Ex: input - '¡£º
abcdef
apples! * and oranges 9jd93jd>' - // output - '¡£º blah div apples and oranges jd jd ' - this.filterWithEnglishLetters = function(aBuf) { - var result = ''; - var inTag = false; - var prev = 0; - - for (var curr = 0; curr < aBuf.length; curr++) { - var c = aBuf[curr]; - - if (c == '>') { - inTag = false; - } else if (c == '<') { - inTag = true; - } - - var isAlpha = /[a-zA-Z]/.test(c); - var isASCII = /^[\x00-\x7F]*$/.test(c); - - if (isASCII && !isAlpha) { - if (curr > prev && !inTag) { - result = result + aBuf.substring(prev, curr) + ' '; - } - - prev = curr + 1; - } - } - - if (!inTag) { - result = result + aBuf.substring(prev); - } - - return result; - } -} - -}(require('./init')); - -},{"./init":20}],7:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CodingStateMachine = function(sm) { - var self = this; - - function init(sm) { - self._mModel = sm; - self._mCurrentBytePos = 0; - self._mCurrentCharLen = 0; - self.reset(); - } - - this.reset = function() { - this._mCurrentState = jschardet.Constants.start; - } - - this.nextState = function(c) { - // for each byte we get its class - // if it is first byte, we also get byte length - var byteCls = this._mModel.classTable[c.charCodeAt(0)]; - if( this._mCurrentState == jschardet.Constants.start ) { - this._mCurrentBytePos = 0; - this._mCurrentCharLen = this._mModel.charLenTable[byteCls]; - } - // from byte's class and stateTable, we get its next state - this._mCurrentState = this._mModel.stateTable[this._mCurrentState * this._mModel.classFactor + byteCls]; - this._mCurrentBytePos++; - return this._mCurrentState; - } - - this.getCurrentCharLen = function() { - return this._mCurrentCharLen; - } - - this.getCodingStateMachine = function() { - return this._mModel.name; - } - - init(sm); -} - -}(require('./init')); - -},{"./init":20}],8:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.Constants = { - _debug : false, - - detecting : 0, - foundIt : 1, - notMe : 2, - - start : 0, - error : 1, - itsMe : 2, - - MINIMUM_THRESHOLD : 0.20, - SHORTCUT_THRESHOLD : 0.95 -}; - -}(require('./init')); - -},{"./init":20}],9:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EscCharSetProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = [ - new jschardet.CodingStateMachine(jschardet.HZSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022CNSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022JPSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022KRSMModel) - ]; - self.reset(); - } - - this.reset = function() { - jschardet.EscCharSetProber.prototype.reset.apply(this); - for( var i = 0, codingSM; codingSM = this._mCodingSM[i]; i++ ) { - if( !codingSM ) continue; - codingSM.active = true; - codingSM.reset(); - } - this._mActiveSM = self._mCodingSM.length; - this._mDetectedCharset = null; - } - - this.getCharsetName = function() { - return this._mDetectedCharset; - } - - this.getConfidence = function() { - if( this._mDetectedCharset ) { - return 0.99; - } else { - return 0.00; - } - } - - this.feed = function(aBuf) { - for( var i = 0, c; i < aBuf.length; i++ ) { - c = aBuf[i]; - for( var j = 0, codingSM; codingSM = this._mCodingSM[j]; j++ ) { - if( !codingSM || !codingSM.active ) continue; - var codingState = codingSM.nextState(c); - if( codingState == jschardet.Constants.error ) { - codingSM.active = false; - this._mActiveSM--; - if( this._mActiveSM <= 0 ) { - this._mState = jschardet.Constants.notMe; - return this.getState(); - } - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - this._mDetectedCharset = codingSM.getCodingStateMachine(); - return this.getState(); - } - } - } - - return this.getState(); - } - - init(); -} -jschardet.EscCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}],10:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -var consts = jschardet.Constants; - -jschardet.HZ_cls = [ - 1,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,0,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,4,0,5,2,0, // 78 - 7f - 1,1,1,1,1,1,1,1, // 80 - 87 - 1,1,1,1,1,1,1,1, // 88 - 8f - 1,1,1,1,1,1,1,1, // 90 - 97 - 1,1,1,1,1,1,1,1, // 98 - 9f - 1,1,1,1,1,1,1,1, // a0 - a7 - 1,1,1,1,1,1,1,1, // a8 - af - 1,1,1,1,1,1,1,1, // b0 - b7 - 1,1,1,1,1,1,1,1, // b8 - bf - 1,1,1,1,1,1,1,1, // c0 - c7 - 1,1,1,1,1,1,1,1, // c8 - cf - 1,1,1,1,1,1,1,1, // d0 - d7 - 1,1,1,1,1,1,1,1, // d8 - df - 1,1,1,1,1,1,1,1, // e0 - e7 - 1,1,1,1,1,1,1,1, // e8 - ef - 1,1,1,1,1,1,1,1, // f0 - f7 - 1,1,1,1,1,1,1,1 // f8 - ff -]; - -jschardet.HZ_st = [ - consts.start,consts.error, 3,consts.start,consts.start,consts.start,consts.error,consts.error, // 00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start, 4,consts.error, // 10-17 - 5,consts.error, 6,consts.error, 5, 5, 4,consts.error, // 18-1f - 4,consts.error, 4, 4, 4,consts.error, 4,consts.error, // 20-27 - 4,consts.itsMe,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start // 28-2f -]; - -jschardet.HZCharLenTable = [0, 0, 0, 0, 0, 0]; - -jschardet.HZSMModel = { - "classTable" : jschardet.HZ_cls, - "classFactor" : 6, - "stateTable" : jschardet.HZ_st, - "charLenTable" : jschardet.HZCharLenTable, - "name" : "HZ-GB-2312" -}; - -jschardet.ISO2022CN_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,4,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022CN_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, // 00-07 - consts.start,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 08-0f - consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 10-17 - consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.error, 4,consts.error, // 18-1f - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 20-27 - 5, 6,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 28-2f - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 30-37 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.start // 38-3f -]; - -jschardet.ISO2022CNCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022CNSMModel = { - "classTable" : jschardet.ISO2022CN_cls, - "classFactor" : 9, - "stateTable" : jschardet.ISO2022CN_st, - "charLenTable" : jschardet.ISO2022CNCharLenTable, - "name" : "ISO-2022-CN" -}; - -jschardet.ISO2022JP_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,2,2, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,7,0,0,0, // 20 - 27 - 3,0,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 6,0,4,0,8,0,0,0, // 40 - 47 - 0,9,5,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022JP_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, // 00-07 - consts.start,consts.start,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 08-0f - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 10-17 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error, // 18-1f - consts.error, 5,consts.error,consts.error,consts.error, 4,consts.error,consts.error, // 20-27 - consts.error,consts.error,consts.error, 6,consts.itsMe,consts.error,consts.itsMe,consts.error, // 28-2f - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, // 30-37 - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 38-3f - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.start,consts.start // 40-47 -]; - -jschardet.ISO2022JPCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022JPSMModel = { - "classTable" : jschardet.ISO2022JP_cls, - "classFactor" : 10, - "stateTable" : jschardet.ISO2022JP_st, - "charLenTable" : jschardet.ISO2022JPCharLenTable, - "name" : "ISO-2022-JP" -}; - -jschardet.ISO2022KR_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,3,0,0,0, // 20 - 27 - 0,4,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,5,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022KR_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.error,consts.error, // 00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.error, 4,consts.error,consts.error, // 10-17 - consts.error,consts.error,consts.error,consts.error, 5,consts.error,consts.error,consts.error, // 18-1f - consts.error,consts.error,consts.error,consts.itsMe,consts.start,consts.start,consts.start,consts.start // 20-27 -]; - -jschardet.ISO2022KRCharLenTable = [0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022KRSMModel = { - "classTable" : jschardet.ISO2022KR_cls, - "classFactor" : 6, - "stateTable" : jschardet.ISO2022KR_st, - "charLenTable" : jschardet.ISO2022KRCharLenTable, - "name" : "ISO-2022-KR" -}; - -}(require('./init')); - -},{"./init":20}],11:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCJPProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCJPSMModel); - self._mDistributionAnalyzer = new jschardet.EUCJPDistributionAnalysis(); - self._mContextAnalyzer = new jschardet.EUCJPContextAnalysis(); - self.reset(); - } - - this.reset = function() { - jschardet.EUCJPProber.prototype.reset.apply(this); - this._mContextAnalyzer.reset(); - } - - this.getCharsetName = function() { - return "EUC-JP"; - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mContextAnalyzer.feed(this._mLastChar, charLen); - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mContextAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - this._mDistributionAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mContextAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var contxtCf = this._mContextAnalyzer.getConfidence(); - var distribCf = this._mDistributionAnalyzer.getConfidence(); - - return Math.max(contxtCf, distribCf); - } - - init(); -} -jschardet.EUCJPProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],12:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// Sampling from about 20M text materials include literature and computer technology - -// 128 --> 0.79 -// 256 --> 0.92 -// 512 --> 0.986 -// 1024 --> 0.99944 -// 2048 --> 0.99999 -// -// Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24 -// Random Distribution Ration = 512 / (2350-512) = 0.279. -// -// Typical Distribution Ratio - -jschardet.EUCKR_TYPICAL_DISTRIBUTION_RATIO = 6.0; - -jschardet.EUCKR_TABLE_SIZE = 2352; - -// Char to FreqOrder table , -jschardet.EUCKRCharToFreqOrder = [ - 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, -1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, -1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, - 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, - 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, - 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, -1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, - 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, - 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, -1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, -1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, -1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, -1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, -1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, - 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, -1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, -1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, -1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, -1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, - 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, -1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, - 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, - 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, -1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, - 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, -1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, - 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, - 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, -1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, -1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, -1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, -1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, - 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, -1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, - 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, - 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, -1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, -1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, -1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, -1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, -1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, -1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, - 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, - 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, - 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, -1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, - 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, -1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, - 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, - 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, -2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, - 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, - 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, -2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, -2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, -2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, - 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, - 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, -2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, - 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, -1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, -2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, -1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, -2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, -2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, -1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, - 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, -2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, -2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, - 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, - 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, -2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, -1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, -2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, -2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, -2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, -2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, -2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, -2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, -1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, -2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, -2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, -2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, -2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, -2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, -1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, -1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, -2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, -1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, -2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, -1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, - 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, -2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, - 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, -2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, - 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, -2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, -2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, - 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, -2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, -1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, - 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, -1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, -2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, -1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, -2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, - 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, -2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, -1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, -2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, -1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, -2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, -1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, - 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, -2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, -2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, - 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, - 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, -1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, -1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, - 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, -2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, -2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, - 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, - 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, - 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, -2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, - 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, - 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, -2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, -2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, - 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, -2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, -1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, - 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, -2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, -2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, -2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, - 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, - 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, - 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, -2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, -2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, -2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, -1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, -2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, - 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, // 512, 256 -//Everything below is of no interest for detection purpose -2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658, -2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674, -2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690, -2691,2692,2693,2694,2695,2696,2697,2698,2699,1542, 880,2700,2701,2702,2703,2704, -2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720, -2721,2722,2723,2724,2725,1543,2726,2727,2728,2729,2730,2731,2732,1544,2733,2734, -2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750, -2751,2752,2753,2754,1545,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765, -2766,1546,2767,1547,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779, -2780,2781,2782,2783,2784,2785,2786,1548,2787,2788,2789,1109,2790,2791,2792,2793, -2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809, -2810,2811,2812,1329,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824, -2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840, -2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856, -1549,2857,2858,2859,2860,1550,2861,2862,1551,2863,2864,2865,2866,2867,2868,2869, -2870,2871,2872,2873,2874,1110,1330,2875,2876,2877,2878,2879,2880,2881,2882,2883, -2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899, -2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915, -2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,1331, -2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,1552,2944,2945, -2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961, -2962,2963,2964,1252,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976, -2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992, -2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008, -3009,3010,3011,3012,1553,3013,3014,3015,3016,3017,1554,3018,1332,3019,3020,3021, -3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037, -3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,1555,3051,3052, -3053,1556,1557,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066, -3067,1558,3068,3069,3070,3071,3072,3073,3074,3075,3076,1559,3077,3078,3079,3080, -3081,3082,3083,1253,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095, -3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,1152,3109,3110, -3111,3112,3113,1560,3114,3115,3116,3117,1111,3118,3119,3120,3121,3122,3123,3124, -3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140, -3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156, -3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172, -3173,3174,3175,3176,1333,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187, -3188,3189,1561,3190,3191,1334,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201, -3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217, -3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233, -3234,1562,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248, -3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264, -3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,1563,3278,3279, -3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295, -3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311, -3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327, -3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343, -3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359, -3360,3361,3362,3363,3364,1335,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374, -3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,1336,3388,3389, -3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405, -3406,3407,3408,3409,3410,3411,3412,3413,3414,1337,3415,3416,3417,3418,3419,1338, -3420,3421,3422,1564,1565,3423,3424,3425,3426,3427,3428,3429,3430,3431,1254,3432, -3433,3434,1339,3435,3436,3437,3438,3439,1566,3440,3441,3442,3443,3444,3445,3446, -3447,3448,3449,3450,3451,3452,3453,3454,1255,3455,3456,3457,3458,3459,1567,1191, -3460,1568,1569,3461,3462,3463,1570,3464,3465,3466,3467,3468,1571,3469,3470,3471, -3472,3473,1572,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486, -1340,3487,3488,3489,3490,3491,3492,1021,3493,3494,3495,3496,3497,3498,1573,3499, -1341,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,1342,3512,3513, -3514,3515,3516,1574,1343,3517,3518,3519,1575,3520,1576,3521,3522,3523,3524,3525, -3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541, -3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557, -3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573, -3574,3575,3576,3577,3578,3579,3580,1577,3581,3582,1578,3583,3584,3585,3586,3587, -3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603, -3604,1579,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618, -3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,1580,3630,3631,1581,3632, -3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648, -3649,3650,3651,3652,3653,3654,3655,3656,1582,3657,3658,3659,3660,3661,3662,3663, -3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679, -3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695, -3696,3697,3698,3699,3700,1192,3701,3702,3703,3704,1256,3705,3706,3707,3708,1583, -1257,3709,3710,3711,3712,3713,3714,3715,3716,1584,3717,3718,3719,3720,3721,3722, -3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738, -3739,3740,3741,3742,3743,3744,3745,1344,3746,3747,3748,3749,3750,3751,3752,3753, -3754,3755,3756,1585,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,1586,3767, -3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,1345,3779,3780,3781,3782, -3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,1346,1587,3796, -3797,1588,3798,3799,3800,3801,3802,3803,3804,3805,3806,1347,3807,3808,3809,3810, -3811,1589,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,1590,3822,3823,1591, -1348,3824,3825,3826,3827,3828,3829,3830,1592,3831,3832,1593,3833,3834,3835,3836, -3837,3838,3839,3840,3841,3842,3843,3844,1349,3845,3846,3847,3848,3849,3850,3851, -3852,3853,3854,3855,3856,3857,3858,1594,3859,3860,3861,3862,3863,3864,3865,3866, -3867,3868,3869,1595,3870,3871,3872,3873,1596,3874,3875,3876,3877,3878,3879,3880, -3881,3882,3883,3884,3885,3886,1597,3887,3888,3889,3890,3891,3892,3893,3894,3895, -1598,3896,3897,3898,1599,1600,3899,1350,3900,1351,3901,3902,1352,3903,3904,3905, -3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921, -3922,3923,3924,1258,3925,3926,3927,3928,3929,3930,3931,1193,3932,1601,3933,3934, -3935,3936,3937,3938,3939,3940,3941,3942,3943,1602,3944,3945,3946,3947,3948,1603, -3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964, -3965,1604,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,1353,3978, -3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,1354,3992,3993, -3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009, -4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,1355,4024, -4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040, -1605,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055, -4056,4057,4058,4059,4060,1606,4061,4062,4063,4064,1607,4065,4066,4067,4068,4069, -4070,4071,4072,4073,4074,4075,4076,1194,4077,4078,1608,4079,4080,4081,4082,4083, -4084,4085,4086,4087,1609,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098, -4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,1259,4109,4110,4111,4112,4113, -4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,1195,4125,4126,4127,1610, -4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,1356,4138,4139,4140,4141,4142, -4143,4144,1611,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157, -4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173, -4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189, -4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205, -4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,1612,4220, -4221,4222,4223,4224,4225,4226,4227,1357,4228,1613,4229,4230,4231,4232,4233,4234, -4235,4236,4237,4238,4239,4240,4241,4242,4243,1614,4244,4245,4246,4247,4248,4249, -4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265, -4266,4267,4268,4269,4270,1196,1358,4271,4272,4273,4274,4275,4276,4277,4278,4279, -4280,4281,4282,4283,4284,4285,4286,4287,1615,4288,4289,4290,4291,4292,4293,4294, -4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310, -4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326, -4327,4328,4329,4330,4331,4332,4333,4334,1616,4335,4336,4337,4338,4339,4340,4341, -4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357, -4358,4359,4360,1617,4361,4362,4363,4364,4365,1618,4366,4367,4368,4369,4370,4371, -4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387, -4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403, -4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,1619,4417,4418, -4419,4420,4421,4422,4423,4424,4425,1112,4426,4427,4428,4429,4430,1620,4431,4432, -4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,1260,1261,4443,4444,4445,4446, -4447,4448,4449,4450,4451,4452,4453,4454,4455,1359,4456,4457,4458,4459,4460,4461, -4462,4463,4464,4465,1621,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476, -4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,1055,4490,4491, -4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507, -4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,1622,4519,4520,4521,1623, -4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,1360,4536, -4537,4538,4539,4540,4541,4542,4543, 975,4544,4545,4546,4547,4548,4549,4550,4551, -4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567, -4568,4569,4570,4571,1624,4572,4573,4574,4575,4576,1625,4577,4578,4579,4580,4581, -4582,4583,4584,1626,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,1627, -4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611, -4612,4613,4614,4615,1628,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626, -4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642, -4643,4644,4645,4646,4647,4648,4649,1361,4650,4651,4652,4653,4654,4655,4656,4657, -4658,4659,4660,4661,1362,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672, -4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,1629,4683,4684,4685,4686,4687, -1630,4688,4689,4690,4691,1153,4692,4693,4694,1113,4695,4696,4697,4698,4699,4700, -4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,1197,4712,4713,4714,4715, -4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731, -4732,4733,4734,4735,1631,4736,1632,4737,4738,4739,4740,4741,4742,4743,4744,1633, -4745,4746,4747,4748,4749,1262,4750,4751,4752,4753,4754,1363,4755,4756,4757,4758, -4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,1634,4769,4770,4771,4772,4773, -4774,4775,4776,4777,4778,1635,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788, -4789,1636,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803, -4804,4805,4806,1637,4807,4808,4809,1638,4810,4811,4812,4813,4814,4815,4816,4817, -4818,1639,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832, -4833,1077,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847, -4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863, -4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879, -4880,4881,4882,4883,1640,4884,4885,1641,4886,4887,4888,4889,4890,4891,4892,4893, -4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909, -4910,4911,1642,4912,4913,4914,1364,4915,4916,4917,4918,4919,4920,4921,4922,4923, -4924,4925,4926,4927,4928,4929,4930,4931,1643,4932,4933,4934,4935,4936,4937,4938, -4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954, -4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970, -4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,1644,4981,4982,4983,4984,1645, -4985,4986,1646,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999, -5000,5001,5002,5003,5004,5005,1647,5006,1648,5007,5008,5009,5010,5011,5012,1078, -5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028, -1365,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,1649,5040,5041,5042, -5043,5044,5045,1366,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,1650,5056, -5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072, -5073,5074,5075,5076,5077,1651,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087, -5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103, -5104,5105,5106,5107,5108,5109,5110,1652,5111,5112,5113,5114,5115,5116,5117,5118, -1367,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,1653,5130,5131,5132, -5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148, -5149,1368,5150,1654,5151,1369,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161, -5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177, -5178,1370,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192, -5193,5194,5195,5196,5197,5198,1655,5199,5200,5201,5202,1656,5203,5204,5205,5206, -1371,5207,1372,5208,5209,5210,5211,1373,5212,5213,1374,5214,5215,5216,5217,5218, -5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234, -5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,1657,5248,5249, -5250,5251,1658,1263,5252,5253,5254,5255,5256,1375,5257,5258,5259,5260,5261,5262, -5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278, -5279,5280,5281,5282,5283,1659,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293, -5294,5295,5296,5297,5298,5299,5300,1660,5301,5302,5303,5304,5305,5306,5307,5308, -5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,1376,5322,5323, -5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,1198,5334,5335,5336,5337,5338, -5339,5340,5341,5342,5343,1661,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353, -5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369, -5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385, -5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,1264,5399,5400, -5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,1662,5413,5414,5415, -5416,1663,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430, -5431,5432,5433,5434,5435,5436,5437,5438,1664,5439,5440,5441,5442,5443,5444,5445, -5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461, -5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477, -5478,1154,5479,5480,5481,5482,5483,5484,5485,1665,5486,5487,5488,5489,5490,5491, -5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507, -5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523, -5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539, -5540,5541,5542,5543,5544,5545,5546,5547,5548,1377,5549,5550,5551,5552,5553,5554, -5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570, -1114,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585, -5586,5587,5588,5589,5590,5591,5592,1378,5593,5594,5595,5596,5597,5598,5599,5600, -5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,1379,5615, -5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631, -5632,5633,5634,1380,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646, -5647,5648,5649,1381,1056,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660, -1666,5661,5662,5663,5664,5665,5666,5667,5668,1667,5669,1668,5670,5671,5672,5673, -5674,5675,5676,5677,5678,1155,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688, -5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,1669,5699,5700,5701,5702,5703, -5704,5705,1670,5706,5707,5708,5709,5710,1671,5711,5712,5713,5714,1382,5715,5716, -5717,5718,5719,5720,5721,5722,5723,5724,5725,1672,5726,5727,1673,1674,5728,5729, -5730,5731,5732,5733,5734,5735,5736,1675,5737,5738,5739,5740,5741,5742,5743,5744, -1676,5745,5746,5747,5748,5749,5750,5751,1383,5752,5753,5754,5755,5756,5757,5758, -5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,1677,5769,5770,5771,5772,5773, -1678,5774,5775,5776, 998,5777,5778,5779,5780,5781,5782,5783,5784,5785,1384,5786, -5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,1679,5801, -5802,5803,1115,1116,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815, -5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831, -5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847, -5848,5849,5850,5851,5852,5853,5854,5855,1680,5856,5857,5858,5859,5860,5861,5862, -5863,5864,1681,5865,5866,5867,1682,5868,5869,5870,5871,5872,5873,5874,5875,5876, -5877,5878,5879,1683,5880,1684,5881,5882,5883,5884,1685,5885,5886,5887,5888,5889, -5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905, -5906,5907,1686,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, -5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,1687, -5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951, -5952,1688,1689,5953,1199,5954,5955,5956,5957,5958,5959,5960,5961,1690,5962,5963, -5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979, -5980,5981,1385,5982,1386,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993, -5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6008,6009, -6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025, -6026,6027,1265,6028,6029,1691,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039, -6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055, -6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071, -6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,1692,6085,6086, -6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102, -6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118, -6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,1693,6132,6133, -6134,6135,6136,1694,6137,6138,6139,6140,6141,1695,6142,6143,6144,6145,6146,6147, -6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163, -6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179, -6180,6181,6182,6183,6184,6185,1696,6186,6187,6188,6189,6190,6191,6192,6193,6194, -6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210, -6211,6212,6213,6214,6215,6216,6217,6218,6219,1697,6220,6221,6222,6223,6224,6225, -6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241, -6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,1698,6254,6255,6256, -6257,6258,6259,6260,6261,6262,6263,1200,6264,6265,6266,6267,6268,6269,6270,6271, //1024 -6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287, -6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,1699, -6303,6304,1700,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317, -6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333, -6334,6335,6336,6337,6338,6339,1701,6340,6341,6342,6343,6344,1387,6345,6346,6347, -6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363, -6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379, -6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395, -6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411, -6412,6413,1702,6414,6415,6416,6417,6418,6419,6420,6421,6422,1703,6423,6424,6425, -6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,1704,6439,6440, -6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456, -6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472, -6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488, -6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,1266, -6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519, -6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533,6534,6535, -6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551, -1705,1706,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565, -6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581, -6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597, -6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613, -6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629, -6630,6631,6632,6633,6634,6635,6636,6637,1388,6638,6639,6640,6641,6642,6643,6644, -1707,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659, -6660,6661,6662,6663,1708,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674, -1201,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689, -6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705, -6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721, -6722,6723,6724,6725,1389,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736, -1390,1709,6737,6738,6739,6740,6741,6742,1710,6743,6744,6745,6746,1391,6747,6748, -6749,6750,6751,6752,6753,6754,6755,6756,6757,1392,6758,6759,6760,6761,6762,6763, -6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779, -6780,1202,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794, -6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,1711, -6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822,6823,6824,6825, -6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,1393,6837,6838,6839,6840, -6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856, -6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872, -6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888, -6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,1712,6903, -6904,6905,6906,6907,6908,6909,6910,1713,6911,6912,6913,6914,6915,6916,6917,6918, -6919,6920,6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934, -6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950, -6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966, -6967,6968,6969,6970,6971,6972,6973,6974,1714,6975,6976,6977,6978,6979,6980,6981, -6982,6983,6984,6985,6986,6987,6988,1394,6989,6990,6991,6992,6993,6994,6995,6996, -6997,6998,6999,7000,1715,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011, -7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027, -7028,1716,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042, -7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058, -7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074, -7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090, -7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106, -7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122, -7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138, -7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154, -7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170, -7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186, -7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202, -7203,7204,7205,7206,7207,1395,7208,7209,7210,7211,7212,7213,1717,7214,7215,7216, -7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232, -7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248, -7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264, -7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280, -7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296, -7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312, -7313,1718,7314,7315,7316,7317,7318,7319,7320,7321,7322,7323,7324,7325,7326,7327, -7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343, -7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359, -7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375, -7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391, -7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407, -7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418,7419,7420,7421,7422,7423, -7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439, -7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455, -7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471, -7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487, -7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503, -7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519, -7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535, -7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551, -7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, -7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583, -7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599, -7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615, -7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631, -7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647, -7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663, -7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679, -7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695, -7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711, -7712,7713,7714,7715,7716,7717,7718,7719,7720,7721,7722,7723,7724,7725,7726,7727, -7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743, -7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759, -7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775, -7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791, -7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807, -7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823, -7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839, -7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855, -7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871, -7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887, -7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903, -7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919, -7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, -7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, -7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, -7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, -7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, -8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, -8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, -8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, -8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, -8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, -8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, -8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, -8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, -8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, -8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, -8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, -8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, -8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, -8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, -8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, -8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, -8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, -8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287, -8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303, -8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319, -8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335, -8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351, -8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367, -8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383, -8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399, -8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415, -8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431, -8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447, -8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463, -8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479, -8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495, -8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511, -8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527, -8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543, -8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559, -8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575, -8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591, -8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607, -8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623, -8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639, -8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655, -8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671, -8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687, -8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, -8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719, -8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735, -8736,8737,8738,8739,8740,8741 -]; - -}(require('./init')); - -},{"./init":20}],13:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCKRProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCKRSMModel); - self._mDistributionAnalyzer = new jschardet.EUCKRDistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "EUC-KR"; - } - - init(); -} -jschardet.EUCKRProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],14:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// EUCTW frequency table -// Converted from big5 work -// by Taiwan's Mandarin Promotion Council -// - -// 128 --> 0.42261 -// 256 --> 0.57851 -// 512 --> 0.74851 -// 1024 --> 0.89384 -// 2048 --> 0.97583 -// -// Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 -// Random Distribution Ration = 512/(5401-512)=0.105 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR - -jschardet.EUCTW_TYPICAL_DISTRIBUTION_RATIO = 0.75; - -// Char to FreqOrder table , -jschardet.EUCTW_TABLE_SIZE = 8102; - -jschardet.EUCTWCharToFreqOrder = [ - 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, // 2742 -3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, // 2758 -1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, // 2774 - 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, // 2790 -3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, // 2806 -4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, // 2822 -7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, // 2838 - 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, // 2854 - 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, // 2870 - 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, // 2886 -2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, // 2902 -1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, // 2918 -3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, // 2934 - 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, // 2950 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, // 2966 -3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, // 2982 -2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, // 2998 - 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, // 3014 -3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, // 3030 -1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, // 3046 -7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, // 3062 - 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, // 3078 -7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, // 3094 -1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, // 3110 - 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, // 3126 - 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, // 3142 -3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, // 3158 -3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, // 3174 - 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, // 3190 -2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, // 3206 -2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, // 3222 - 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, // 3238 - 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, // 3254 -3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, // 3270 -1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, // 3286 -1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, // 3302 -1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, // 3318 -2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, // 3334 - 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, // 3350 -4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, // 3366 -1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, // 3382 -7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, // 3398 -2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, // 3414 - 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, // 3430 - 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, // 3446 - 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, // 3462 - 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, // 3478 -7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, // 3494 - 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, // 3510 -1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, // 3526 - 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, // 3542 - 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, // 3558 -7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, // 3574 -1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, // 3590 - 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, // 3606 -3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, // 3622 -4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, // 3638 -3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, // 3654 - 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, // 3670 - 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, // 3686 -1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, // 3702 -4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, // 3718 -3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, // 3734 -3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, // 3750 -2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, // 3766 -7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, // 3782 -3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, // 3798 -7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, // 3814 -1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, // 3830 -2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, // 3846 -1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, // 3862 - 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, // 3878 -1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, // 3894 -4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, // 3910 -3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, // 3926 - 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, // 3942 - 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, // 3958 - 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, // 3974 -2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, // 3990 -7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, // 4006 -1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, // 4022 -2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, // 4038 -1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, // 4054 -1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, // 4070 -7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, // 4086 -7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, // 4102 -7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, // 4118 -3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, // 4134 -4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, // 4150 -1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, // 4166 -7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, // 4182 -2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, // 4198 -7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, // 4214 -3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, // 4230 -3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, // 4246 -7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, // 4262 -2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, // 4278 -7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, // 4294 - 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, // 4310 -4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, // 4326 -2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, // 4342 -7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, // 4358 -3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, // 4374 -2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, // 4390 -2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, // 4406 - 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, // 4422 -2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, // 4438 -1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, // 4454 -1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, // 4470 -2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, // 4486 -1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, // 4502 -7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, // 4518 -7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, // 4534 -2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, // 4550 -4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, // 4566 -1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, // 4582 -7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, // 4598 - 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, // 4614 -4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, // 4630 - 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, // 4646 -2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, // 4662 - 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, // 4678 -1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, // 4694 -1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, // 4710 - 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, // 4726 -3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, // 4742 -3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, // 4758 -1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, // 4774 -3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, // 4790 -7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, // 4806 -7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, // 4822 -1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, // 4838 -2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, // 4854 -1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, // 4870 -3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, // 4886 -2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, // 4902 -3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, // 4918 -2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, // 4934 -4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, // 4950 -4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, // 4966 -3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, // 4982 - 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, // 4998 -3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, // 5014 - 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, // 5030 -3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, // 5046 -3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, // 5062 -3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, // 5078 -1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, // 5094 -7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, // 5110 - 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, // 5126 -7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, // 5142 -1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, // 5158 - 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, // 5174 -4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, // 5190 -3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, // 5206 - 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, // 5222 -2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, // 5238 -2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, // 5254 -3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, // 5270 -1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, // 5286 -4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, // 5302 -2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, // 5318 -1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, // 5334 -1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, // 5350 -2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, // 5366 -3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, // 5382 -1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, // 5398 -7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, // 5414 -1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, // 5430 -4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, // 5446 -1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, // 5462 - 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, // 5478 -1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, // 5494 -3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, // 5510 -3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, // 5526 -2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, // 5542 -1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, // 5558 -4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, // 5574 - 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, // 5590 -7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, // 5606 -2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, // 5622 -3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, // 5638 -4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, // 5654 - 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, // 5670 -7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, // 5686 -7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, // 5702 -1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, // 5718 -4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, // 5734 -3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, // 5750 -2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, // 5766 -3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, // 5782 -3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, // 5798 -2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, // 5814 -1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, // 5830 -4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, // 5846 -3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, // 5862 -3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, // 5878 -2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, // 5894 -4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, // 5910 -7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, // 5926 -3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, // 5942 -2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, // 5958 -3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, // 5974 -1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, // 5990 -2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, // 6006 -3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, // 6022 -4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, // 6038 -2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, // 6054 -2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, // 6070 -7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, // 6086 -1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, // 6102 -2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, // 6118 -1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, // 6134 -3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, // 6150 -4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, // 6166 -2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, // 6182 -3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, // 6198 -3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, // 6214 -2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, // 6230 -4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, // 6246 -2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, // 6262 -3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, // 6278 -4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, // 6294 -7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, // 6310 -3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, // 6326 - 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, // 6342 -1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, // 6358 -4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, // 6374 -1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, // 6390 -4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, // 6406 -7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, // 6422 - 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, // 6438 -7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, // 6454 -2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, // 6470 -1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, // 6486 -1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, // 6502 -3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, // 6518 - 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, // 6534 - 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, // 6550 - 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, // 6566 -3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, // 6582 -2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, // 6598 - 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, // 6614 -7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, // 6630 -1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, // 6646 -3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, // 6662 -7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, // 6678 -1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, // 6694 -7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, // 6710 -4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, // 6726 -1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, // 6742 -2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, // 6758 -2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, // 6774 -4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, // 6790 - 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, // 6806 - 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, // 6822 -3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, // 6838 -3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, // 6854 -1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, // 6870 -2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, // 6886 -7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, // 6902 -1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, // 6918 -1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, // 6934 -3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, // 6950 - 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, // 6966 -1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, // 6982 -4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, // 6998 -7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, // 7014 -2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, // 7030 -3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, // 7046 - 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, // 7062 -1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, // 7078 -2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, // 7094 -2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, // 7110 -7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, // 7126 -7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, // 7142 -7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, // 7158 -2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, // 7174 -2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, // 7190 -1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, // 7206 -4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, // 7222 -3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, // 7238 -3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, // 7254 -4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, // 7270 -4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, // 7286 -2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, // 7302 -2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, // 7318 -7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, // 7334 -4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, // 7350 -7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, // 7366 -2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, // 7382 -1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, // 7398 -3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, // 7414 -4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, // 7430 -2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, // 7446 - 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, // 7462 -2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, // 7478 -1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, // 7494 -2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, // 7510 -2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, // 7526 -4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, // 7542 -7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, // 7558 -1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, // 7574 -3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, // 7590 -7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, // 7606 -1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, // 7622 -8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, // 7638 -2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, // 7654 -8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, // 7670 -2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, // 7686 -2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, // 7702 -8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, // 7718 -8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, // 7734 -8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, // 7750 - 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, // 7766 -8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, // 7782 -4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, // 7798 -3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, // 7814 -8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, // 7830 -1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, // 7846 -8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, // 7862 - 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, // 7878 -1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, // 7894 - 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, // 7910 -4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, // 7926 -1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, // 7942 -4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, // 7958 -1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, // 7974 - 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, // 7990 -3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, // 8006 -4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, // 8022 -8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, // 8038 - 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, // 8054 -3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, // 8070 - 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, // 8086 -2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, // 8102 -//Everything below is of no interest for detection purpose -2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122, // 8118 -2493,3016,3734,8123,8124,2192,8125,8126,2162,8127,8128,8129,8130,8131,8132,8133, // 8134 -8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149, // 8150 -8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165, // 8166 -8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181, // 8182 -8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197, // 8198 -8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213, // 8214 -8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229, // 8230 -8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245, // 8246 -8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261, // 8262 -8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277, // 8278 -8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293, // 8294 -8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309, // 8310 -8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325, // 8326 -8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341, // 8342 -8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357, // 8358 -8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373, // 8374 -8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389, // 8390 -8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405, // 8406 -8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421, // 8422 -8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437, // 8438 -8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453, // 8454 -8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469, // 8470 -8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485, // 8486 -8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501, // 8502 -8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517, // 8518 -8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533, // 8534 -8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549, // 8550 -8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565, // 8566 -8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581, // 8582 -8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597, // 8598 -8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613, // 8614 -8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629, // 8630 -8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645, // 8646 -8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661, // 8662 -8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677, // 8678 -8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, // 8694 -8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, // 8710 -8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, // 8726 -8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741 -]; // 8742 - -}(require('./init')); - -},{"./init":20}],15:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCTWProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCTWSMModel); - self._mDistributionAnalyzer = new jschardet.EUCTWDistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "EUC-TW"; - } - - init(); -} -jschardet.EUCTWProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],16:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// GB2312 most frequently used character table -// -// Char to FreqOrder table , from hz6763 - -// 512 --> 0.79 -- 0.79 -// 1024 --> 0.92 -- 0.13 -// 2048 --> 0.98 -- 0.06 -// 6768 --> 1.00 -- 0.02 -// -// Ideal Distribution Ratio = 0.79135/(1-0.79135) = 3.79 -// Random Distribution Ration = 512 / (3755 - 512) = 0.157 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR - -jschardet.GB2312_TYPICAL_DISTRIBUTION_RATIO = 0.9; - -jschardet.GB2312_TABLE_SIZE = 3760; - -jschardet.GB2312CharToFreqOrder = [ -1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, -2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, -2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, - 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, -1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, -1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, - 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, -1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, -2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, -3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, - 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, -1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, - 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, -2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, - 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, -2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, -1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, -3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, - 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, -1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, - 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, -2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, -1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, -3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, -1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, -2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, -1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, - 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, -3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, -3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, - 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, -3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, - 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, -1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, -3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, -2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, -1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, - 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, -1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, -4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, - 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, -3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, -3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, - 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, -1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, -2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, -1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, -1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, - 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, -3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, -3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, -4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, - 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, -3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, -1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, -1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, -4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, - 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, - 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, -3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, -1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, - 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, -1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, -2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, - 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, - 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, - 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, -3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, -4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, -3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, - 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, -2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, -2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, -2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, - 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, -2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, - 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, - 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, - 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, -3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, -2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, -2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, -1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, - 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, -2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, - 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, - 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, -1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, -1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, - 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, - 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, -1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, -2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, -3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, -2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, -2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, -2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, -3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, -1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, -1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, -2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, -1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, -3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, -1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, -1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, -3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, - 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, -2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, -1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, -4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, -1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, -1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, -3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, -1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, - 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, - 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, -1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, - 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, -1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, -1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, - 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, -3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, -4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, -3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, -2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, -2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, -1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, -3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, -2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, -1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, -1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, - 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, -2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, -2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, -3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, -4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, -3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, - 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, -3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, -2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, -1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, - 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, - 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, -3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, -4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, -2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, -1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, -1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, - 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, -1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, -3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, - 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, - 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, -1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, - 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, -1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, - 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, -2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, - 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, -2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, -2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, -1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, -1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, -2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, - 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, -1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, -1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, -2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, -2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, -3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, -1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, -4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, - 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, - 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, -3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, -1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, - 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, -3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, -1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, -4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, -1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, -2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, -1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, - 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, -1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, -3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, - 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, -2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, - 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, -1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, -1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, -1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, -3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, -2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, -3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, -3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, -3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, - 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, -2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, - 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, -2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, - 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, -1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, - 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, - 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, -1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, -3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, -3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, -1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, -1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, -3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, -2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, -2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, -1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, -3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, - 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, -4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, -1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, -2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, -3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, -3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, -1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, - 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, - 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, -2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, - 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, -1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, - 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, -1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, -1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, -1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, -1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, -1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, - 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, - 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, // last 512 -//Everything below is of no interest for detection purpose -5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636, -5509,3257,5510,5973,5445,5872,4941,4403,3174,4627,5873,6276,2286,4230,5446,5874, -5122,6102,6103,4162,5447,5123,5323,4849,6277,3980,3851,5066,4246,5774,5067,6278, -3001,2807,5695,3346,5775,5974,5158,5448,6487,5975,5976,5776,3598,6279,5696,4806, -4211,4154,6280,6488,6489,6490,6281,4212,5037,3374,4171,6491,4562,4807,4722,4827, -5977,6104,4532,4079,5159,5324,5160,4404,3858,5359,5875,3975,4288,4610,3486,4512, -5325,3893,5360,6282,6283,5560,2522,4231,5978,5186,5449,2569,3878,6284,5401,3578, -4415,6285,4656,5124,5979,2506,4247,4449,3219,3417,4334,4969,4329,6492,4576,4828, -4172,4416,4829,5402,6286,3927,3852,5361,4369,4830,4477,4867,5876,4173,6493,6105, -4657,6287,6106,5877,5450,6494,4155,4868,5451,3700,5629,4384,6288,6289,5878,3189, -4881,6107,6290,6495,4513,6496,4692,4515,4723,5100,3356,6497,6291,3810,4080,5561, -3570,4430,5980,6498,4355,5697,6499,4724,6108,6109,3764,4050,5038,5879,4093,3226, -6292,5068,5217,4693,3342,5630,3504,4831,4377,4466,4309,5698,4431,5777,6293,5778, -4272,3706,6110,5326,3752,4676,5327,4273,5403,4767,5631,6500,5699,5880,3475,5039, -6294,5562,5125,4348,4301,4482,4068,5126,4593,5700,3380,3462,5981,5563,3824,5404, -4970,5511,3825,4738,6295,6501,5452,4516,6111,5881,5564,6502,6296,5982,6503,4213, -4163,3454,6504,6112,4009,4450,6113,4658,6297,6114,3035,6505,6115,3995,4904,4739, -4563,4942,4110,5040,3661,3928,5362,3674,6506,5292,3612,4791,5565,4149,5983,5328, -5259,5021,4725,4577,4564,4517,4364,6298,5405,4578,5260,4594,4156,4157,5453,3592, -3491,6507,5127,5512,4709,4922,5984,5701,4726,4289,6508,4015,6116,5128,4628,3424, -4241,5779,6299,4905,6509,6510,5454,5702,5780,6300,4365,4923,3971,6511,5161,3270, -3158,5985,4100, 867,5129,5703,6117,5363,3695,3301,5513,4467,6118,6512,5455,4232, -4242,4629,6513,3959,4478,6514,5514,5329,5986,4850,5162,5566,3846,4694,6119,5456, -4869,5781,3779,6301,5704,5987,5515,4710,6302,5882,6120,4392,5364,5705,6515,6121, -6516,6517,3736,5988,5457,5989,4695,2457,5883,4551,5782,6303,6304,6305,5130,4971, -6122,5163,6123,4870,3263,5365,3150,4871,6518,6306,5783,5069,5706,3513,3498,4409, -5330,5632,5366,5458,5459,3991,5990,4502,3324,5991,5784,3696,4518,5633,4119,6519, -4630,5634,4417,5707,4832,5992,3418,6124,5993,5567,4768,5218,6520,4595,3458,5367, -6125,5635,6126,4202,6521,4740,4924,6307,3981,4069,4385,6308,3883,2675,4051,3834, -4302,4483,5568,5994,4972,4101,5368,6309,5164,5884,3922,6127,6522,6523,5261,5460, -5187,4164,5219,3538,5516,4111,3524,5995,6310,6311,5369,3181,3386,2484,5188,3464, -5569,3627,5708,6524,5406,5165,4677,4492,6312,4872,4851,5885,4468,5996,6313,5709, -5710,6128,2470,5886,6314,5293,4882,5785,3325,5461,5101,6129,5711,5786,6525,4906, -6526,6527,4418,5887,5712,4808,2907,3701,5713,5888,6528,3765,5636,5331,6529,6530, -3593,5889,3637,4943,3692,5714,5787,4925,6315,6130,5462,4405,6131,6132,6316,5262, -6531,6532,5715,3859,5716,5070,4696,5102,3929,5788,3987,4792,5997,6533,6534,3920, -4809,5000,5998,6535,2974,5370,6317,5189,5263,5717,3826,6536,3953,5001,4883,3190, -5463,5890,4973,5999,4741,6133,6134,3607,5570,6000,4711,3362,3630,4552,5041,6318, -6001,2950,2953,5637,4646,5371,4944,6002,2044,4120,3429,6319,6537,5103,4833,6538, -6539,4884,4647,3884,6003,6004,4758,3835,5220,5789,4565,5407,6540,6135,5294,4697, -4852,6320,6321,3206,4907,6541,6322,4945,6542,6136,6543,6323,6005,4631,3519,6544, -5891,6545,5464,3784,5221,6546,5571,4659,6547,6324,6137,5190,6548,3853,6549,4016, -4834,3954,6138,5332,3827,4017,3210,3546,4469,5408,5718,3505,4648,5790,5131,5638, -5791,5465,4727,4318,6325,6326,5792,4553,4010,4698,3439,4974,3638,4335,3085,6006, -5104,5042,5166,5892,5572,6327,4356,4519,5222,5573,5333,5793,5043,6550,5639,5071, -4503,6328,6139,6551,6140,3914,3901,5372,6007,5640,4728,4793,3976,3836,4885,6552, -4127,6553,4451,4102,5002,6554,3686,5105,6555,5191,5072,5295,4611,5794,5296,6556, -5893,5264,5894,4975,5466,5265,4699,4976,4370,4056,3492,5044,4886,6557,5795,4432, -4769,4357,5467,3940,4660,4290,6141,4484,4770,4661,3992,6329,4025,4662,5022,4632, -4835,4070,5297,4663,4596,5574,5132,5409,5895,6142,4504,5192,4664,5796,5896,3885, -5575,5797,5023,4810,5798,3732,5223,4712,5298,4084,5334,5468,6143,4052,4053,4336, -4977,4794,6558,5335,4908,5576,5224,4233,5024,4128,5469,5225,4873,6008,5045,4729, -4742,4633,3675,4597,6559,5897,5133,5577,5003,5641,5719,6330,6560,3017,2382,3854, -4406,4811,6331,4393,3964,4946,6561,2420,3722,6562,4926,4378,3247,1736,4442,6332, -5134,6333,5226,3996,2918,5470,4319,4003,4598,4743,4744,4485,3785,3902,5167,5004, -5373,4394,5898,6144,4874,1793,3997,6334,4085,4214,5106,5642,4909,5799,6009,4419, -4189,3330,5899,4165,4420,5299,5720,5227,3347,6145,4081,6335,2876,3930,6146,3293, -3786,3910,3998,5900,5300,5578,2840,6563,5901,5579,6147,3531,5374,6564,6565,5580, -4759,5375,6566,6148,3559,5643,6336,6010,5517,6337,6338,5721,5902,3873,6011,6339, -6567,5518,3868,3649,5722,6568,4771,4947,6569,6149,4812,6570,2853,5471,6340,6341, -5644,4795,6342,6012,5723,6343,5724,6013,4349,6344,3160,6150,5193,4599,4514,4493, -5168,4320,6345,4927,3666,4745,5169,5903,5005,4928,6346,5725,6014,4730,4203,5046, -4948,3395,5170,6015,4150,6016,5726,5519,6347,5047,3550,6151,6348,4197,4310,5904, -6571,5581,2965,6152,4978,3960,4291,5135,6572,5301,5727,4129,4026,5905,4853,5728, -5472,6153,6349,4533,2700,4505,5336,4678,3583,5073,2994,4486,3043,4554,5520,6350, -6017,5800,4487,6351,3931,4103,5376,6352,4011,4321,4311,4190,5136,6018,3988,3233, -4350,5906,5645,4198,6573,5107,3432,4191,3435,5582,6574,4139,5410,6353,5411,3944, -5583,5074,3198,6575,6354,4358,6576,5302,4600,5584,5194,5412,6577,6578,5585,5413, -5303,4248,5414,3879,4433,6579,4479,5025,4854,5415,6355,4760,4772,3683,2978,4700, -3797,4452,3965,3932,3721,4910,5801,6580,5195,3551,5907,3221,3471,3029,6019,3999, -5908,5909,5266,5267,3444,3023,3828,3170,4796,5646,4979,4259,6356,5647,5337,3694, -6357,5648,5338,4520,4322,5802,3031,3759,4071,6020,5586,4836,4386,5048,6581,3571, -4679,4174,4949,6154,4813,3787,3402,3822,3958,3215,3552,5268,4387,3933,4950,4359, -6021,5910,5075,3579,6358,4234,4566,5521,6359,3613,5049,6022,5911,3375,3702,3178, -4911,5339,4521,6582,6583,4395,3087,3811,5377,6023,6360,6155,4027,5171,5649,4421, -4249,2804,6584,2270,6585,4000,4235,3045,6156,5137,5729,4140,4312,3886,6361,4330, -6157,4215,6158,3500,3676,4929,4331,3713,4930,5912,4265,3776,3368,5587,4470,4855, -3038,4980,3631,6159,6160,4132,4680,6161,6362,3923,4379,5588,4255,6586,4121,6587, -6363,4649,6364,3288,4773,4774,6162,6024,6365,3543,6588,4274,3107,3737,5050,5803, -4797,4522,5589,5051,5730,3714,4887,5378,4001,4523,6163,5026,5522,4701,4175,2791, -3760,6589,5473,4224,4133,3847,4814,4815,4775,3259,5416,6590,2738,6164,6025,5304, -3733,5076,5650,4816,5590,6591,6165,6592,3934,5269,6593,3396,5340,6594,5804,3445, -3602,4042,4488,5731,5732,3525,5591,4601,5196,6166,6026,5172,3642,4612,3202,4506, -4798,6366,3818,5108,4303,5138,5139,4776,3332,4304,2915,3415,4434,5077,5109,4856, -2879,5305,4817,6595,5913,3104,3144,3903,4634,5341,3133,5110,5651,5805,6167,4057, -5592,2945,4371,5593,6596,3474,4182,6367,6597,6168,4507,4279,6598,2822,6599,4777, -4713,5594,3829,6169,3887,5417,6170,3653,5474,6368,4216,2971,5228,3790,4579,6369, -5733,6600,6601,4951,4746,4555,6602,5418,5475,6027,3400,4665,5806,6171,4799,6028, -5052,6172,3343,4800,4747,5006,6370,4556,4217,5476,4396,5229,5379,5477,3839,5914, -5652,5807,4714,3068,4635,5808,6173,5342,4192,5078,5419,5523,5734,6174,4557,6175, -4602,6371,6176,6603,5809,6372,5735,4260,3869,5111,5230,6029,5112,6177,3126,4681, -5524,5915,2706,3563,4748,3130,6178,4018,5525,6604,6605,5478,4012,4837,6606,4534, -4193,5810,4857,3615,5479,6030,4082,3697,3539,4086,5270,3662,4508,4931,5916,4912, -5811,5027,3888,6607,4397,3527,3302,3798,2775,2921,2637,3966,4122,4388,4028,4054, -1633,4858,5079,3024,5007,3982,3412,5736,6608,3426,3236,5595,3030,6179,3427,3336, -3279,3110,6373,3874,3039,5080,5917,5140,4489,3119,6374,5812,3405,4494,6031,4666, -4141,6180,4166,6032,5813,4981,6609,5081,4422,4982,4112,3915,5653,3296,3983,6375, -4266,4410,5654,6610,6181,3436,5082,6611,5380,6033,3819,5596,4535,5231,5306,5113, -6612,4952,5918,4275,3113,6613,6376,6182,6183,5814,3073,4731,4838,5008,3831,6614, -4888,3090,3848,4280,5526,5232,3014,5655,5009,5737,5420,5527,6615,5815,5343,5173, -5381,4818,6616,3151,4953,6617,5738,2796,3204,4360,2989,4281,5739,5174,5421,5197, -3132,5141,3849,5142,5528,5083,3799,3904,4839,5480,2880,4495,3448,6377,6184,5271, -5919,3771,3193,6034,6035,5920,5010,6036,5597,6037,6378,6038,3106,5422,6618,5423, -5424,4142,6619,4889,5084,4890,4313,5740,6620,3437,5175,5307,5816,4199,5198,5529, -5817,5199,5656,4913,5028,5344,3850,6185,2955,5272,5011,5818,4567,4580,5029,5921, -3616,5233,6621,6622,6186,4176,6039,6379,6380,3352,5200,5273,2908,5598,5234,3837, -5308,6623,6624,5819,4496,4323,5309,5201,6625,6626,4983,3194,3838,4167,5530,5922, -5274,6381,6382,3860,3861,5599,3333,4292,4509,6383,3553,5481,5820,5531,4778,6187, -3955,3956,4324,4389,4218,3945,4325,3397,2681,5923,4779,5085,4019,5482,4891,5382, -5383,6040,4682,3425,5275,4094,6627,5310,3015,5483,5657,4398,5924,3168,4819,6628, -5925,6629,5532,4932,4613,6041,6630,4636,6384,4780,4204,5658,4423,5821,3989,4683, -5822,6385,4954,6631,5345,6188,5425,5012,5384,3894,6386,4490,4104,6632,5741,5053, -6633,5823,5926,5659,5660,5927,6634,5235,5742,5824,4840,4933,4820,6387,4859,5928, -4955,6388,4143,3584,5825,5346,5013,6635,5661,6389,5014,5484,5743,4337,5176,5662, -6390,2836,6391,3268,6392,6636,6042,5236,6637,4158,6638,5744,5663,4471,5347,3663, -4123,5143,4293,3895,6639,6640,5311,5929,5826,3800,6189,6393,6190,5664,5348,3554, -3594,4749,4603,6641,5385,4801,6043,5827,4183,6642,5312,5426,4761,6394,5665,6191, -4715,2669,6643,6644,5533,3185,5427,5086,5930,5931,5386,6192,6044,6645,4781,4013, -5745,4282,4435,5534,4390,4267,6045,5746,4984,6046,2743,6193,3501,4087,5485,5932, -5428,4184,4095,5747,4061,5054,3058,3862,5933,5600,6646,5144,3618,6395,3131,5055, -5313,6396,4650,4956,3855,6194,3896,5202,4985,4029,4225,6195,6647,5828,5486,5829, -3589,3002,6648,6397,4782,5276,6649,6196,6650,4105,3803,4043,5237,5830,6398,4096, -3643,6399,3528,6651,4453,3315,4637,6652,3984,6197,5535,3182,3339,6653,3096,2660, -6400,6654,3449,5934,4250,4236,6047,6401,5831,6655,5487,3753,4062,5832,6198,6199, -6656,3766,6657,3403,4667,6048,6658,4338,2897,5833,3880,2797,3780,4326,6659,5748, -5015,6660,5387,4351,5601,4411,6661,3654,4424,5935,4339,4072,5277,4568,5536,6402, -6662,5238,6663,5349,5203,6200,5204,6201,5145,4536,5016,5056,4762,5834,4399,4957, -6202,6403,5666,5749,6664,4340,6665,5936,5177,5667,6666,6667,3459,4668,6404,6668, -6669,4543,6203,6670,4276,6405,4480,5537,6671,4614,5205,5668,6672,3348,2193,4763, -6406,6204,5937,5602,4177,5669,3419,6673,4020,6205,4443,4569,5388,3715,3639,6407, -6049,4058,6206,6674,5938,4544,6050,4185,4294,4841,4651,4615,5488,6207,6408,6051, -5178,3241,3509,5835,6208,4958,5836,4341,5489,5278,6209,2823,5538,5350,5206,5429, -6675,4638,4875,4073,3516,4684,4914,4860,5939,5603,5389,6052,5057,3237,5490,3791, -6676,6409,6677,4821,4915,4106,5351,5058,4243,5539,4244,5604,4842,4916,5239,3028, -3716,5837,5114,5605,5390,5940,5430,6210,4332,6678,5540,4732,3667,3840,6053,4305, -3408,5670,5541,6410,2744,5240,5750,6679,3234,5606,6680,5607,5671,3608,4283,4159, -4400,5352,4783,6681,6411,6682,4491,4802,6211,6412,5941,6413,6414,5542,5751,6683, -4669,3734,5942,6684,6415,5943,5059,3328,4670,4144,4268,6685,6686,6687,6688,4372, -3603,6689,5944,5491,4373,3440,6416,5543,4784,4822,5608,3792,4616,5838,5672,3514, -5391,6417,4892,6690,4639,6691,6054,5673,5839,6055,6692,6056,5392,6212,4038,5544, -5674,4497,6057,6693,5840,4284,5675,4021,4545,5609,6418,4454,6419,6213,4113,4472, -5314,3738,5087,5279,4074,5610,4959,4063,3179,4750,6058,6420,6214,3476,4498,4716, -5431,4960,4685,6215,5241,6694,6421,6216,6695,5841,5945,6422,3748,5946,5179,3905, -5752,5545,5947,4374,6217,4455,6423,4412,6218,4803,5353,6696,3832,5280,6219,4327, -4702,6220,6221,6059,4652,5432,6424,3749,4751,6425,5753,4986,5393,4917,5948,5030, -5754,4861,4733,6426,4703,6697,6222,4671,5949,4546,4961,5180,6223,5031,3316,5281, -6698,4862,4295,4934,5207,3644,6427,5842,5950,6428,6429,4570,5843,5282,6430,6224, -5088,3239,6060,6699,5844,5755,6061,6431,2701,5546,6432,5115,5676,4039,3993,3327, -4752,4425,5315,6433,3941,6434,5677,4617,4604,3074,4581,6225,5433,6435,6226,6062, -4823,5756,5116,6227,3717,5678,4717,5845,6436,5679,5846,6063,5847,6064,3977,3354, -6437,3863,5117,6228,5547,5394,4499,4524,6229,4605,6230,4306,4500,6700,5951,6065, -3693,5952,5089,4366,4918,6701,6231,5548,6232,6702,6438,4704,5434,6703,6704,5953, -4168,6705,5680,3420,6706,5242,4407,6066,3812,5757,5090,5954,4672,4525,3481,5681, -4618,5395,5354,5316,5955,6439,4962,6707,4526,6440,3465,4673,6067,6441,5682,6708, -5435,5492,5758,5683,4619,4571,4674,4804,4893,4686,5493,4753,6233,6068,4269,6442, -6234,5032,4705,5146,5243,5208,5848,6235,6443,4963,5033,4640,4226,6236,5849,3387, -6444,6445,4436,4437,5850,4843,5494,4785,4894,6709,4361,6710,5091,5956,3331,6237, -4987,5549,6069,6711,4342,3517,4473,5317,6070,6712,6071,4706,6446,5017,5355,6713, -6714,4988,5436,6447,4734,5759,6715,4735,4547,4456,4754,6448,5851,6449,6450,3547, -5852,5318,6451,6452,5092,4205,6716,6238,4620,4219,5611,6239,6072,4481,5760,5957, -5958,4059,6240,6453,4227,4537,6241,5761,4030,4186,5244,5209,3761,4457,4876,3337, -5495,5181,6242,5959,5319,5612,5684,5853,3493,5854,6073,4169,5613,5147,4895,6074, -5210,6717,5182,6718,3830,6243,2798,3841,6075,6244,5855,5614,3604,4606,5496,5685, -5118,5356,6719,6454,5960,5357,5961,6720,4145,3935,4621,5119,5962,4261,6721,6455, -4786,5963,4375,4582,6245,6246,6247,6076,5437,4877,5856,3376,4380,6248,4160,6722, -5148,6456,5211,6457,6723,4718,6458,6724,6249,5358,4044,3297,6459,6250,5857,5615, -5497,5245,6460,5498,6725,6251,6252,5550,3793,5499,2959,5396,6461,6462,4572,5093, -5500,5964,3806,4146,6463,4426,5762,5858,6077,6253,4755,3967,4220,5965,6254,4989, -5501,6464,4352,6726,6078,4764,2290,5246,3906,5438,5283,3767,4964,2861,5763,5094, -6255,6256,4622,5616,5859,5860,4707,6727,4285,4708,4824,5617,6257,5551,4787,5212, -4965,4935,4687,6465,6728,6466,5686,6079,3494,4413,2995,5247,5966,5618,6729,5967, -5764,5765,5687,5502,6730,6731,6080,5397,6467,4990,6258,6732,4538,5060,5619,6733, -4719,5688,5439,5018,5149,5284,5503,6734,6081,4607,6259,5120,3645,5861,4583,6260, -4584,4675,5620,4098,5440,6261,4863,2379,3306,4585,5552,5689,4586,5285,6735,4864, -6736,5286,6082,6737,4623,3010,4788,4381,4558,5621,4587,4896,3698,3161,5248,4353, -4045,6262,3754,5183,4588,6738,6263,6739,6740,5622,3936,6741,6468,6742,6264,5095, -6469,4991,5968,6743,4992,6744,6083,4897,6745,4256,5766,4307,3108,3968,4444,5287, -3889,4343,6084,4510,6085,4559,6086,4898,5969,6746,5623,5061,4919,5249,5250,5504, -5441,6265,5320,4878,3242,5862,5251,3428,6087,6747,4237,5624,5442,6266,5553,4539, -6748,2585,3533,5398,4262,6088,5150,4736,4438,6089,6267,5505,4966,6749,6268,6750, -6269,5288,5554,3650,6090,6091,4624,6092,5690,6751,5863,4270,5691,4277,5555,5864, -6752,5692,4720,4865,6470,5151,4688,4825,6753,3094,6754,6471,3235,4653,6755,5213, -5399,6756,3201,4589,5865,4967,6472,5866,6473,5019,3016,6757,5321,4756,3957,4573, -6093,4993,5767,4721,6474,6758,5625,6759,4458,6475,6270,6760,5556,4994,5214,5252, -6271,3875,5768,6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970, -3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703, -5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978, -4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767 -]; - -}(require('./init')); - -},{"./init":20}],17:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.GB2312Prober = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.GB2312SMModel); - self._mDistributionAnalyzer = new jschardet.GB2312DistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "GB2312"; - } - - init(); -} -jschardet.GB2312Prober.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],18:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// This prober doesn't actually recognize a language or a charset. -// It is a helper prober for the use of the Hebrew model probers - -////// General ideas of the Hebrew charset recognition ////// -// -// Four main charsets exist in Hebrew: -// "ISO-8859-8" - Visual Hebrew -// "windows-1255" - Logical Hebrew -// "ISO-8859-8-I" - Logical Hebrew -// "x-mac-hebrew" - ?? Logical Hebrew ?? -// -// Both "ISO" charsets use a completely identical set of code points, whereas -// "windows-1255" and "x-mac-hebrew" are two different proper supersets of -// these code points. windows-1255 defines additional characters in the range -// 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific -// diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. -// x-mac-hebrew defines similar additional code points but with a different -// mapping. -// -// As far as an average Hebrew text with no diacritics is concerned, all four -// charsets are identical with respect to code points. Meaning that for the -// main Hebrew alphabet, all four map the same values to all 27 Hebrew letters -// (including final letters). -// -// The dominant difference between these charsets is their directionality. -// "Visual" directionality means that the text is ordered as if the renderer is -// not aware of a BIDI rendering algorithm. The renderer sees the text and -// draws it from left to right. The text itself when ordered naturally is read -// backwards. A buffer of Visual Hebrew generally looks like so: -// "[last word of first line spelled backwards] [whole line ordered backwards -// and spelled backwards] [first word of first line spelled backwards] -// [end of line] [last word of second line] ... etc' " -// adding punctuation marks, numbers and English text to visual text is -// naturally also "visual" and from left to right. -// -// "Logical" directionality means the text is ordered "naturally" according to -// the order it is read. It is the responsibility of the renderer to display -// the text from right to left. A BIDI algorithm is used to place general -// punctuation marks, numbers and English text in the text. -// -// Texts in x-mac-hebrew are almost impossible to find on the Internet. From -// what little evidence I could find, it seems that its general directionality -// is Logical. -// -// To sum up all of the above, the Hebrew probing mechanism knows about two -// charsets: -// Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are -// backwards while line order is natural. For charset recognition purposes -// the line order is unimportant (In fact, for this implementation, even -// word order is unimportant). -// Logical Hebrew - "windows-1255" - normal, naturally ordered text. -// -// "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be -// specifically identified. -// "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew -// that contain special punctuation marks or diacritics is displayed with -// some unconverted characters showing as question marks. This problem might -// be corrected using another model prober for x-mac-hebrew. Due to the fact -// that x-mac-hebrew texts are so rare, writing another model prober isn't -// worth the effort and performance hit. -// -//////// The Prober //////// -// -// The prober is divided between two SBCharSetProbers and a HebrewProber, -// all of which are managed, created, fed data, inquired and deleted by the -// SBCSGroupProber. The two SBCharSetProbers identify that the text is in -// fact some kind of Hebrew, Logical or Visual. The final decision about which -// one is it is made by the HebrewProber by combining final-letter scores -// with the scores of the two SBCharSetProbers to produce a final answer. -// -// The SBCSGroupProber is responsible for stripping the original text of HTML -// tags, English characters, numbers, low-ASCII punctuation characters, spaces -// and new lines. It reduces any sequence of such characters to a single space. -// The buffer fed to each prober in the SBCS group prober is pure text in -// high-ASCII. -// The two SBCharSetProbers (model probers) share the same language model: -// Win1255Model. -// The first SBCharSetProber uses the model normally as any other -// SBCharSetProber does, to recognize windows-1255, upon which this model was -// built. The second SBCharSetProber is told to make the pair-of-letter -// lookup in the language model backwards. This in practice exactly simulates -// a visual Hebrew model using the windows-1255 logical Hebrew model. -// -// The HebrewProber is not using any language model. All it does is look for -// final-letter evidence suggesting the text is either logical Hebrew or visual -// Hebrew. Disjointed from the model probers, the results of the HebrewProber -// alone are meaningless. HebrewProber always returns 0.00 as confidence -// since it never identifies a charset by itself. Instead, the pointer to the -// HebrewProber is passed to the model probers as a helper "Name Prober". -// When the Group prober receives a positive identification from any prober, -// it asks for the name of the charset identified. If the prober queried is a -// Hebrew model prober, the model prober forwards the call to the -// HebrewProber to make the final decision. In the HebrewProber, the -// decision is made according to the final-letters scores maintained and Both -// model probers scores. The answer is returned in the form of the name of the -// charset identified, either "windows-1255" or "ISO-8859-8". - -jschardet.HebrewProber = function() { - jschardet.CharSetProber.apply(this); - - // windows-1255 / ISO-8859-8 code points of interest - var FINAL_KAF = '\xea' - var NORMAL_KAF = '\xeb' - var FINAL_MEM = '\xed' - var NORMAL_MEM = '\xee' - var FINAL_NUN = '\xef' - var NORMAL_NUN = '\xf0' - var FINAL_PE = '\xf3' - var NORMAL_PE = '\xf4' - var FINAL_TSADI = '\xf5' - var NORMAL_TSADI = '\xf6' - - // Minimum Visual vs Logical final letter score difference. - // If the difference is below this, don't rely solely on the final letter score distance. - var MIN_FINAL_CHAR_DISTANCE = 5 - - // Minimum Visual vs Logical model score difference. - // If the difference is below this, don't rely at all on the model score distance. - var MIN_MODEL_DISTANCE = 0.01 - - var VISUAL_HEBREW_NAME = "ISO-8859-8" - var LOGICAL_HEBREW_NAME = "windows-1255" - var self = this; - - function init() { - self._mLogicalProber = null; - self._mVisualProber = null; - self.reset(); - } - - this.reset = function() { - this._mFinalCharLogicalScore = 0; - this._mFinalCharVisualScore = 0; - // The two last characters seen in the previous buffer, - // mPrev and mBeforePrev are initialized to space in order to simulate a word - // delimiter at the beginning of the data - this._mPrev = " "; - this._mBeforePrev = " "; - // These probers are owned by the group prober. - } - - this.setModelProbers = function(logicalProber, visualProber) { - this._mLogicalProber = logicalProber; - this._mVisualProber = visualProber; - } - - this.isFinal = function(c) { - return [FINAL_KAF, FINAL_MEM, FINAL_NUN, FINAL_PE, FINAL_TSADI].indexOf(c) != -1; - } - - this.isNonFinal = function(c) { - // The normal Tsadi is not a good Non-Final letter due to words like - // 'lechotet' (to chat) containing an apostrophe after the tsadi. This - // apostrophe is converted to a space in FilterWithoutEnglishLetters causing - // the Non-Final tsadi to appear at an end of a word even though this is not - // the case in the original text. - // The letters Pe and Kaf rarely display a related behavior of not being a - // good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' for - // example legally end with a Non-Final Pe or Kaf. However, the benefit of - // these letters as Non-Final letters outweighs the damage since these words - // are quite rare. - return [NORMAL_KAF, NORMAL_MEM, NORMAL_NUN, NORMAL_PE].indexOf(c) != -1; - } - - this.feed = function(aBuf) { - // Final letter analysis for logical-visual decision. - // Look for evidence that the received buffer is either logical Hebrew or - // visual Hebrew. - // The following cases are checked: - // 1) A word longer than 1 letter, ending with a final letter. This is an - // indication that the text is laid out "naturally" since the final letter - // really appears at the end. +1 for logical score. - // 2) A word longer than 1 letter, ending with a Non-Final letter. In normal - // Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, should not end with - // the Non-Final form of that letter. Exceptions to this rule are mentioned - // above in isNonFinal(). This is an indication that the text is laid out - // backwards. +1 for visual score - // 3) A word longer than 1 letter, starting with a final letter. Final letters - // should not appear at the beginning of a word. This is an indication that - // the text is laid out backwards. +1 for visual score. - // - // The visual score and logical score are accumulated throughout the text and - // are finally checked against each other in GetCharSetName(). - // No checking for final letters in the middle of words is done since that case - // is not an indication for either Logical or Visual text. - // - // We automatically filter out all 7-bit characters (replace them with spaces) - // so the word boundary detection works properly. [MAP] - - if( this.getState() == jschardet.Constants.notMe ) { - // Both model probers say it's not them. No reason to continue. - return jschardet.Constants.notMe; - } - - aBuf = this.filterHighBitOnly(aBuf); - - for( var i = 0, cur; i < aBuf.length; i++ ) { - cur = aBuf[i]; - if( cur == " " ) { - // We stand on a space - a word just ended - if( this._mBeforePrev != " " ) { - // next-to-last char was not a space so self._mPrev is not a 1 letter word - if( this.isFinal(this._mPrev) ) { - // case (1) [-2:not space][-1:final letter][cur:space] - this._mFinalCharLogicalScore++; - } else if( this.isNonFinal(this._mPrev) ) { - // case (2) [-2:not space][-1:Non-Final letter][cur:space] - this._mFinalCharVisualScore++; - } - } - } else { - // Not standing on a space - if( this._mBeforePrev == " " && this.isFinal(this._mPrev) && cur != " " ) { - // case (3) [-2:space][-1:final letter][cur:not space] - this._mFinalCharVisualScore++; - } - } - this._mBeforePrev = this._mPrev; - this._mPrev = cur; - } - // Forever detecting, till the end or until both model probers return eNotMe (handled above) - return jschardet.Constants.detecting; - } - - this.getCharsetName = function() { - // Make the decision: is it Logical or Visual? - // If the final letter score distance is dominant enough, rely on it. - var finalsub = this._mFinalCharLogicalScore - this._mFinalCharVisualScore; - if( finalsub >= MIN_FINAL_CHAR_DISTANCE ) { - return LOGICAL_HEBREW_NAME; - } - if( finalsub <= -MIN_FINAL_CHAR_DISTANCE ) { - return VISUAL_HEBREW_NAME; - } - - // It's not dominant enough, try to rely on the model scores instead. - var modelsub = this._mLogicalProber.getConfidence() - this._mVisualProber.getConfidence(); - if( modelsub > MIN_MODEL_DISTANCE ) { - return LOGICAL_HEBREW_NAME; - } - if( modelsub < -MIN_MODEL_DISTANCE ) { - return VISUAL_HEBREW_NAME; - } - - // Still no good, back to final letter distance, maybe it'll save the day. - if( finalsub < 0 ) { - return VISUAL_HEBREW_NAME; - } - - // (finalsub > 0 - Logical) or (don't know what to do) default to Logical. - return LOGICAL_HEBREW_NAME; - } - - this.getState = function() { - // Remain active as long as any of the model probers are active. - if( this._mLogicalProber.getState() == jschardet.Constants.notMe && - this._mVisualProber.getState() == jschardet.Constants.notMe ) { - return jschardet.Constants.notMe; - } - return jschardet.Constants.detecting; - } - - init(); -} -jschardet.HebrewProber.prototype = new jschardet.CharSetProber(); - -// https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/IndexOf -if (!Array.prototype.indexOf) -{ - Array.prototype.indexOf = function(elt /*, from*/) - { - var len = this.length >>> 0; - - var from = Number(arguments[1]) || 0; - from = (from < 0) - ? Math.ceil(from) - : Math.floor(from); - if (from < 0) - from += len; - - for (; from < len; from++) - { - if (from in this && - this[from] === elt) - return from; - } - return -1; - }; -} - -}(require('./init')); - -},{"./init":20}],19:[function(require,module,exports){ -module.exports = require('./init') -},{"./init":20}],20:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -var jschardet = exports; - -require('./constants'); -require('./codingstatemachine'); -require('./escsm'); -require('./mbcssm'); -require('./charsetprober'); -require('./mbcharsetprober'); -require('./jisfreq'); -require('./gb2312freq'); -require('./euckrfreq'); -require('./big5freq'); -require('./euctwfreq'); -require('./chardistribution'); -require('./jpcntx'); -require('./sjisprober'); -require('./utf8prober'); -require('./charsetgroupprober'); -require('./eucjpprober'); -require('./gb2312prober'); -require('./euckrprober'); -require('./big5prober'); -require('./euctwprober'); -require('./mbcsgroupprober'); -require('./sbcharsetprober'); -require('./langgreekmodel'); -require('./langthaimodel'); -require('./langbulgarianmodel'); -require('./langcyrillicmodel'); -require('./hebrewprober'); -require('./langhebrewmodel'); -require('./langhungarianmodel'); -require('./sbcsgroupprober'); -require('./latin1prober'); -require('./escprober'); -require('./universaldetector'); - -jschardet.VERSION = "1.4.1"; -jschardet.detect = function(buffer) { - var u = new jschardet.UniversalDetector(); - u.reset(); - if( typeof Buffer == 'function' && buffer instanceof Buffer ) { - u.feed(buffer.toString('binary')); - } else { - u.feed(buffer); - } - u.close(); - return u.result; -} -jschardet.log = function() { - console.log.apply(console, arguments); -} - -},{"./big5freq":2,"./big5prober":3,"./chardistribution":4,"./charsetgroupprober":5,"./charsetprober":6,"./codingstatemachine":7,"./constants":8,"./escprober":9,"./escsm":10,"./eucjpprober":11,"./euckrfreq":12,"./euckrprober":13,"./euctwfreq":14,"./euctwprober":15,"./gb2312freq":16,"./gb2312prober":17,"./hebrewprober":18,"./jisfreq":21,"./jpcntx":22,"./langbulgarianmodel":23,"./langcyrillicmodel":24,"./langgreekmodel":25,"./langhebrewmodel":26,"./langhungarianmodel":27,"./langthaimodel":28,"./latin1prober":29,"./mbcharsetprober":30,"./mbcsgroupprober":31,"./mbcssm":32,"./sbcharsetprober":33,"./sbcsgroupprober":34,"./sjisprober":35,"./universaldetector":36,"./utf8prober":37}],21:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// Sampling from about 20M text materials include literature and computer technology -// -// Japanese frequency table, applied to both S-JIS and EUC-JP -// They are sorted in order. -// -// 128 --> 0.77094 -// 256 --> 0.85710 -// 512 --> 0.92635 -// 1024 --> 0.97130 -// 2048 --> 0.99431 -// -// Ideal Distribution Ratio = 0.92635 / (1-0.92635) = 12.58 -// Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191 -// -// Typical Distribution Ratio, 25% of IDR - -jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO = 3.0; - -jschardet.JIS_TABLE_SIZE = 4368; - -jschardet.JISCharToFreqOrder = [ - 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, // 16 -3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, // 32 -1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, // 48 -2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, // 64 -2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, // 80 -5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, // 96 -1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, // 112 -5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, // 128 -5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, // 144 -5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, // 160 -5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, // 176 -5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, // 192 -5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, // 208 -1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, // 224 -1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, // 240 -1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, // 256 -2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, // 272 -3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, // 288 -3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, // 304 - 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, // 320 - 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, // 336 -1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, // 352 - 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, // 368 -5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, // 384 - 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, // 400 - 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, // 416 - 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, // 432 - 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, // 448 - 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, // 464 -5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, // 480 -5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, // 496 -5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, // 512 -4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, // 528 -5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, // 544 -5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, // 560 -5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, // 576 -5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, // 592 -5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, // 608 -5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, // 624 -5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, // 640 -5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, // 656 -5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, // 672 -3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, // 688 -5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, // 704 -5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, // 720 -5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, // 736 -5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, // 752 -5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, // 768 -5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, // 784 -5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, // 800 -5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, // 816 -5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, // 832 -5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, // 848 -5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, // 864 -5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, // 880 -5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, // 896 -5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, // 912 -5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, // 928 -5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, // 944 -5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, // 960 -5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, // 976 -5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, // 992 -5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, // 1008 -5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, // 1024 -5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, // 1040 -5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, // 1056 -5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, // 1072 -5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, // 1088 -5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, // 1104 -5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, // 1120 -5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, // 1136 -5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, // 1152 -5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, // 1168 -5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, // 1184 -5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, // 1200 -5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, // 1216 -5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, // 1232 -5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, // 1248 -5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, // 1264 -5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, // 1280 -5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, // 1296 -6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, // 1312 -6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, // 1328 -6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, // 1344 -6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, // 1360 -6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, // 1376 -6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, // 1392 -6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, // 1408 -6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, // 1424 -4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, // 1440 - 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, // 1456 - 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, // 1472 -1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, // 1488 -1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, // 1504 - 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, // 1520 -3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, // 1536 -3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, // 1552 - 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, // 1568 -3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, // 1584 -3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, // 1600 - 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, // 1616 -2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, // 1632 - 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, // 1648 -3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, // 1664 -1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, // 1680 - 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, // 1696 -1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, // 1712 - 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, // 1728 -2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, // 1744 -2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, // 1760 -2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, // 1776 -2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, // 1792 -1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, // 1808 -1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, // 1824 -1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, // 1840 -1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, // 1856 -2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, // 1872 -1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, // 1888 -2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, // 1904 -1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, // 1920 -1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, // 1936 -1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, // 1952 -1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, // 1968 -1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, // 1984 -1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, // 2000 - 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, // 2016 - 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, // 2032 -1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, // 2048 -2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, // 2064 -2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, // 2080 -2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, // 2096 -3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, // 2112 -3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, // 2128 - 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, // 2144 -3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, // 2160 -1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, // 2176 - 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, // 2192 -2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, // 2208 -1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, // 2224 - 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, // 2240 -3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, // 2256 -4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, // 2272 -2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, // 2288 -1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, // 2304 -2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, // 2320 -1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, // 2336 - 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, // 2352 - 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, // 2368 -1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, // 2384 -2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, // 2400 -2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, // 2416 -2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, // 2432 -3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, // 2448 -1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, // 2464 -2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, // 2480 - 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, // 2496 - 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, // 2512 - 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, // 2528 -1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, // 2544 -2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, // 2560 - 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, // 2576 -1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, // 2592 -1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, // 2608 - 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, // 2624 -1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, // 2640 -1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, // 2656 -1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, // 2672 - 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, // 2688 -2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, // 2704 - 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, // 2720 -2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, // 2736 -3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, // 2752 -2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, // 2768 -1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, // 2784 -6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, // 2800 -1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, // 2816 -2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, // 2832 -1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, // 2848 - 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, // 2864 - 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, // 2880 -3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, // 2896 -3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, // 2912 -1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, // 2928 -1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, // 2944 -1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, // 2960 -1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, // 2976 - 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, // 2992 - 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, // 3008 -2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, // 3024 - 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, // 3040 -3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, // 3056 -2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, // 3072 - 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, // 3088 -1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, // 3104 -2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, // 3120 - 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, // 3136 -1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, // 3152 - 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, // 3168 -4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, // 3184 -2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, // 3200 -1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, // 3216 - 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, // 3232 -1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, // 3248 -2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, // 3264 - 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, // 3280 -6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, // 3296 -1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, // 3312 -1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, // 3328 -2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, // 3344 -3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, // 3360 - 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, // 3376 -3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, // 3392 -1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, // 3408 - 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, // 3424 -1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, // 3440 - 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, // 3456 -3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, // 3472 - 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, // 3488 -2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, // 3504 - 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, // 3520 -4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, // 3536 -2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, // 3552 -1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, // 3568 -1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, // 3584 -1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, // 3600 - 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, // 3616 -1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, // 3632 -3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, // 3648 -1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, // 3664 -3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, // 3680 - 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, // 3696 - 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, // 3712 - 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, // 3728 -2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, // 3744 -1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, // 3760 - 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, // 3776 -1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, // 3792 - 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, // 3808 -1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, // 3824 - 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, // 3840 - 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, // 3856 - 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, // 3872 -1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, // 3888 -1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, // 3904 -2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, // 3920 -4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, // 3936 - 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, // 3952 -1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, // 3968 - 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, // 3984 -1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, // 4000 -3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, // 4016 -1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, // 4032 -2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, // 4048 -2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, // 4064 -1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, // 4080 -1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, // 4096 -2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, // 4112 - 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, // 4128 -2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, // 4144 -1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, // 4160 -1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, // 4176 -1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, // 4192 -1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, // 4208 -3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, // 4224 -2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, // 4240 -2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, // 4256 - 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, // 4272 -3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, // 4288 -3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, // 4304 -1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, // 4320 -2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, // 4336 -1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, // 4352 -2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, // 4368 //last 512 -//Everything below is of no interest for detection purpose -2138,2122,3730,2888,1995,1820,1044,6190,6191,6192,6193,6194,6195,6196,6197,6198, // 4384 -6199,6200,6201,6202,6203,6204,6205,4670,6206,6207,6208,6209,6210,6211,6212,6213, // 4400 -6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229, // 4416 -6230,6231,6232,6233,6234,6235,6236,6237,3187,6238,6239,3969,6240,6241,6242,6243, // 4432 -6244,4671,6245,6246,4672,6247,6248,4133,6249,6250,4364,6251,2923,2556,2613,4673, // 4448 -4365,3970,6252,6253,6254,6255,4674,6256,6257,6258,2768,2353,4366,4675,4676,3188, // 4464 -4367,3463,6259,4134,4677,4678,6260,2267,6261,3842,3332,4368,3543,6262,6263,6264, // 4480 -3013,1954,1928,4135,4679,6265,6266,2478,3091,6267,4680,4369,6268,6269,1699,6270, // 4496 -3544,4136,4681,6271,4137,6272,4370,2804,6273,6274,2593,3971,3972,4682,6275,2236, // 4512 -4683,6276,6277,4684,6278,6279,4138,3973,4685,6280,6281,3258,6282,6283,6284,6285, // 4528 -3974,4686,2841,3975,6286,6287,3545,6288,6289,4139,4687,4140,6290,4141,6291,4142, // 4544 -6292,6293,3333,6294,6295,6296,4371,6297,3399,6298,6299,4372,3976,6300,6301,6302, // 4560 -4373,6303,6304,3843,3731,6305,4688,4374,6306,6307,3259,2294,6308,3732,2530,4143, // 4576 -6309,4689,6310,6311,6312,3048,6313,6314,4690,3733,2237,6315,6316,2282,3334,6317, // 4592 -6318,3844,6319,6320,4691,6321,3400,4692,6322,4693,6323,3049,6324,4375,6325,3977, // 4608 -6326,6327,6328,3546,6329,4694,3335,6330,4695,4696,6331,6332,6333,6334,4376,3978, // 4624 -6335,4697,3979,4144,6336,3980,4698,6337,6338,6339,6340,6341,4699,4700,4701,6342, // 4640 -6343,4702,6344,6345,4703,6346,6347,4704,6348,4705,4706,3135,6349,4707,6350,4708, // 4656 -6351,4377,6352,4709,3734,4145,6353,2506,4710,3189,6354,3050,4711,3981,6355,3547, // 4672 -3014,4146,4378,3735,2651,3845,3260,3136,2224,1986,6356,3401,6357,4712,2594,3627, // 4688 -3137,2573,3736,3982,4713,3628,4714,4715,2682,3629,4716,6358,3630,4379,3631,6359, // 4704 -6360,6361,3983,6362,6363,6364,6365,4147,3846,4717,6366,6367,3737,2842,6368,4718, // 4720 -2628,6369,3261,6370,2386,6371,6372,3738,3984,4719,3464,4720,3402,6373,2924,3336, // 4736 -4148,2866,6374,2805,3262,4380,2704,2069,2531,3138,2806,2984,6375,2769,6376,4721, // 4752 -4722,3403,6377,6378,3548,6379,6380,2705,3092,1979,4149,2629,3337,2889,6381,3338, // 4768 -4150,2557,3339,4381,6382,3190,3263,3739,6383,4151,4723,4152,2558,2574,3404,3191, // 4784 -6384,6385,4153,6386,4724,4382,6387,6388,4383,6389,6390,4154,6391,4725,3985,6392, // 4800 -3847,4155,6393,6394,6395,6396,6397,3465,6398,4384,6399,6400,6401,6402,6403,6404, // 4816 -4156,6405,6406,6407,6408,2123,6409,6410,2326,3192,4726,6411,6412,6413,6414,4385, // 4832 -4157,6415,6416,4158,6417,3093,3848,6418,3986,6419,6420,3849,6421,6422,6423,4159, // 4848 -6424,6425,4160,6426,3740,6427,6428,6429,6430,3987,6431,4727,6432,2238,6433,6434, // 4864 -4386,3988,6435,6436,3632,6437,6438,2843,6439,6440,6441,6442,3633,6443,2958,6444, // 4880 -6445,3466,6446,2364,4387,3850,6447,4388,2959,3340,6448,3851,6449,4728,6450,6451, // 4896 -3264,4729,6452,3193,6453,4389,4390,2706,3341,4730,6454,3139,6455,3194,6456,3051, // 4912 -2124,3852,1602,4391,4161,3853,1158,3854,4162,3989,4392,3990,4731,4732,4393,2040, // 4928 -4163,4394,3265,6457,2807,3467,3855,6458,6459,6460,3991,3468,4733,4734,6461,3140, // 4944 -2960,6462,4735,6463,6464,6465,6466,4736,4737,4738,4739,6467,6468,4164,2403,3856, // 4960 -6469,6470,2770,2844,6471,4740,6472,6473,6474,6475,6476,6477,6478,3195,6479,4741, // 4976 -4395,6480,2867,6481,4742,2808,6482,2493,4165,6483,6484,6485,6486,2295,4743,6487, // 4992 -6488,6489,3634,6490,6491,6492,6493,6494,6495,6496,2985,4744,6497,6498,4745,6499, // 5008 -6500,2925,3141,4166,6501,6502,4746,6503,6504,4747,6505,6506,6507,2890,6508,6509, // 5024 -6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,3469,4167,6520,6521,6522,4748, // 5040 -4396,3741,4397,4749,4398,3342,2125,4750,6523,4751,4752,4753,3052,6524,2961,4168, // 5056 -6525,4754,6526,4755,4399,2926,4169,6527,3857,6528,4400,4170,6529,4171,6530,6531, // 5072 -2595,6532,6533,6534,6535,3635,6536,6537,6538,6539,6540,6541,6542,4756,6543,6544, // 5088 -6545,6546,6547,6548,4401,6549,6550,6551,6552,4402,3405,4757,4403,6553,6554,6555, // 5104 -4172,3742,6556,6557,6558,3992,3636,6559,6560,3053,2726,6561,3549,4173,3054,4404, // 5120 -6562,6563,3993,4405,3266,3550,2809,4406,6564,6565,6566,4758,4759,6567,3743,6568, // 5136 -4760,3744,4761,3470,6569,6570,6571,4407,6572,3745,4174,6573,4175,2810,4176,3196, // 5152 -4762,6574,4177,6575,6576,2494,2891,3551,6577,6578,3471,6579,4408,6580,3015,3197, // 5168 -6581,3343,2532,3994,3858,6582,3094,3406,4409,6583,2892,4178,4763,4410,3016,4411, // 5184 -6584,3995,3142,3017,2683,6585,4179,6586,6587,4764,4412,6588,6589,4413,6590,2986, // 5200 -6591,2962,3552,6592,2963,3472,6593,6594,4180,4765,6595,6596,2225,3267,4414,6597, // 5216 -3407,3637,4766,6598,6599,3198,6600,4415,6601,3859,3199,6602,3473,4767,2811,4416, // 5232 -1856,3268,3200,2575,3996,3997,3201,4417,6603,3095,2927,6604,3143,6605,2268,6606, // 5248 -3998,3860,3096,2771,6607,6608,3638,2495,4768,6609,3861,6610,3269,2745,4769,4181, // 5264 -3553,6611,2845,3270,6612,6613,6614,3862,6615,6616,4770,4771,6617,3474,3999,4418, // 5280 -4419,6618,3639,3344,6619,4772,4182,6620,2126,6621,6622,6623,4420,4773,6624,3018, // 5296 -6625,4774,3554,6626,4183,2025,3746,6627,4184,2707,6628,4421,4422,3097,1775,4185, // 5312 -3555,6629,6630,2868,6631,6632,4423,6633,6634,4424,2414,2533,2928,6635,4186,2387, // 5328 -6636,4775,6637,4187,6638,1891,4425,3202,3203,6639,6640,4776,6641,3345,6642,6643, // 5344 -3640,6644,3475,3346,3641,4000,6645,3144,6646,3098,2812,4188,3642,3204,6647,3863, // 5360 -3476,6648,3864,6649,4426,4001,6650,6651,6652,2576,6653,4189,4777,6654,6655,6656, // 5376 -2846,6657,3477,3205,4002,6658,4003,6659,3347,2252,6660,6661,6662,4778,6663,6664, // 5392 -6665,6666,6667,6668,6669,4779,4780,2048,6670,3478,3099,6671,3556,3747,4004,6672, // 5408 -6673,6674,3145,4005,3748,6675,6676,6677,6678,6679,3408,6680,6681,6682,6683,3206, // 5424 -3207,6684,6685,4781,4427,6686,4782,4783,4784,6687,6688,6689,4190,6690,6691,3479, // 5440 -6692,2746,6693,4428,6694,6695,6696,6697,6698,6699,4785,6700,6701,3208,2727,6702, // 5456 -3146,6703,6704,3409,2196,6705,4429,6706,6707,6708,2534,1996,6709,6710,6711,2747, // 5472 -6712,6713,6714,4786,3643,6715,4430,4431,6716,3557,6717,4432,4433,6718,6719,6720, // 5488 -6721,3749,6722,4006,4787,6723,6724,3644,4788,4434,6725,6726,4789,2772,6727,6728, // 5504 -6729,6730,6731,2708,3865,2813,4435,6732,6733,4790,4791,3480,6734,6735,6736,6737, // 5520 -4436,3348,6738,3410,4007,6739,6740,4008,6741,6742,4792,3411,4191,6743,6744,6745, // 5536 -6746,6747,3866,6748,3750,6749,6750,6751,6752,6753,6754,6755,3867,6756,4009,6757, // 5552 -4793,4794,6758,2814,2987,6759,6760,6761,4437,6762,6763,6764,6765,3645,6766,6767, // 5568 -3481,4192,6768,3751,6769,6770,2174,6771,3868,3752,6772,6773,6774,4193,4795,4438, // 5584 -3558,4796,4439,6775,4797,6776,6777,4798,6778,4799,3559,4800,6779,6780,6781,3482, // 5600 -6782,2893,6783,6784,4194,4801,4010,6785,6786,4440,6787,4011,6788,6789,6790,6791, // 5616 -6792,6793,4802,6794,6795,6796,4012,6797,6798,6799,6800,3349,4803,3483,6801,4804, // 5632 -4195,6802,4013,6803,6804,4196,6805,4014,4015,6806,2847,3271,2848,6807,3484,6808, // 5648 -6809,6810,4441,6811,4442,4197,4443,3272,4805,6812,3412,4016,1579,6813,6814,4017, // 5664 -6815,3869,6816,2964,6817,4806,6818,6819,4018,3646,6820,6821,4807,4019,4020,6822, // 5680 -6823,3560,6824,6825,4021,4444,6826,4198,6827,6828,4445,6829,6830,4199,4808,6831, // 5696 -6832,6833,3870,3019,2458,6834,3753,3413,3350,6835,4809,3871,4810,3561,4446,6836, // 5712 -6837,4447,4811,4812,6838,2459,4448,6839,4449,6840,6841,4022,3872,6842,4813,4814, // 5728 -6843,6844,4815,4200,4201,4202,6845,4023,6846,6847,4450,3562,3873,6848,6849,4816, // 5744 -4817,6850,4451,4818,2139,6851,3563,6852,6853,3351,6854,6855,3352,4024,2709,3414, // 5760 -4203,4452,6856,4204,6857,6858,3874,3875,6859,6860,4819,6861,6862,6863,6864,4453, // 5776 -3647,6865,6866,4820,6867,6868,6869,6870,4454,6871,2869,6872,6873,4821,6874,3754, // 5792 -6875,4822,4205,6876,6877,6878,3648,4206,4455,6879,4823,6880,4824,3876,6881,3055, // 5808 -4207,6882,3415,6883,6884,6885,4208,4209,6886,4210,3353,6887,3354,3564,3209,3485, // 5824 -2652,6888,2728,6889,3210,3755,6890,4025,4456,6891,4825,6892,6893,6894,6895,4211, // 5840 -6896,6897,6898,4826,6899,6900,4212,6901,4827,6902,2773,3565,6903,4828,6904,6905, // 5856 -6906,6907,3649,3650,6908,2849,3566,6909,3567,3100,6910,6911,6912,6913,6914,6915, // 5872 -4026,6916,3355,4829,3056,4457,3756,6917,3651,6918,4213,3652,2870,6919,4458,6920, // 5888 -2438,6921,6922,3757,2774,4830,6923,3356,4831,4832,6924,4833,4459,3653,2507,6925, // 5904 -4834,2535,6926,6927,3273,4027,3147,6928,3568,6929,6930,6931,4460,6932,3877,4461, // 5920 -2729,3654,6933,6934,6935,6936,2175,4835,2630,4214,4028,4462,4836,4215,6937,3148, // 5936 -4216,4463,4837,4838,4217,6938,6939,2850,4839,6940,4464,6941,6942,6943,4840,6944, // 5952 -4218,3274,4465,6945,6946,2710,6947,4841,4466,6948,6949,2894,6950,6951,4842,6952, // 5968 -4219,3057,2871,6953,6954,6955,6956,4467,6957,2711,6958,6959,6960,3275,3101,4843, // 5984 -6961,3357,3569,6962,4844,6963,6964,4468,4845,3570,6965,3102,4846,3758,6966,4847, // 6000 -3878,4848,4849,4029,6967,2929,3879,4850,4851,6968,6969,1733,6970,4220,6971,6972, // 6016 -6973,6974,6975,6976,4852,6977,6978,6979,6980,6981,6982,3759,6983,6984,6985,3486, // 6032 -3487,6986,3488,3416,6987,6988,6989,6990,6991,6992,6993,6994,6995,6996,6997,4853, // 6048 -6998,6999,4030,7000,7001,3211,7002,7003,4221,7004,7005,3571,4031,7006,3572,7007, // 6064 -2614,4854,2577,7008,7009,2965,3655,3656,4855,2775,3489,3880,4222,4856,3881,4032, // 6080 -3882,3657,2730,3490,4857,7010,3149,7011,4469,4858,2496,3491,4859,2283,7012,7013, // 6096 -7014,2365,4860,4470,7015,7016,3760,7017,7018,4223,1917,7019,7020,7021,4471,7022, // 6112 -2776,4472,7023,7024,7025,7026,4033,7027,3573,4224,4861,4034,4862,7028,7029,1929, // 6128 -3883,4035,7030,4473,3058,7031,2536,3761,3884,7032,4036,7033,2966,2895,1968,4474, // 6144 -3276,4225,3417,3492,4226,2105,7034,7035,1754,2596,3762,4227,4863,4475,3763,4864, // 6160 -3764,2615,2777,3103,3765,3658,3418,4865,2296,3766,2815,7036,7037,7038,3574,2872, // 6176 -3277,4476,7039,4037,4477,7040,7041,4038,7042,7043,7044,7045,7046,7047,2537,7048, // 6192 -7049,7050,7051,7052,7053,7054,4478,7055,7056,3767,3659,4228,3575,7057,7058,4229, // 6208 -7059,7060,7061,3660,7062,3212,7063,3885,4039,2460,7064,7065,7066,7067,7068,7069, // 6224 -7070,7071,7072,7073,7074,4866,3768,4867,7075,7076,7077,7078,4868,3358,3278,2653, // 6240 -7079,7080,4479,3886,7081,7082,4869,7083,7084,7085,7086,7087,7088,2538,7089,7090, // 6256 -7091,4040,3150,3769,4870,4041,2896,3359,4230,2930,7092,3279,7093,2967,4480,3213, // 6272 -4481,3661,7094,7095,7096,7097,7098,7099,7100,7101,7102,2461,3770,7103,7104,4231, // 6288 -3151,7105,7106,7107,4042,3662,7108,7109,4871,3663,4872,4043,3059,7110,7111,7112, // 6304 -3493,2988,7113,4873,7114,7115,7116,3771,4874,7117,7118,4232,4875,7119,3576,2336, // 6320 -4876,7120,4233,3419,4044,4877,4878,4482,4483,4879,4484,4234,7121,3772,4880,1045, // 6336 -3280,3664,4881,4882,7122,7123,7124,7125,4883,7126,2778,7127,4485,4486,7128,4884, // 6352 -3214,3887,7129,7130,3215,7131,4885,4045,7132,7133,4046,7134,7135,7136,7137,7138, // 6368 -7139,7140,7141,7142,7143,4235,7144,4886,7145,7146,7147,4887,7148,7149,7150,4487, // 6384 -4047,4488,7151,7152,4888,4048,2989,3888,7153,3665,7154,4049,7155,7156,7157,7158, // 6400 -7159,7160,2931,4889,4890,4489,7161,2631,3889,4236,2779,7162,7163,4891,7164,3060, // 6416 -7165,1672,4892,7166,4893,4237,3281,4894,7167,7168,3666,7169,3494,7170,7171,4050, // 6432 -7172,7173,3104,3360,3420,4490,4051,2684,4052,7174,4053,7175,7176,7177,2253,4054, // 6448 -7178,7179,4895,7180,3152,3890,3153,4491,3216,7181,7182,7183,2968,4238,4492,4055, // 6464 -7184,2990,7185,2479,7186,7187,4493,7188,7189,7190,7191,7192,4896,7193,4897,2969, // 6480 -4494,4898,7194,3495,7195,7196,4899,4495,7197,3105,2731,7198,4900,7199,7200,7201, // 6496 -4056,7202,3361,7203,7204,4496,4901,4902,7205,4497,7206,7207,2315,4903,7208,4904, // 6512 -7209,4905,2851,7210,7211,3577,7212,3578,4906,7213,4057,3667,4907,7214,4058,2354, // 6528 -3891,2376,3217,3773,7215,7216,7217,7218,7219,4498,7220,4908,3282,2685,7221,3496, // 6544 -4909,2632,3154,4910,7222,2337,7223,4911,7224,7225,7226,4912,4913,3283,4239,4499, // 6560 -7227,2816,7228,7229,7230,7231,7232,7233,7234,4914,4500,4501,7235,7236,7237,2686, // 6576 -7238,4915,7239,2897,4502,7240,4503,7241,2516,7242,4504,3362,3218,7243,7244,7245, // 6592 -4916,7246,7247,4505,3363,7248,7249,7250,7251,3774,4506,7252,7253,4917,7254,7255, // 6608 -3284,2991,4918,4919,3219,3892,4920,3106,3497,4921,7256,7257,7258,4922,7259,4923, // 6624 -3364,4507,4508,4059,7260,4240,3498,7261,7262,4924,7263,2992,3893,4060,3220,7264, // 6640 -7265,7266,7267,7268,7269,4509,3775,7270,2817,7271,4061,4925,4510,3776,7272,4241, // 6656 -4511,3285,7273,7274,3499,7275,7276,7277,4062,4512,4926,7278,3107,3894,7279,7280, // 6672 -4927,7281,4513,7282,7283,3668,7284,7285,4242,4514,4243,7286,2058,4515,4928,4929, // 6688 -4516,7287,3286,4244,7288,4517,7289,7290,7291,3669,7292,7293,4930,4931,4932,2355, // 6704 -4933,7294,2633,4518,7295,4245,7296,7297,4519,7298,7299,4520,4521,4934,7300,4246, // 6720 -4522,7301,7302,7303,3579,7304,4247,4935,7305,4936,7306,7307,7308,7309,3777,7310, // 6736 -4523,7311,7312,7313,4248,3580,7314,4524,3778,4249,7315,3581,7316,3287,7317,3221, // 6752 -7318,4937,7319,7320,7321,7322,7323,7324,4938,4939,7325,4525,7326,7327,7328,4063, // 6768 -7329,7330,4940,7331,7332,4941,7333,4526,7334,3500,2780,1741,4942,2026,1742,7335, // 6784 -7336,3582,4527,2388,7337,7338,7339,4528,7340,4250,4943,7341,7342,7343,4944,7344, // 6800 -7345,7346,3020,7347,4945,7348,7349,7350,7351,3895,7352,3896,4064,3897,7353,7354, // 6816 -7355,4251,7356,7357,3898,7358,3779,7359,3780,3288,7360,7361,4529,7362,4946,4530, // 6832 -2027,7363,3899,4531,4947,3222,3583,7364,4948,7365,7366,7367,7368,4949,3501,4950, // 6848 -3781,4951,4532,7369,2517,4952,4252,4953,3155,7370,4954,4955,4253,2518,4533,7371, // 6864 -7372,2712,4254,7373,7374,7375,3670,4956,3671,7376,2389,3502,4065,7377,2338,7378, // 6880 -7379,7380,7381,3061,7382,4957,7383,7384,7385,7386,4958,4534,7387,7388,2993,7389, // 6896 -3062,7390,4959,7391,7392,7393,4960,3108,4961,7394,4535,7395,4962,3421,4536,7396, // 6912 -4963,7397,4964,1857,7398,4965,7399,7400,2176,3584,4966,7401,7402,3422,4537,3900, // 6928 -3585,7403,3782,7404,2852,7405,7406,7407,4538,3783,2654,3423,4967,4539,7408,3784, // 6944 -3586,2853,4540,4541,7409,3901,7410,3902,7411,7412,3785,3109,2327,3903,7413,7414, // 6960 -2970,4066,2932,7415,7416,7417,3904,3672,3424,7418,4542,4543,4544,7419,4968,7420, // 6976 -7421,4255,7422,7423,7424,7425,7426,4067,7427,3673,3365,4545,7428,3110,2559,3674, // 6992 -7429,7430,3156,7431,7432,3503,7433,3425,4546,7434,3063,2873,7435,3223,4969,4547, // 7008 -4548,2898,4256,4068,7436,4069,3587,3786,2933,3787,4257,4970,4971,3788,7437,4972, // 7024 -3064,7438,4549,7439,7440,7441,7442,7443,4973,3905,7444,2874,7445,7446,7447,7448, // 7040 -3021,7449,4550,3906,3588,4974,7450,7451,3789,3675,7452,2578,7453,4070,7454,7455, // 7056 -7456,4258,3676,7457,4975,7458,4976,4259,3790,3504,2634,4977,3677,4551,4260,7459, // 7072 -7460,7461,7462,3907,4261,4978,7463,7464,7465,7466,4979,4980,7467,7468,2213,4262, // 7088 -7469,7470,7471,3678,4981,7472,2439,7473,4263,3224,3289,7474,3908,2415,4982,7475, // 7104 -4264,7476,4983,2655,7477,7478,2732,4552,2854,2875,7479,7480,4265,7481,4553,4984, // 7120 -7482,7483,4266,7484,3679,3366,3680,2818,2781,2782,3367,3589,4554,3065,7485,4071, // 7136 -2899,7486,7487,3157,2462,4072,4555,4073,4985,4986,3111,4267,2687,3368,4556,4074, // 7152 -3791,4268,7488,3909,2783,7489,2656,1962,3158,4557,4987,1963,3159,3160,7490,3112, // 7168 -4988,4989,3022,4990,4991,3792,2855,7491,7492,2971,4558,7493,7494,4992,7495,7496, // 7184 -7497,7498,4993,7499,3426,4559,4994,7500,3681,4560,4269,4270,3910,7501,4075,4995, // 7200 -4271,7502,7503,4076,7504,4996,7505,3225,4997,4272,4077,2819,3023,7506,7507,2733, // 7216 -4561,7508,4562,7509,3369,3793,7510,3590,2508,7511,7512,4273,3113,2994,2616,7513, // 7232 -7514,7515,7516,7517,7518,2820,3911,4078,2748,7519,7520,4563,4998,7521,7522,7523, // 7248 -7524,4999,4274,7525,4564,3682,2239,4079,4565,7526,7527,7528,7529,5000,7530,7531, // 7264 -5001,4275,3794,7532,7533,7534,3066,5002,4566,3161,7535,7536,4080,7537,3162,7538, // 7280 -7539,4567,7540,7541,7542,7543,7544,7545,5003,7546,4568,7547,7548,7549,7550,7551, // 7296 -7552,7553,7554,7555,7556,5004,7557,7558,7559,5005,7560,3795,7561,4569,7562,7563, // 7312 -7564,2821,3796,4276,4277,4081,7565,2876,7566,5006,7567,7568,2900,7569,3797,3912, // 7328 -7570,7571,7572,4278,7573,7574,7575,5007,7576,7577,5008,7578,7579,4279,2934,7580, // 7344 -7581,5009,7582,4570,7583,4280,7584,7585,7586,4571,4572,3913,7587,4573,3505,7588, // 7360 -5010,7589,7590,7591,7592,3798,4574,7593,7594,5011,7595,4281,7596,7597,7598,4282, // 7376 -5012,7599,7600,5013,3163,7601,5014,7602,3914,7603,7604,2734,4575,4576,4577,7605, // 7392 -7606,7607,7608,7609,3506,5015,4578,7610,4082,7611,2822,2901,2579,3683,3024,4579, // 7408 -3507,7612,4580,7613,3226,3799,5016,7614,7615,7616,7617,7618,7619,7620,2995,3290, // 7424 -7621,4083,7622,5017,7623,7624,7625,7626,7627,4581,3915,7628,3291,7629,5018,7630, // 7440 -7631,7632,7633,4084,7634,7635,3427,3800,7636,7637,4582,7638,5019,4583,5020,7639, // 7456 -3916,7640,3801,5021,4584,4283,7641,7642,3428,3591,2269,7643,2617,7644,4585,3592, // 7472 -7645,4586,2902,7646,7647,3227,5022,7648,4587,7649,4284,7650,7651,7652,4588,2284, // 7488 -7653,5023,7654,7655,7656,4589,5024,3802,7657,7658,5025,3508,4590,7659,7660,7661, // 7504 -1969,5026,7662,7663,3684,1821,2688,7664,2028,2509,4285,7665,2823,1841,7666,2689, // 7520 -3114,7667,3917,4085,2160,5027,5028,2972,7668,5029,7669,7670,7671,3593,4086,7672, // 7536 -4591,4087,5030,3803,7673,7674,7675,7676,7677,7678,7679,4286,2366,4592,4593,3067, // 7552 -2328,7680,7681,4594,3594,3918,2029,4287,7682,5031,3919,3370,4288,4595,2856,7683, // 7568 -3509,7684,7685,5032,5033,7686,7687,3804,2784,7688,7689,7690,7691,3371,7692,7693, // 7584 -2877,5034,7694,7695,3920,4289,4088,7696,7697,7698,5035,7699,5036,4290,5037,5038, // 7600 -5039,7700,7701,7702,5040,5041,3228,7703,1760,7704,5042,3229,4596,2106,4089,7705, // 7616 -4597,2824,5043,2107,3372,7706,4291,4090,5044,7707,4091,7708,5045,3025,3805,4598, // 7632 -4292,4293,4294,3373,7709,4599,7710,5046,7711,7712,5047,5048,3806,7713,7714,7715, // 7648 -5049,7716,7717,7718,7719,4600,5050,7720,7721,7722,5051,7723,4295,3429,7724,7725, // 7664 -7726,7727,3921,7728,3292,5052,4092,7729,7730,7731,7732,7733,7734,7735,5053,5054, // 7680 -7736,7737,7738,7739,3922,3685,7740,7741,7742,7743,2635,5055,7744,5056,4601,7745, // 7696 -7746,2560,7747,7748,7749,7750,3923,7751,7752,7753,7754,7755,4296,2903,7756,7757, // 7712 -7758,7759,7760,3924,7761,5057,4297,7762,7763,5058,4298,7764,4093,7765,7766,5059, // 7728 -3925,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,3595,7777,4299,5060,4094, // 7744 -7778,3293,5061,7779,7780,4300,7781,7782,4602,7783,3596,7784,7785,3430,2367,7786, // 7760 -3164,5062,5063,4301,7787,7788,4095,5064,5065,7789,3374,3115,7790,7791,7792,7793, // 7776 -7794,7795,7796,3597,4603,7797,7798,3686,3116,3807,5066,7799,7800,5067,7801,7802, // 7792 -4604,4302,5068,4303,4096,7803,7804,3294,7805,7806,5069,4605,2690,7807,3026,7808, // 7808 -7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824, // 7824 -7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7840 -7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856, // 7856 -7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872, // 7872 -7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888, // 7888 -7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904, // 7904 -7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920, // 7920 -7921,7922,7923,7924,3926,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, // 7936 -7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, // 7952 -7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, // 7968 -7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, // 7984 -7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, // 8000 -8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, // 8016 -8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, // 8032 -8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, // 8048 -8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, // 8064 -8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, // 8080 -8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, // 8096 -8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, // 8112 -8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, // 8128 -8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, // 8144 -8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, // 8160 -8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, // 8176 -8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, // 8192 -8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, // 8208 -8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, // 8224 -8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, // 8240 -8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, // 8256 -8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271 // 8272 -]; - -}(require('./init')); - -},{"./init":20}],22:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// This is hiragana 2-char sequence table, the number in each cell represents its frequency category -jschardet.jp2CharContext = [ -[0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1], -[2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,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0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2], -[0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3], -[0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1] -]; - -jschardet.JapaneseContextAnalysis = function() { - var NUM_OF_CATEGORY = 6; - var DONT_KNOW = -1; - var ENOUGH_REL_THRESHOLD = 100; - var MAX_REL_THRESHOLD = 1000; - var MINIMUM_DATA_THRESHOLD = 4; - var self = this; - - function init() { - self.reset(); - } - - this.reset = function() { - this._mTotalRel = 0; // total sequence received - this._mRelSample = []; // category counters, each interger counts sequence in its category - for( var i = 0; i < NUM_OF_CATEGORY; this._mRelSample[i++] = 0 ); - this._mNeedToSkipCharNum = 0; // if last byte in current buffer is not the last byte of a character, we need to know how many bytes to skip in next buffer - this._mLastCharOrder = -1; // The order of previous char - this._mDone = false; // If this flag is set to true, detection is done and conclusion has been made - } - - this.feed = function(aBuf, aLen) { - if( this._mDone ) return; - - // The buffer we got is byte oriented, and a character may span in more than one - // buffers. In case the last one or two byte in last buffer is not complete, we - // record how many byte needed to complete that character and skip these bytes here. - // We can choose to record those bytes as well and analyse the character once it - // is complete, but since a character will not make much difference, by simply skipping - // this character will simply our logic and improve performance. - var i = this._mNeedToSkipCharNum; - while( i < aLen ) { - var rets = this.getOrder(aBuf.slice(i,i+2)); - var order = rets[0]; - var charLen = rets[1]; - i += charLen; - if( i > aLen ) { - this._mNeedToSkipCharNum = i - aLen; - this._mLastCharOrder = -1; - } else { - if( order != -1 && this._mLastCharOrder != -1 ) { - this._mTotalRel += 1; - if( this._mTotalRel > MAX_REL_THRESHOLD ) { - this._mDone = true; - break; - } - this._mRelSample[jschardet.jp2CharContext[this._mLastCharOrder][order]] += 1; - } - this._mLastCharOrder = order; - } - } - } - - this.gotEnoughData = function() { - return this._mTotalRel > ENOUGH_REL_THRESHOLD; - } - - this.getConfidence = function() { - // This is just one way to calculate confidence. It works well for me. - if( this._mTotalRel > MINIMUM_DATA_THRESHOLD ) { - return (this._mTotalRel - this._mRelSample[0]) / this._mTotalRel; - } else { - return DONT_KNOW; - } - } - - this.getOrder = function(aStr) { - return [-1, 1]; - } - - init(); -} - -jschardet.SJISContextAnalysis = function() { - this.getOrder = function(aStr) { - if( !aStr ) return [-1, 1]; - // find out current char's byte length - if( (aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F) || - (aStr.charCodeAt(0) >= 0xE0 && aStr.charCodeAt(0) <= 0xFC) ) { - var charLen = 2; - } else { - charLen = 1; - } - - // return its order if it is hiragana - if( aStr.length > 1 ) { - if( aStr.charCodeAt(0) == 0x82 && aStr.charCodeAt(1) >= 0x9F && - aStr.charCodeAt(0) <= 0xF1 ) { - return [aStr.charCodeAt(1) - 0x9F, charLen]; - } - } - - return [-1, charLen]; - } -} -jschardet.SJISContextAnalysis.prototype = new jschardet.JapaneseContextAnalysis(); - -jschardet.EUCJPContextAnalysis = function() { - this.getOrder = function(aStr) { - if( !aStr ) return [-1, 1]; - // find out current char's byte length - if( aStr.charCodeAt(0) >= 0x8E || - (aStr.charCodeAt(0) >= 0xA1 && aStr.charCodeAt(0) <= 0xFE) ) { - var charLen = 2; - } else if( aStr.charCodeAt(0) == 0x8F ) { - charLen = 3; - } else { - charLen = 1; - } - - // return its order if it is hiragana - if( aStr.length > 1 ) { - if( aStr.charCodeAt(0) == 0xA4 && aStr.charCodeAt(1) >= 0xA1 && - aStr.charCodeAt(1) <= 0xF3 ) { - return [aStr.charCodeAt(1) - 0xA1, charLen]; - } - } - - return [-1, charLen]; - } -} -jschardet.EUCJPContextAnalysis.prototype = new jschardet.JapaneseContextAnalysis(); - -}(require('./init')); - -},{"./init":20}],23:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -// this table is modified base on win1251BulgarianCharToOrderMap, so -// only number <64 is sure valid - -jschardet.Latin5_BulgarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, // 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, // 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, // 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, // 70 -194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, // 80 -210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, // 90 - 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, // a0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, // b0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, // c0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, // d0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, // e0 - 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253 // f0 -]; - -jschardet.win1251BulgarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, // 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, // 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, // 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, // 70 -206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, // 80 -221, 78, 64, 83,121, 98,117,105,222,223,224,225,226,227,228,229, // 90 - 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, // a0 - 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, // b0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, // c0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, // d0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, // e0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16 // f0 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 96.9392% -// first 1024 sequences:3.0618% -// rest sequences: 0.2992% -// negative sequences: 0.0020% -jschardet.BulgarianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2, -3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1, -0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,0,3,1,0, -0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,1,3,3,3,3,2,2,2,1,1,2,0,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,2,3,2,2,3,3,1,1,2,3,3,2,3,3,3,3,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-1,1,1,1,1,1,1,2,0,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 -]; - -jschardet.Latin5BulgarianModel = { - "charToOrderMap" : jschardet.Latin5_BulgarianCharToOrderMap, - "precedenceMatrix" : jschardet.BulgarianLangModel, - "mTypicalPositiveRatio" : 0.969392, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-5" -}; - -jschardet.Win1251BulgarianModel = { - "charToOrderMap" : jschardet.win1251BulgarianCharToOrderMap, - "precedenceMatrix" : jschardet.BulgarianLangModel, - "mTypicalPositiveRatio" : 0.969392, - "keepEnglishLetter" : false, - "charsetName" : "windows-1251" -}; - -}(require('./init')); - -},{"./init":20}],24:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// KOI8-R language model -// Character Mapping Table: -jschardet.KOI8R_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, // 80 -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, // 90 -223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, // a0 -238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, // b0 - 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, // c0 - 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, // d0 - 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, // e0 - 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70 // f0 -]; - -jschardet.win1251_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246, 68,247,248,249,250,251,252,253, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16 -]; - -jschardet.latin5_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255 -]; - -jschardet.macCyrillic_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255 -]; - -jschardet.IBM855_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, -206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, - 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, -220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, -230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, - 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, - 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, -250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255 -]; - -jschardet.IBM866_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 97.6601% -// first 1024 sequences: 2.3389% -// rest sequences: 0.1237% -// negative sequences: 0.0009% -jschardet.RussianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,2,2,2,3,1,3,3,1,3,3,3,3,2,2,3,0,2,2,2,3,3,2,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3,3,3,2,1,2,2,0,1,2,2,2,2,2,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -3,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, -0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 -]; - -jschardet.Koi8rModel = { - "charToOrderMap" : jschardet.KOI8R_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "KOI8-R" -}; - -jschardet.Win1251CyrillicModel = { - "charToOrderMap" : jschardet.win1251_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "windows-1251" -}; - -jschardet.Latin5CyrillicModel = { - "charToOrderMap" : jschardet.latin5_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-5" -}; - -jschardet.MacCyrillicModel = { - "charToOrderMap" : jschardet.macCyrillic_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "MacCyrillic" -}; - -jschardet.Ibm866Model = { - "charToOrderMap" : jschardet.IBM866_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "IBM866" -}; - -jschardet.Ibm855Model = { - "charToOrderMap" : jschardet.IBM855_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "IBM855" -}; - -}(require('./init')); - -},{"./init":20}],25:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -jschardet.Latin7_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, // 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, // 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, // 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, // 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 90 -253,233, 90,253,253,253,253,253,253,253,253,253,253, 74,253,253, // a0 -253,253,253,253,247,248, 61, 36, 46, 71, 73,253, 54,253,108,123, // b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, // c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, // d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, // e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253 // f0 -]; - -jschardet.win1253_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, // 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, // 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, // 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, // 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 90 -253,233, 61,253,253,253,253,253,253,253,253,253,253, 74,253,253, // a0 -253,253,253,253,247,253,253, 36, 46, 71, 73,253, 54,253,108,123, // b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, // c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, // d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, // e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253 // f0 -] - -// Model Table: -// total sequences: 100% -// first 512 sequences: 98.2851% -// first 1024 sequences:1.7001% -// rest sequences: 0.0359% -// neg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,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.Latin7GreekModel = { - "charToOrderMap" : jschardet.Latin7_CharToOrderMap, - "precedenceMatrix" : jschardet.GreekLangModel, - "mTypicalPositiveRatio" : 0.982851, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-7" -}; - -jschardet.Win1253GreekModel = { - "charToOrderMap" : jschardet.win1253_CharToOrderMap, - "precedenceMatrix" : jschardet.GreekLangModel, - "mTypicalPositiveRatio" : 0.982851, - "keepEnglishLetter" : false, - "charsetName" : "windows-1253" -}; - -}(require('./init')); - -},{"./init":20}],26:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Windows-1255 language model -// Character Mapping Table: -jschardet.win1255_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, // 40 - 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, // 50 -253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, // 60 - 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, // 70 -124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, -215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, - 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, -106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, - 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, -238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, - 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, - 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 98.4004% -// first 1024 sequences: 1.5981% -// rest sequences: 0.087% -// negative sequences: 0.0015% -jschardet.HebrewLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, -3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, -1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, -0,1,0,0,2,0,2,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, -1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, -0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0 -]; - -jschardet.Win1255HebrewModel = { - "charToOrderMap" : jschardet.win1255_CharToOrderMap, - "precedenceMatrix" : jschardet.HebrewLangModel, - "mTypicalPositiveRatio" : 0.984004, - "keepEnglishLetter" : false, - "charsetName" : "windows-1255" -}; - -}(require('./init')); - -},{"./init":20}],27:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -jschardet.Latin2_HungarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174, -175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205, - 79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241, - 82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85, -245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253 -] - -jschardet.win1250HungarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176, -177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205, - 81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241, - 84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87, -245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 94.7368% -// first 1024 sequences:5.2623% -// rest sequences: 0.8894% -// negative sequences: 0.0009% -jschardet.HungarianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,2,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0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.Latin2HungarianModel = { - "charToOrderMap" : jschardet.Latin2_HungarianCharToOrderMap, - "precedenceMatrix" : jschardet.HungarianLangModel, - "mTypicalPositiveRatio" : 0.947368, - "keepEnglishLetter" : true, - "charsetName" : "ISO-8859-2" -}; - -jschardet.Win1250HungarianModel = { - "charToOrderMap" : jschardet.win1250HungarianCharToOrderMap, - "precedenceMatrix" : jschardet.HungarianLangModel, - "mTypicalPositiveRatio" : 0.947368, - "keepEnglishLetter" : true, - "charsetName" : "windows-1250" -}; - -}(require('./init')); - -},{"./init":20}],28:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// The following result for thai was collected from a limited sample (1M). - -// Character Mapping Table: -jschardet.TIS620CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,182,106,107,100,183,184,185,101, 94,186,187,108,109,110,111, // 40 -188,189,190, 89, 95,112,113,191,192,193,194,253,253,253,253,253, // 50 -253, 64, 72, 73,114, 74,115,116,102, 81,201,117, 90,103, 78, 82, // 60 - 96,202, 91, 79, 84,104,105, 97, 98, 92,203,253,253,253,253,253, // 70 -209,210,211,212,213, 88,214,215,216,217,218,219,220,118,221,222, -223,224, 99, 85, 83,225,226,227,228,229,230,231,232,233,234,235, -236, 5, 30,237, 24,238, 75, 8, 26, 52, 34, 51,119, 47, 58, 57, - 49, 53, 55, 43, 20, 19, 44, 14, 48, 3, 17, 25, 39, 62, 31, 54, - 45, 9, 16, 2, 61, 15,239, 12, 42, 46, 18, 21, 76, 4, 66, 63, - 22, 10, 1, 36, 23, 13, 40, 27, 32, 35, 86,240,241,242,243,244, - 11, 28, 41, 29, 33,245, 50, 37, 6, 7, 67, 77, 38, 93,246,247, - 68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 92.6386% -// first 1024 sequences:7.3177% -// rest sequences: 1.0230% -// negative sequences: 0.0436% -jschardet.ThaiLangModel = [ -0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3, -0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2, -3,0,3,3,2,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,3,2,3,0,2,2,2,3, -0,2,3,0,0,0,0,1,0,1,2,3,1,1,3,2,2,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,2,3,2,3,3,2,2,2, -3,1,2,3,0,3,3,2,2,1,2,3,3,1,2,0,1,3,0,1,0,0,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0, -2,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,3,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0, -1,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,1,0,0,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.TIS620ThaiModel = { - "charToOrderMap" : jschardet.TIS620CharToOrderMap, - "precedenceMatrix" : jschardet.ThaiLangModel, - "mTypicalPositiveRatio" : 0.926386, - "keepEnglishLetter" : false, - "charsetName" : "TIS-620" -}; - -}(require('./init')); - -},{"./init":20}],29:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -(function() { - var UDF = 0; // undefined - var OTH = 1; // other - jschardet.OTH = 1; - var ASC = 2; // ascii capital letter - var ASS = 3; // ascii small letter - var ACV = 4; // accent capital vowel - var ACO = 5; // accent capital other - var ASV = 6; // accent small vowel - var ASO = 7; // accent small other - - jschardet.Latin1_CharToClass = [ - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 00 - 07 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 08 - 0F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 10 - 17 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 18 - 1F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 20 - 27 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 28 - 2F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 30 - 37 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 38 - 3F - OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 40 - 47 - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 48 - 4F - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 50 - 57 - ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, // 58 - 5F - OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 60 - 67 - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 68 - 6F - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 70 - 77 - ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, // 78 - 7F - OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, // 80 - 87 - OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, // 88 - 8F - UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 90 - 97 - OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, // 98 - 9F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A0 - A7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A8 - AF - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B0 - B7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B8 - BF - ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, // C0 - C7 - ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, // C8 - CF - ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, // D0 - D7 - ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, // D8 - DF - ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, // E0 - E7 - ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, // E8 - EF - ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, // F0 - F7 - ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO // F8 - FF - ]; - - // 0 : illegal - // 1 : very unlikely - // 2 : normal - // 3 : very likely - jschardet.Latin1ClassModel = [ - // UDF OTH ASC ASS ACV ACO ASV ASO - 0, 0, 0, 0, 0, 0, 0, 0, // UDF - 0, 3, 3, 3, 3, 3, 3, 3, // OTH - 0, 3, 3, 3, 3, 3, 3, 3, // ASC - 0, 3, 3, 3, 1, 1, 3, 3, // ASS - 0, 3, 3, 3, 1, 2, 1, 2, // ACV - 0, 3, 3, 3, 3, 3, 3, 3, // ACO - 0, 3, 1, 3, 1, 1, 1, 3, // ASV - 0, 3, 1, 3, 1, 1, 3, 3 // ASO - ]; -})(); - -jschardet.Latin1Prober = function() { - jschardet.CharSetProber.apply(this); - - var FREQ_CAT_NUM = 4; - var CLASS_NUM = 8; // total classes - var self = this; - - function init() { - self.reset(); - } - - this.reset = function() { - this._mLastCharClass = jschardet.OTH; - this._mFreqCounter = []; - for( var i = 0; i < FREQ_CAT_NUM; this._mFreqCounter[i++] = 0 ); - jschardet.Latin1Prober.prototype.reset.apply(this); - } - - this.getCharsetName = function() { - return "windows-1252"; - } - - this.feed = function(aBuf) { - aBuf = this.filterWithEnglishLetters(aBuf); - for( var i = 0; i < aBuf.length; i++ ) { - var c = aBuf.charCodeAt(i); - var charClass = jschardet.Latin1_CharToClass[c]; - var freq = jschardet.Latin1ClassModel[(this._mLastCharClass * CLASS_NUM) + charClass]; - if( freq == 0 ) { - this._mState = jschardet.Constants.notMe; - break; - } - this._mFreqCounter[freq]++; - this._mLastCharClass = charClass; - } - - return this.getState(); - } - - this.getConfidence = function() { - var confidence; - var constants; - - if( this.getState() == jschardet.Constants.notMe ) { - return 0.01; - } - - var total = 0; - for( var i = 0; i < this._mFreqCounter.length; i++ ) { - total += this._mFreqCounter[i]; - } - if( total < 0.01 ) { - constants = 0.0; - } else { - confidence = (this._mFreqCounter[3] / total) - (this._mFreqCounter[1] * 20 / total); - } - if( confidence < 0 ) { - confidence = 0.0; - } - // lower the confidence of latin1 so that other more accurate detector - // can take priority. - // - // antonio.afonso: need to change this otherwise languages like pt, es, fr using latin1 will never be detected. - confidence = confidence * 0.95; - return confidence; - } - - init(); -} -jschardet.Latin1Prober.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}],30:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.MultiByteCharSetProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mDistributionAnalyzer = null; - self._mCodingSM = null; - //self._mLastChar = ["\x00", "\x00"]; - self._mLastChar = "\x00\x00"; - } - - this.reset = function() { - jschardet.MultiByteCharSetProber.prototype.reset.apply(this); - if( this._mCodingSM ) { - this._mCodingSM.reset(); - } - if( this._mDistributionAnalyzer ) { - this._mDistributionAnalyzer.reset(); - } - //this._mLastChar = ["\x00", "\x00"]; - this._mLastChar = "\x00\x00"; - } - - this.getCharsetName = function() { - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mDistributionAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mDistributionAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - return this._mDistributionAnalyzer.getConfidence(); - } -} -jschardet.MultiByteCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}],31:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.MBCSGroupProber = function() { - jschardet.CharSetGroupProber.apply(this); - this._mProbers = [ - new jschardet.UTF8Prober(), - new jschardet.SJISProber(), - new jschardet.EUCJPProber(), - new jschardet.GB2312Prober(), - new jschardet.EUCKRProber(), - new jschardet.Big5Prober(), - new jschardet.EUCTWProber() - ]; - this.reset(); -} -jschardet.MBCSGroupProber.prototype = new jschardet.CharSetGroupProber(); - -}(require('./init')); - -},{"./init":20}],32:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -var consts = jschardet.Constants; - -// BIG5 - -jschardet.BIG5_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 //allow 0x00 as legal value - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,1, // 78 - 7f - 4,4,4,4,4,4,4,4, // 80 - 87 - 4,4,4,4,4,4,4,4, // 88 - 8f - 4,4,4,4,4,4,4,4, // 90 - 97 - 4,4,4,4,4,4,4,4, // 98 - 9f - 4,3,3,3,3,3,3,3, // a0 - a7 - 3,3,3,3,3,3,3,3, // a8 - af - 3,3,3,3,3,3,3,3, // b0 - b7 - 3,3,3,3,3,3,3,3, // b8 - bf - 3,3,3,3,3,3,3,3, // c0 - c7 - 3,3,3,3,3,3,3,3, // c8 - cf - 3,3,3,3,3,3,3,3, // d0 - d7 - 3,3,3,3,3,3,3,3, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,3,3,3, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,3,3,0 // f8 - ff -]; - -jschardet.BIG5_st = [ - consts.error,consts.start,consts.start, 3,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error, //08-0f - consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //10-17 -]; - -jschardet.Big5CharLenTable = [0, 1, 1, 2, 0]; - -jschardet.Big5SMModel = { - "classTable" : jschardet.BIG5_cls, - "classFactor" : 5, - "stateTable" : jschardet.BIG5_st, - "charLenTable" : jschardet.Big5CharLenTable, - "name" : "Big5" -}; - -// EUC-JP - -jschardet.EUCJP_cls = [ - 4,4,4,4,4,4,4,4, // 00 - 07 - 4,4,4,4,4,4,5,5, // 08 - 0f - 4,4,4,4,4,4,4,4, // 10 - 17 - 4,4,4,5,4,4,4,4, // 18 - 1f - 4,4,4,4,4,4,4,4, // 20 - 27 - 4,4,4,4,4,4,4,4, // 28 - 2f - 4,4,4,4,4,4,4,4, // 30 - 37 - 4,4,4,4,4,4,4,4, // 38 - 3f - 4,4,4,4,4,4,4,4, // 40 - 47 - 4,4,4,4,4,4,4,4, // 48 - 4f - 4,4,4,4,4,4,4,4, // 50 - 57 - 4,4,4,4,4,4,4,4, // 58 - 5f - 4,4,4,4,4,4,4,4, // 60 - 67 - 4,4,4,4,4,4,4,4, // 68 - 6f - 4,4,4,4,4,4,4,4, // 70 - 77 - 4,4,4,4,4,4,4,4, // 78 - 7f - 5,5,5,5,5,5,5,5, // 80 - 87 - 5,5,5,5,5,5,1,3, // 88 - 8f - 5,5,5,5,5,5,5,5, // 90 - 97 - 5,5,5,5,5,5,5,5, // 98 - 9f - 5,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,0,5 // f8 - ff -]; - -jschardet.EUCJP_st = [ - 3, 4, 3, 5,consts.start,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.start,consts.error,consts.start,consts.error,consts.error,consts.error, //10-17 - consts.error,consts.error,consts.start,consts.error,consts.error,consts.error, 3,consts.error, //18-1f - 3,consts.error,consts.error,consts.error,consts.start,consts.start,consts.start,consts.start //20-27 -]; - -jschardet.EUCJPCharLenTable = [2, 2, 2, 3, 1, 0]; - -jschardet.EUCJPSMModel = { - "classTable" : jschardet.EUCJP_cls, - "classFactor" : 6, - "stateTable" : jschardet.EUCJP_st, - "charLenTable" : jschardet.EUCJPCharLenTable, - "name" : "EUC-JP" -}; - -// EUC-KR - -jschardet.EUCKR_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 1,1,1,1,1,1,1,1, // 40 - 47 - 1,1,1,1,1,1,1,1, // 48 - 4f - 1,1,1,1,1,1,1,1, // 50 - 57 - 1,1,1,1,1,1,1,1, // 58 - 5f - 1,1,1,1,1,1,1,1, // 60 - 67 - 1,1,1,1,1,1,1,1, // 68 - 6f - 1,1,1,1,1,1,1,1, // 70 - 77 - 1,1,1,1,1,1,1,1, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,3,3,3, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,3,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,0 // f8 - ff -]; - -jschardet.EUCKR_st = [ - consts.error,consts.start, 3,consts.error,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start //08-0f -]; - -jschardet.EUCKRCharLenTable = [0, 1, 2, 0]; - -jschardet.EUCKRSMModel = { - "classTable" : jschardet.EUCKR_cls, - "classFactor" : 4, - "stateTable" : jschardet.EUCKR_st, - "charLenTable" : jschardet.EUCKRCharLenTable, - "name" : "EUC-KR" -}; - -// EUC-TW - -jschardet.EUCTW_cls = [ - 2,2,2,2,2,2,2,2, // 00 - 07 - 2,2,2,2,2,2,0,0, // 08 - 0f - 2,2,2,2,2,2,2,2, // 10 - 17 - 2,2,2,0,2,2,2,2, // 18 - 1f - 2,2,2,2,2,2,2,2, // 20 - 27 - 2,2,2,2,2,2,2,2, // 28 - 2f - 2,2,2,2,2,2,2,2, // 30 - 37 - 2,2,2,2,2,2,2,2, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,2, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,6,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,3,4,4,4,4,4,4, // a0 - a7 - 5,5,1,1,1,1,1,1, // a8 - af - 1,1,1,1,1,1,1,1, // b0 - b7 - 1,1,1,1,1,1,1,1, // b8 - bf - 1,1,3,1,3,3,3,3, // c0 - c7 - 3,3,3,3,3,3,3,3, // c8 - cf - 3,3,3,3,3,3,3,3, // d0 - d7 - 3,3,3,3,3,3,3,3, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,3,3,3, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,3,3,0 // f8 - ff -]; - -jschardet.EUCTW_st = [ - consts.error,consts.error,consts.start, 3, 3, 3, 4,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.start,consts.error, //10-17 - consts.start,consts.start,consts.start,consts.error,consts.error,consts.error,consts.error,consts.error, //18-1f - 5,consts.error,consts.error,consts.error,consts.start,consts.error,consts.start,consts.start, //20-27 - consts.start,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //28-2f -]; - -jschardet.EUCTWCharLenTable = [0, 0, 1, 2, 2, 2, 3]; - -jschardet.EUCTWSMModel = { - "classTable" : jschardet.EUCTW_cls, - "classFactor" : 7, - "stateTable" : jschardet.EUCTW_st, - "charLenTable" : jschardet.EUCTWCharLenTable, - "name" : "x-euc-tw" -}; - -// GB2312 - -jschardet.GB2312_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 3,3,3,3,3,3,3,3, // 30 - 37 - 3,3,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,4, // 78 - 7f - 5,6,6,6,6,6,6,6, // 80 - 87 - 6,6,6,6,6,6,6,6, // 88 - 8f - 6,6,6,6,6,6,6,6, // 90 - 97 - 6,6,6,6,6,6,6,6, // 98 - 9f - 6,6,6,6,6,6,6,6, // a0 - a7 - 6,6,6,6,6,6,6,6, // a8 - af - 6,6,6,6,6,6,6,6, // b0 - b7 - 6,6,6,6,6,6,6,6, // b8 - bf - 6,6,6,6,6,6,6,6, // c0 - c7 - 6,6,6,6,6,6,6,6, // c8 - cf - 6,6,6,6,6,6,6,6, // d0 - d7 - 6,6,6,6,6,6,6,6, // d8 - df - 6,6,6,6,6,6,6,6, // e0 - e7 - 6,6,6,6,6,6,6,6, // e8 - ef - 6,6,6,6,6,6,6,6, // f0 - f7 - 6,6,6,6,6,6,6,0 // f8 - ff -]; - -jschardet.GB2312_st = [ - consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, 3,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start, //10-17 - 4,consts.error,consts.start,consts.start,consts.error,consts.error,consts.error,consts.error, //18-1f - consts.error,consts.error, 5,consts.error,consts.error,consts.error,consts.itsMe,consts.error, //20-27 - consts.error,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //28-2f -]; - -// To be accurate, the length of class 6 can be either 2 or 4. -// But it is not necessary to discriminate between the two since -// it is used for frequency analysis only, and we are validing -// each code range there as well. So it is safe to set it to be -// 2 here. -jschardet.GB2312CharLenTable = [0, 1, 1, 1, 1, 1, 2]; - -jschardet.GB2312SMModel = { - "classTable" : jschardet.GB2312_cls, - "classFactor" : 7, - "stateTable" : jschardet.GB2312_st, - "charLenTable" : jschardet.GB2312CharLenTable, - "name" : "GB2312" -}; - -// Shift_JIS - -jschardet.SJIS_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,1, // 78 - 7f - 3,3,3,3,3,3,3,3, // 80 - 87 - 3,3,3,3,3,3,3,3, // 88 - 8f - 3,3,3,3,3,3,3,3, // 90 - 97 - 3,3,3,3,3,3,3,3, // 98 - 9f - // 0xa0 is illegal in sjis encoding, but some pages does - // contain such byte. We need to be more consts.error forgiven. - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,4,4,4, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,0,0,0 // f8 - ff -]; - -jschardet.SJIS_st = [ - consts.error,consts.start,consts.start, 3,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start,consts.start,consts.start //10-17 -]; - -jschardet.SJISCharLenTable = [0, 1, 1, 2, 0, 0]; - -jschardet.SJISSMModel = { - "classTable" : jschardet.SJIS_cls, - "classFactor" : 6, - "stateTable" : jschardet.SJIS_st, - "charLenTable" : jschardet.SJISCharLenTable, - "name" : "Shift_JIS" -}; - -//UCS2-BE - -jschardet.UCS2BE_cls = [ - 0,0,0,0,0,0,0,0, // 00 - 07 - 0,0,1,0,0,2,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,3,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,3,3,3,3,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,0,0,0,0,0,0,0, // a0 - a7 - 0,0,0,0,0,0,0,0, // a8 - af - 0,0,0,0,0,0,0,0, // b0 - b7 - 0,0,0,0,0,0,0,0, // b8 - bf - 0,0,0,0,0,0,0,0, // c0 - c7 - 0,0,0,0,0,0,0,0, // c8 - cf - 0,0,0,0,0,0,0,0, // d0 - d7 - 0,0,0,0,0,0,0,0, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,4,5 // f8 - ff -]; - -jschardet.UCS2BE_st = [ - 5, 7, 7,consts.error, 4, 3,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe, 6, 6, 6, 6,consts.error,consts.error, //10-17 - 6, 6, 6, 6, 6,consts.itsMe, 6, 6, //18-1f - 6, 6, 6, 6, 5, 7, 7,consts.error, //20-27 - 5, 8, 6, 6,consts.error, 6, 6, 6, //28-2f - 6, 6, 6, 6,consts.error,consts.error,consts.start,consts.start //30-37 -]; - -jschardet.UCS2BECharLenTable = [2, 2, 2, 0, 2, 2]; - -jschardet.UCS2BESMModel = { - "classTable" : jschardet.UCS2BE_cls, - "classFactor" : 6, - "stateTable" : jschardet.UCS2BE_st, - "charLenTable" : jschardet.UCS2BECharLenTable, - "name" : "UTF-16BE" -}; - -// UCS2-LE - -jschardet.UCS2LE_cls = [ - 0,0,0,0,0,0,0,0, // 00 - 07 - 0,0,1,0,0,2,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,3,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,3,3,3,3,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,0,0,0,0,0,0,0, // a0 - a7 - 0,0,0,0,0,0,0,0, // a8 - af - 0,0,0,0,0,0,0,0, // b0 - b7 - 0,0,0,0,0,0,0,0, // b8 - bf - 0,0,0,0,0,0,0,0, // c0 - c7 - 0,0,0,0,0,0,0,0, // c8 - cf - 0,0,0,0,0,0,0,0, // d0 - d7 - 0,0,0,0,0,0,0,0, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,4,5 // f8 - ff -]; - -jschardet.UCS2LE_st = [ - 6, 6, 7, 6, 4, 3,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe, 5, 5, 5,consts.error,consts.itsMe,consts.error, //10-17 - 5, 5, 5,consts.error, 5,consts.error, 6, 6, //18-1f - 7, 6, 8, 8, 5, 5, 5,consts.error, //20-27 - 5, 5, 5,consts.error,consts.error,consts.error, 5, 5, //28-2f - 5, 5, 5,consts.error, 5,consts.error,consts.start,consts.start //30-37 -]; - -jschardet.UCS2LECharLenTable = [2, 2, 2, 2, 2, 2]; - -jschardet.UCS2LESMModel = { - "classTable" : jschardet.UCS2LE_cls, - "classFactor" : 6, - "stateTable" : jschardet.UCS2LE_st, - "charLenTable" : jschardet.UCS2LECharLenTable, - "name" : "UTF-16LE" -}; - -// UTF-8 - -jschardet.UTF8_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 //allow 0x00 as a legal value - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 1,1,1,1,1,1,1,1, // 40 - 47 - 1,1,1,1,1,1,1,1, // 48 - 4f - 1,1,1,1,1,1,1,1, // 50 - 57 - 1,1,1,1,1,1,1,1, // 58 - 5f - 1,1,1,1,1,1,1,1, // 60 - 67 - 1,1,1,1,1,1,1,1, // 68 - 6f - 1,1,1,1,1,1,1,1, // 70 - 77 - 1,1,1,1,1,1,1,1, // 78 - 7f - 2,2,2,2,3,3,3,3, // 80 - 87 - 4,4,4,4,4,4,4,4, // 88 - 8f - 4,4,4,4,4,4,4,4, // 90 - 97 - 4,4,4,4,4,4,4,4, // 98 - 9f - 5,5,5,5,5,5,5,5, // a0 - a7 - 5,5,5,5,5,5,5,5, // a8 - af - 5,5,5,5,5,5,5,5, // b0 - b7 - 5,5,5,5,5,5,5,5, // b8 - bf - 0,0,6,6,6,6,6,6, // c0 - c7 - 6,6,6,6,6,6,6,6, // c8 - cf - 6,6,6,6,6,6,6,6, // d0 - d7 - 6,6,6,6,6,6,6,6, // d8 - df - 7,8,8,8,8,8,8,8, // e0 - e7 - 8,8,8,8,8,9,8,8, // e8 - ef - 10,11,11,11,11,11,11,11, // f0 - f7 - 12,13,13,13,14,15,0,0 // f8 - ff -]; - -jschardet.UTF8_st = [ - consts.error,consts.start,consts.error,consts.error,consts.error,consts.error, 12, 10, //00-07 - 9, 11, 8, 7, 6, 5, 4, 3, //08-0f - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //10-17 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //18-1f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //20-27 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //28-2f - consts.error,consts.error, 5, 5, 5, 5,consts.error,consts.error, //30-37 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //38-3f - consts.error,consts.error,consts.error, 5, 5, 5,consts.error,consts.error, //40-47 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //48-4f - consts.error,consts.error, 7, 7, 7, 7,consts.error,consts.error, //50-57 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //58-5f - consts.error,consts.error,consts.error,consts.error, 7, 7,consts.error,consts.error, //60-67 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //68-6f - consts.error,consts.error, 9, 9, 9, 9,consts.error,consts.error, //70-77 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //78-7f - consts.error,consts.error,consts.error,consts.error,consts.error, 9,consts.error,consts.error, //80-87 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //88-8f - consts.error,consts.error, 12, 12, 12, 12,consts.error,consts.error, //90-97 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //98-9f - consts.error,consts.error,consts.error,consts.error,consts.error, 12,consts.error,consts.error, //a0-a7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //a8-af - consts.error,consts.error, 12, 12, 12,consts.error,consts.error,consts.error, //b0-b7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //b8-bf - consts.error,consts.error,consts.start,consts.start,consts.start,consts.start,consts.error,consts.error, //c0-c7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error //c8-cf -]; - -jschardet.UTF8CharLenTable = [0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6]; - -jschardet.UTF8SMModel = { - "classTable" : jschardet.UTF8_cls, - "classFactor" : 16, - "stateTable" : jschardet.UTF8_st, - "charLenTable" : jschardet.UTF8CharLenTable, - "name" : "UTF-8" -}; - -}(require('./init')); - -},{"./init":20}],33:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SingleByteCharSetProber = function(model, reversed, nameProber) { - jschardet.CharSetProber.apply(this); - - var SAMPLE_SIZE = 64; - var SB_ENOUGH_REL_THRESHOLD = 1024; - var POSITIVE_SHORTCUT_THRESHOLD = 0.95; - var NEGATIVE_SHORTCUT_THRESHOLD = 0.05; - var SYMBOL_CAT_ORDER = 250; - var NUMBER_OF_SEQ_CAT = 4; - var POSITIVE_CAT = NUMBER_OF_SEQ_CAT - 1; - //var NEGATIVE_CAT = 0; - - var self = this; - - function init(model, reversed, nameProber) { - self._mModel = model; - self._mReversed = reversed; // "true" if we need to reverse every pair in the model lookup - self._mNameProber = nameProber; // Optional auxiliary prober for name decision - self.reset(); - } - - this.reset = function() { - jschardet.SingleByteCharSetProber.prototype.reset.apply(this); - this._mLastOrder = 255; // char order of last character - this._mSeqCounters = []; - for( var i = 0; i < NUMBER_OF_SEQ_CAT; this._mSeqCounters[i++] = 0 ); - this._mTotalSeqs = 0; - this._mTotalChar = 0; - this._mFreqChar = 0; // characters that fall in our sampling range - } - - this.getCharsetName = function() { - if( this._mNameProber ) { - return this._mNameProber.getCharsetName(); - } else { - return this._mModel.charsetName; - } - } - - this.feed = function(aBuf) { - if( ! this._mModel.keepEnglishLetter ) { - aBuf = this.filterWithoutEnglishLetters(aBuf); - } - var aLen = aBuf.length; - if( !aLen ) { - return this.getState(); - } - for( var i = 0, c; i < aLen; i++ ) - { - c = aBuf.charCodeAt(i); - var order = this._mModel.charToOrderMap[c]; - if( order < SYMBOL_CAT_ORDER ) { - this._mTotalChar++; - } - if( order < SAMPLE_SIZE ) { - this._mFreqChar++; - if( this._mLastOrder < SAMPLE_SIZE ) { - this._mTotalSeqs++; - if( !this._mReversed ) { - this._mSeqCounters[this._mModel.precedenceMatrix[(this._mLastOrder * SAMPLE_SIZE) + order]]++; - } else { // reverse the order of the letters in the lookup - this._mSeqCounters[this._mModel.precedenceMatrix[(order * SAMPLE_SIZE) + this._mLastOrder]]++; - } - } - } - this._mLastOrder = order; - } - - if( this.getState() == jschardet.Constants.detecting ) { - if( self._mTotalSeqs > SB_ENOUGH_REL_THRESHOLD ) { - var cf = this.getConfidence(); - if( cf > POSITIVE_SHORTCUT_THRESHOLD ) { - if( jschardet.Constants._debug ) { - jschardet.log(this._mModel.charsetName + " confidence = " + cf + ", we have a winner\n"); - } - } else if( cf < NEGATIVE_SHORTCUT_THRESHOLD ) { - if( jschardet.Constants._debug ) { - jschardet.log(this._mModel.charsetName + " confidence = " + cf + ", below negative shortcut threshhold " + NEGATIVE_SHORTCUT_THRESHOLD + "\n"); - } - this._mState = jschardet.Constants.notMe; - } - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var r = 0.01; - if( this._mTotalSeqs > 0 ) { - //jschardet.log(this._mSeqCounters[POSITIVE_CAT] + " " + this._mTotalSeqs + " " + this._mModel.mTypicalPositiveRatio); - r = (1.0 * this._mSeqCounters[POSITIVE_CAT]) / this._mTotalSeqs / this._mModel.mTypicalPositiveRatio; - //jschardet.log(r + " " + this._mFreqChar + " " + this._mTotalChar); - r *= this._mFreqChar / this._mTotalChar; - if( r >= 1.0 ) { - r = 0.99; - } - } - return r; - } - - reversed = reversed !== undefined ? reversed : false; - nameProber = nameProber !== undefined ? nameProber : null; - init(model, reversed, nameProber); -} -jschardet.SingleByteCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}],34:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SBCSGroupProber = function() { - jschardet.CharSetGroupProber.apply(this); - - var self = this; - - function init() { - self._mProbers = [ - new jschardet.SingleByteCharSetProber(jschardet.Win1251CyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.Koi8rModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin5CyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.MacCyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.Ibm866Model), - new jschardet.SingleByteCharSetProber(jschardet.Ibm855Model), - new jschardet.SingleByteCharSetProber(jschardet.Latin7GreekModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1253GreekModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin5BulgarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1251BulgarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin2HungarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1250HungarianModel), - new jschardet.SingleByteCharSetProber(jschardet.TIS620ThaiModel) - ]; - var hebrewProber = new jschardet.HebrewProber(); - var logicalHebrewProber = new jschardet.SingleByteCharSetProber(jschardet.Win1255HebrewModel, false, hebrewProber); - var visualHebrewProber = new jschardet.SingleByteCharSetProber(jschardet.Win1255HebrewModel, true, hebrewProber); - hebrewProber.setModelProbers(logicalHebrewProber, visualHebrewProber); - self._mProbers.push(hebrewProber, logicalHebrewProber, visualHebrewProber); - - self.reset(); - } - - init(); -} -jschardet.SBCSGroupProber.prototype = new jschardet.CharSetGroupProber(); - -}(require('./init')); - -},{"./init":20}],35:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SJISProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.SJISSMModel); - self._mDistributionAnalyzer = new jschardet.SJISDistributionAnalysis(); - self._mContextAnalyzer = new jschardet.SJISContextAnalysis(); - self.reset(); - } - - this.reset = function() { - jschardet.SJISProber.prototype.reset.apply(this); - this._mContextAnalyzer.reset(); - } - - this.getCharsetName = function() { - return "SHIFT_JIS"; - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mContextAnalyzer.feed(this._mLastChar.slice(2 - charLen), charLen); - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mContextAnalyzer.feed(aBuf.slice(i + 1 - charLen, i + 3 - charLen), charLen); - this._mDistributionAnalyzer.feed(aBuf.slice(i - 1, i + 1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mContextAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var contxtCf = this._mContextAnalyzer.getConfidence(); - var distribCf = this._mDistributionAnalyzer.getConfidence(); - return Math.max(contxtCf, distribCf); - } - - init(); -} -jschardet.SJISProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); - -},{"./init":20}],36:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -/** - * This is a port from the python port, version "2.0.1" - */ - -!function(jschardet) { - -jschardet.UniversalDetector = function() { - var MINIMUM_THRESHOLD = jschardet.Constants.MINIMUM_THRESHOLD; - var _state = { - pureAscii : 0, - escAscii : 1, - highbyte : 2 - }; - var self = this; - - function init() { - self._highBitDetector = /[\x80-\xFF]/; - self._escDetector = /(\x1B|~\{)/; - self._mEscCharsetProber = null; - self._mCharsetProbers = []; - self.reset(); - } - - this.reset = function() { - this.result = {"encoding": null, "confidence": 0.0}; - this.done = false; - this._mStart = true; - this._mGotData = false; - this._mInputState = _state.pureAscii; - this._mLastChar = ""; - this._mBOM = ""; - if( this._mEscCharsetProber ) { - this._mEscCharsetProber.reset(); - } - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - prober.reset(); - } - } - - this.feed = function(aBuf) { - if( this.done ) return; - - var aLen = aBuf.length; - if( !aLen ) return; - - if( !this._mGotData ) { - this._mBOM += aBuf; - // If the data starts with BOM, we know it is UTF - if( this._mBOM.slice(0,3) == "\xEF\xBB\xBF" ) { - // EF BB BF UTF-8 with BOM - this.result = {"encoding": "UTF-8", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\xFF\xFE\x00\x00" ) { - // FF FE 00 00 UTF-32, little-endian BOM - this.result = {"encoding": "UTF-32LE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\x00\x00\xFE\xFF" ) { - // 00 00 FE FF UTF-32, big-endian BOM - this.result = {"encoding": "UTF-32BE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\xFE\xFF\x00\x00" ) { - // FE FF 00 00 UCS-4, unusual octet order BOM (3412) - this.result = {"encoding": "X-ISO-10646-UCS-4-3412", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\x00\x00\xFF\xFE" ) { - // 00 00 FF FE UCS-4, unusual octet order BOM (2143) - this.result = {"encoding": "X-ISO-10646-UCS-4-2143", "confidence": 1.0}; - } else if( this._mBOM.slice(0,2) == "\xFF\xFE" ) { - // FF FE UTF-16, little endian BOM - this.result = {"encoding": "UTF-16LE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,2) == "\xFE\xFF" ) { - // FE FF UTF-16, big endian BOM - this.result = {"encoding": "UTF-16BE", "confidence": 1.0}; - } - - // If we got to 4 chars without being able to detect a BOM we - // stop trying. - if( this._mBOM.length > 3 ) { - this._mGotData = true; - } - } - - if( this.result.encoding && (this.result.confidence > 0.0) ) { - this.done = true; - return; - } - - if( this._mInputState == _state.pureAscii ) { - if( this._highBitDetector.test(aBuf) ) { - this._mInputState = _state.highbyte; - } else if( this._escDetector.test(this._mLastChar + aBuf) ) { - this._mInputState = _state.escAscii; - } - } - - this._mLastChar = aBuf.slice(-1); - - if( this._mInputState == _state.escAscii ) { - if( !this._mEscCharsetProber ) { - this._mEscCharsetProber = new jschardet.EscCharSetProber(); - } - if( this._mEscCharsetProber.feed(aBuf) == jschardet.Constants.foundIt ) { - this.result = { - "encoding": this._mEscCharsetProber.getCharsetName(), - "confidence": this._mEscCharsetProber.getConfidence() - }; - this.done = true; - } - } else if( this._mInputState == _state.highbyte ) { - if( this._mCharsetProbers.length == 0 ) { - this._mCharsetProbers = [ - new jschardet.MBCSGroupProber(), - new jschardet.SBCSGroupProber(), - new jschardet.Latin1Prober() - ]; - } - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( prober.feed(aBuf) == jschardet.Constants.foundIt ) { - this.result = { - "encoding": prober.getCharsetName(), - "confidence": prober.getConfidence() - }; - this.done = true; - break; - } - } - } - } - - this.close = function() { - if( this.done ) return; - if( this._mBOM.length === 0 ) { - if( jschardet.Constants._debug ) { - jschardet.log("no data received!\n"); - } - return; - } - this.done = true; - - if( this._mInputState == _state.pureAscii ) { - if( jschardet.Constants._debug ) { - jschardet.log("pure ascii") - } - this.result = {"encoding": "ascii", "confidence": 1.0}; - return this.result; - } - - if( this._mInputState == _state.highbyte ) { - var proberConfidence = null; - var maxProberConfidence = 0.0; - var maxProber = null; - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( !prober ) continue; - proberConfidence = prober.getConfidence(); - if( proberConfidence > maxProberConfidence ) { - maxProberConfidence = proberConfidence; - maxProber = prober; - } - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " confidence " + prober.getConfidence()); - } - } - if( maxProber && maxProberConfidence > MINIMUM_THRESHOLD ) { - this.result = { - "encoding": maxProber.getCharsetName(), - "confidence": maxProber.getConfidence() - }; - return this.result; - } - } - - if( jschardet.Constants._debug ) { - jschardet.log("no probers hit minimum threshhold\n"); - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( !prober ) continue; - jschardet.log(prober.getCharsetName() + " confidence = " + - prober.getConfidence() + "\n"); - } - } - } - - init(); -} - -}(require('./init')); - -},{"./init":20}],37:[function(require,module,exports){ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.UTF8Prober = function() { - jschardet.CharSetProber.apply(this); - - var ONE_CHAR_PROB = 0.5; - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.UTF8SMModel); - self.reset(); - } - - this.reset = function() { - jschardet.UTF8Prober.prototype.reset.apply(this); - this._mCodingSM.reset(); - this._mNumOfMBChar = 0; - } - - this.getCharsetName = function() { - return "UTF-8"; - } - - this.feed = function(aBuf) { - for( var i = 0, c; i < aBuf.length; i++ ) { - c = aBuf[i]; - var codingState = this._mCodingSM.nextState(c); - if( codingState == jschardet.Constants.error ) { - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - if( this._mCodingSM.getCurrentCharLen() >= 2 ) { - this._mNumOfMBChar++; - } - } - } - - if( this.getState() == jschardet.Constants.detecting ) { - if( this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var unlike = 0.99; - if( this._mNumOfMBChar < 6 ) { - for( var i = 0; i < this._mNumOfMBChar; i++ ) { - unlike *= ONE_CHAR_PROB; - } - return 1 - unlike; - } else { - return unlike; - } - } - - init(); -} -jschardet.UTF8Prober.prototype = new jschardet.CharSetProber(); - -}(require('./init')); - -},{"./init":20}]},{},[1])(1) -}); \ No newline at end of file diff --git a/tools/eslint/node_modules/jschardet/dist/jschardet.min.js b/tools/eslint/node_modules/jschardet/dist/jschardet.min.js deleted file mode 100755 index dbe7577aa0e957..00000000000000 --- a/tools/eslint/node_modules/jschardet/dist/jschardet.min.js +++ /dev/null @@ -1,673 +0,0 @@ -(function(n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n():"function"===typeof define&&define.amd?define([],n):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).jschardet=n()})(function(){return function b(a,d,h){function l(c,k){if(!d[c]){if(!a[c]){var g="function"==typeof require&&require;if(!k&&g)return g(c,!0);if(f)return f(c,!0);g=Error("Cannot find module '"+c+"'");throw g.code="MODULE_NOT_FOUND",g;}g=d[c]= -{exports:{}};a[c][0].call(g.exports,function(h){var b=a[c][1][h];return l(b?b:h)},g,g.exports,b,a,d,h)}return d[c].exports}for(var f="function"==typeof require&&require,c=0;cthis._mCharToFreqOrder[h]&&this._mFreqChars++)};this.getConfidence=function(){if(0>=this._mTotalChars||3>=this._mFreqChars)return.01;if(this._mTotalChars!=this._mFreqChars){var a=this._mFreqChars/((this._mTotalChars-this._mFreqChars)*this._mTypicalDistributionRatio);if(.99>a)return a}return.99};this.gotEnoughData=function(){return 1024=a.charCodeAt(0))var b=188*(a.charCodeAt(0)-129);else if(224<=a.charCodeAt(0)&&239>=a.charCodeAt(0))b= -188*(a.charCodeAt(0)-224+31);else return-1;b+=a.charCodeAt(1)-64;if(64>a.charCodeAt(1)||127===a.charCodeAt(1)||252=this._mActiveNum)){this._mState=a.Constants.notMe;break}}return this.getState()}; -this.getConfidence=function(){var b=this.getState();if(b==a.Constants.foundIt)return.99;if(b==a.Constants.notMe)return.01;b=0;this._mBestGuessProber=null;for(var f=0,c;c=this._mProbers[f];f++)if(c)if(c.active){var e=c.getConfidence();a.Constants._debug&&a.log(c.getCharsetName()+" confidence = "+e+"\n");b"==g?h=!1:"<"==g&&(h=!0);var m=/[a-zA-Z]/.test(g);/^[\x00-\x7F]*$/.test(g)&&!m&&(d>e&&!h&&(b=b+a.substring(e,d)+" "),e=d+1)}h||(b+=a.substring(e));return b}}}(b("./init"))},{"./init":20}],7:[function(b,a,d){!function(a){a.CodingStateMachine=function(b){this.reset=function(){this._mCurrentState=a.Constants.start};this.nextState=function(b){b=this._mModel.classTable[b.charCodeAt(0)];this._mCurrentState== -a.Constants.start&&(this._mCurrentBytePos=0,this._mCurrentCharLen=this._mModel.charLenTable[b]);this._mCurrentState=this._mModel.stateTable[this._mCurrentState*this._mModel.classFactor+b];this._mCurrentBytePos++;return this._mCurrentState};this.getCurrentCharLen=function(){return this._mCurrentCharLen};this.getCodingStateMachine=function(){return this._mModel.name};this._mModel=b;this._mCurrentCharLen=this._mCurrentBytePos=0;this.reset()}}(b("./init"))},{"./init":20}],8:[function(b,a,d){b("./init").Constants= -{_debug:!1,detecting:0,foundIt:1,notMe:2,start:0,error:1,itsMe:2,MINIMUM_THRESHOLD:.2,SHORTCUT_THRESHOLD:.95};!0},{"./init":20}],9:[function(b,a,d){!function(a){a.EscCharSetProber=function(){a.CharSetProber.apply(this);var b=this;this.reset=function(){a.EscCharSetProber.prototype.reset.apply(this);for(var f=0,c;c=this._mCodingSM[f];f++)c&&(c.active=!0,c.reset());this._mActiveSM=b._mCodingSM.length;this._mDetectedCharset=null};this.getCharsetName=function(){return this._mDetectedCharset};this.getConfidence= -function(){return this._mDetectedCharset?.99:0};this.feed=function(b){for(var c=0,l;c=this._mActiveSM)return this._mState=a.Constants.notMe,this.getState()}else if(m==a.Constants.itsMe)return this._mState=a.Constants.foundIt,this._mDetectedCharset=g.getCodingStateMachine(),this.getState()}}return this.getState()};b._mCodingSM=[new a.CodingStateMachine(a.HZSMModel), -new a.CodingStateMachine(a.ISO2022CNSMModel),new a.CodingStateMachine(a.ISO2022JPSMModel),new a.CodingStateMachine(a.ISO2022KRSMModel)];b.reset()};a.EscCharSetProber.prototype=new a.CharSetProber}(b("./init"))},{"./init":20}],10:[function(b,a,d){b=b("./init");a=b.Constants;b.HZ_cls=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,5,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];b.HZ_st=[a.start,a.error,3,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.start,a.start,4,a.error,5,a.error,6,a.error, -5,5,4,a.error,4,a.error,4,4,4,a.error,4,a.error,4,a.itsMe,a.start,a.start,a.start,a.start,a.start,a.start];b.HZCharLenTable=[0,0,0,0,0,0];b.HZSMModel={classTable:b.HZ_cls,classFactor:6,stateTable:b.HZ_st,charLenTable:b.HZCharLenTable,name:"HZ-GB-2312"};b.ISO2022CN_cls=[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2];b.ISO2022CN_st=[a.start,3,a.error,a.start,a.start,a.start,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe, -a.error,a.error,a.error,4,a.error,a.error,a.error,a.error,a.itsMe,a.error,a.error,a.error,a.error,5,6,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.error,a.start];b.ISO2022CNCharLenTable=[0,0,0,0,0,0,0,0,0];b.ISO2022CNSMModel={classTable:b.ISO2022CN_cls,classFactor:9,stateTable:b.ISO2022CN_st,charLenTable:b.ISO2022CNCharLenTable,name:"ISO-2022-CN"};b.ISO2022JP_cls=[2,0,0,0,0,0,0,0,0, -0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,7,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,4,0,8,0,0,0,0,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2];b.ISO2022JP_st= -[a.start,3,a.error,a.start,a.start,a.start,a.start,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.error,5,a.error,a.error,a.error,4,a.error,a.error,a.error,a.error,a.error,6,a.itsMe,a.error,a.itsMe,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.error,a.error,a.error,a.itsMe,a.error,a.error,a.error,a.error,a.error,a.error, -a.error,a.error,a.itsMe,a.error,a.start,a.start];b.ISO2022JPCharLenTable=[0,0,0,0,0,0,0,0,0,0];b.ISO2022JPSMModel={classTable:b.ISO2022JP_cls,classFactor:10,stateTable:b.ISO2022JP_st,charLenTable:b.ISO2022JPCharLenTable,name:"ISO-2022-JP"};b.ISO2022KR_cls=[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2];b.ISO2022KR_st=[a.start,3,a.error,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.error,4,a.error,a.error,a.error,a.error,a.error,a.error,5,a.error, -a.error,a.error,a.error,a.error,a.error,a.itsMe,a.start,a.start,a.start,a.start];b.ISO2022KRCharLenTable=[0,0,0,0,0,0];b.ISO2022KRSMModel={classTable:b.ISO2022KR_cls,classFactor:6,stateTable:b.ISO2022KR_st,charLenTable:b.ISO2022KRCharLenTable,name:"ISO-2022-KR"};!0},{"./init":20}],11:[function(b,a,d){!function(a){a.EUCJPProber=function(){a.MultiByteCharSetProber.apply(this);this.reset=function(){a.EUCJPProber.prototype.reset.apply(this);this._mContextAnalyzer.reset()};this.getCharsetName=function(){return"EUC-JP"}; -this.feed=function(b){for(var f=b.length,c=0;ca.Constants.SHORTCUT_THRESHOLD&&(this._mState=a.Constants.foundIt);return this.getState()};this.getConfidence=function(){var a=this._mContextAnalyzer.getConfidence(),b=this._mDistributionAnalyzer.getConfidence();return Math.max(a,b)};this._mCodingSM=new a.CodingStateMachine(a.EUCJPSMModel); -this._mDistributionAnalyzer=new a.EUCJPDistributionAnalysis;this._mContextAnalyzer=new a.EUCJPContextAnalysis;this.reset()};a.EUCJPProber.prototype=new a.MultiByteCharSetProber}(b("./init"))},{"./init":20}],12:[function(b,a,d){b=b("./init");b.EUCKR_TYPICAL_DISTRIBUTION_RATIO=6;b.EUCKR_TABLE_SIZE=2352;b.EUCKRCharToFreqOrder=[13,130,120,1396,481,1719,1720,328,609,212,1721,707,400,299,1722,87,1397,1723,104,536,1117,1203,1724,1267,685,1268,508,1725,1726,1727,1728,1398,1399,1729,1730,1731,141,621,326, -1057,368,1732,267,488,20,1733,1269,1734,945,1400,1735,47,904,1270,1736,1737,773,248,1738,409,313,786,429,1739,116,987,813,1401,683,75,1204,145,1740,1741,1742,1743,16,847,667,622,708,1744,1745,1746,966,787,304,129,1747,60,820,123,676,1748,1749,1750,1751,617,1752,626,1753,1754,1755,1756,653,1757,1758,1759,1760,1761,1762,856,344,1763,1764,1765,1766,89,401,418,806,905,848,1767,1768,1769,946,1205,709,1770,1118,1771,241,1772,1773,1774,1271,1775,569,1776,999,1777,1778,1779,1780,337,751,1058,28,628,254,1781, -177,906,270,349,891,1079,1782,19,1783,379,1784,315,1785,629,754,1402,559,1786,636,203,1206,1787,710,567,1788,935,814,1789,1790,1207,766,528,1791,1792,1208,1793,1794,1795,1796,1797,1403,1798,1799,533,1059,1404,1405,1156,1406,936,884,1080,1800,351,1801,1802,1803,1804,1805,801,1806,1807,1808,1119,1809,1157,714,474,1407,1810,298,899,885,1811,1120,802,1158,1812,892,1813,1814,1408,659,1815,1816,1121,1817,1818,1819,1820,1821,1822,319,1823,594,545,1824,815,937,1209,1825,1826,573,1409,1022,1827,1210,1828, -1829,1830,1831,1832,1833,556,722,807,1122,1060,1834,697,1835,900,557,715,1836,1410,540,1411,752,1159,294,597,1211,976,803,770,1412,1837,1838,39,794,1413,358,1839,371,925,1840,453,661,788,531,723,544,1023,1081,869,91,1841,392,430,790,602,1414,677,1082,457,1415,1416,1842,1843,475,327,1024,1417,795,121,1844,733,403,1418,1845,1846,1847,300,119,711,1212,627,1848,1272,207,1849,1850,796,1213,382,1851,519,1852,1083,893,1853,1854,1855,367,809,487,671,1856,663,1857,1858,956,471,306,857,1859,1860,1160,1084, -1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871,282,96,574,1872,502,1085,1873,1214,1874,907,1875,1876,827,977,1419,1420,1421,268,1877,1422,1878,1879,1880,308,1881,2,537,1882,1883,1215,1884,1885,127,791,1886,1273,1423,1887,34,336,404,643,1888,571,654,894,840,1889,0,886,1274,122,575,260,908,938,1890,1275,410,316,1891,1892,100,1893,1894,1123,48,1161,1124,1025,1895,633,901,1276,1896,1897,115,816,1898,317,1899,694,1900,909,734,1424,572,866,1425,691,85,524,1010,543,394,841,1901,1902,1903,1026, -1904,1905,1906,1907,1908,1909,30,451,651,988,310,1910,1911,1426,810,1216,93,1912,1913,1277,1217,1914,858,759,45,58,181,610,269,1915,1916,131,1062,551,443,1E3,821,1427,957,895,1086,1917,1918,375,1919,359,1920,687,1921,822,1922,293,1923,1924,40,662,118,692,29,939,887,640,482,174,1925,69,1162,728,1428,910,1926,1278,1218,1279,386,870,217,854,1163,823,1927,1928,1929,1930,834,1931,78,1932,859,1933,1063,1934,1935,1936,1937,438,1164,208,595,1938,1939,1940,1941,1219,1125,1942,280,888,1429,1430,1220,1431,1943, -1944,1945,1946,1947,1280,150,510,1432,1948,1949,1950,1951,1952,1953,1954,1011,1087,1955,1433,1043,1956,881,1957,614,958,1064,1065,1221,1958,638,1001,860,967,896,1434,989,492,553,1281,1165,1959,1282,1002,1283,1222,1960,1961,1962,1963,36,383,228,753,247,454,1964,876,678,1965,1966,1284,126,464,490,835,136,672,529,940,1088,1435,473,1967,1968,467,50,390,227,587,279,378,598,792,968,240,151,160,849,882,1126,1285,639,1044,133,140,288,360,811,563,1027,561,142,523,1969,1970,1971,7,103,296,439,407,506,634,990, -1972,1973,1974,1975,645,1976,1977,1978,1979,1980,1981,236,1982,1436,1983,1984,1089,192,828,618,518,1166,333,1127,1985,818,1223,1986,1987,1988,1989,1990,1991,1992,1993,342,1128,1286,746,842,1994,1995,560,223,1287,98,8,189,650,978,1288,1996,1437,1997,17,345,250,423,277,234,512,226,97,289,42,167,1998,201,1999,2E3,843,836,824,532,338,783,1090,182,576,436,1438,1439,527,500,2001,947,889,2002,2003,2004,2005,262,600,314,447,2006,547,2007,693,738,1129,2008,71,1440,745,619,688,2009,829,2010,2011,147,2012,33, -948,2013,2014,74,224,2015,61,191,918,399,637,2016,1028,1130,257,902,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,837,2027,2028,2029,2030,179,874,591,52,724,246,2031,2032,2033,2034,1167,969,2035,1289,630,605,911,1091,1168,2036,2037,2038,1441,912,2039,623,2040,2041,253,1169,1290,2042,1442,146,620,611,577,433,2043,1224,719,1170,959,440,437,534,84,388,480,1131,159,220,198,679,2044,1012,819,1066,1443,113,1225,194,318,1003,1029,2045,2046,2047,2048,1067,2049,2050,2051,2052,2053,59,913,112,2054,632, -2055,455,144,739,1291,2056,273,681,499,2057,448,2058,2059,760,2060,2061,970,384,169,245,1132,2062,2063,414,1444,2064,2065,41,235,2066,157,252,877,568,919,789,580,2067,725,2068,2069,1292,2070,2071,1445,2072,1446,2073,2074,55,588,66,1447,271,1092,2075,1226,2076,960,1013,372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085,850,2086,2087,2088,2089,2090,186,2091,1068,180,2092,2093,2094,109,1227,522,606,2095,867,1448,1093,991,1171,926,353,1133,2096,581,2097,2098,2099,1294,1449,1450,2100,596,1172,1014, -1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452,949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,804,2118,2119,1230,1231,805,1456,405,1136,2120,2121,2122,2123,2124,720,701,1297,992,1457,927,1004,2125,2126,2127,2128,2129,2130,22,417,2131,303,2132,385,2133,971,520,513,2134,1174,73,1096,231,274,962,1458,673,2135,1459,2136,152,1137,2137,2138,2139,2140,1005,1138,1460,1139,2141,2142,2143,2144,11,374,844,2145,154,1232,46,1461,2146,838,830,721, -1233,106,2147,90,428,462,578,566,1175,352,2148,2149,538,1234,124,1298,2150,1462,761,565,2151,686,2152,649,2153,72,173,2154,460,415,2155,1463,2156,1235,305,2157,2158,2159,2160,2161,2162,579,2163,2164,2165,2166,2167,747,2168,2169,2170,2171,1464,669,2172,2173,2174,2175,2176,1465,2177,23,530,285,2178,335,729,2179,397,2180,2181,2182,1030,2183,2184,698,2185,2186,325,2187,2188,369,2189,799,1097,1015,348,2190,1069,680,2191,851,1466,2192,2193,10,2194,613,424,2195,979,108,449,589,27,172,81,1031,80,774,281, -350,1032,525,301,582,1176,2196,674,1045,2197,2198,1467,730,762,2199,2200,2201,2202,1468,2203,993,2204,2205,266,1070,963,1140,2206,2207,2208,664,1098,972,2209,2210,2211,1177,1469,1470,871,2212,2213,2214,2215,2216,1471,2217,2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233,2234,2235,1299,2236,2237,200,2238,477,373,2239,2240,731,825,777,2241,2242,2243,521,486,548,2244,2245,2246,1473,1300,53,549,137,875,76,158,2247,1301,1474,469,396,1016,278,712,2248,321,442,503, -767,744,941,1237,1178,1475,2249,82,178,1141,1179,973,2250,1302,2251,297,2252,2253,570,2254,2255,2256,18,450,206,2257,290,292,1142,2258,511,162,99,346,164,735,2259,1476,1477,4,554,343,798,1099,2260,1100,2261,43,171,1303,139,215,2262,2263,717,775,2264,1033,322,216,2265,831,2266,149,2267,1304,2268,2269,702,1238,135,845,347,309,2270,484,2271,878,655,238,1006,1478,2272,67,2273,295,2274,2275,461,2276,478,942,412,2277,1034,2278,2279,2280,265,2281,541,2282,2283,2284,2285,2286,70,852,1071,2287,2288,2289,2290, -21,56,509,117,432,2291,2292,331,980,552,1101,148,284,105,393,1180,1239,755,2293,187,2294,1046,1479,2295,340,2296,63,1047,230,2297,2298,1305,763,1306,101,800,808,494,2299,2300,2301,903,2302,37,1072,14,5,2303,79,675,2304,312,2305,2306,2307,2308,2309,1480,6,1307,2310,2311,2312,1,470,35,24,229,2313,695,210,86,778,15,784,592,779,32,77,855,964,2314,259,2315,501,380,2316,2317,83,981,153,689,1308,1481,1482,1483,2318,2319,716,1484,2320,2321,2322,2323,2324,2325,1485,2326,2327,128,57,68,261,1048,211,170,1240, -31,2328,51,435,742,2329,2330,2331,635,2332,264,456,2333,2334,2335,425,2336,1486,143,507,263,943,2337,363,920,1487,256,1488,1102,243,601,1489,2338,2339,2340,2341,2342,2343,2344,861,2345,2346,2347,2348,2349,2350,395,2351,1490,1491,62,535,166,225,2352,2353,668,419,1241,138,604,928,2354,1181,2355,1492,1493,2356,2357,2358,1143,2359,696,2360,387,307,1309,682,476,2361,2362,332,12,222,156,2363,232,2364,641,276,656,517,1494,1495,1035,416,736,1496,2365,1017,586,2366,2367,2368,1497,2369,242,2370,2371,2372,1498, -2373,965,713,2374,2375,2376,2377,740,982,1499,944,1500,1007,2378,2379,1310,1501,2380,2381,2382,785,329,2383,2384,1502,2385,2386,2387,932,2388,1503,2389,2390,2391,2392,1242,2393,2394,2395,2396,2397,994,950,2398,2399,2400,2401,1504,1311,2402,2403,2404,2405,1049,749,2406,2407,853,718,1144,1312,2408,1182,1505,2409,2410,255,516,479,564,550,214,1506,1507,1313,413,239,444,339,1145,1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414,176,703,497,624,593,921,302,2415,341,165,1103,1512,2416,1513,2417, -2418,2419,376,2420,700,2421,2422,2423,258,768,1316,2424,1183,2425,995,608,2426,2427,2428,2429,221,2430,2431,2432,2433,2434,2435,2436,2437,195,323,726,188,897,983,1317,377,644,1050,879,2438,452,2439,2440,2441,2442,2443,2444,914,2445,2446,2447,2448,915,489,2449,1514,1184,2450,2451,515,64,427,495,2452,583,2453,483,485,1038,562,213,1515,748,666,2454,2455,2456,2457,334,2458,780,996,1008,705,1243,2459,2460,2461,2462,2463,114,2464,493,1146,366,163,1516,961,1104,2465,291,2466,1318,1105,2467,1517,365,2468, -355,951,1244,2469,1319,2470,631,2471,2472,218,1320,364,320,756,1518,1519,1321,1520,1322,2473,2474,2475,2476,997,2477,2478,2479,2480,665,1185,2481,916,1521,2482,2483,2484,584,684,2485,2486,797,2487,1051,1186,2488,2489,2490,1522,2491,2492,370,2493,1039,1187,65,2494,434,205,463,1188,2495,125,812,391,402,826,699,286,398,155,781,771,585,2496,590,505,1073,2497,599,244,219,917,1018,952,646,1523,2498,1323,2499,2500,49,984,354,741,2501,625,2502,1324,2503,1019,190,357,757,491,95,782,868,2504,2505,2506,2507, -2508,2509,134,1524,1074,422,1525,898,2510,161,2511,2512,2513,2514,769,2515,1526,2516,2517,411,1325,2518,472,1527,2519,2520,2521,2522,2523,2524,985,2525,2526,2527,2528,2529,2530,764,2531,1245,2532,2533,25,204,311,2534,496,2535,1052,2536,2537,2538,2539,2540,2541,2542,199,704,504,468,758,657,1528,196,44,839,1246,272,750,2543,765,862,2544,2545,1326,2546,132,615,933,2547,732,2548,2549,2550,1189,1529,2551,283,1247,1053,607,929,2552,2553,2554,930,183,872,616,1040,1147,2555,1148,1020,441,249,1075,2556,2557, -2558,466,743,2559,2560,2561,92,514,426,420,526,2562,2563,2564,2565,2566,2567,2568,185,2569,2570,2571,2572,776,1530,658,2573,362,2574,361,922,1076,793,2575,2576,2577,2578,2579,2580,1531,251,2581,2582,2583,2584,1532,54,612,237,1327,2585,2586,275,408,647,111,2587,1533,1106,465,3,458,9,38,2588,107,110,890,209,26,737,498,2589,1534,2590,431,202,88,1535,356,287,1107,660,1149,2591,381,1536,986,1150,445,1248,1151,974,2592,2593,846,2594,446,953,184,1249,1250,727,2595,923,193,883,2596,2597,2598,102,324,539, -817,2599,421,1041,2600,832,2601,94,175,197,406,2602,459,2603,2604,2605,2606,2607,330,555,2608,2609,2610,706,1108,389,2611,2612,2613,2614,233,2615,833,558,931,954,1251,2616,2617,1537,546,2618,2619,1009,2620,2621,2622,1538,690,1328,2623,955,2624,1539,2625,2626,772,2627,2628,2629,2630,2631,924,648,863,603,2632,2633,934,1540,864,865,2634,642,1042,670,1190,2635,2636,2637,2638,168,2639,652,873,542,1054,1541,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659, -2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,1542,880,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,1543,2726,2727,2728,2729,2730,2731,2732,1544,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,1545,2755, -2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,1546,2767,1547,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786,1548,2787,2788,2789,1109,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,1329,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851, -2852,2853,2854,2855,2856,1549,2857,2858,2859,2860,1550,2861,2862,1551,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,1110,1330,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,1331,2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,1552,2944,2945, -2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,1252,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976,2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2996,2997,2998,2999,3E3,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,1553,3013,3014,3015,3016,3017,1554,3018,1332,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042, -3043,3044,3045,3046,3047,3048,3049,3050,1555,3051,3052,3053,1556,1557,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,1558,3068,3069,3070,3071,3072,3073,3074,3075,3076,1559,3077,3078,3079,3080,3081,3082,3083,1253,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,1152,3109,3110,3111,3112,3113,1560,3114,3115,3116,3117,1111,3118,3119,3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134, -3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172,3173,3174,3175,3176,1333,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187,3188,3189,1561,3190,3191,1334,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232, -3233,3234,1562,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248,3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,1563,3278,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295,3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327,3328,3329,3330,3331, -3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,3361,3362,3363,3364,1335,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374,3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,1336,3388,3389,3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410,3411,3412,3413,3414,1337,3415,3416,3417,3418,3419,1338,3420,3421,3422,1564,1565,3423,3424,3425,3426, -3427,3428,3429,3430,3431,1254,3432,3433,3434,1339,3435,3436,3437,3438,3439,1566,3440,3441,3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,1255,3455,3456,3457,3458,3459,1567,1191,3460,1568,1569,3461,3462,3463,1570,3464,3465,3466,3467,3468,1571,3469,3470,3471,3472,3473,1572,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,1340,3487,3488,3489,3490,3491,3492,1021,3493,3494,3495,3496,3497,3498,1573,3499,1341,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,1342, -3512,3513,3514,3515,3516,1574,1343,3517,3518,3519,1575,3520,1576,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541,3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,3580,1577,3581,3582,1578,3583,3584,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,1579,3605, -3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,1580,3630,3631,1581,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,1582,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,1192,3701,3702, -3703,3704,1256,3705,3706,3707,3708,1583,1257,3709,3710,3711,3712,3713,3714,3715,3716,1584,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,1344,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,1585,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,1586,3767,3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,1345,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795, -1346,1587,3796,3797,1588,3798,3799,3800,3801,3802,3803,3804,3805,3806,1347,3807,3808,3809,3810,3811,1589,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,1590,3822,3823,1591,1348,3824,3825,3826,3827,3828,3829,3830,1592,3831,3832,1593,3833,3834,3835,3836,3837,3838,3839,3840,3841,3842,3843,3844,1349,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,1594,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,1595,3870,3871,3872,3873,1596,3874,3875,3876,3877,3878,3879,3880,3881,3882, -3883,3884,3885,3886,1597,3887,3888,3889,3890,3891,3892,3893,3894,3895,1598,3896,3897,3898,1599,1600,3899,1350,3900,1351,3901,3902,1352,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,1258,3925,3926,3927,3928,3929,3930,3931,1193,3932,1601,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3943,1602,3944,3945,3946,3947,3948,1603,3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,1604,3966,3967,3968,3969,3970, -3971,3972,3973,3974,3975,3976,3977,1353,3978,3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,1354,3992,3993,3994,3995,3996,3997,3998,3999,4E3,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,1355,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,1605,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,1606,4061,4062,4063,4064,1607,4065, -4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,1194,4077,4078,1608,4079,4080,4081,4082,4083,4084,4085,4086,4087,1609,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098,4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,1259,4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,1195,4125,4126,4127,1610,4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,1356,4138,4139,4140,4141,4142,4143,4144,1611,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157,4158, -4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173,4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189,4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205,4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,1612,4220,4221,4222,4223,4224,4225,4226,4227,1357,4228,1613,4229,4230,4231,4232,4233,4234,4235,4236,4237,4238,4239,4240,4241,4242,4243,1614,4244,4245,4246,4247,4248,4249,4250,4251,4252,4253,4254,4255, -4256,4257,4258,4259,4260,4261,4262,4263,4264,4265,4266,4267,4268,4269,4270,1196,1358,4271,4272,4273,4274,4275,4276,4277,4278,4279,4280,4281,4282,4283,4284,4285,4286,4287,1615,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310,4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326,4327,4328,4329,4330,4331,4332,4333,4334,1616,4335,4336,4337,4338,4339,4340,4341,4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352, -4353,4354,4355,4356,4357,4358,4359,4360,1617,4361,4362,4363,4364,4365,1618,4366,4367,4368,4369,4370,4371,4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387,4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,1619,4417,4418,4419,4420,4421,4422,4423,4424,4425,1112,4426,4427,4428,4429,4430,1620,4431,4432,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,1260,1261,4443,4444,4445,4446, -4447,4448,4449,4450,4451,4452,4453,4454,4455,1359,4456,4457,4458,4459,4460,4461,4462,4463,4464,4465,1621,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476,4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,1055,4490,4491,4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507,4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,1622,4519,4520,4521,1623,4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,1360,4536,4537,4538,4539,4540,4541, -4542,4543,975,4544,4545,4546,4547,4548,4549,4550,4551,4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567,4568,4569,4570,4571,1624,4572,4573,4574,4575,4576,1625,4577,4578,4579,4580,4581,4582,4583,4584,1626,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,1627,4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611,4612,4613,4614,4615,1628,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626,4627,4628,4629,4630,4631,4632,4633,4634,4635,4636, -4637,4638,4639,4640,4641,4642,4643,4644,4645,4646,4647,4648,4649,1361,4650,4651,4652,4653,4654,4655,4656,4657,4658,4659,4660,4661,1362,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672,4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,1629,4683,4684,4685,4686,4687,1630,4688,4689,4690,4691,1153,4692,4693,4694,1113,4695,4696,4697,4698,4699,4700,4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,1197,4712,4713,4714,4715,4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730, -4731,4732,4733,4734,4735,1631,4736,1632,4737,4738,4739,4740,4741,4742,4743,4744,1633,4745,4746,4747,4748,4749,1262,4750,4751,4752,4753,4754,1363,4755,4756,4757,4758,4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,1634,4769,4770,4771,4772,4773,4774,4775,4776,4777,4778,1635,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788,4789,1636,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803,4804,4805,4806,1637,4807,4808,4809,1638,4810,4811,4812,4813,4814,4815,4816,4817,4818,1639,4819,4820, -4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832,4833,1077,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847,4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863,4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879,4880,4881,4882,4883,1640,4884,4885,1641,4886,4887,4888,4889,4890,4891,4892,4893,4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909,4910,4911,1642,4912,4913,4914,1364,4915,4916, -4917,4918,4919,4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,1643,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,1644,4981,4982,4983,4984,1645,4985,4986,1646,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,5E3,5001,5002,5003,5004,5005,1647,5006,1648,5007,5008,5009,5010,5011, -5012,1078,5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028,1365,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,1649,5040,5041,5042,5043,5044,5045,1366,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,1650,5056,5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072,5073,5074,5075,5076,5077,1651,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103,5104,5105,5106, -5107,5108,5109,5110,1652,5111,5112,5113,5114,5115,5116,5117,5118,1367,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,1653,5130,5131,5132,5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149,1368,5150,1654,5151,1369,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177,5178,1370,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192,5193,5194,5195,5196,5197,5198,1655,5199, -5200,5201,5202,1656,5203,5204,5205,5206,1371,5207,1372,5208,5209,5210,5211,1373,5212,5213,1374,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,1657,5248,5249,5250,5251,1658,1263,5252,5253,5254,5255,5256,1375,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283,1659,5284,5285,5286,5287,5288,5289,5290, -5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,1660,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,1376,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,1198,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,1661,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385,5386,5387, -5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,1264,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,1662,5413,5414,5415,5416,1663,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,1664,5439,5440,5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477,5478,1154,5479,5480,5481,5482,5483, -5484,5485,1665,5486,5487,5488,5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,1377,5549,5550,5551,5552,5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570,1114,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581, -5582,5583,5584,5585,5586,5587,5588,5589,5590,5591,5592,1378,5593,5594,5595,5596,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,1379,5615,5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632,5633,5634,1380,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,1381,1056,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,1666,5661,5662,5663,5664,5665,5666,5667,5668,1667,5669,1668,5670,5671,5672,5673,5674, -5675,5676,5677,5678,1155,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,1669,5699,5700,5701,5702,5703,5704,5705,1670,5706,5707,5708,5709,5710,1671,5711,5712,5713,5714,1382,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,1672,5726,5727,1673,1674,5728,5729,5730,5731,5732,5733,5734,5735,5736,1675,5737,5738,5739,5740,5741,5742,5743,5744,1676,5745,5746,5747,5748,5749,5750,5751,1383,5752,5753,5754,5755,5756,5757,5758,5759,5760,5761,5762,5763,5764, -5765,5766,5767,5768,1677,5769,5770,5771,5772,5773,1678,5774,5775,5776,998,5777,5778,5779,5780,5781,5782,5783,5784,5785,1384,5786,5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,1679,5801,5802,5803,1115,1116,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,1680,5856,5857, -5858,5859,5860,5861,5862,5863,5864,1681,5865,5866,5867,1682,5868,5869,5870,5871,5872,5873,5874,5875,5876,5877,5878,5879,1683,5880,1684,5881,5882,5883,5884,1685,5885,5886,5887,5888,5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,1686,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,1687,5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951, -5952,1688,1689,5953,1199,5954,5955,5956,5957,5958,5959,5960,5961,1690,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,1385,5982,1386,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6E3,6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,1265,6028,6029,1691,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044, -6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,1692,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,1693,6132,6133,6134,6135,6136,1694,6137,6138,6139,6140,6141,1695, -6142,6143,6144,6145,6146,6147,6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180,6181,6182,6183,6184,6185,1696,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212,6213,6214,6215,6216,6217,6218,6219,1697,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240, -6241,6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,1698,6254,6255,6256,6257,6258,6259,6260,6261,6262,6263,1200,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287,6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,1699,6303,6304,1700,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317,6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334,6335,6336,6337, -6338,6339,1701,6340,6341,6342,6343,6344,1387,6345,6346,6347,6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411,6412,6413,1702,6414,6415,6416,6417,6418,6419,6420,6421,6422,1703,6423,6424,6425,6426,6427,6428,6429,6430,6431,6432,6433,6434, -6435,6436,6437,6438,1704,6439,6440,6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456,6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,1266,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533, -6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551,1705,1706,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565,6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581,6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629,6630,6631,6632, -6633,6634,6635,6636,6637,1388,6638,6639,6640,6641,6642,6643,6644,1707,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659,6660,6661,6662,6663,1708,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674,1201,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,1389,6726,6727,6728, -6729,6730,6731,6732,6733,6734,6735,6736,1390,1709,6737,6738,6739,6740,6741,6742,1710,6743,6744,6745,6746,1391,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,1392,6758,6759,6760,6761,6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779,6780,1202,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,1711,6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822, -6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,1393,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,1712,6903,6904,6905,6906,6907,6908,6909,6910,1713,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920, -6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934,6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950,6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968,6969,6970,6971,6972,6973,6974,1714,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984,6985,6986,6987,6988,1394,6989,6990,6991,6992,6993,6994,6995,6996,6997,6998,6999,7E3,1715,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013,7014,7015,7016,7017,7018, -7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,1716,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042,7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074,7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118, -7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138,7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186,7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,1395,7208,7209,7210,7211,7212,7213,1717,7214,7215,7216,7217, -7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312,7313,1718,7314,7315,7316,7317, -7318,7319,7320,7321,7322,7323,7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418, -7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455,7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503,7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519, -7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567,7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615,7616,7617,7618,7619,7620, -7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631,7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695,7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711,7712,7713,7714,7715,7716,7717,7718,7719,7720,7721, -7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759,7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807,7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822, -7823,7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920,7921,7922,7923, -7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983,7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999,8E3,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024, -8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047,8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125, -8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226, -8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325,8326,8327, -8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428, -8429,8430,8431,8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529, -8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629,8630, -8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731, -8732,8733,8734,8735,8736,8737,8738,8739,8740,8741];!0},{"./init":20}],13:[function(b,a,d){!function(a){a.EUCKRProber=function(){a.MultiByteCharSetProber.apply(this);this.getCharsetName=function(){return"EUC-KR"};this._mCodingSM=new a.CodingStateMachine(a.EUCKRSMModel);this._mDistributionAnalyzer=new a.EUCKRDistributionAnalysis;this.reset()};a.EUCKRProber.prototype=new a.MultiByteCharSetProber}(b("./init"))},{"./init":20}],14:[function(b,a,d){b=b("./init");b.EUCTW_TYPICAL_DISTRIBUTION_RATIO=.75;b.EUCTW_TABLE_SIZE= -8102;b.EUCTWCharToFreqOrder=[1,1800,1506,255,1431,198,9,82,6,7310,177,202,3615,1256,2808,110,3735,33,3241,261,76,44,2113,16,2931,2184,1176,659,3868,26,3404,2643,1198,3869,3313,4060,410,2211,302,590,361,1963,8,204,58,4296,7311,1931,63,7312,7313,317,1614,75,222,159,4061,2412,1480,7314,3500,3068,224,2809,3616,3,10,3870,1471,29,2774,1135,2852,1939,873,130,3242,1123,312,7315,4297,2051,507,252,682,7316,142,1914,124,206,2932,34,3501,3173,64,604,7317,2494,1976,1977,155,1990,645,641,1606,7318,3405,337,72, -406,7319,80,630,238,3174,1509,263,939,1092,2644,756,1440,1094,3406,449,69,2969,591,179,2095,471,115,2034,1843,60,50,2970,134,806,1868,734,2035,3407,180,995,1607,156,537,2893,688,7320,319,1305,779,2144,514,2374,298,4298,359,2495,90,2707,1338,663,11,906,1099,2545,20,2436,182,532,1716,7321,732,1376,4062,1311,1420,3175,25,2312,1056,113,399,382,1949,242,3408,2467,529,3243,475,1447,3617,7322,117,21,656,810,1297,2295,2329,3502,7323,126,4063,706,456,150,613,4299,71,1118,2036,4064,145,3069,85,835,486,2114, -1246,1426,428,727,1285,1015,800,106,623,303,1281,7324,2127,2354,347,3736,221,3503,3110,7325,1955,1153,4065,83,296,1199,3070,192,624,93,7326,822,1897,2810,3111,795,2064,991,1554,1542,1592,27,43,2853,859,139,1456,860,4300,437,712,3871,164,2392,3112,695,211,3017,2096,195,3872,1608,3504,3505,3618,3873,234,811,2971,2097,3874,2229,1441,3506,1615,2375,668,2076,1638,305,228,1664,4301,467,415,7327,262,2098,1593,239,108,300,200,1033,512,1247,2077,7328,7329,2173,3176,3619,2673,593,845,1062,3244,88,1723,2037, -3875,1950,212,266,152,149,468,1898,4066,4302,77,187,7330,3018,37,5,2972,7331,3876,7332,7333,39,2517,4303,2894,3177,2078,55,148,74,4304,545,483,1474,1029,1665,217,1869,1531,3113,1104,2645,4067,24,172,3507,900,3877,3508,3509,4305,32,1408,2811,1312,329,487,2355,2247,2708,784,2674,4,3019,3314,1427,1788,188,109,499,7334,3620,1717,1789,888,1217,3020,4306,7335,3510,7336,3315,1520,3621,3878,196,1034,775,7337,7338,929,1815,249,439,38,7339,1063,7340,794,3879,1435,2296,46,178,3245,2065,7341,2376,7342,214,1709, -4307,804,35,707,324,3622,1601,2546,140,459,4068,7343,7344,1365,839,272,978,2257,2572,3409,2128,1363,3623,1423,697,100,3071,48,70,1231,495,3114,2193,7345,1294,7346,2079,462,586,1042,3246,853,256,988,185,2377,3410,1698,434,1084,7347,3411,314,2615,2775,4308,2330,2331,569,2280,637,1816,2518,757,1162,1878,1616,3412,287,1577,2115,768,4309,1671,2854,3511,2519,1321,3737,909,2413,7348,4069,933,3738,7349,2052,2356,1222,4310,765,2414,1322,786,4311,7350,1919,1462,1677,2895,1699,7351,4312,1424,2437,3115,3624, -2590,3316,1774,1940,3413,3880,4070,309,1369,1130,2812,364,2230,1653,1299,3881,3512,3882,3883,2646,525,1085,3021,902,2E3,1475,964,4313,421,1844,1415,1057,2281,940,1364,3116,376,4314,4315,1381,7,2520,983,2378,336,1710,2675,1845,321,3414,559,1131,3022,2742,1808,1132,1313,265,1481,1857,7352,352,1203,2813,3247,167,1089,420,2814,776,792,1724,3513,4071,2438,3248,7353,4072,7354,446,229,333,2743,901,3739,1200,1557,4316,2647,1920,395,2744,2676,3740,4073,1835,125,916,3178,2616,4317,7355,7356,3741,7357,7358, -7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145,438,2591,2896,2379,3317,1068,958,3023,461,311,2855,2677,4074,1915,3179,4075,1978,383,750,2745,2617,4076,274,539,385,1278,1442,7361,1154,1964,384,561,210,98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257,129,7363,3742,642,523,2776,2777,2648,7364,141,2231,1333,68,176,441,876,907,4077,603,2592,710,171,3417,404,549,18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320,7366,2973,368,7367,146,366,99,871,3627,1543,748,807,1586, -1185,22,2258,379,3743,3180,7368,3181,505,1941,2618,1991,1382,2314,7369,380,2357,218,702,1817,1248,3418,3024,3517,3318,3249,7370,2974,3628,930,3250,3744,7371,59,7372,585,601,4078,497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374,749,1836,690,1899,3745,1772,3885,1476,429,1043,1790,2232,2116,917,4079,447,1086,1629,7375,556,7376,7377,2020,1654,844,1090,105,550,966,1758,2815,1008,1782,686,1095,7378,2282,793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746,980,2496,544,353,527,4324,908,2678,2899,7380, -381,2619,1942,1348,7381,1341,1252,560,3072,7382,3420,2856,7383,2053,973,886,2080,143,4325,7384,7385,157,3886,496,4081,57,840,540,2038,4326,4327,3421,2117,1445,970,2259,1748,1965,2081,4082,3119,1234,1775,3251,2816,3629,773,1206,2129,1066,2039,1326,3887,1738,1725,4083,279,3120,51,1544,2594,423,1578,2130,2066,173,4328,1879,7386,7387,1583,264,610,3630,4329,2439,280,154,7388,7389,7390,1739,338,1282,3073,693,2857,1411,1074,3747,2440,7391,4330,7392,7393,1240,952,2394,7394,2900,1538,2679,685,1483,4084,2468, -1436,953,4085,2054,4331,671,2395,79,4086,2441,3252,608,567,2680,3422,4087,4088,1691,393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672,3748,3182,1464,522,1119,661,1150,216,675,4333,3888,1432,3519,609,4334,2681,2397,7400,7401,7402,4089,3025,0,7403,2469,315,231,2442,301,3319,4335,2380,7404,233,4090,3631,1818,4336,4337,7405,96,1776,1315,2082,7406,257,7407,1809,3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074,363,1655,3183,7409,2975,7410,7411,7412,3889,1567,3890,718,103,3184,849, -1443,341,3320,2934,1484,7413,1712,127,67,339,4092,2398,679,1412,821,7414,7415,834,738,351,2976,2146,846,235,1497,1880,418,1992,3749,2710,186,1100,2147,2746,3520,1545,1355,2935,2858,1377,583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358,78,3750,3751,267,1289,2099,2001,1594,4094,348,369,1274,2194,2175,1837,4338,1820,2817,3635,2747,2283,2002,4339,2936,2748,144,3321,882,4340,3892,2749,3423,4341,2901,7417,4095,1726,320,7418,3893,3026,788,2978,7419,2818,1773,1327,2859,3894,2819,7420,1306,4342, -2003,1700,3752,3521,2359,2650,787,2022,506,824,3636,534,323,4343,1044,3322,2023,1900,946,3424,7421,1778,1500,1678,7422,1881,4344,165,243,4345,3637,2521,123,683,4096,764,4346,36,3895,1792,589,2902,816,626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932,891,2083,2903,304,4097,7424,292,2979,2711,3522,691,2100,4098,1115,4347,118,662,7425,611,1156,854,2381,1316,2861,2,386,515,2904,7426,7427,3253,868,2234,1486,855,2651,785,2212,3028,7428,1040,3185,3523,7429,3121,448,7430,1525,7431, -2164,4348,7432,3754,7433,4099,2820,3524,3122,503,818,3898,3123,1568,814,676,1444,306,1749,7434,3755,1416,1030,197,1428,805,2821,1501,4349,7435,7436,7437,1993,7438,4350,7439,7440,2195,13,2779,3638,2980,3124,1229,1916,7441,3756,2131,7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445,646,3757,2443,307,7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451,519,7452,128,2132,92,2284,1979,7453,3900,1512,342,3125,2196,7454,2780,2214,1980,3323,7455,290,1656,1317,789,827,2360, -7456,3758,4352,562,581,3901,7457,401,4353,2248,94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459,828,1105,4101,1262,1394,7460,4102,605,4356,7461,1783,2862,7462,2822,819,2101,578,2197,2937,7463,1502,436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466,2332,2067,23,4357,193,826,3759,2102,699,1630,4104,3075,390,1793,1064,3526,7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359,137,4106,598,3078,1966,780,104,974,2938,7470,278,899,253,402,572,504,493,1339,7471,3903,1275, -4360,2574,2550,7472,3640,3029,3079,2249,565,1334,2713,863,41,7473,7474,4361,7475,1657,2333,19,463,2750,4107,606,7476,2981,3256,1087,2084,1323,2652,2982,7477,1631,1623,1750,4108,2682,7478,2864,791,2714,2653,2334,232,2416,7479,2983,1498,7480,2654,2620,755,1366,3641,3257,3126,2025,1609,119,1917,3427,862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125,817,4110,4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485,2683,733,40,1632,1106,2865,345,4113,841,2524, -230,4364,2984,1846,3259,3428,7486,1263,986,3429,7487,735,879,254,1137,857,622,1300,1180,1388,1562,3907,3908,2939,967,2751,2655,1349,592,2133,1692,3324,2985,1994,4114,1679,3909,1901,2185,7488,739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870,2752,2986,7490,435,7491,343,1108,596,17,1751,4365,2235,3430,3643,7492,4366,294,3527,2940,1693,477,979,281,2041,3528,643,2042,3644,2621,2782,2261,1031,2335,2134,2298,3529,4367,367,1249,2552,7493,3530,7494,4368,1283,3325,2004,240,1762,3326,4369, -4370,836,1069,3128,474,7495,2148,2525,268,3531,7496,3188,1521,1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118,961,1673,2622,190,2005,2200,3762,4371,4372,7500,570,2497,3645,1490,7501,4373,2623,3260,1956,4374,584,1514,396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910,619,7505,3129,3261,215,2006,2783,2553,3189,4377,3190,4378,763,4119,3763,4379,7506,7507,1957,1767,2941,3328,3646,1174,452,1477,4380,3329,3130,7508,2825,1253,2382,2186,1091,2285,4120,492,7509,638,1169,1824,2135, -1752,3911,648,926,1021,1324,4381,520,4382,997,847,1007,892,4383,3764,2262,1871,3647,7510,2400,1784,4384,1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551,30,2263,4122,7511,2026,4386,3534,7512,501,7513,4123,594,3431,2165,1821,3535,3432,3536,3192,829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388,4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389,374,3914,652,4128,4129,375,1140,798,7520,7521,7522,2361,4390,2264,546,1659,138,3031,2445,4391,7523,2250,612, -1848,910,796,3765,1740,1371,825,3766,3767,7524,2906,2554,7525,692,444,3032,2624,801,4392,4130,7526,1491,244,1053,3033,4131,4132,340,7527,3915,1041,2987,293,1168,87,1357,7528,1539,959,7529,2236,721,694,4133,3768,219,1478,644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825,730,1515,184,2827,66,4393,7532,1660,2943,246,3332,378,1457,226,3433,975,3917,2944,1264,3537,674,696,7533,163,7534,1141,2417,2166,713,3538,3333,4394,3918,7535,7536,1186,15,7537,1079,1070,7538,1522,3193,3539,276, -1050,2716,758,1126,653,2945,3263,7539,2337,889,3540,3919,3081,2989,903,1250,4395,3920,3434,3541,1342,1681,1718,766,3264,286,89,2946,3649,7540,1713,7541,2597,3334,2990,7542,2947,2215,3194,2866,7543,4396,2498,2526,181,387,1075,3921,731,2187,3335,7544,3265,310,313,3435,2299,770,4134,54,3034,189,4397,3082,3769,3922,7545,1230,1617,1849,355,3542,4135,4398,3336,111,4136,3650,1350,3135,3436,3035,4137,2149,3266,3543,7546,2784,3923,3924,2991,722,2008,7547,1071,247,1207,2338,2471,1378,4399,2009,864,1437,1214, -4400,373,3770,1142,2216,667,4401,442,2753,2555,3771,3925,1968,4138,3267,1839,837,170,1107,934,1336,1882,7548,7549,2118,4139,2828,743,1569,7550,4402,4140,582,2384,1418,3437,7551,1802,7552,357,1395,1729,3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554,482,2446,4404,7555,7556,1492,833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652,4142,1686,1794,416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867,4405,1610,1584,3036,2419,2754,443,3269,1163,3136,7561,7562,3926, -7563,4143,2499,3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145,431,3438,7565,250,97,81,4146,7566,1648,1850,1558,160,848,7567,866,740,1694,7568,2201,2830,3195,4147,4407,3653,1687,950,2472,426,469,3196,3654,3655,3928,7569,7570,1188,424,1995,861,3546,4148,3775,2202,2685,168,1235,3547,4149,7571,2086,1674,4408,3337,3270,220,2557,1009,7572,3776,670,2992,332,1208,717,7573,7574,3548,2447,3929,3338,7575,513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527,3656,3549,815,1587,3930,3931, -7581,3550,3439,3777,1254,4410,1328,3038,1390,3932,1741,3933,3778,3934,7582,236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411,7585,308,7586,4412,245,4413,1851,2473,1307,2575,430,715,2136,2449,7587,270,199,2869,3935,7588,3551,2718,1753,761,1754,725,1661,1840,4414,3440,3658,7589,7590,587,14,3272,227,2598,326,480,2265,943,2755,3552,291,650,1883,7591,1702,1226,102,1547,62,3441,904,4415,3442,1164,4150,7592,7593,1224,1548,2756,391,498,1493,7594,1386,1419,7595,2055,1177,4416,813,880,1081,2363,566,1145, -4417,2286,1001,1035,2558,2599,2238,394,1286,7596,7597,2068,7598,86,1494,1730,3936,491,1588,745,897,2948,843,3340,3937,2757,2870,3273,1768,998,2217,2069,397,1826,1195,1969,3659,2993,3341,284,7599,3782,2500,2137,2119,1903,7600,3938,2150,3939,4151,1036,3443,1904,114,2559,4152,209,1527,7601,7602,2949,2831,2625,2385,2719,3139,812,2560,7603,3274,7604,1559,737,1884,3660,1210,885,28,2686,3553,3783,7605,4153,1004,1779,4418,7606,346,1981,2218,2687,4419,3784,1742,797,1642,3940,1933,1072,1384,2151,896,3941,3275, -3661,3197,2871,3554,7607,2561,1958,4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528,2600,161,1178,4156,1982,987,4423,1101,4157,631,3943,1157,3198,2420,1343,1241,1016,2239,2562,372,877,2339,2501,1160,555,1934,911,3944,7611,466,1170,169,1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612,992,2340,3444,1540,2721,1201,2070,2401,1996,2475,7613,4424,528,1922,2188,1503,1873,1570,2364,3342,3276,7614,557,1073,7615,1827,3445,2087,2266,3140,3039,3084,767,3085,2786,4425, -1006,4158,4426,2341,1267,2176,3664,3199,778,3945,3200,2722,1597,2657,7616,4427,7617,3446,7618,7619,7620,3277,2689,1433,3278,131,95,1504,3946,723,4159,3141,1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949,4160,2576,248,1634,3785,912,7623,2832,3666,3040,3786,654,53,7624,2996,7625,1688,4428,777,3447,1032,3950,1425,7626,191,820,2120,2833,971,4429,931,3202,135,664,783,3787,1997,772,2908,1935,3951,3788,4430,2909,3203,282,2723,640,1372,3448,1127,922,325,3344,7627,7628,711, -2044,7629,7630,3952,2219,2787,1936,3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955,3956,7632,2221,258,3205,4432,101,1227,7633,3280,1755,7634,1391,3281,7635,2910,2056,893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642,878,1325,1780,2788,4433,259,1385,2577,744,1183,2267,4434,7643,3957,2502,7644,684,1024,4162,7645,472,3557,3449,1165,3282,3958,3959,322,2152,881,455,1695,1152,1340,660,554,2153,4435,1058,4436,4163,830,1065,3346,3960,4437,1923,7646,1703,1918, -7647,932,2268,122,7648,4438,947,677,7649,3791,2627,297,1905,1924,2269,4439,2317,3283,7650,7651,4164,7652,4165,84,4166,112,989,7653,547,1059,3961,701,3558,1019,7654,4167,7655,3450,942,639,457,2301,2451,993,2951,407,851,494,4440,3347,927,7656,1237,7657,2421,3348,573,4168,680,921,2911,1279,1874,285,790,1448,1983,719,2167,7658,7659,4441,3962,3963,1649,7660,1541,563,7661,1077,7662,3349,3041,3451,511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443,7663,535,1048,1276,1189,2912,2028,3142,1438,1373, -2834,2952,1134,2012,7664,4169,1238,2578,3086,1259,7665,700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906,4444,2601,3967,781,2422,132,1589,203,147,273,2789,2402,898,1786,2154,3968,3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793,965,7673,1804,2690,1516,3559,1121,1082,1329,3284,3970,1449,3794,65,1128,2835,2913,2759,1590,3795,7674,7675,12,2658,45,976,2579,3144,4447,517,2528,1013,1037,3209,7676,3796,2836,7677,3797,7678,3452,7679,2602,614,1998,2318,3798,3087,2724,2628,7680,2580,4172, -599,1269,7681,1810,3669,7682,2691,3088,759,1060,489,1805,3351,3285,1358,7683,7684,2386,1387,1215,2629,2252,490,7685,7686,4173,1759,2387,2343,7687,4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344,874,7688,7689,3454,3670,1858,91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403,3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973,2365,4453,7694,2029,7695,7696,3974,2693,1216,237,2581,4174,2319,3975,3802,4454,4455,2694,3560,3457,445,4456,7697,7698, -7699,7700,2761,61,3976,3672,1822,3977,7701,687,2045,935,925,405,2660,703,1096,1859,2725,4457,3978,1876,1367,2695,3352,918,2105,1781,2476,334,3287,1611,1093,4458,564,3146,3458,3673,3353,945,2631,2057,4459,7702,1925,872,4175,7703,3459,2696,3089,349,4176,3674,3979,4460,3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046,782,3981,400,251,4179,1624,7704,7705,277,3676,299,1265,476,1191,3804,2121,4180,4181,1109,205,7706,2582,1E3,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565,107,2477,2157,3982,3460, -3147,7711,1533,541,1301,158,753,4182,2872,3562,7712,1696,370,1088,4183,4466,3563,579,327,440,162,2240,269,1937,1374,3461,968,3043,56,1396,3090,2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717,2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985,7722,1076,49,7723,951,3211,3289,3290,450,2837,920,7724,1811,2792,2366,4184,1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472,2388,2604,260,1795,3213,7727,7728,3808,3291, -708,7729,3565,1704,7730,3566,1351,1618,3357,2999,1886,944,4185,3358,4186,3044,3359,4187,7731,3678,422,413,1714,3292,500,2058,2345,4188,2479,7732,1344,1910,954,7733,1668,7734,7735,3986,2404,4189,3567,3809,4190,7736,2302,1318,2505,3091,133,3092,2873,4473,629,31,2838,2697,3810,4474,850,949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988,620,3214,981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738,3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743,869,2839, -655,3811,3812,3094,3989,3E3,3813,1310,3569,4477,7744,7745,7746,1733,558,4478,3681,335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192,470,2726,2107,2793,913,1054,3990,7747,1027,7748,3046,3991,4479,982,2662,3362,3148,3465,3216,3217,1946,2794,7749,571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089,984,4481,3683,1959,7753,3684,852,923,2795,3466,3685,969,1519,999,2048,2320,1705,7754,3095,615,1662,151,597,3992,2405,2321,1049,275,4482,3686,4193,568,3687,3571,2480,4194,3688,7755,2425,2270,409,3218, -7756,1566,2874,3467,1002,769,2840,194,2090,3149,3689,2222,3294,4195,628,1505,7757,7758,1763,2177,3001,3993,521,1161,2584,1787,2203,2406,4483,3994,1625,4196,4197,412,42,3096,464,7759,2632,4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295,1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091,460,7765,4487,7766,3002,962,588,3574,289,3219,2634,1116,52,7767,3047,1796,7768,7769,7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365,465,4489,1572,510, -7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776,7777,4199,536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911,2796,7781,3296,1122,377,3220,7782,360,7783,7784,4200,1529,551,7785,2059,3693,1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404,136,1468,1479,672,1171,3221,2303,271,3151,7787,2762,7788,2049,678,2727,865,1947,4493,7789,2013,3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816,509,2841,2453,2876,3817,7792,7793,3152, -3153,4496,4202,2531,4497,2304,1166,1010,552,681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154,358,453,736,175,478,1117,905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473,3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298,2918,3049,2179,3474,595,2122,7800,3997,7801,7802,4206,1707,2636,223,3696,1359,751,3098,183,3475,7803,2797,3003,419,2369,633,704,3818,2389,241,7804,7805,7806,838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, -1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605,484,3698,7810,3999,625,4209,2273,3368,1499,4210,4E3,7811,4001,4211,3222,2274,2275,3476,7812,7813,2764,808,2606,3699,3369,4002,4212,3100,2532,526,3370,3821,4213,955,7814,1620,4214,2637,2427,7815,1429,3700,1669,1831,994,928,7816,3578,1260,7817,7818,7819,1948,2288,741,2919,1626,4215,2729,2455,867,1184,362,3371,1392,7820,7821,4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877,1292,1929,2506,2842,3701,1985,1187, -2071,2014,2607,4217,7823,2566,2507,2169,3702,2483,3299,7824,3703,4501,7825,7826,666,1003,3005,1022,3579,4218,7827,4502,1813,2253,574,3822,1603,295,1535,705,3823,4219,283,858,417,7828,7829,3224,4503,4504,3051,1220,1889,1046,2276,2456,4004,1393,1599,689,2567,388,4220,7830,2484,802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833,809,7834,7835,7836,575,2730,3477,956,1552,1469,1144,2323,7837,2324,1560,2457,3580,3226,4005,616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840, -1319,3704,3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826,607,2306,3827,762,2878,1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508,2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451,7851,7852,7853,7854,2922,4006,4007,2485,2346,411,4008,4009,3582,3300,3101,4509,1561,2664,1452,4010,1375,7855,7856,47,2959,316,7857,1406,1591,2923,3156,7858,1025,2141,3102,3157,354,2731,884,2224,4225,2407,508,3706,726,3583,996,2428,3584,729,7859,392,2191, -1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800,919,2347,2960,2348,1270,4511,4012,73,7862,7863,647,7864,3228,2843,2255,1550,1346,3006,7865,1332,883,3479,7866,7867,7868,7869,3301,2765,7870,1212,831,1347,4226,4512,2326,3830,1863,3053,720,3831,4513,4514,3832,7871,4227,7872,7873,4515,7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924,669,2208,2665,2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518,3158,518,7885,4013,7886,4229,1960,7887,2142,4230,7888, -7889,3007,2349,2350,3833,516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961,1422,577,1470,3008,1524,3373,7892,7893,432,4232,3054,3480,7894,2586,1455,2508,2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482,2639,4016,4233,4521,2290,895,924,4234,2170,331,2243,3056,166,1627,3057,1098,7898,1232,2880,2227,3374,4522,657,403,1196,2372,542,3709,3375,1600,4235,3483,7899,4523,2767,3230,576,530,1362,7900,4524,2533,2666,3710,4017,7901,842,3834,7902,2801, -2031,1014,4018,213,2700,3376,665,621,4236,7903,3711,2925,2430,7904,2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906,724,2277,600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909,651,4240,7910,1612,4241,2611,7911,2844,7912,2734,2307,3058,7913,716,2459,3059,174,1255,2701,4019,3590,548,1320,1398,728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062,3712,3591,3713,747,7916,635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922,3378,4530,2432,451,7923,3714,2535,2072,4244, -2735,4245,4022,7924,1764,4531,7925,4246,350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024,488,4532,458,4248,4025,3715,771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487,2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015,2736,7932,1155,1017,3716,3836,7933,3303,2308,201,1864,4253,1430,7934,4026,7935,7936,7937,7938,7939,4254,1604,7940,414,1865,371,2587,4534,4535,3485,2016,3104,4536,1708,960,4255,887,389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, -7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380,2882,4256,7950,4257,2640,3381,2802,673,2703,2460,709,3486,4028,3593,4258,7951,1148,502,634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105,948,3232,121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488,4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803,531,2737,2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017,120,4262,4263,2062,3595,3234, -2309,3840,2668,3382,1954,4542,7963,7964,3488,1047,2704,1266,7965,1368,4543,2845,649,3383,3841,2539,2738,1102,2846,2669,7966,7967,1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385,2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460,856,7974,3600,7975,2885,2963,7976,2886,3843,7977,4264,632,2510,875,3844,1697,3845,2291,7978,7979,4544,3010,1239,580,4545,4265,7980,914,936,2074,1190,4032,1039,2123,7981,7982,7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033,915, -3305,4267,4268,3306,1605,1834,7986,2739,398,3601,4269,3847,4034,328,1912,2847,4035,3848,1331,4270,3011,937,4271,7987,3602,4036,4037,3387,2160,4546,3388,524,742,538,3065,1012,7988,7989,3849,2461,7990,658,1103,225,3850,7991,7992,4547,7993,4548,7994,3236,1243,7995,4038,963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550,8E3,8001,8002,3489,3307,957,3389,2540,2032,1930,2927,2462,870,2018,3604,1746,2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066,8006,3162,2373, -4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292,977,2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689,714,4551,3491,8009,2328,3852,533,4273,3605,2181,617,8010,2464,3308,3492,2310,8011,8012,3165,8013,8014,3853,1987,618,427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552,8018,3494,8019,8020,2279,1576,473,3606,4275,3395,972,8021,3607,8022,3067,8023,8024,4553,4554,8025,3727,4041,4042,8026,153,4555,356,8027,1891,2888,4276,2143,408,803,2352,8028,3854,8029,4277,1646,2570,2511, -4556,4557,3855,8030,3856,4278,8031,2411,3396,752,8032,8033,1961,2964,8034,746,3012,2465,8035,4279,3728,698,4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706,3858,1973,4281,8038,4282,3167,823,1303,1288,1236,2848,3495,4044,3398,774,3859,8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284,344,1173,288,2311,454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563,985,894,8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194,425, -8050,4564,3169,1245,3730,4285,8051,8052,2850,8053,636,4565,1855,3861,760,1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210,479,8058,8059,832,8060,4049,2489,8061,2965,2490,3731,990,3109,627,1814,2642,4289,1582,4290,2125,2111,3496,4567,8062,799,4291,3170,8063,4568,2112,1737,3013,1018,543,754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889,4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239,1842,3610,1715,481,365,1975,1856,8074, -8075,1962,2491,4573,8076,2126,3611,3240,433,1894,2063,2075,8077,602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083,3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088,4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094,8095,1895,8096,8097,4580,1896,4054,318,8098,2094,4055,4293,8099,8100,485,8101,938,3862,553,2670,116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104,3613,2929,4056,1747,2930,2968,8105,8106,207,8107,8108,2672,4581,2514, -8109,3015,890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114,941,2294,208,3499,4057,2019,330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118,2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122,2493,3016,3734,8123,8124,2192,8125,8126,2162,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,8166,8167,8168, -8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269, -8270,8271,8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370, -8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471, -8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572, -8573,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673, -8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741];!0},{"./init":20}],15:[function(b,a,d){!function(a){a.EUCTWProber=function(){a.MultiByteCharSetProber.apply(this);this.getCharsetName=function(){return"EUC-TW"}; -this._mCodingSM=new a.CodingStateMachine(a.EUCTWSMModel);this._mDistributionAnalyzer=new a.EUCTWDistributionAnalysis;this.reset()};a.EUCTWProber.prototype=new a.MultiByteCharSetProber}(b("./init"))},{"./init":20}],16:[function(b,a,d){b=b("./init");b.GB2312_TYPICAL_DISTRIBUTION_RATIO=.9;b.GB2312_TABLE_SIZE=3760;b.GB2312CharToFreqOrder=[1671,749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515,572,3191,2205,2361,224,2558,479,1711,963,3162,440,4060,1905,2966,2947,3580,2647,3961,3842,2204,869,4207, -970,2678,5626,2944,2956,1479,4048,514,3595,588,1346,2820,3409,249,4088,1746,1873,2047,1774,581,1813,358,1174,3590,1014,1561,4844,2245,670,1636,3112,889,1286,953,556,2327,3060,1290,3141,613,185,3477,1367,850,3820,1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349,388,3098,2091,1360,3585,152,1687,1539,738,1559,59,1232,2925,2267,1388,1249,1741,1679,2960,151,1566,1125,1352,4271,924,4296,385,3166,4459,310,1245,2850,70,3285,2729,3534,3575,2398,3298,3466,1960,2265,217,3647,864,1909,2084,4401,2773,1010, -3269,5152,853,3051,3121,1244,4251,1895,364,1499,1540,2313,1180,3655,2268,562,715,2417,3061,544,336,3768,2380,1752,4075,950,280,2425,4382,183,2759,3272,333,4297,2155,1688,2356,1444,1039,4540,736,1177,3349,2443,2368,2144,2225,565,196,1482,3406,927,1335,4147,692,878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816,2534,1546,2393,2760,737,2494,13,447,245,2747,38,2765,2129,2589,1079,606,360,471,3755,2890,404,848,699,1785,1236,370,2221,1023,3746,2074,2026,2023,2388,1581,2119,812,1141,3091,2536,1519, -804,2053,406,1596,1090,784,548,4414,1806,2264,2936,1100,343,4114,5096,622,3358,743,3668,1510,1626,5020,3567,2513,3195,4115,5627,2489,2991,24,2065,2697,1087,2719,48,1634,315,68,985,2052,198,2239,1347,1107,1439,597,2366,2172,871,3307,919,2487,2790,1867,236,2570,1413,3794,906,3365,3381,1701,1982,1818,1524,2924,1205,616,2586,2072,2004,575,253,3099,32,1365,1182,197,1714,2454,1201,554,3388,3224,2748,756,2587,250,2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153,615,911,1506,1474,2495,1265, -1906,2749,3756,3280,2161,898,2714,1759,3450,2243,2444,563,26,3286,2266,3769,3344,2707,3677,611,1402,531,1028,2871,4548,1375,261,2948,835,1190,4134,353,840,2684,1900,3082,1435,2109,1207,1674,329,1872,2781,4055,2686,2104,608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054,1681,1153,225,1627,2929,162,2050,2511,3687,1954,124,1859,2431,1684,3032,2894,585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209,256,518,2042,2105,3777,3657,643,2298,1148,1779,190,989,3544,414,11,2135, -2063,2979,1471,403,3678,126,770,1563,671,2499,3216,2877,600,1179,307,2805,4937,1268,1297,2694,252,4032,1448,1494,1331,1394,127,2256,222,1647,1035,1481,3056,1915,1048,873,3651,210,33,1608,2516,200,1520,415,102,0,3389,1287,817,91,3299,2940,836,1814,549,2197,1396,1669,2987,3582,2297,2848,4528,1070,687,20,1819,121,1552,1364,1461,1968,2617,3540,2824,2083,177,948,4938,2291,110,4549,2066,648,3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123,208,1804,3159,2992,2531,2549,3361,2418,1350,2347,2800, -2568,1291,2036,2680,72,842,1990,212,1233,1154,1586,75,2027,3410,4900,1823,1337,2710,2676,728,2810,1522,3026,4995,157,755,1050,4022,710,785,1936,2194,2085,1406,2777,2400,150,1250,4049,1206,807,1910,534,529,3309,1721,1660,274,39,2827,661,2670,1578,925,3248,3815,1094,4278,4901,4252,41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258,887,538,4187,3199,1294,2439,3042,2329,2343,2497,1255,107,543,1527,521,3478,3568,194,5062,15,961,3870,1241,1192,2664,66,5215,3260,2111,1295,1127,2152,3805,4135, -901,1164,1976,398,1278,530,1460,748,904,1054,1966,1426,53,2909,509,523,2279,1534,536,1019,239,1685,460,2353,673,1065,2401,3600,4298,2272,1272,2363,284,1753,3679,4064,1695,81,815,2677,2757,2731,1386,859,500,4221,2190,2566,757,1006,2519,2068,1166,1455,337,2654,3203,1863,1682,1914,3025,1252,1409,1366,847,714,2834,2038,3209,964,2970,1901,885,2553,1078,1756,3049,301,1572,3326,688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088,262,1158,1254,389,1641,1812,526,1719,923,2073,1073,1902,468,489,4625,1140, -857,2375,3070,3319,2863,380,116,1328,2693,1161,2244,273,1212,1884,2769,3011,1775,1142,461,3066,1200,2147,2212,790,702,2695,4222,1601,1058,434,2338,5153,3640,67,2360,4099,2502,618,3472,1329,416,1132,830,2782,1807,2653,3211,3510,1662,192,2124,296,3979,1739,1611,3684,23,118,324,446,1239,1225,293,2520,3814,3795,2535,3116,17,1074,467,2692,2201,387,2922,45,1326,3055,1645,3659,2817,958,243,1903,2320,1339,2825,1784,3289,356,576,865,2315,2381,3377,3916,1088,3122,1713,1655,935,628,4689,1034,1327,441,800,720, -894,1979,2183,1528,5289,2702,1071,4046,3572,2399,1571,3281,79,761,1103,327,134,758,1899,1371,1615,879,442,215,2605,2579,173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946,814,4968,3487,1548,2644,1567,1285,2,295,2636,97,946,3576,832,141,4257,3273,760,3821,3521,3156,2607,949,1024,1733,1516,1803,1920,2125,2283,2665,3180,1501,2064,3560,2171,1592,803,3518,1416,732,3897,4258,1363,1362,2458,119,1427,602,1525,2608,1605,1639,3175,694,3064,10,465,76,2E3,4846,4208,444,3781,1619,3353,2206,1273,3796, -740,2483,320,1723,2377,3660,2619,1359,1137,1762,1724,2345,2842,1850,1862,912,821,1866,612,2625,1735,2573,3369,1093,844,89,937,930,1424,3564,2413,2972,1004,3046,3019,2011,711,3171,1452,4178,428,801,1943,432,445,2811,206,4136,1472,730,349,73,397,2802,2547,998,1637,1167,789,396,3217,154,1218,716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627,552,3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703,640,1045,1370,1246,4996,371,1575,2436,1621,2210,984,4033,1734,2638,16,4529,663,2755,3255,1451, -3917,2257,1253,1955,2234,1263,2951,214,1229,617,485,359,1831,1969,473,2310,750,2058,165,80,2864,2419,361,4344,2416,2479,1134,796,3726,1266,2943,860,2715,938,390,2734,1313,1384,248,202,877,1064,2854,522,3907,279,1602,297,2357,395,3740,137,2075,944,4089,2584,1267,3802,62,1533,2285,178,176,780,2440,201,3707,590,478,1560,4354,2117,1075,30,74,4643,4004,1635,1441,2745,776,2596,238,1077,1692,1912,2844,605,499,1742,3947,241,3053,980,1749,936,2640,4511,2582,515,1543,2162,5322,2892,2993,890,2148,1924,665,1827, -3581,1032,968,3163,339,1044,1896,270,583,1791,1720,4367,1194,3488,3669,43,2523,1657,163,2167,290,1209,1622,3378,550,634,2508,2510,695,2634,2384,2512,1476,1414,220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680,854,3227,1299,2976,3172,186,2998,1459,443,1067,3251,1495,321,1932,3054,909,753,1410,1828,436,2441,1119,1587,3164,2186,1258,227,231,1425,1890,3200,3942,247,959,725,5254,2741,577,2158,2079,929,120,174,838,2813,591,1115,417,2024,40,3240,1536,1037,291,4151,2354,632,1298,2406,2500,3535,1825, -1846,3451,205,1171,345,4238,18,1163,811,685,2208,1217,425,1312,1508,1175,4308,2552,1033,587,1381,3059,2984,3482,340,1316,4023,3972,792,3176,519,777,4690,918,933,4130,2981,3741,90,3360,2911,2200,5184,4550,609,3079,2030,272,3379,2736,363,3881,1130,1447,286,779,357,1169,3350,3137,1630,1220,2687,2391,747,1277,3688,2618,2682,2601,1156,3196,5290,4034,3102,1689,3596,3128,874,219,2783,798,508,1843,2461,269,1658,1776,1392,1913,2983,3287,2866,2159,2372,829,4076,46,4253,2873,1889,1894,915,1834,1631,2181,2318, -298,664,2818,3555,2735,954,3228,3117,527,3511,2173,681,2712,3033,2247,2346,3467,1652,155,2164,3382,113,1994,450,899,494,994,1237,2958,1875,2336,1926,3727,545,1577,1550,633,3473,204,1305,3072,2410,1956,2471,707,2134,841,2195,2196,2663,3843,1026,4940,990,3252,4997,368,1092,437,3212,3258,1933,1829,675,2977,2893,412,943,3723,4644,3294,3283,2230,2373,5154,2389,2241,2661,2323,1404,2524,593,787,677,3008,1275,2059,438,2709,2609,2240,2269,2246,1446,36,1568,1373,3892,1574,2301,1456,3962,693,2276,5216,2035, -1143,2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090,424,1694,312,3634,3390,4179,3335,2252,1214,561,1059,3243,2295,2561,975,5155,2321,2751,3772,472,1537,3282,3398,1047,2077,2348,2878,1323,3340,3076,690,2906,51,369,170,3541,1060,2187,2688,3670,2541,1083,1683,928,3918,459,109,4427,599,3744,4286,143,2101,2730,2490,82,1588,3036,2121,281,1860,477,4035,1238,2812,3020,2716,3312,1530,2188,2055,1317,843,636,1808,1173,3495,649,181,1002,147,3641,1159,2414,3750,2289,2795,813,3123,2610,1136,4368,5, -3391,4541,2174,420,429,1728,754,1228,2115,2219,347,2223,2733,735,1518,3003,2355,3134,1764,3948,3329,1888,2424,1001,1234,1972,3321,3363,1672,1021,1450,1584,226,765,655,2526,3404,3244,2302,3665,731,594,2184,319,1576,621,658,2656,4299,2099,3864,1279,2071,2598,2739,795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004,2591,1084,213,2287,1963,3565,2250,822,793,4574,3187,1772,1789,3050,595,1484,1959,2770,1080,2650,456,422,2996,940,3322,4328,4345,3092,2742,965,2784,739,4124,952, -1358,2498,2949,2565,332,2698,2378,660,2260,2473,4194,3856,2919,535,1260,2651,1208,1428,1300,1949,1303,2942,433,2455,2450,1251,1946,614,1269,641,1306,1810,2737,3078,2912,564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307,3218,2175,1897,3063,682,1157,4040,4005,1712,1160,1941,1399,394,402,2952,1573,1151,2986,2404,862,299,2033,1489,3006,346,171,2886,3401,1726,2932,168,2533,47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965,504,1036,2690,2988,2405,745,5871,849,2397,2056,3081, -863,2359,3857,2096,99,1397,1769,2300,4428,1643,3455,1978,1757,3718,1440,35,4879,3742,1296,4228,2280,160,5063,1599,2013,166,520,3479,1646,3345,3012,490,1937,1545,1264,2182,2505,1096,1188,1369,1436,2421,1667,2792,2460,1270,2122,727,3167,2143,806,1706,1012,1800,3037,960,2218,1882,805,139,2456,1139,1521,851,1052,3093,3089,342,2039,744,5097,1468,1502,1585,2087,223,939,326,2140,2577,892,2481,1623,4077,982,3708,135,2131,87,2503,3114,2326,1106,876,1616,547,2997,2831,2093,3441,4530,4314,9,3256,4229,4148,659, -1462,1986,1710,2046,2913,2231,4090,4880,5255,3392,3274,1368,3689,4645,1477,705,3384,3635,1068,1529,2941,1458,3782,1509,100,1656,2548,718,2339,408,1590,2780,3548,1838,4117,3719,1345,3530,717,3442,2778,3220,2898,1892,4590,3614,3371,2043,1998,1224,3483,891,635,584,2559,3355,733,1766,1729,1172,3789,1891,2307,781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535,3213,1189,1934,5693,3262,586,3118,1324,1598,517,1564,2217,1868,1893,4445,3728,2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711, -5098,4287,338,1993,3129,3489,2689,1809,2815,1997,957,1855,3898,2550,3275,3057,1105,1319,627,1505,1911,1883,3526,698,3629,3456,1833,1431,746,77,1261,2017,2296,1977,1885,125,1334,1600,525,1798,1109,2222,1470,1945,559,2236,1186,3443,2476,1929,1411,2411,3135,1777,3372,2621,1841,1613,3229,668,1430,1839,2643,2916,195,1989,2671,2358,1387,629,3205,2293,5256,4439,123,1310,888,1879,4300,3021,3605,1003,1162,3192,2910,2010,140,2395,2859,55,1082,2012,2901,662,419,2081,1438,680,2774,4654,3912,1620,1731,1625,5035, -4065,2328,512,1344,802,5443,2163,2311,2537,524,3399,98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346,180,1113,4655,3461,2028,1698,833,2696,1235,1322,1594,4408,3623,3013,3225,2040,3022,541,2881,607,3632,2029,1665,1219,639,1385,1686,1099,2803,3231,1938,3188,2858,427,676,2772,1168,2025,454,3253,2486,3556,230,1950,580,791,1991,1280,1086,1974,2034,630,257,3338,2788,4903,1017,86,4790,966,2789,1995,1696,1131,259,3095,4188,1308,179,1463,5257,289,4107,1248,42,3413,1725,2288,896,1947, -774,4474,4254,604,3430,4264,392,2514,2588,452,237,1408,3018,988,4531,1970,3034,3310,540,2370,1562,1288,2990,502,4765,1147,4,1853,2708,207,294,2814,4078,2902,2509,684,34,3105,3532,2551,644,709,2801,2344,573,1727,3573,3557,2021,1081,3100,4315,2100,3681,199,2263,1837,2385,146,3484,1195,2776,3949,997,1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076,493,117,5400,2521,972,1490,2934,1796,4542,2374,1512,2933,2657,413,2888,1135,2762,2314,2156,1355,2369,766,2007,2527,2170,3124,2491,2593,2632,4757,2437, -234,3125,3591,1898,1750,1376,1942,3468,3138,570,2127,2145,3276,4131,962,132,1445,4196,19,941,3624,3480,3366,1973,1374,4461,3431,2629,283,2415,2275,808,2887,3620,2112,2563,1353,3610,955,1089,3103,1053,96,88,4097,823,3808,1583,399,292,4091,3313,421,1128,642,4006,903,2539,1877,2082,596,29,4066,1790,722,2157,130,995,1569,769,1485,464,513,2213,288,1923,1101,2453,4316,133,486,2445,50,625,487,2207,57,423,481,2962,159,3729,1558,491,303,482,501,240,2837,112,3648,2392,1783,362,8,3433,3422,610,2793,3277,1390, -1284,1654,21,3823,734,367,623,193,287,374,1009,1483,816,476,313,2255,2340,1262,2150,2899,1146,2581,782,2116,1659,2018,1880,255,3586,3314,1110,2867,2137,2564,986,2767,5185,2006,650,158,926,762,881,3157,2717,2362,3587,306,3690,3245,1542,3077,2427,1691,2478,2118,2985,3490,2438,539,2305,983,129,1754,355,4201,2386,827,2923,104,1773,2838,2771,411,2905,3919,376,767,122,1114,828,2422,1817,3506,266,3460,1007,1609,4998,945,2612,4429,2274,726,1247,1964,2914,2199,2070,4002,4108,657,3323,1422,579,455,2764,4737, -1222,2895,1670,824,1223,1487,2525,558,861,3080,598,2659,2515,1967,752,2583,2376,2214,4180,977,704,2464,4999,2622,4109,1210,2961,819,1541,142,2284,44,418,457,1126,3730,4347,4626,1644,1876,3671,1864,302,1063,5694,624,723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098,409,1011,2325,3704,2306,818,1732,1383,1824,1844,3757,999,2705,3497,1216,1423,2683,2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343,783,724,191,2434,1354,2220,5065,1763,2752,2472,4152,131,175,2885,3434,92,1466,4920, -2616,3871,3872,3866,128,1551,1632,669,1854,3682,4691,4125,1230,188,2973,3290,1302,1213,560,3266,917,763,3909,3249,1760,868,1958,764,1782,2097,145,2277,3774,4462,64,1491,3062,971,2132,3606,2442,221,1226,1617,218,323,1185,3207,3147,571,619,1473,1005,1744,2281,449,1887,2396,3685,275,375,3816,1743,3844,3731,845,1983,2350,4210,1377,773,967,3499,3052,3743,2725,4007,1697,1022,3943,1464,3264,2855,2722,1952,1029,2839,2467,84,4383,2215,820,1391,2015,2448,3672,377,1948,2168,797,2545,3536,2578,2645,94,2874,1678, -405,1259,3071,771,546,1315,470,1243,3083,895,2468,981,969,2037,846,4181,653,1276,2928,14,2594,557,3007,2474,156,902,1338,1740,2574,537,2518,973,2282,2216,2433,1928,138,2903,1293,2631,1612,646,3457,839,2935,111,496,2191,2847,589,3186,149,3994,2060,4031,2641,4067,3145,1870,37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261,1301,251,2446,2599,2153,872,3246,637,334,3705,831,884,921,3065,3140,4092,2198,1944,246,2964,108,2045,1152,1921,2308,1031,203,3173,4170,1907,3890,810,1401,2003,1690,506,647,1242, -2828,1761,1649,3208,2249,1589,3709,2931,5156,1708,498,666,2613,834,3817,1231,184,2851,1124,883,3197,2261,3710,1765,1553,2658,1178,2639,2351,93,1193,942,2538,2141,4402,235,1821,870,1591,2192,1709,1871,3341,1618,4126,2595,2334,603,651,69,701,268,2662,3411,2555,1380,1606,503,448,254,2371,2646,574,1187,2309,1770,322,2235,1292,1801,305,566,1133,229,2067,2057,706,167,483,2002,2672,3295,1820,3561,3067,316,378,2746,3452,1112,136,1981,507,1651,2917,1117,285,4591,182,2580,3522,1304,335,3303,1835,2504,1795, -1792,2248,674,1018,2106,2449,1857,2292,2845,976,3047,1781,2600,2727,1389,1281,52,3152,153,265,3950,672,3485,3951,4463,430,1183,365,278,2169,27,1407,1336,2304,209,1340,1730,2202,1852,2403,2883,979,1737,1062,631,2829,2542,3876,2592,825,2086,2226,3048,3625,352,1417,3724,542,991,431,1351,3938,1861,2294,826,1361,2927,3142,3503,1738,463,2462,2723,582,1916,1595,2808,400,3845,3891,2868,3621,2254,58,2492,1123,910,2160,2614,1372,1603,1196,1072,3385,1700,3267,1980,696,480,2430,920,799,1570,2920,1951,2041,4047, -2540,1321,4223,2469,3562,2228,1271,2602,401,2833,3351,2575,5157,907,2312,1256,410,263,3507,1582,996,678,1849,2316,1480,908,3545,2237,703,2322,667,1826,2849,1531,2604,2999,2407,3146,2151,2630,1786,3711,469,3542,497,3899,2409,858,837,4446,3393,1274,786,620,1845,2001,3311,484,308,3367,1204,1815,3691,2332,1532,2557,1842,2020,2724,1927,2333,4440,567,22,1673,2728,4475,1987,1858,1144,1597,101,1832,3601,12,974,3783,4391,951,1412,1,3720,453,4608,4041,528,1041,1027,3230,2628,1129,875,1051,3291,1203,2262,1069, -2860,2799,2149,2615,3278,144,1758,3040,31,475,1680,366,2685,3184,311,1642,4008,2466,5036,1593,1493,2809,216,1420,1668,233,304,2128,3284,232,1429,1768,1040,2008,3407,2740,2967,2543,242,2133,778,1565,2022,2620,505,2189,2756,1098,2273,372,1614,708,553,2846,2094,2278,169,3626,2835,4161,228,2674,3165,809,1454,1309,466,1705,1095,900,3423,880,2667,3751,5258,2317,3109,2571,4317,2766,1503,1342,866,4447,1118,63,2076,314,1881,1348,1061,172,978,3515,1747,532,511,3970,6,601,905,2699,3300,1751,276,1467,3725,2668, -65,4239,2544,2779,2556,1604,578,2451,1802,992,2331,2624,1320,3446,713,1513,1013,103,2786,2447,1661,886,1702,916,654,3574,2031,1556,751,2178,2821,2179,1498,1538,2176,271,914,2251,2080,1325,638,1953,2937,3877,2432,2754,95,3265,1716,260,1227,4083,775,106,1357,3254,426,1607,555,2480,772,1985,244,2546,474,495,1046,2611,1851,2061,71,2089,1675,2590,742,3758,2843,3222,1433,267,2180,2576,2826,2233,2092,3913,2435,956,1745,3075,856,2113,1116,451,3,1988,2896,1398,993,2463,1878,2049,1341,2718,2721,2870,2108,712, -2904,4363,2753,2324,277,2872,2349,2649,384,987,435,691,3E3,922,164,3939,652,1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664,2530,1434,2408,893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078,49,3770,3469,462,318,656,2259,3250,3069,679,1629,2758,344,1138,1104,3120,1836,1283,3115,2154,1437,4448,934,759,1999,794,2862,1038,533,2560,1722,2342,855,2626,1197,1663,4476,3127,85,4240,2528,25,1111,1181,3673,407,3470,4561,2679,2713,768,1925,2841,3986,1544,1165,932,373,1240,2146, -1930,2673,721,4766,354,4333,391,2963,187,61,3364,1442,1102,330,1940,1767,341,3809,4118,393,2496,2062,2211,105,331,300,439,913,1332,626,379,3304,1557,328,689,3952,309,1555,931,317,2517,3027,325,569,686,2107,3084,60,1042,1333,2794,264,3177,4014,1628,258,3712,7,4464,1176,1043,1778,683,114,1975,78,1492,383,1886,510,386,645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015,1282,1289,4609,697,1453,3044,2666,3611,1856,2412,54,719,1330,568,3778,2459,1748,788,492,551,1191,1E3,488,3394, -3763,282,1799,348,2016,1523,3155,2390,1049,382,2019,1788,1170,729,2968,3523,897,3926,2785,2938,3292,350,2319,3238,1718,1717,2655,3453,3143,4465,161,2889,2980,2009,1421,56,1908,1640,2387,2232,1917,1874,2477,4921,148,83,3438,592,4245,2882,1822,1055,741,115,1496,1624,381,1638,4592,1020,516,3214,458,947,4575,1432,211,1514,2926,1865,2142,189,852,1221,1400,1486,882,2299,4036,351,28,1122,700,6479,6480,6481,6482,6483,5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636,5509,3257, -5510,5973,5445,5872,4941,4403,3174,4627,5873,6276,2286,4230,5446,5874,5122,6102,6103,4162,5447,5123,5323,4849,6277,3980,3851,5066,4246,5774,5067,6278,3001,2807,5695,3346,5775,5974,5158,5448,6487,5975,5976,5776,3598,6279,5696,4806,4211,4154,6280,6488,6489,6490,6281,4212,5037,3374,4171,6491,4562,4807,4722,4827,5977,6104,4532,4079,5159,5324,5160,4404,3858,5359,5875,3975,4288,4610,3486,4512,5325,3893,5360,6282,6283,5560,2522,4231,5978,5186,5449,2569,3878,6284,5401,3578,4415,6285,4656,5124,5979,2506,4247, -4449,3219,3417,4334,4969,4329,6492,4576,4828,4172,4416,4829,5402,6286,3927,3852,5361,4369,4830,4477,4867,5876,4173,6493,6105,4657,6287,6106,5877,5450,6494,4155,4868,5451,3700,5629,4384,6288,6289,5878,3189,4881,6107,6290,6495,4513,6496,4692,4515,4723,5100,3356,6497,6291,3810,4080,5561,3570,4430,5980,6498,4355,5697,6499,4724,6108,6109,3764,4050,5038,5879,4093,3226,6292,5068,5217,4693,3342,5630,3504,4831,4377,4466,4309,5698,4431,5777,6293,5778,4272,3706,6110,5326,3752,4676,5327,4273,5403,4767,5631,6500, -5699,5880,3475,5039,6294,5562,5125,4348,4301,4482,4068,5126,4593,5700,3380,3462,5981,5563,3824,5404,4970,5511,3825,4738,6295,6501,5452,4516,6111,5881,5564,6502,6296,5982,6503,4213,4163,3454,6504,6112,4009,4450,6113,4658,6297,6114,3035,6505,6115,3995,4904,4739,4563,4942,4110,5040,3661,3928,5362,3674,6506,5292,3612,4791,5565,4149,5983,5328,5259,5021,4725,4577,4564,4517,4364,6298,5405,4578,5260,4594,4156,4157,5453,3592,3491,6507,5127,5512,4709,4922,5984,5701,4726,4289,6508,4015,6116,5128,4628,3424,4241, -5779,6299,4905,6509,6510,5454,5702,5780,6300,4365,4923,3971,6511,5161,3270,3158,5985,4100,867,5129,5703,6117,5363,3695,3301,5513,4467,6118,6512,5455,4232,4242,4629,6513,3959,4478,6514,5514,5329,5986,4850,5162,5566,3846,4694,6119,5456,4869,5781,3779,6301,5704,5987,5515,4710,6302,5882,6120,4392,5364,5705,6515,6121,6516,6517,3736,5988,5457,5989,4695,2457,5883,4551,5782,6303,6304,6305,5130,4971,6122,5163,6123,4870,3263,5365,3150,4871,6518,6306,5783,5069,5706,3513,3498,4409,5330,5632,5366,5458,5459,3991, -5990,4502,3324,5991,5784,3696,4518,5633,4119,6519,4630,5634,4417,5707,4832,5992,3418,6124,5993,5567,4768,5218,6520,4595,3458,5367,6125,5635,6126,4202,6521,4740,4924,6307,3981,4069,4385,6308,3883,2675,4051,3834,4302,4483,5568,5994,4972,4101,5368,6309,5164,5884,3922,6127,6522,6523,5261,5460,5187,4164,5219,3538,5516,4111,3524,5995,6310,6311,5369,3181,3386,2484,5188,3464,5569,3627,5708,6524,5406,5165,4677,4492,6312,4872,4851,5885,4468,5996,6313,5709,5710,6128,2470,5886,6314,5293,4882,5785,3325,5461,5101, -6129,5711,5786,6525,4906,6526,6527,4418,5887,5712,4808,2907,3701,5713,5888,6528,3765,5636,5331,6529,6530,3593,5889,3637,4943,3692,5714,5787,4925,6315,6130,5462,4405,6131,6132,6316,5262,6531,6532,5715,3859,5716,5070,4696,5102,3929,5788,3987,4792,5997,6533,6534,3920,4809,5E3,5998,6535,2974,5370,6317,5189,5263,5717,3826,6536,3953,5001,4883,3190,5463,5890,4973,5999,4741,6133,6134,3607,5570,6E3,4711,3362,3630,4552,5041,6318,6001,2950,2953,5637,4646,5371,4944,6002,2044,4120,3429,6319,6537,5103,4833,6538, -6539,4884,4647,3884,6003,6004,4758,3835,5220,5789,4565,5407,6540,6135,5294,4697,4852,6320,6321,3206,4907,6541,6322,4945,6542,6136,6543,6323,6005,4631,3519,6544,5891,6545,5464,3784,5221,6546,5571,4659,6547,6324,6137,5190,6548,3853,6549,4016,4834,3954,6138,5332,3827,4017,3210,3546,4469,5408,5718,3505,4648,5790,5131,5638,5791,5465,4727,4318,6325,6326,5792,4553,4010,4698,3439,4974,3638,4335,3085,6006,5104,5042,5166,5892,5572,6327,4356,4519,5222,5573,5333,5793,5043,6550,5639,5071,4503,6328,6139,6551,6140, -3914,3901,5372,6007,5640,4728,4793,3976,3836,4885,6552,4127,6553,4451,4102,5002,6554,3686,5105,6555,5191,5072,5295,4611,5794,5296,6556,5893,5264,5894,4975,5466,5265,4699,4976,4370,4056,3492,5044,4886,6557,5795,4432,4769,4357,5467,3940,4660,4290,6141,4484,4770,4661,3992,6329,4025,4662,5022,4632,4835,4070,5297,4663,4596,5574,5132,5409,5895,6142,4504,5192,4664,5796,5896,3885,5575,5797,5023,4810,5798,3732,5223,4712,5298,4084,5334,5468,6143,4052,4053,4336,4977,4794,6558,5335,4908,5576,5224,4233,5024,4128, -5469,5225,4873,6008,5045,4729,4742,4633,3675,4597,6559,5897,5133,5577,5003,5641,5719,6330,6560,3017,2382,3854,4406,4811,6331,4393,3964,4946,6561,2420,3722,6562,4926,4378,3247,1736,4442,6332,5134,6333,5226,3996,2918,5470,4319,4003,4598,4743,4744,4485,3785,3902,5167,5004,5373,4394,5898,6144,4874,1793,3997,6334,4085,4214,5106,5642,4909,5799,6009,4419,4189,3330,5899,4165,4420,5299,5720,5227,3347,6145,4081,6335,2876,3930,6146,3293,3786,3910,3998,5900,5300,5578,2840,6563,5901,5579,6147,3531,5374,6564,6565, -5580,4759,5375,6566,6148,3559,5643,6336,6010,5517,6337,6338,5721,5902,3873,6011,6339,6567,5518,3868,3649,5722,6568,4771,4947,6569,6149,4812,6570,2853,5471,6340,6341,5644,4795,6342,6012,5723,6343,5724,6013,4349,6344,3160,6150,5193,4599,4514,4493,5168,4320,6345,4927,3666,4745,5169,5903,5005,4928,6346,5725,6014,4730,4203,5046,4948,3395,5170,6015,4150,6016,5726,5519,6347,5047,3550,6151,6348,4197,4310,5904,6571,5581,2965,6152,4978,3960,4291,5135,6572,5301,5727,4129,4026,5905,4853,5728,5472,6153,6349,4533, -2700,4505,5336,4678,3583,5073,2994,4486,3043,4554,5520,6350,6017,5800,4487,6351,3931,4103,5376,6352,4011,4321,4311,4190,5136,6018,3988,3233,4350,5906,5645,4198,6573,5107,3432,4191,3435,5582,6574,4139,5410,6353,5411,3944,5583,5074,3198,6575,6354,4358,6576,5302,4600,5584,5194,5412,6577,6578,5585,5413,5303,4248,5414,3879,4433,6579,4479,5025,4854,5415,6355,4760,4772,3683,2978,4700,3797,4452,3965,3932,3721,4910,5801,6580,5195,3551,5907,3221,3471,3029,6019,3999,5908,5909,5266,5267,3444,3023,3828,3170,4796, -5646,4979,4259,6356,5647,5337,3694,6357,5648,5338,4520,4322,5802,3031,3759,4071,6020,5586,4836,4386,5048,6581,3571,4679,4174,4949,6154,4813,3787,3402,3822,3958,3215,3552,5268,4387,3933,4950,4359,6021,5910,5075,3579,6358,4234,4566,5521,6359,3613,5049,6022,5911,3375,3702,3178,4911,5339,4521,6582,6583,4395,3087,3811,5377,6023,6360,6155,4027,5171,5649,4421,4249,2804,6584,2270,6585,4E3,4235,3045,6156,5137,5729,4140,4312,3886,6361,4330,6157,4215,6158,3500,3676,4929,4331,3713,4930,5912,4265,3776,3368,5587, -4470,4855,3038,4980,3631,6159,6160,4132,4680,6161,6362,3923,4379,5588,4255,6586,4121,6587,6363,4649,6364,3288,4773,4774,6162,6024,6365,3543,6588,4274,3107,3737,5050,5803,4797,4522,5589,5051,5730,3714,4887,5378,4001,4523,6163,5026,5522,4701,4175,2791,3760,6589,5473,4224,4133,3847,4814,4815,4775,3259,5416,6590,2738,6164,6025,5304,3733,5076,5650,4816,5590,6591,6165,6592,3934,5269,6593,3396,5340,6594,5804,3445,3602,4042,4488,5731,5732,3525,5591,4601,5196,6166,6026,5172,3642,4612,3202,4506,4798,6366,3818, -5108,4303,5138,5139,4776,3332,4304,2915,3415,4434,5077,5109,4856,2879,5305,4817,6595,5913,3104,3144,3903,4634,5341,3133,5110,5651,5805,6167,4057,5592,2945,4371,5593,6596,3474,4182,6367,6597,6168,4507,4279,6598,2822,6599,4777,4713,5594,3829,6169,3887,5417,6170,3653,5474,6368,4216,2971,5228,3790,4579,6369,5733,6600,6601,4951,4746,4555,6602,5418,5475,6027,3400,4665,5806,6171,4799,6028,5052,6172,3343,4800,4747,5006,6370,4556,4217,5476,4396,5229,5379,5477,3839,5914,5652,5807,4714,3068,4635,5808,6173,5342, -4192,5078,5419,5523,5734,6174,4557,6175,4602,6371,6176,6603,5809,6372,5735,4260,3869,5111,5230,6029,5112,6177,3126,4681,5524,5915,2706,3563,4748,3130,6178,4018,5525,6604,6605,5478,4012,4837,6606,4534,4193,5810,4857,3615,5479,6030,4082,3697,3539,4086,5270,3662,4508,4931,5916,4912,5811,5027,3888,6607,4397,3527,3302,3798,2775,2921,2637,3966,4122,4388,4028,4054,1633,4858,5079,3024,5007,3982,3412,5736,6608,3426,3236,5595,3030,6179,3427,3336,3279,3110,6373,3874,3039,5080,5917,5140,4489,3119,6374,5812,3405, -4494,6031,4666,4141,6180,4166,6032,5813,4981,6609,5081,4422,4982,4112,3915,5653,3296,3983,6375,4266,4410,5654,6610,6181,3436,5082,6611,5380,6033,3819,5596,4535,5231,5306,5113,6612,4952,5918,4275,3113,6613,6376,6182,6183,5814,3073,4731,4838,5008,3831,6614,4888,3090,3848,4280,5526,5232,3014,5655,5009,5737,5420,5527,6615,5815,5343,5173,5381,4818,6616,3151,4953,6617,5738,2796,3204,4360,2989,4281,5739,5174,5421,5197,3132,5141,3849,5142,5528,5083,3799,3904,4839,5480,2880,4495,3448,6377,6184,5271,5919,3771, -3193,6034,6035,5920,5010,6036,5597,6037,6378,6038,3106,5422,6618,5423,5424,4142,6619,4889,5084,4890,4313,5740,6620,3437,5175,5307,5816,4199,5198,5529,5817,5199,5656,4913,5028,5344,3850,6185,2955,5272,5011,5818,4567,4580,5029,5921,3616,5233,6621,6622,6186,4176,6039,6379,6380,3352,5200,5273,2908,5598,5234,3837,5308,6623,6624,5819,4496,4323,5309,5201,6625,6626,4983,3194,3838,4167,5530,5922,5274,6381,6382,3860,3861,5599,3333,4292,4509,6383,3553,5481,5820,5531,4778,6187,3955,3956,4324,4389,4218,3945,4325, -3397,2681,5923,4779,5085,4019,5482,4891,5382,5383,6040,4682,3425,5275,4094,6627,5310,3015,5483,5657,4398,5924,3168,4819,6628,5925,6629,5532,4932,4613,6041,6630,4636,6384,4780,4204,5658,4423,5821,3989,4683,5822,6385,4954,6631,5345,6188,5425,5012,5384,3894,6386,4490,4104,6632,5741,5053,6633,5823,5926,5659,5660,5927,6634,5235,5742,5824,4840,4933,4820,6387,4859,5928,4955,6388,4143,3584,5825,5346,5013,6635,5661,6389,5014,5484,5743,4337,5176,5662,6390,2836,6391,3268,6392,6636,6042,5236,6637,4158,6638,5744, -5663,4471,5347,3663,4123,5143,4293,3895,6639,6640,5311,5929,5826,3800,6189,6393,6190,5664,5348,3554,3594,4749,4603,6641,5385,4801,6043,5827,4183,6642,5312,5426,4761,6394,5665,6191,4715,2669,6643,6644,5533,3185,5427,5086,5930,5931,5386,6192,6044,6645,4781,4013,5745,4282,4435,5534,4390,4267,6045,5746,4984,6046,2743,6193,3501,4087,5485,5932,5428,4184,4095,5747,4061,5054,3058,3862,5933,5600,6646,5144,3618,6395,3131,5055,5313,6396,4650,4956,3855,6194,3896,5202,4985,4029,4225,6195,6647,5828,5486,5829,3589, -3002,6648,6397,4782,5276,6649,6196,6650,4105,3803,4043,5237,5830,6398,4096,3643,6399,3528,6651,4453,3315,4637,6652,3984,6197,5535,3182,3339,6653,3096,2660,6400,6654,3449,5934,4250,4236,6047,6401,5831,6655,5487,3753,4062,5832,6198,6199,6656,3766,6657,3403,4667,6048,6658,4338,2897,5833,3880,2797,3780,4326,6659,5748,5015,6660,5387,4351,5601,4411,6661,3654,4424,5935,4339,4072,5277,4568,5536,6402,6662,5238,6663,5349,5203,6200,5204,6201,5145,4536,5016,5056,4762,5834,4399,4957,6202,6403,5666,5749,6664,4340, -6665,5936,5177,5667,6666,6667,3459,4668,6404,6668,6669,4543,6203,6670,4276,6405,4480,5537,6671,4614,5205,5668,6672,3348,2193,4763,6406,6204,5937,5602,4177,5669,3419,6673,4020,6205,4443,4569,5388,3715,3639,6407,6049,4058,6206,6674,5938,4544,6050,4185,4294,4841,4651,4615,5488,6207,6408,6051,5178,3241,3509,5835,6208,4958,5836,4341,5489,5278,6209,2823,5538,5350,5206,5429,6675,4638,4875,4073,3516,4684,4914,4860,5939,5603,5389,6052,5057,3237,5490,3791,6676,6409,6677,4821,4915,4106,5351,5058,4243,5539,4244, -5604,4842,4916,5239,3028,3716,5837,5114,5605,5390,5940,5430,6210,4332,6678,5540,4732,3667,3840,6053,4305,3408,5670,5541,6410,2744,5240,5750,6679,3234,5606,6680,5607,5671,3608,4283,4159,4400,5352,4783,6681,6411,6682,4491,4802,6211,6412,5941,6413,6414,5542,5751,6683,4669,3734,5942,6684,6415,5943,5059,3328,4670,4144,4268,6685,6686,6687,6688,4372,3603,6689,5944,5491,4373,3440,6416,5543,4784,4822,5608,3792,4616,5838,5672,3514,5391,6417,4892,6690,4639,6691,6054,5673,5839,6055,6692,6056,5392,6212,4038,5544, -5674,4497,6057,6693,5840,4284,5675,4021,4545,5609,6418,4454,6419,6213,4113,4472,5314,3738,5087,5279,4074,5610,4959,4063,3179,4750,6058,6420,6214,3476,4498,4716,5431,4960,4685,6215,5241,6694,6421,6216,6695,5841,5945,6422,3748,5946,5179,3905,5752,5545,5947,4374,6217,4455,6423,4412,6218,4803,5353,6696,3832,5280,6219,4327,4702,6220,6221,6059,4652,5432,6424,3749,4751,6425,5753,4986,5393,4917,5948,5030,5754,4861,4733,6426,4703,6697,6222,4671,5949,4546,4961,5180,6223,5031,3316,5281,6698,4862,4295,4934,5207, -3644,6427,5842,5950,6428,6429,4570,5843,5282,6430,6224,5088,3239,6060,6699,5844,5755,6061,6431,2701,5546,6432,5115,5676,4039,3993,3327,4752,4425,5315,6433,3941,6434,5677,4617,4604,3074,4581,6225,5433,6435,6226,6062,4823,5756,5116,6227,3717,5678,4717,5845,6436,5679,5846,6063,5847,6064,3977,3354,6437,3863,5117,6228,5547,5394,4499,4524,6229,4605,6230,4306,4500,6700,5951,6065,3693,5952,5089,4366,4918,6701,6231,5548,6232,6702,6438,4704,5434,6703,6704,5953,4168,6705,5680,3420,6706,5242,4407,6066,3812,5757, -5090,5954,4672,4525,3481,5681,4618,5395,5354,5316,5955,6439,4962,6707,4526,6440,3465,4673,6067,6441,5682,6708,5435,5492,5758,5683,4619,4571,4674,4804,4893,4686,5493,4753,6233,6068,4269,6442,6234,5032,4705,5146,5243,5208,5848,6235,6443,4963,5033,4640,4226,6236,5849,3387,6444,6445,4436,4437,5850,4843,5494,4785,4894,6709,4361,6710,5091,5956,3331,6237,4987,5549,6069,6711,4342,3517,4473,5317,6070,6712,6071,4706,6446,5017,5355,6713,6714,4988,5436,6447,4734,5759,6715,4735,4547,4456,4754,6448,5851,6449,6450, -3547,5852,5318,6451,6452,5092,4205,6716,6238,4620,4219,5611,6239,6072,4481,5760,5957,5958,4059,6240,6453,4227,4537,6241,5761,4030,4186,5244,5209,3761,4457,4876,3337,5495,5181,6242,5959,5319,5612,5684,5853,3493,5854,6073,4169,5613,5147,4895,6074,5210,6717,5182,6718,3830,6243,2798,3841,6075,6244,5855,5614,3604,4606,5496,5685,5118,5356,6719,6454,5960,5357,5961,6720,4145,3935,4621,5119,5962,4261,6721,6455,4786,5963,4375,4582,6245,6246,6247,6076,5437,4877,5856,3376,4380,6248,4160,6722,5148,6456,5211,6457, -6723,4718,6458,6724,6249,5358,4044,3297,6459,6250,5857,5615,5497,5245,6460,5498,6725,6251,6252,5550,3793,5499,2959,5396,6461,6462,4572,5093,5500,5964,3806,4146,6463,4426,5762,5858,6077,6253,4755,3967,4220,5965,6254,4989,5501,6464,4352,6726,6078,4764,2290,5246,3906,5438,5283,3767,4964,2861,5763,5094,6255,6256,4622,5616,5859,5860,4707,6727,4285,4708,4824,5617,6257,5551,4787,5212,4965,4935,4687,6465,6728,6466,5686,6079,3494,4413,2995,5247,5966,5618,6729,5967,5764,5765,5687,5502,6730,6731,6080,5397,6467, -4990,6258,6732,4538,5060,5619,6733,4719,5688,5439,5018,5149,5284,5503,6734,6081,4607,6259,5120,3645,5861,4583,6260,4584,4675,5620,4098,5440,6261,4863,2379,3306,4585,5552,5689,4586,5285,6735,4864,6736,5286,6082,6737,4623,3010,4788,4381,4558,5621,4587,4896,3698,3161,5248,4353,4045,6262,3754,5183,4588,6738,6263,6739,6740,5622,3936,6741,6468,6742,6264,5095,6469,4991,5968,6743,4992,6744,6083,4897,6745,4256,5766,4307,3108,3968,4444,5287,3889,4343,6084,4510,6085,4559,6086,4898,5969,6746,5623,5061,4919,5249, -5250,5504,5441,6265,5320,4878,3242,5862,5251,3428,6087,6747,4237,5624,5442,6266,5553,4539,6748,2585,3533,5398,4262,6088,5150,4736,4438,6089,6267,5505,4966,6749,6268,6750,6269,5288,5554,3650,6090,6091,4624,6092,5690,6751,5863,4270,5691,4277,5555,5864,6752,5692,4720,4865,6470,5151,4688,4825,6753,3094,6754,6471,3235,4653,6755,5213,5399,6756,3201,4589,5865,4967,6472,5866,6473,5019,3016,6757,5321,4756,3957,4573,6093,4993,5767,4721,6474,6758,5625,6759,4458,6475,6270,6760,5556,4994,5214,5252,6271,3875,5768, -6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970,3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703,5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978,4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767];!0},{"./init":20}],17:[function(b,a,d){!function(a){a.GB2312Prober=function(){a.MultiByteCharSetProber.apply(this);this.getCharsetName=function(){return"GB2312"};this._mCodingSM=new a.CodingStateMachine(a.GB2312SMModel); -this._mDistributionAnalyzer=new a.GB2312DistributionAnalysis;this.reset()};a.GB2312Prober.prototype=new a.MultiByteCharSetProber}(b("./init"))},{"./init":20}],18:[function(b,a,d){!function(a){a.HebrewProber=function(){a.CharSetProber.apply(this);this.reset=function(){this._mFinalCharVisualScore=this._mFinalCharLogicalScore=0;this._mBeforePrev=this._mPrev=" "};this.setModelProbers=function(a,b){this._mLogicalProber=a;this._mVisualProber=b};this.isFinal=function(a){return-1!=["\u00ea","\u00ed","\u00ef", -"\u00f3","\u00f5"].indexOf(a)};this.isNonFinal=function(a){return-1!=["\u00eb","\u00ee","\u00f0","\u00f4"].indexOf(a)};this.feed=function(b){if(this.getState()==a.Constants.notMe)return a.Constants.notMe;b=this.filterHighBitOnly(b);for(var f=0,c;f=a)return"ISO-8859-8";var b=this._mLogicalProber.getConfidence()-this._mVisualProber.getConfidence();return.01b||0>a?"ISO-8859-8":"windows-1255"};this.getState=function(){return this._mLogicalProber.getState()==a.Constants.notMe&&this._mVisualProber.getState()==a.Constants.notMe? -a.Constants.notMe:a.Constants.detecting};this._mVisualProber=this._mLogicalProber=null;this.reset()};a.HebrewProber.prototype=new a.CharSetProber;Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var h=this.length>>>0,e=Number(b)||0,e=0>e?Math.ceil(e):Math.floor(e);for(0>e&&(e+=h);ea;this._mRelSample[a++]=0);this._mNeedToSkipCharNum=0;this._mLastCharOrder=-1;this._mDone=!1};this.feed=function(b,f){if(!this._mDone)for(var c=this._mNeedToSkipCharNum;cf)this._mNeedToSkipCharNum=c-f,this._mLastCharOrder=-1;else{if(-1!=d&&-1!=this._mLastCharOrder){this._mTotalRel+=1;if(1E3< -this._mTotalRel){this._mDone=!0;break}this._mRelSample[a.jp2CharContext[this._mLastCharOrder][d]]+=1}this._mLastCharOrder=d}}};this.gotEnoughData=function(){return 100=a.charCodeAt(0)||224<=a.charCodeAt(0)&& -252>=a.charCodeAt(0)?2:1;return 1=a.charCodeAt(0)?[a.charCodeAt(1)-159,b]:[-1,b]}};a.SJISContextAnalysis.prototype=new a.JapaneseContextAnalysis;a.EUCJPContextAnalysis=function(){this.getOrder=function(a){if(!a)return[-1,1];var b=142<=a.charCodeAt(0)||161<=a.charCodeAt(0)&&254>=a.charCodeAt(0)?2:143==a.charCodeAt(0)?3:1;return 1=a.charCodeAt(1)?[a.charCodeAt(1)-161,b]:[-1,b]}};a.EUCJPContextAnalysis.prototype= -new a.JapaneseContextAnalysis}(b("./init"))},{"./init":20}],23:[function(b,a,d){b=b("./init");b.Latin5_BulgarianCharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,77,90,99,100,72,109,107,101,79,185,81,102,76,94,82,110,186,108,91,74,119,84,96,111,187,115,253,253,253,253,253,253, -65,69,70,66,63,68,112,103,92,194,104,95,86,87,71,116,195,85,93,97,113,196,197,198,199,200,253,253,253,253,253,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,81,226,227,228,229,230,105,231,232,233,234,235,236,45,237,238,31,32,35,43,37,44,55,47,40,59,33,46,38,36,41,30,39,28,34,51,48,49,53,50,54,57,61,239,67,240,60,56,1,18,9,20,11,3,23,15,2,26,12,10,14,6,4,13,7,8,5,19,29,25,22,21,27,24,17,75,52,241,42,16,62,242,243,244, -58,245,98,246,247,248,249,250,251,91,252,253];b.win1251BulgarianCharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,77,90,99,100,72,109,107,101,79,185,81,102,76,94,82,110,186,108,91,74,119,84,96,111,187,115,253,253,253,253,253,253,65,69,70,66,63,68,112,103,92,194,104,95,86,87, -71,116,195,85,93,97,113,196,197,198,199,200,253,253,253,253,253,206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220,221,78,64,83,121,98,117,105,222,223,224,225,226,227,228,229,88,230,231,232,233,122,89,106,234,235,236,237,238,45,239,240,73,80,118,114,241,242,243,244,245,62,58,246,247,248,249,250,31,32,35,43,37,44,55,47,40,59,33,46,38,36,41,30,39,28,34,51,48,49,53,50,54,57,61,251,67,252,60,56,1,18,9,20,11,3,23,15,2,26,12,10,14,6,4,13,7,8,5,19,29,25,22,21,27,24,17,75,52,253,42,16];b.BulgarianLangModel= -[0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2,3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,3,3,3,3,3,3,3,3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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,2,0,0,2,0,1,0,0,1,0,0,1,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,2,0,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];b.Latin5BulgarianModel={charToOrderMap:b.Latin5_BulgarianCharToOrderMap,precedenceMatrix:b.BulgarianLangModel,mTypicalPositiveRatio:.969392,keepEnglishLetter:!1,charsetName:"ISO-8859-5"};b.Win1251BulgarianModel={charToOrderMap:b.win1251BulgarianCharToOrderMap,precedenceMatrix:b.BulgarianLangModel,mTypicalPositiveRatio:.969392,keepEnglishLetter:!1, -charsetName:"windows-1251"};!0},{"./init":20}],24:[function(b,a,d){b=b("./init");b.KOI8R_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66, -173,65,174,76,175,64,176,177,77,72,178,69,67,179,78,73,180,181,79,182,183,184,185,253,253,253,253,253,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,68,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,27,3,21,28,13,2,39,19,26,4,23,11,8,12,5,1,15,16,9,7,6,14,24,10,17,18,20,25,30,29,22,54,59,37,44,58,41,48,53,46,55,42,60,36,49,38,31,34,35,43,45, -32,40,52,56,33,61,62,51,57,47,63,50,70];b.win1251_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66,173,65,174,76,175,64,176,177,77,72,178, -69,67,179,78,73,180,181,79,182,183,184,185,253,253,253,253,253,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,68,247,248,249,250,251,252,253,37,44,33,46,41,48,56,51,42,60,36,49,38,31,34,35,45,32,40,52,53,55,58,50,57,63,70,62,61,47,59,43,3,21,10,19,13,2,24,20,4,23,11,8,12,5,1,15,9,7,6,14,39,26,28,22,25,29,54,18,17,30,27,16]; -b.latin5_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66,173,65,174,76,175,64,176,177,77,72,178,69,67,179,78,73,180,181,79,182,183,184,185, -253,253,253,253,253,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,37,44,33,46,41,48,56,51,42,60,36,49,38,31,34,35,45,32,40,52,53,55,58,50,57,63,70,62,61,47,59,43,3,21,10,19,13,2,24,20,4,23,11,8,12,5,1,15,9,7,6,14,39,26,28,22,25,29,54,18,17,30,27,16,239,68,240,241,242,243,244,245,246,247,248,249,250,251,252,255];b.macCyrillic_CharToOrderMap=[255,255,255, -255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66,173,65,174,76,175,64,176,177,77,72,178,69,67,179,78,73,180,181,79,182,183,184,185,253,253,253,253,253,37,44,33,46,41, -48,56,51,42,60,36,49,38,31,34,35,45,32,40,52,53,55,58,50,57,63,70,62,61,47,59,43,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,68,16,3,21,10,19,13,2,24,20,4,23,11,8,12,5,1,15,9,7,6,14,39,26,28,22,25,29,54,18,17,30,27,255];b.IBM855_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255, -254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66,173,65,174,76,175,64,176,177,77,72,178,69,67,179,78,73,180,181,79,182,183,184,185,253,253,253,253,253,191,192,193,194,68,195,196,197,198,199,200,201,202,203, -204,205,206,207,208,209,210,211,212,213,214,215,216,217,27,59,54,70,3,37,21,44,28,58,13,41,2,48,39,53,19,46,218,219,220,221,222,223,224,26,55,4,42,225,226,227,228,23,60,229,230,231,232,233,234,235,11,36,236,237,238,239,240,241,242,243,8,49,12,38,5,31,1,34,15,244,245,246,247,35,16,248,43,9,45,7,32,6,40,14,52,24,56,10,33,17,61,249,250,18,62,20,51,25,57,30,47,29,63,22,50,251,252,255];b.IBM866_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,142,143,144,145,146,147,148,149,150,151,152,74,153,75,154,155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253,253,71,172,66,173,65,174,76,175,64,176,177,77,72,178,69,67,179,78,73,180,181,79,182,183,184,185,253,253,253,253,253,37,44,33,46,41,48,56,51,42,60,36,49,38,31,34,35,45,32,40,52,53,55,58,50,57,63,70,62,61,47,59,43, -3,21,10,19,13,2,24,20,4,23,11,8,12,5,1,15,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220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0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,0];b.Koi8rModel={charToOrderMap:b.KOI8R_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1,charsetName:"KOI8-R"};b.Win1251CyrillicModel={charToOrderMap:b.win1251_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1,charsetName:"windows-1251"};b.Latin5CyrillicModel={charToOrderMap:b.latin5_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1, -charsetName:"ISO-8859-5"};b.MacCyrillicModel={charToOrderMap:b.macCyrillic_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1,charsetName:"MacCyrillic"};b.Ibm866Model={charToOrderMap:b.IBM866_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1,charsetName:"IBM866"};b.Ibm855Model={charToOrderMap:b.IBM855_CharToOrderMap,precedenceMatrix:b.RussianLangModel,mTypicalPositiveRatio:.976601,keepEnglishLetter:!1, -charsetName:"IBM855"};!0},{"./init":20}],25:[function(b,a,d){b=b("./init");b.Latin7_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,82,100,104,94,98,101,116,102,111,187,117,92,88,113,85,79,118,105,83,67,114,119,95,99,109,188,253,253,253,253,253,253,72,70,80,81,60,96,93,89, -68,120,97,77,86,69,55,78,115,65,66,58,76,106,103,87,107,112,253,253,253,253,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,233,90,253,253,253,253,253,253,253,253,253,253,74,253,253,253,253,253,253,247,248,61,36,46,71,73,253,54,253,108,123,110,31,51,43,41,34,91,40,52,47,44,53,38,49,59,39,35,48,250,37,33,45,56,50,84,57,120,121,17,18,22,15,124,1,29,20,21,3,32,13,25,5,11,16,10,6,30,4,9,8,14,7,2,12,28,23,42,24,64, -75,19,26,27,253];b.win1253_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,82,100,104,94,98,101,116,102,111,187,117,92,88,113,85,79,118,105,83,67,114,119,95,99,109,188,253,253,253,253,253,253,72,70,80,81,60,96,93,89,68,120,97,77,86,69,55,78,115,65,66,58,76,106,103,87,107,112, -253,253,253,253,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,233,61,253,253,253,253,253,253,253,253,253,253,74,253,253,253,253,253,253,247,253,253,36,46,71,73,253,54,253,108,123,110,31,51,43,41,34,91,40,52,47,44,53,38,49,59,39,35,48,250,37,33,45,56,50,84,57,120,121,17,18,22,15,124,1,29,20,21,3,32,13,25,5,11,16,10,6,30,4,9,8,14,7,2,12,28,23,42,24,64,75,19,26,27,253];b.GreekLangModel=[0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,2,3,3,3,3,3,3,3,3,1,3,3,3,0,2,2,3,3,0,3,0,3,2,0,3,3,3,0,3,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0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,0,1,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,2,0,0,0,0, -2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];b.Latin7GreekModel={charToOrderMap:b.Latin7_CharToOrderMap,precedenceMatrix:b.GreekLangModel,mTypicalPositiveRatio:.982851,keepEnglishLetter:!1,charsetName:"ISO-8859-7"};b.Win1253GreekModel={charToOrderMap:b.win1253_CharToOrderMap,precedenceMatrix:b.GreekLangModel,mTypicalPositiveRatio:.982851,keepEnglishLetter:!1,charsetName:"windows-1253"};!0},{"./init":20}],26:[function(b, -a,d){b=b("./init");b.win1255_CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,69,91,79,80,92,89,97,90,68,111,112,82,73,95,85,78,121,86,71,67,102,107,84,114,103,115,253,253,253,253,253,253,50,74,60,61,42,76,70,64,53,105,93,56,65,54,49,66,110,51,43,44,63,81,77,98,75,108,253,253, -253,253,253,124,202,203,204,205,40,58,206,207,208,209,210,211,212,213,214,215,83,52,47,46,72,32,94,216,113,217,109,218,219,220,221,34,116,222,118,100,223,224,117,119,104,125,225,226,87,99,227,106,122,123,228,55,229,230,101,231,232,120,233,48,39,57,234,30,59,41,88,33,37,36,31,29,35,235,62,28,236,126,237,238,38,45,239,240,241,242,243,127,244,245,246,247,248,249,250,9,8,20,16,3,2,24,14,22,1,25,15,4,11,6,23,12,19,13,26,18,27,21,17,7,10,5,251,252,128,96,253];b.HebrewLangModel=[0,3,3,3,3,3,3,3,3,3,3,2, -3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0,3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3,1,2,1,1,2,2,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1,0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0];b.Win1255HebrewModel={charToOrderMap:b.win1255_CharToOrderMap,precedenceMatrix:b.HebrewLangModel,mTypicalPositiveRatio:.984004,keepEnglishLetter:!1,charsetName:"windows-1255"};!0},{"./init":20}],27:[function(b,a,d){b=b("./init");b.Latin2_HungarianCharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,28,40,54,45,32,50,49,38,39,53,36,41,34,35,47,46,71,43,33,37,57,48,64,68,55,52,253,253,253,253,253,253,2,18,26,17,1,27,12,20,9,22,7,6,13,4,8,23,67,10,5,3,21,19,65,62,16,11,253,253,253,253,253,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197, -75,198,199,200,201,202,203,204,205,79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,51,81,222,78,223,224,225,226,44,227,228,229,61,230,231,232,233,234,58,235,66,59,236,237,238,60,69,63,239,240,241,82,14,74,242,70,80,243,72,244,15,83,77,84,30,76,85,245,246,247,25,73,42,24,248,249,250,31,56,29,251,252,253];b.win1250HungarianCharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,253,253,253, -253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,28,40,54,45,32,50,49,38,39,53,36,41,34,35,47,46,72,43,33,37,57,48,64,68,55,52,253,253,253,253,253,253,2,18,26,17,1,27,12,20,9,22,7,6,13,4,8,23,67,10,5,3,21,19,65,62,16,11,253,253,253,253,253,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,78,181,69,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,76,198,199,200,201,202,203,204,205,81,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,51,83,222,80,223,224,225,226,44,227,228,229,61,230,231,232,233,234,58,235,66,59,236,237,238,60,70,63,239,240,241,84,14,75,242,71,82,243,73,244,15,85,79,86,30,77,87,245,246,247,25,74,42,24,248,249,250,31,56,29,251,252,253];b.HungarianLangModel=[0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2,3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,1,2,3,3,3,3,2,3,3,1,1,3,3,0,1,1,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,2,1,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0,1,0,0,2,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,2,0,0,1,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1,1,2,0,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,2,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,2,0, -0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0];b.Latin2HungarianModel={charToOrderMap:b.Latin2_HungarianCharToOrderMap, -precedenceMatrix:b.HungarianLangModel,mTypicalPositiveRatio:.947368,keepEnglishLetter:!0,charsetName:"ISO-8859-2"};b.Win1250HungarianModel={charToOrderMap:b.win1250HungarianCharToOrderMap,precedenceMatrix:b.HungarianLangModel,mTypicalPositiveRatio:.947368,keepEnglishLetter:!0,charsetName:"windows-1250"};!0},{"./init":20}],28:[function(b,a,d){b=b("./init");b.TIS620CharToOrderMap=[255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,182,106,107,100,183,184,185,101,94,186,187,108,109,110,111,188,189,190,89,95,112,113,191,192,193,194,253,253,253,253,253,253,64,72,73,114,74,115,116,102,81,201,117,90,103,78,82,96,202,91,79,84,104,105,97,98,92,203,253,253,253,253,253,209,210,211,212,213,88,214,215,216,217,218,219,220,118,221,222,223,224,99,85,83,225,226,227,228,229,230,231,232,233,234,235,236, -5,30,237,24,238,75,8,26,52,34,51,119,47,58,57,49,53,55,43,20,19,44,14,48,3,17,25,39,62,31,54,45,9,16,2,61,15,239,12,42,46,18,21,76,4,66,63,22,10,1,36,23,13,40,27,32,35,86,240,241,242,243,244,11,28,41,29,33,245,50,37,6,7,67,77,38,93,246,247,68,56,59,65,69,60,70,80,71,87,248,249,250,251,252,253];b.ThaiLangModel=[0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3,0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2,3,0,3,3,2,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,3,2,3,0,2,2,2, -3,0,2,3,0,0,0,0,1,0,1,2,3,1,1,3,2,2,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,2,3,2,3,3,2,2,2,3,1,2,3,0,3,3,2,2,1,2,3,3,1,2,0,1,3,0,1,0,0,1,0,0,0,0,0,0,0,1,1,3,3,2,2,3,3,3,3,1,2,3,3,3,3,3,2,2,2,2,3,3,2,2,3,3,2,2,3,2,3,2,2,3,3,1,2,3,1,2,2,3,3,1,0,2,1,0,0,3,1,2,1,0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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,5,5,4,4,4,4,4,4,4,4,5,5,4,4,4,4,4,1,4,4,4,4,4,5,5,5,6,6,6,6,6,6,7,7,6,6,6,6,6,6,6,6,7,7,6,6,6,6,6,1,6,6,6,6,6,7,7,7];a.Latin1ClassModel=[0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,0,3,3,3,1,1,3,3,0,3,3,3,1,2,1,2,0,3,3,3,3,3,3,3,0,3,1,3,1,1,1,3,0,3,1,3,1,1,3,3];a.Latin1Prober=function(){a.CharSetProber.apply(this);this.reset=function(){this._mLastCharClass=a.OTH;this._mFreqCounter=[];for(var b=0;4>b;this._mFreqCounter[b++]= -0);a.Latin1Prober.prototype.reset.apply(this)};this.getCharsetName=function(){return"windows-1252"};this.feed=function(b){b=this.filterWithEnglishLetters(b);for(var f=0;ff||(b=this._mFreqCounter[3]/f-20*this._mFreqCounter[1]/f);0>b&&(b=0);return.95*b};this.reset()};a.Latin1Prober.prototype=new a.CharSetProber}(b("./init"))},{"./init":20}],30:[function(b,a,d){!function(a){a.MultiByteCharSetProber=function(){a.CharSetProber.apply(this);this.reset=function(){a.MultiByteCharSetProber.prototype.reset.apply(this);this._mCodingSM&&this._mCodingSM.reset();this._mDistributionAnalyzer&&this._mDistributionAnalyzer.reset();this._mLastChar="\x00\x00"}; -this.getCharsetName=function(){};this.feed=function(b){for(var f=b.length,c=0;ca.Constants.SHORTCUT_THRESHOLD&&(this._mState=a.Constants.foundIt);return this.getState()};this.getConfidence=function(){return this._mDistributionAnalyzer.getConfidence()}};a.MultiByteCharSetProber.prototype=new a.CharSetProber}(b("./init"))},{"./init":20}],31:[function(b,a,d){!function(a){a.MBCSGroupProber=function(){a.CharSetGroupProber.apply(this);this._mProbers= -[new a.UTF8Prober,new a.SJISProber,new a.EUCJPProber,new a.GB2312Prober,new a.EUCKRProber,new a.Big5Prober,new a.EUCTWProber];this.reset()};a.MBCSGroupProber.prototype=new a.CharSetGroupProber}(b("./init"))},{"./init":20}],32:[function(b,a,d){b=b("./init");a=b.Constants;b.BIG5_cls=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0];b.BIG5_st=[a.error,a.start,a.start,3,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.start,a.start,a.start,a.start,a.start,a.start,a.start];b.Big5CharLenTable= -[0,1,1,2,0];b.Big5SMModel={classTable:b.BIG5_cls,classFactor:5,stateTable:b.BIG5_st,charLenTable:b.Big5CharLenTable,name:"Big5"};b.EUCJP_cls=[4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,4,4,4,4,4,4,4,4,4,4,4,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5];b.EUCJP_st=[3,4,3,5,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.start,a.error,a.start,a.error,a.error,a.error,a.error,a.error,a.start,a.error,a.error,a.error,3,a.error,3,a.error,a.error,a.error,a.start,a.start,a.start,a.start];b.EUCJPCharLenTable=[2,2,2,3,1,0];b.EUCJPSMModel={classTable:b.EUCJP_cls, -classFactor:6,stateTable:b.EUCJP_st,charLenTable:b.EUCJPCharLenTable,name:"EUC-JP"};b.EUCKR_cls=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0];b.EUCKR_st=[a.error,a.start,3,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.start,a.start];b.EUCKRCharLenTable=[0,1,2,0];b.EUCKRSMModel={classTable:b.EUCKR_cls,classFactor:4,stateTable:b.EUCKR_st,charLenTable:b.EUCKRCharLenTable,name:"EUC-KR"};b.EUCTW_cls=[2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,4,4,4,4,4,5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0];b.EUCTW_st=[a.error,a.error,a.start,3,3,3,4,a.error,a.error,a.error,a.error,a.error, -a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.start,a.error,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,5,a.error,a.error,a.error,a.start,a.error,a.start,a.start,a.start,a.error,a.start,a.start,a.start,a.start,a.start,a.start];b.EUCTWCharLenTable=[0,0,1,2,2,2,3];b.EUCTWSMModel={classTable:b.EUCTW_cls,classFactor:7,stateTable:b.EUCTW_st,charLenTable:b.EUCTWCharLenTable,name:"x-euc-tw"};b.GB2312_cls=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, -1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0];b.GB2312_st=[a.error,a.start,a.start, -a.start,a.start,a.start,3,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.start,4,a.error,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,5,a.error,a.error,a.error,a.itsMe,a.error,a.error,a.error,a.start,a.start,a.start,a.start,a.start,a.start];b.GB2312CharLenTable=[0,1,1,1,1,1,2];b.GB2312SMModel={classTable:b.GB2312_cls,classFactor:7,stateTable:b.GB2312_st,charLenTable:b.GB2312CharLenTable,name:"GB2312"}; -b.SJIS_cls=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,3,3,3,3,3, -3,3,3,3,3,3,3,3,0,0,0];b.SJIS_st=[a.error,a.start,a.start,3,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,a.start,a.start,a.start,a.start];b.SJISCharLenTable=[0,1,1,2,0,0];b.SJISSMModel={classTable:b.SJIS_cls,classFactor:6,stateTable:b.SJIS_st,charLenTable:b.SJISCharLenTable,name:"Shift_JIS"};b.UCS2BE_cls=[0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5];b.UCS2BE_st=[5,7,7,a.error,4,3,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe, -a.itsMe,a.itsMe,a.itsMe,6,6,6,6,a.error,a.error,6,6,6,6,6,a.itsMe,6,6,6,6,6,6,5,7,7,a.error,5,8,6,6,a.error,6,6,6,6,6,6,6,a.error,a.error,a.start,a.start];b.UCS2BECharLenTable=[2,2,2,0,2,2];b.UCS2BESMModel={classTable:b.UCS2BE_cls,classFactor:6,stateTable:b.UCS2BE_st,charLenTable:b.UCS2BECharLenTable,name:"UTF-16BE"};b.UCS2LE_cls=[0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5];b.UCS2LE_st=[6,6,7,6,4,3,a.error,a.error,a.error,a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,5,5,5,a.error,a.itsMe,a.error,5,5,5, -a.error,5,a.error,6,6,7,6,8,8,5,5,5,a.error,5,5,5,a.error,a.error,a.error,5,5,5,5,5,a.error,5,a.error,a.start,a.start];b.UCS2LECharLenTable=[2,2,2,2,2,2];b.UCS2LESMModel={classTable:b.UCS2LE_cls,classFactor:6,stateTable:b.UCS2LE_st,charLenTable:b.UCS2LECharLenTable,name:"UTF-16LE"};b.UTF8_cls=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,8,8,8,8,8,8,8,8,8,8,8,8,9,8,8,10,11,11,11,11,11,11,11,12,13,13,13,14,15,0,0];b.UTF8_st=[a.error,a.start,a.error,a.error,a.error,a.error,12,10,9,11,8,7,6,5,4,3,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error, -a.error,a.error,a.error,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.itsMe,a.error,a.error,5,5,5,5,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,5,5,5,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,7,7,7,7,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error, -7,7,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,9,9,9,9,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,9,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,12,12,12,12,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,12,a.error,a.error,a.error,a.error,a.error, -a.error,a.error,a.error,a.error,a.error,a.error,a.error,12,12,12,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.start,a.start,a.start,a.start,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error,a.error];b.UTF8CharLenTable=[0,1,0,0,0,0,2,3,3,3,4,4,5,5,6,6];b.UTF8SMModel={classTable:b.UTF8_cls,classFactor:16,stateTable:b.UTF8_st,charLenTable:b.UTF8CharLenTable,name:"UTF-8"};!0},{"./init":20}],33:[function(b,a,d){!function(a){a.SingleByteCharSetProber= -function(b,f,c){a.CharSetProber.apply(this);var e=this;this.reset=function(){a.SingleByteCharSetProber.prototype.reset.apply(this);this._mLastOrder=255;this._mSeqCounters=[];for(var b=0;4>b;this._mSeqCounters[b++]=0);this._mFreqChar=this._mTotalChar=this._mTotalSeqs=0};this.getCharsetName=function(){return this._mNameProber?this._mNameProber.getCharsetName():this._mModel.charsetName};this.feed=function(b){this._mModel.keepEnglishLetter||(b=this.filterWithoutEnglishLetters(b));var c=b.length;if(!c)return this.getState(); -for(var f=0,d;fd&&this._mTotalChar++,64>d&&(this._mFreqChar++,64>this._mLastOrder&&(this._mTotalSeqs++,this._mReversed?this._mSeqCounters[this._mModel.precedenceMatrix[64*d+this._mLastOrder]]++:this._mSeqCounters[this._mModel.precedenceMatrix[64*this._mLastOrder+d]]++)),this._mLastOrder=d;this.getState()==a.Constants.detecting&&1024b&&(a.Constants._debug&&a.log(this._mModel.charsetName+" confidence = "+b+", below negative shortcut threshhold 0.05\n"),this._mState=a.Constants.notMe));return this.getState()};this.getConfidence=function(){var a=.01;0a.Constants.SHORTCUT_THRESHOLD&&(this._mState=a.Constants.foundIt);return this.getState()};this.getConfidence=function(){var a=this._mContextAnalyzer.getConfidence(),b=this._mDistributionAnalyzer.getConfidence();return Math.max(a,b)};this._mCodingSM=new a.CodingStateMachine(a.SJISSMModel);this._mDistributionAnalyzer=new a.SJISDistributionAnalysis;this._mContextAnalyzer=new a.SJISContextAnalysis;this.reset()};a.SJISProber.prototype= -new a.MultiByteCharSetProber}(b("./init"))},{"./init":20}],36:[function(b,a,d){!function(a){a.UniversalDetector=function(){var b=a.Constants.MINIMUM_THRESHOLD;this.reset=function(){this.result={encoding:null,confidence:0};this.done=!1;this._mStart=!0;this._mGotData=!1;this._mInputState=0;this._mBOM=this._mLastChar="";this._mEscCharsetProber&&this._mEscCharsetProber.reset();for(var a=0,b;b=this._mCharsetProbers[a];a++)b.reset()};this.feed=function(b){if(!this.done&&b.length)if(this._mGotData||(this._mBOM+= -b,"\u00ef\u00bb\u00bf"==this._mBOM.slice(0,3)?this.result={encoding:"UTF-8",confidence:1}:"\u00ff\u00fe\x00\x00"==this._mBOM.slice(0,4)?this.result={encoding:"UTF-32LE",confidence:1}:"\x00\x00\u00fe\u00ff"==this._mBOM.slice(0,4)?this.result={encoding:"UTF-32BE",confidence:1}:"\u00fe\u00ff\x00\x00"==this._mBOM.slice(0,4)?this.result={encoding:"X-ISO-10646-UCS-4-3412",confidence:1}:"\x00\x00\u00ff\u00fe"==this._mBOM.slice(0,4)?this.result={encoding:"X-ISO-10646-UCS-4-2143",confidence:1}:"\u00ff\u00fe"== -this._mBOM.slice(0,2)?this.result={encoding:"UTF-16LE",confidence:1}:"\u00fe\u00ff"==this._mBOM.slice(0,2)&&(this.result={encoding:"UTF-16BE",confidence:1}),3c&&(c=d,e=g),a.Constants._debug&&a.log(g.getCharsetName()+" confidence "+g.getConfidence()));if(e&&c>b)return this.result= -{encoding:e.getCharsetName(),confidence:e.getConfidence()}}if(a.Constants._debug)for(a.log("no probers hit minimum threshhold\n"),k=0;g=this._mCharsetProbers[k];k++)g&&a.log(g.getCharsetName()+" confidence = "+g.getConfidence()+"\n")}};this._highBitDetector=/[\x80-\xFF]/;this._escDetector=/(\x1B|~\{)/;this._mEscCharsetProber=null;this._mCharsetProbers=[];this.reset()}}(b("./init"))},{"./init":20}],37:[function(b,a,d){!function(a){a.UTF8Prober=function(){a.CharSetProber.apply(this);this.reset=function(){a.UTF8Prober.prototype.reset.apply(this); -this._mCodingSM.reset();this._mNumOfMBChar=0};this.getCharsetName=function(){return"UTF-8"};this.feed=function(b){for(var d=0,c;da.Constants.SHORTCUT_THRESHOLD&&(this._mState= -a.Constants.foundIt);return this.getState()};this.getConfidence=function(){var a=.99;if(6>this._mNumOfMBChar){for(var b=0;b=0.1.90" - }, - "homepage": "https://github.com/aadsm/jschardet#readme", - "keywords": [ - "encoding", - "charset" - ], - "license": "LGPL-2.1+", - "main": "src/init", - "name": "jschardet", - "repository": { - "type": "git", - "url": "git+https://github.com/aadsm/jschardet.git" - }, - "scripts": { - "dist": "npm run dist-dev && java -jar node_modules/google-closure-compiler/compiler.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS --js dist/jschardet.js > dist/jschardet.min.js", - "dist-dev": "mkdir -p dist && browserify index.js -s jschardet --detect-globals false -o dist/jschardet.js" - }, - "version": "1.6.0" -} diff --git a/tools/eslint/node_modules/jschardet/src/big5freq.js b/tools/eslint/node_modules/jschardet/src/big5freq.js deleted file mode 100755 index c20075f8727e77..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/big5freq.js +++ /dev/null @@ -1,929 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// Big5 frequency table -// by Taiwan's Mandarin Promotion Council -// -// -// 128 --> 0.42261 -// 256 --> 0.57851 -// 512 --> 0.74851 -// 1024 --> 0.89384 -// 2048 --> 0.97583 -// -// Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 -// Random Distribution Ration = 512/(5401-512)=0.105 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR - -jschardet.BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75; - -//Char to FreqOrder table -jschardet.BIG5_TABLE_SIZE = 5376; - -jschardet.Big5CharToFreqOrder = [ - 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, // 16 -3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, // 32 -1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, // 48 - 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, // 64 -3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, // 80 -4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, // 96 -5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, // 112 - 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, // 128 - 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, // 144 - 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, // 160 -2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, // 176 -1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, // 192 -3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, // 208 - 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, // 224 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, // 240 -3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, // 256 -2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, // 272 - 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, // 288 -3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, // 304 -1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, // 320 -5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, // 336 - 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, // 352 -5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, // 368 -1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, // 384 - 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, // 400 - 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, // 416 -3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, // 432 -3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, // 448 - 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, // 464 -2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, // 480 -2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, // 496 - 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, // 512 - 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, // 528 -3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, // 544 -1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, // 560 -1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, // 576 -1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, // 592 -2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, // 608 - 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, // 624 -4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, // 640 -1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, // 656 -5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, // 672 -2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, // 688 - 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, // 704 - 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, // 720 - 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, // 736 - 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, // 752 -5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, // 768 - 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, // 784 -1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, // 800 - 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, // 816 - 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, // 832 -5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, // 848 -1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, // 864 - 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, // 880 -3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, // 896 -4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, // 912 -3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, // 928 - 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, // 944 - 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, // 960 -1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, // 976 -4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, // 992 -3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, // 1008 -3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, // 1024 -2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, // 1040 -5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, // 1056 -3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, // 1072 -5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, // 1088 -1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, // 1104 -2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, // 1120 -1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, // 1136 - 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, // 1152 -1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, // 1168 -4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, // 1184 -3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, // 1200 - 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, // 1216 - 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, // 1232 - 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, // 1248 -2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, // 1264 -5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, // 1280 -1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, // 1296 -2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, // 1312 -1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, // 1328 -1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, // 1344 -5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, // 1360 -5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, // 1376 -5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, // 1392 -3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, // 1408 -4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, // 1424 -4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, // 1440 -2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, // 1456 -5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, // 1472 -3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, // 1488 - 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, // 1504 -5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, // 1520 -5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, // 1536 -1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, // 1552 -2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, // 1568 -3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, // 1584 -4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, // 1600 -5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, // 1616 -3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, // 1632 -4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, // 1648 -1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, // 1664 -1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, // 1680 -4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, // 1696 -1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, // 1712 - 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, // 1728 -1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, // 1744 -1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, // 1760 -3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, // 1776 - 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, // 1792 -5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, // 1808 -2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, // 1824 -1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, // 1840 -1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, // 1856 -5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, // 1872 - 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, // 1888 -4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, // 1904 - 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, // 1920 -2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, // 1936 - 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, // 1952 -1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, // 1968 -1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, // 1984 - 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, // 2000 -4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, // 2016 -4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, // 2032 -1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, // 2048 -3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, // 2064 -5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, // 2080 -5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, // 2096 -1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, // 2112 -2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, // 2128 -1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, // 2144 -3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, // 2160 -2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, // 2176 -3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, // 2192 -2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, // 2208 -4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, // 2224 -4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, // 2240 -3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, // 2256 - 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, // 2272 -3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, // 2288 - 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, // 2304 -3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, // 2320 -4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, // 2336 -3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, // 2352 -1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, // 2368 -5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, // 2384 - 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, // 2400 -5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, // 2416 -1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, // 2432 - 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, // 2448 -4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, // 2464 -4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, // 2480 - 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, // 2496 -2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, // 2512 -2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, // 2528 -3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, // 2544 -1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, // 2560 -4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, // 2576 -2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, // 2592 -1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, // 2608 -1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, // 2624 -2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, // 2640 -3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, // 2656 -1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, // 2672 -5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, // 2688 -1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, // 2704 -4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, // 2720 -1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, // 2736 - 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, // 2752 -1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, // 2768 -4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, // 2784 -4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, // 2800 -2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, // 2816 -1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, // 2832 -4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, // 2848 - 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, // 2864 -5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, // 2880 -2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, // 2896 -3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, // 2912 -4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, // 2928 - 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, // 2944 -5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, // 2960 -5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, // 2976 -1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, // 2992 -4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, // 3008 -4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, // 3024 -2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, // 3040 -3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, // 3056 -3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, // 3072 -2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, // 3088 -1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, // 3104 -4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, // 3120 -3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, // 3136 -3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, // 3152 -2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, // 3168 -4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, // 3184 -5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, // 3200 -3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, // 3216 -2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, // 3232 -3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, // 3248 -1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, // 3264 -2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, // 3280 -3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, // 3296 -4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, // 3312 -2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, // 3328 -2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, // 3344 -5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, // 3360 -1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, // 3376 -2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, // 3392 -1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, // 3408 -3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, // 3424 -4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, // 3440 -2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, // 3456 -3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, // 3472 -3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, // 3488 -2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, // 3504 -4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, // 3520 -2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, // 3536 -3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, // 3552 -4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, // 3568 -5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, // 3584 -3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, // 3600 - 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, // 3616 -1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, // 3632 -4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, // 3648 -1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, // 3664 -4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, // 3680 -5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, // 3696 - 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, // 3712 -5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, // 3728 -5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, // 3744 -2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, // 3760 -3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, // 3776 -2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, // 3792 -2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, // 3808 - 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, // 3824 -1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, // 3840 -4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, // 3856 -3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, // 3872 -3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, // 3888 - 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, // 3904 -2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, // 3920 - 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, // 3936 -2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, // 3952 -4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, // 3968 -1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, // 3984 -4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, // 4000 -1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, // 4016 -3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, // 4032 - 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, // 4048 -3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, // 4064 -5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, // 4080 -5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, // 4096 -3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, // 4112 -3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, // 4128 -1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, // 4144 -2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, // 4160 -5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, // 4176 -1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, // 4192 -1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, // 4208 -3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, // 4224 - 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, // 4240 -1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, // 4256 -4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, // 4272 -5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, // 4288 -2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, // 4304 -3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, // 4320 - 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, // 4336 -1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, // 4352 -2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, // 4368 -2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, // 4384 -5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, // 4400 -5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, // 4416 -5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, // 4432 -2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, // 4448 -2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, // 4464 -1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, // 4480 -4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, // 4496 -3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, // 4512 -3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, // 4528 -4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, // 4544 -4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, // 4560 -2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, // 4576 -2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, // 4592 -5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, // 4608 -4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, // 4624 -5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, // 4640 -4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, // 4656 - 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, // 4672 - 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, // 4688 -1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, // 4704 -3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, // 4720 -4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, // 4736 -1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, // 4752 -5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, // 4768 -2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, // 4784 -2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, // 4800 -3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, // 4816 -5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, // 4832 -1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, // 4848 -3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, // 4864 -5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, // 4880 -1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, // 4896 -5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, // 4912 -2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, // 4928 -3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, // 4944 -2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, // 4960 -3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, // 4976 -3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, // 4992 -3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, // 5008 -4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, // 5024 - 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, // 5040 -2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, // 5056 -4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, // 5072 -3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, // 5088 -5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, // 5104 -1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, // 5120 -5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, // 5136 - 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, // 5152 -1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, // 5168 - 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, // 5184 -4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, // 5200 -1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, // 5216 -4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, // 5232 -1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, // 5248 - 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, // 5264 -3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, // 5280 -4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, // 5296 -5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, // 5312 - 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, // 5328 -3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, // 5344 - 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, // 5360 -2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, // 5376 //last 512 -//Everything below is of no interest for detection purpose -2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, // 5392 -2500,3034,3800,5803,5804,2195,4814,5805,2163,5806,5807,5808,5809,5810,5811,5812, // 5408 -5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828, // 5424 -5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844, // 5440 -5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860, // 5456 -5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876, // 5472 -5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892, // 5488 -5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908, // 5504 -5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924, // 5520 -5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940, // 5536 -5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956, // 5552 -5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972, // 5568 -5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988, // 5584 -5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004, // 5600 -6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020, // 5616 -6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036, // 5632 -6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052, // 5648 -6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068, // 5664 -6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084, // 5680 -6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100, // 5696 -6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116, // 5712 -6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132, // 5728 -6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148, // 5744 -6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164, // 5760 -6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180, // 5776 -6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196, // 5792 -6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212, // 5808 -6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,3670,6224,6225,6226,6227, // 5824 -6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243, // 5840 -6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259, // 5856 -6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275, // 5872 -6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,4815,6286,6287,6288,6289,6290, // 5888 -6291,6292,4816,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305, // 5904 -6306,6307,6308,6309,6310,6311,4817,4818,6312,6313,6314,6315,6316,6317,6318,4819, // 5920 -6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334, // 5936 -6335,6336,6337,4820,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349, // 5952 -6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365, // 5968 -6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381, // 5984 -6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397, // 6000 -6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,3441,6411,6412, // 6016 -6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,4440,6426,6427, // 6032 -6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443, // 6048 -6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,4821,6455,6456,6457,6458, // 6064 -6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474, // 6080 -6475,6476,6477,3947,3948,6478,6479,6480,6481,3272,4441,6482,6483,6484,6485,4442, // 6096 -6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,4822,6497,6498,6499,6500, // 6112 -6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516, // 6128 -6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532, // 6144 -6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548, // 6160 -6549,6550,6551,6552,6553,6554,6555,6556,2784,6557,4823,6558,6559,6560,6561,6562, // 6176 -6563,6564,6565,6566,6567,6568,6569,3949,6570,6571,6572,4824,6573,6574,6575,6576, // 6192 -6577,6578,6579,6580,6581,6582,6583,4825,6584,6585,6586,3950,2785,6587,6588,6589, // 6208 -6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605, // 6224 -6606,6607,6608,6609,6610,6611,6612,4826,6613,6614,6615,4827,6616,6617,6618,6619, // 6240 -6620,6621,6622,6623,6624,6625,4164,6626,6627,6628,6629,6630,6631,6632,6633,6634, // 6256 -3547,6635,4828,6636,6637,6638,6639,6640,6641,6642,3951,2984,6643,6644,6645,6646, // 6272 -6647,6648,6649,4165,6650,4829,6651,6652,4830,6653,6654,6655,6656,6657,6658,6659, // 6288 -6660,6661,6662,4831,6663,6664,6665,6666,6667,6668,6669,6670,6671,4166,6672,4832, // 6304 -3952,6673,6674,6675,6676,4833,6677,6678,6679,4167,6680,6681,6682,3198,6683,6684, // 6320 -6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,4834,6698,6699, // 6336 -6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715, // 6352 -6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731, // 6368 -6732,6733,6734,4443,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,4444, // 6384 -6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761, // 6400 -6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777, // 6416 -6778,6779,6780,6781,4168,6782,6783,3442,6784,6785,6786,6787,6788,6789,6790,6791, // 6432 -4169,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806, // 6448 -6807,6808,6809,6810,6811,4835,6812,6813,6814,4445,6815,6816,4446,6817,6818,6819, // 6464 -6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835, // 6480 -3548,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,4836,6847,6848,6849, // 6496 -6850,6851,6852,6853,6854,3953,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864, // 6512 -6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,3199,6878,6879, // 6528 -6880,6881,6882,4447,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894, // 6544 -6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,4170,6905,6906,6907,6908,6909, // 6560 -6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925, // 6576 -6926,6927,4837,6928,6929,6930,6931,6932,6933,6934,6935,6936,3346,6937,6938,4838, // 6592 -6939,6940,6941,4448,6942,6943,6944,6945,6946,4449,6947,6948,6949,6950,6951,6952, // 6608 -6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968, // 6624 -6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984, // 6640 -6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,3671,6995,6996,6997,6998,4839, // 6656 -6999,7000,7001,7002,3549,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013, // 6672 -7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029, // 6688 -7030,4840,7031,7032,7033,7034,7035,7036,7037,7038,4841,7039,7040,7041,7042,7043, // 6704 -7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059, // 6720 -7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,2985,7071,7072,7073,7074, // 6736 -7075,7076,7077,7078,7079,7080,4842,7081,7082,7083,7084,7085,7086,7087,7088,7089, // 6752 -7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105, // 6768 -7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,4450,7119,7120, // 6784 -7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136, // 6800 -7137,7138,7139,7140,7141,7142,7143,4843,7144,7145,7146,7147,7148,7149,7150,7151, // 6816 -7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167, // 6832 -7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183, // 6848 -7184,7185,7186,7187,7188,4171,4172,7189,7190,7191,7192,7193,7194,7195,7196,7197, // 6864 -7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213, // 6880 -7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229, // 6896 -7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245, // 6912 -7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261, // 6928 -7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277, // 6944 -7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293, // 6960 -7294,7295,7296,4844,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308, // 6976 -7309,7310,7311,7312,7313,7314,7315,7316,4451,7317,7318,7319,7320,7321,7322,7323, // 6992 -7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339, // 7008 -7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,4173,7354, // 7024 -7355,4845,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369, // 7040 -7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385, // 7056 -7386,7387,7388,4846,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400, // 7072 -7401,7402,7403,7404,7405,3672,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415, // 7088 -7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431, // 7104 -7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447, // 7120 -7448,7449,7450,7451,7452,7453,4452,7454,3200,7455,7456,7457,7458,7459,7460,7461, // 7136 -7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,4847,7475,7476, // 7152 -7477,3133,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491, // 7168 -7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,3347,7503,7504,7505,7506, // 7184 -7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,4848, // 7200 -7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537, // 7216 -7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,3801,4849,7550,7551, // 7232 -7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, // 7248 -7568,7569,3035,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582, // 7264 -7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598, // 7280 -7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614, // 7296 -7615,7616,4850,7617,7618,3802,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628, // 7312 -7629,7630,7631,7632,4851,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643, // 7328 -7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659, // 7344 -7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,4453,7671,7672,7673,7674, // 7360 -7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690, // 7376 -7691,7692,7693,7694,7695,7696,7697,3443,7698,7699,7700,7701,7702,4454,7703,7704, // 7392 -7705,7706,7707,7708,7709,7710,7711,7712,7713,2472,7714,7715,7716,7717,7718,7719, // 7408 -7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,3954,7732,7733,7734, // 7424 -7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750, // 7440 -3134,7751,7752,4852,7753,7754,7755,4853,7756,7757,7758,7759,7760,4174,7761,7762, // 7456 -7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778, // 7472 -7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794, // 7488 -7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,4854,7806,7807,7808,7809, // 7504 -7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825, // 7520 -4855,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7536 -7841,7842,7843,7844,7845,7846,7847,3955,7848,7849,7850,7851,7852,7853,7854,7855, // 7552 -7856,7857,7858,7859,7860,3444,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870, // 7568 -7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886, // 7584 -7887,7888,7889,7890,7891,4175,7892,7893,7894,7895,7896,4856,4857,7897,7898,7899, // 7600 -7900,2598,7901,7902,7903,7904,7905,7906,7907,7908,4455,7909,7910,7911,7912,7913, // 7616 -7914,3201,7915,7916,7917,7918,7919,7920,7921,4858,7922,7923,7924,7925,7926,7927, // 7632 -7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943, // 7648 -7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959, // 7664 -7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975, // 7680 -7976,7977,7978,7979,7980,7981,4859,7982,7983,7984,7985,7986,7987,7988,7989,7990, // 7696 -7991,7992,7993,7994,7995,7996,4860,7997,7998,7999,8000,8001,8002,8003,8004,8005, // 7712 -8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,4176,8017,8018,8019,8020, // 7728 -8021,8022,8023,4861,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035, // 7744 -8036,4862,4456,8037,8038,8039,8040,4863,8041,8042,8043,8044,8045,8046,8047,8048, // 7760 -8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064, // 7776 -8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080, // 7792 -8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096, // 7808 -8097,8098,8099,4864,4177,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110, // 7824 -8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,4178,8121,8122,8123,8124,8125, // 7840 -8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141, // 7856 -8142,8143,8144,8145,4865,4866,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155, // 7872 -8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,4179,8166,8167,8168,8169,8170, // 7888 -8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,4457,8182,8183,8184,8185, // 7904 -8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201, // 7920 -8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217, // 7936 -8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233, // 7952 -8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249, // 7968 -8250,8251,8252,8253,8254,8255,8256,3445,8257,8258,8259,8260,8261,8262,4458,8263, // 7984 -8264,8265,8266,8267,8268,8269,8270,8271,8272,4459,8273,8274,8275,8276,3550,8277, // 8000 -8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,4460,8290,8291,8292, // 8016 -8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,4867, // 8032 -8308,8309,8310,8311,8312,3551,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322, // 8048 -8323,8324,8325,8326,4868,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337, // 8064 -8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353, // 8080 -8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,4869,4461,8364,8365,8366,8367, // 8096 -8368,8369,8370,4870,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382, // 8112 -8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398, // 8128 -8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,4871,8411,8412,8413, // 8144 -8414,8415,8416,8417,8418,8419,8420,8421,8422,4462,8423,8424,8425,8426,8427,8428, // 8160 -8429,8430,8431,8432,8433,2986,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443, // 8176 -8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459, // 8192 -8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475, // 8208 -8476,8477,8478,4180,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490, // 8224 -8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506, // 8240 -8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522, // 8256 -8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538, // 8272 -8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554, // 8288 -8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,4872,8565,8566,8567,8568,8569, // 8304 -8570,8571,8572,8573,4873,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584, // 8320 -8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600, // 8336 -8601,8602,8603,8604,8605,3803,8606,8607,8608,8609,8610,8611,8612,8613,4874,3804, // 8352 -8614,8615,8616,8617,8618,8619,8620,8621,3956,8622,8623,8624,8625,8626,8627,8628, // 8368 -8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,2865,8639,8640,8641,8642,8643, // 8384 -8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,4463,8657,8658, // 8400 -8659,4875,4876,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672, // 8416 -8673,8674,8675,8676,8677,8678,8679,8680,8681,4464,8682,8683,8684,8685,8686,8687, // 8432 -8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, // 8448 -8704,8705,8706,8707,8708,8709,2261,8710,8711,8712,8713,8714,8715,8716,8717,8718, // 8464 -8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,4181, // 8480 -8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749, // 8496 -8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,4877,8764, // 8512 -8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780, // 8528 -8781,8782,8783,8784,8785,8786,8787,8788,4878,8789,4879,8790,8791,8792,4880,8793, // 8544 -8794,8795,8796,8797,8798,8799,8800,8801,4881,8802,8803,8804,8805,8806,8807,8808, // 8560 -8809,8810,8811,8812,8813,8814,8815,3957,8816,8817,8818,8819,8820,8821,8822,8823, // 8576 -8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839, // 8592 -8840,8841,8842,8843,8844,8845,8846,8847,4882,8848,8849,8850,8851,8852,8853,8854, // 8608 -8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870, // 8624 -8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,3202,8885, // 8640 -8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901, // 8656 -8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917, // 8672 -8918,8919,8920,8921,8922,8923,8924,4465,8925,8926,8927,8928,8929,8930,8931,8932, // 8688 -4883,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,2214,8944,8945,8946, // 8704 -8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962, // 8720 -8963,8964,8965,4884,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977, // 8736 -8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,4885, // 8752 -8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008, // 8768 -9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,4182,9022,9023, // 8784 -9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039, // 8800 -9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055, // 8816 -9056,9057,9058,9059,9060,9061,9062,9063,4886,9064,9065,9066,9067,9068,9069,4887, // 8832 -9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085, // 8848 -9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101, // 8864 -9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117, // 8880 -9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133, // 8896 -9134,9135,9136,9137,9138,9139,9140,9141,3958,9142,9143,9144,9145,9146,9147,9148, // 8912 -9149,9150,9151,4888,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163, // 8928 -9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,4889,9176,9177,9178, // 8944 -9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194, // 8960 -9195,9196,9197,9198,9199,9200,9201,9202,9203,4890,9204,9205,9206,9207,9208,9209, // 8976 -9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,4466,9223,9224, // 8992 -9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240, // 9008 -9241,9242,9243,9244,9245,4891,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255, // 9024 -9256,9257,4892,9258,9259,9260,9261,4893,4894,9262,9263,9264,9265,9266,9267,9268, // 9040 -9269,9270,9271,9272,9273,4467,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283, // 9056 -9284,9285,3673,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298, // 9072 -9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314, // 9088 -9315,9316,9317,9318,9319,9320,9321,9322,4895,9323,9324,9325,9326,9327,9328,9329, // 9104 -9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345, // 9120 -9346,9347,4468,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360, // 9136 -9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,4896,9374,4469, // 9152 -9375,9376,9377,9378,9379,4897,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389, // 9168 -9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405, // 9184 -9406,4470,9407,2751,9408,9409,3674,3552,9410,9411,9412,9413,9414,9415,9416,9417, // 9200 -9418,9419,9420,9421,4898,9422,9423,9424,9425,9426,9427,9428,9429,3959,9430,9431, // 9216 -9432,9433,9434,9435,9436,4471,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446, // 9232 -9447,9448,9449,9450,3348,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461, // 9248 -9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,4899,9473,9474,9475,9476, // 9264 -9477,4900,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,3349,9489,9490, // 9280 -9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506, // 9296 -9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,4901,9521, // 9312 -9522,9523,9524,9525,9526,4902,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536, // 9328 -9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552, // 9344 -9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568, // 9360 -9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584, // 9376 -3805,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599, // 9392 -9600,9601,9602,4903,9603,9604,9605,9606,9607,4904,9608,9609,9610,9611,9612,9613, // 9408 -9614,4905,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628, // 9424 -9629,9630,9631,9632,4906,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643, // 9440 -4907,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658, // 9456 -9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,4183,9673, // 9472 -9674,9675,9676,9677,4908,9678,9679,9680,9681,4909,9682,9683,9684,9685,9686,9687, // 9488 -9688,9689,9690,4910,9691,9692,9693,3675,9694,9695,9696,2945,9697,9698,9699,9700, // 9504 -9701,9702,9703,9704,9705,4911,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715, // 9520 -9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731, // 9536 -9732,9733,9734,9735,4912,9736,9737,9738,9739,9740,4913,9741,9742,9743,9744,9745, // 9552 -9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,4914,9759,9760, // 9568 -9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776, // 9584 -9777,9778,9779,9780,9781,9782,4915,9783,9784,9785,9786,9787,9788,9789,9790,9791, // 9600 -9792,9793,4916,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806, // 9616 -9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822, // 9632 -9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838, // 9648 -9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854, // 9664 -9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,4917,9869, // 9680 -9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885, // 9696 -9886,9887,9888,9889,9890,9891,9892,4472,9893,9894,9895,9896,9897,3806,9898,9899, // 9712 -9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,4918, // 9728 -9915,9916,9917,4919,9918,9919,9920,9921,4184,9922,9923,9924,9925,9926,9927,9928, // 9744 -9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944, // 9760 -9945,9946,4920,9947,9948,9949,9950,9951,9952,9953,9954,9955,4185,9956,9957,9958, // 9776 -9959,9960,9961,9962,9963,9964,9965,4921,9966,9967,9968,4473,9969,9970,9971,9972, // 9792 -9973,9974,9975,9976,9977,4474,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987, // 9808 -9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003, // 9824 -10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019, // 9840 -10020,10021,4922,10022,4923,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033, // 9856 -10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,4924, // 9872 -10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064, // 9888 -10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080, // 9904 -10081,10082,10083,10084,10085,10086,10087,4475,10088,10089,10090,10091,10092,10093,10094,10095, // 9920 -10096,10097,4476,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110, // 9936 -10111,2174,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125, // 9952 -10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,3807, // 9968 -4186,4925,10141,10142,10143,10144,10145,10146,10147,4477,4187,10148,10149,10150,10151,10152, // 9984 -10153,4188,10154,10155,10156,10157,10158,10159,10160,10161,4926,10162,10163,10164,10165,10166, //10000 -10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182, //10016 -10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,3203,10193,10194,10195,10196,10197, //10032 -10198,10199,10200,4478,10201,10202,10203,10204,4479,10205,10206,10207,10208,10209,10210,10211, //10048 -10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227, //10064 -10228,10229,10230,10231,10232,10233,10234,4927,10235,10236,10237,10238,10239,10240,10241,10242, //10080 -10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258, //10096 -10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,4480, //10112 -4928,4929,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287, //10128 -10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303, //10144 -10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319, //10160 -10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,4930, //10176 -10335,10336,10337,10338,10339,10340,10341,10342,4931,10343,10344,10345,10346,10347,10348,10349, //10192 -10350,10351,10352,10353,10354,10355,3088,10356,2786,10357,10358,10359,10360,4189,10361,10362, //10208 -10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,4932,10376,10377, //10224 -10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,4933, //10240 -10393,10394,10395,4934,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407, //10256 -10408,10409,10410,10411,10412,3446,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422, //10272 -10423,4935,10424,10425,10426,10427,10428,10429,10430,4936,10431,10432,10433,10434,10435,10436, //10288 -10437,10438,10439,10440,10441,10442,10443,4937,10444,10445,10446,10447,4481,10448,10449,10450, //10304 -10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466, //10320 -10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482, //10336 -10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498, //10352 -10499,10500,10501,10502,10503,10504,10505,4938,10506,10507,10508,10509,10510,2552,10511,10512, //10368 -10513,10514,10515,10516,3447,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527, //10384 -10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543, //10400 -4482,10544,4939,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557, //10416 -10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,3676,4483,10568,10569,10570,10571, //10432 -10572,3448,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586, //10448 -10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602, //10464 -10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618, //10480 -10619,10620,10621,10622,10623,10624,10625,10626,10627,4484,10628,10629,10630,10631,10632,4940, //10496 -10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648, //10512 -10649,10650,10651,10652,10653,10654,10655,10656,4941,10657,10658,10659,2599,10660,10661,10662, //10528 -10663,10664,10665,10666,3089,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677, //10544 -10678,10679,10680,4942,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692, //10560 -10693,10694,10695,10696,10697,4485,10698,10699,10700,10701,10702,10703,10704,4943,10705,3677, //10576 -10706,10707,10708,10709,10710,10711,10712,4944,10713,10714,10715,10716,10717,10718,10719,10720, //10592 -10721,10722,10723,10724,10725,10726,10727,10728,4945,10729,10730,10731,10732,10733,10734,10735, //10608 -10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751, //10624 -10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,4946,10762,10763,10764,10765,10766, //10640 -10767,4947,4948,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780, //10656 -10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796, //10672 -10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812, //10688 -10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828, //10704 -10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844, //10720 -10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860, //10736 -10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876, //10752 -10877,10878,4486,10879,10880,10881,10882,10883,10884,10885,4949,10886,10887,10888,10889,10890, //10768 -10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906, //10784 -10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,4487,10920,10921, //10800 -10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,4950,10933,10934,10935,10936, //10816 -10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,4488,10950,10951, //10832 -10952,10953,10954,10955,10956,10957,10958,10959,4190,10960,10961,10962,10963,10964,10965,10966, //10848 -10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982, //10864 -10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998, //10880 -10999,11000,11001,11002,11003,11004,11005,11006,3960,11007,11008,11009,11010,11011,11012,11013, //10896 -11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029, //10912 -11030,11031,11032,4951,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044, //10928 -11045,11046,11047,4489,11048,11049,11050,11051,4952,11052,11053,11054,11055,11056,11057,11058, //10944 -4953,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,4954,11072, //10960 -11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088, //10976 -11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104, //10992 -11105,11106,11107,11108,11109,11110,11111,11112,11113,11114,11115,3808,11116,11117,11118,11119, //11008 -11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,4955, //11024 -11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150, //11040 -11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,4956,11162,11163,11164,11165, //11056 -11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,4957, //11072 -11181,11182,11183,11184,11185,11186,4958,11187,11188,11189,11190,11191,11192,11193,11194,11195, //11088 -11196,11197,11198,11199,11200,3678,11201,11202,11203,11204,11205,11206,4191,11207,11208,11209, //11104 -11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225, //11120 -11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241, //11136 -11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,4959,11252,11253,11254,11255,11256, //11152 -11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272, //11168 -11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288, //11184 -11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304, //11200 -11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,3679,11315,11316,11317,11318,4490, //11216 -11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334, //11232 -11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,4960,11348,11349, //11248 -11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365, //11264 -11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,3961,4961,11378,11379, //11280 -11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395, //11296 -11396,11397,4192,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410, //11312 -11411,4962,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425, //11328 -11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441, //11344 -11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457, //11360 -11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,4963,11470,11471,4491, //11376 -11472,11473,11474,11475,4964,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486, //11392 -11487,11488,11489,11490,11491,11492,4965,11493,11494,11495,11496,11497,11498,11499,11500,11501, //11408 -11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517, //11424 -11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,3962,11530,11531,11532, //11440 -11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548, //11456 -11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564, //11472 -4193,4194,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578, //11488 -11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,4966,4195,11592, //11504 -11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,3090,11605,11606,11607, //11520 -11608,11609,11610,4967,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622, //11536 -11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638, //11552 -11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653,11654, //11568 -11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670, //11584 -11671,11672,11673,11674,4968,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685, //11600 -11686,11687,11688,11689,11690,11691,11692,11693,3809,11694,11695,11696,11697,11698,11699,11700, //11616 -11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716, //11632 -11717,11718,3553,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,4969, //11648 -11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,4492,11741,11742,11743,11744,11745, //11664 -11746,11747,11748,11749,11750,11751,11752,4970,11753,11754,11755,11756,11757,11758,11759,11760, //11680 -11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776, //11696 -11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,4971,11791, //11712 -11792,11793,11794,11795,11796,11797,4972,11798,11799,11800,11801,11802,11803,11804,11805,11806, //11728 -11807,11808,11809,11810,4973,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821, //11744 -11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,3680,3810,11835, //11760 -11836,4974,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850, //11776 -11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866, //11792 -11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882, //11808 -11883,11884,4493,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897, //11824 -11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913, //11840 -11914,11915,4975,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928, //11856 -11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944, //11872 -11945,11946,11947,11948,11949,4976,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959, //11888 -11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975, //11904 -11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,4196,11988,11989,11990, //11920 -11991,11992,4977,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005, //11936 -12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021, //11952 -12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037, //11968 -12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053, //11984 -12054,12055,12056,12057,12058,12059,12060,12061,4978,12062,12063,12064,12065,12066,12067,12068, //12000 -12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084, //12016 -12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100, //12032 -12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116, //12048 -12117,12118,12119,12120,12121,12122,12123,4979,12124,12125,12126,12127,12128,4197,12129,12130, //12064 -12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146, //12080 -12147,12148,12149,12150,12151,12152,12153,12154,4980,12155,12156,12157,12158,12159,12160,4494, //12096 -12161,12162,12163,12164,3811,12165,12166,12167,12168,12169,4495,12170,12171,4496,12172,12173, //12112 -12174,12175,12176,3812,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188, //12128 -12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204, //12144 -12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220, //12160 -12221,4981,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235, //12176 -4982,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,4983,12246,12247,12248,12249, //12192 -4984,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264, //12208 -4985,12265,4497,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278, //12224 -12279,12280,12281,12282,12283,12284,12285,12286,12287,4986,12288,12289,12290,12291,12292,12293, //12240 -12294,12295,12296,2473,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308, //12256 -12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,3963,12320,12321,12322,12323, //12272 -12324,12325,12326,12327,12328,12329,12330,12331,12332,4987,12333,12334,12335,12336,12337,12338, //12288 -12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354, //12304 -12355,12356,12357,12358,12359,3964,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, //12320 -12370,3965,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, //12336 -12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400, //12352 -12401,12402,12403,12404,12405,12406,12407,12408,4988,12409,12410,12411,12412,12413,12414,12415, //12368 -12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, //12384 -12432,12433,12434,12435,12436,12437,12438,3554,12439,12440,12441,12442,12443,12444,12445,12446, //12400 -12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, //12416 -12463,12464,4989,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477, //12432 -12478,12479,12480,4990,12481,12482,12483,12484,12485,12486,12487,12488,12489,4498,12490,12491, //12448 -12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, //12464 -12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523, //12480 -12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539, //12496 -12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,4991,12552,12553,12554, //12512 -12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570, //12528 -12571,12572,12573,12574,12575,12576,12577,12578,3036,12579,12580,12581,12582,12583,3966,12584, //12544 -12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600, //12560 -12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616, //12576 -12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632, //12592 -12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,4499,12647, //12608 -12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663, //12624 -12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679, //12640 -12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695, //12656 -12696,12697,12698,4992,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710, //12672 -12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726, //12688 -12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742, //12704 -12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758, //12720 -12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774, //12736 -12775,12776,12777,12778,4993,2175,12779,12780,12781,12782,12783,12784,12785,12786,4500,12787, //12752 -12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803, //12768 -12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, //12784 -12820,12821,12822,12823,12824,12825,12826,4198,3967,12827,12828,12829,12830,12831,12832,12833, //12800 -12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849, //12816 -12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,4199,12862,12863,12864, //12832 -12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880, //12848 -12881,12882,12883,12884,12885,12886,12887,4501,12888,12889,12890,12891,12892,12893,12894,12895, //12864 -12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911, //12880 -12912,4994,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926, //12896 -12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942, //12912 -12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,1772,12957, //12928 -12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973, //12944 -12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989, //12960 -12990,12991,12992,12993,12994,12995,12996,12997,4502,12998,4503,12999,13000,13001,13002,13003, //12976 -4504,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018, //12992 -13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,3449,13030,13031,13032,13033, //13008 -13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049, //13024 -13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065, //13040 -13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081, //13056 -13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097, //13072 -13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113, //13088 -13114,13115,13116,13117,13118,3968,13119,4995,13120,13121,13122,13123,13124,13125,13126,13127, //13104 -4505,13128,13129,13130,13131,13132,13133,13134,4996,4506,13135,13136,13137,13138,13139,4997, //13120 -13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155, //13136 -13156,13157,13158,13159,4998,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170, //13152 -13171,13172,13173,13174,13175,13176,4999,13177,13178,13179,13180,13181,13182,13183,13184,13185, //13168 -13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201, //13184 -13202,13203,13204,13205,13206,5000,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216, //13200 -13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,4200,5001,13228,13229,13230, //13216 -13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,3969,13241,13242,13243,13244,3970, //13232 -13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260, //13248 -13261,13262,13263,13264,13265,13266,13267,13268,3450,13269,13270,13271,13272,13273,13274,13275, //13264 -13276,5002,13277,13278,13279,13280,13281,13282,13283,13284,13285,13286,13287,13288,13289,13290, //13280 -13291,13292,13293,13294,13295,13296,13297,13298,13299,13300,13301,13302,3813,13303,13304,13305, //13296 -13306,13307,13308,13309,13310,13311,13312,13313,13314,13315,13316,13317,13318,13319,13320,13321, //13312 -13322,13323,13324,13325,13326,13327,13328,4507,13329,13330,13331,13332,13333,13334,13335,13336, //13328 -13337,13338,13339,13340,13341,5003,13342,13343,13344,13345,13346,13347,13348,13349,13350,13351, //13344 -13352,13353,13354,13355,13356,13357,13358,13359,13360,13361,13362,13363,13364,13365,13366,13367, //13360 -5004,13368,13369,13370,13371,13372,13373,13374,13375,13376,13377,13378,13379,13380,13381,13382, //13376 -13383,13384,13385,13386,13387,13388,13389,13390,13391,13392,13393,13394,13395,13396,13397,13398, //13392 -13399,13400,13401,13402,13403,13404,13405,13406,13407,13408,13409,13410,13411,13412,13413,13414, //13408 -13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430, //13424 -13431,13432,4508,13433,13434,13435,4201,13436,13437,13438,13439,13440,13441,13442,13443,13444, //13440 -13445,13446,13447,13448,13449,13450,13451,13452,13453,13454,13455,13456,13457,5005,13458,13459, //13456 -13460,13461,13462,13463,13464,13465,13466,13467,13468,13469,13470,4509,13471,13472,13473,13474, //13472 -13475,13476,13477,13478,13479,13480,13481,13482,13483,13484,13485,13486,13487,13488,13489,13490, //13488 -13491,13492,13493,13494,13495,13496,13497,13498,13499,13500,13501,13502,13503,13504,13505,13506, //13504 -13507,13508,13509,13510,13511,13512,13513,13514,13515,13516,13517,13518,13519,13520,13521,13522, //13520 -13523,13524,13525,13526,13527,13528,13529,13530,13531,13532,13533,13534,13535,13536,13537,13538, //13536 -13539,13540,13541,13542,13543,13544,13545,13546,13547,13548,13549,13550,13551,13552,13553,13554, //13552 -13555,13556,13557,13558,13559,13560,13561,13562,13563,13564,13565,13566,13567,13568,13569,13570, //13568 -13571,13572,13573,13574,13575,13576,13577,13578,13579,13580,13581,13582,13583,13584,13585,13586, //13584 -13587,13588,13589,13590,13591,13592,13593,13594,13595,13596,13597,13598,13599,13600,13601,13602, //13600 -13603,13604,13605,13606,13607,13608,13609,13610,13611,13612,13613,13614,13615,13616,13617,13618, //13616 -13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,13630,13631,13632,13633,13634, //13632 -13635,13636,13637,13638,13639,13640,13641,13642,5006,13643,13644,13645,13646,13647,13648,13649, //13648 -13650,13651,5007,13652,13653,13654,13655,13656,13657,13658,13659,13660,13661,13662,13663,13664, //13664 -13665,13666,13667,13668,13669,13670,13671,13672,13673,13674,13675,13676,13677,13678,13679,13680, //13680 -13681,13682,13683,13684,13685,13686,13687,13688,13689,13690,13691,13692,13693,13694,13695,13696, //13696 -13697,13698,13699,13700,13701,13702,13703,13704,13705,13706,13707,13708,13709,13710,13711,13712, //13712 -13713,13714,13715,13716,13717,13718,13719,13720,13721,13722,13723,13724,13725,13726,13727,13728, //13728 -13729,13730,13731,13732,13733,13734,13735,13736,13737,13738,13739,13740,13741,13742,13743,13744, //13744 -13745,13746,13747,13748,13749,13750,13751,13752,13753,13754,13755,13756,13757,13758,13759,13760, //13760 -13761,13762,13763,13764,13765,13766,13767,13768,13769,13770,13771,13772,13773,13774,3273,13775, //13776 -13776,13777,13778,13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789,13790,13791, //13792 -13792,13793,13794,13795,13796,13797,13798,13799,13800,13801,13802,13803,13804,13805,13806,13807, //13808 -13808,13809,13810,13811,13812,13813,13814,13815,13816,13817,13818,13819,13820,13821,13822,13823, //13824 -13824,13825,13826,13827,13828,13829,13830,13831,13832,13833,13834,13835,13836,13837,13838,13839, //13840 -13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13854,13855, //13856 -13856,13857,13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,13869,13870,13871, //13872 -13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,13884,13885,13886,13887, //13888 -13888,13889,13890,13891,13892,13893,13894,13895,13896,13897,13898,13899,13900,13901,13902,13903, //13904 -13904,13905,13906,13907,13908,13909,13910,13911,13912,13913,13914,13915,13916,13917,13918,13919, //13920 -13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, //13936 -13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, //13952 -13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, //13968 -13968,13969,13970,13971,13972]; //13973 - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/big5prober.js b/tools/eslint/node_modules/jschardet/src/big5prober.js deleted file mode 100755 index 16bd36b617e263..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/big5prober.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.Big5Prober = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.Big5SMModel); - self._mDistributionAnalyzer = new jschardet.Big5DistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "Big5"; - } - - init(); -} -jschardet.Big5Prober.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/chardistribution.js b/tools/eslint/node_modules/jschardet/src/chardistribution.js deleted file mode 100755 index e0b99a3fc239ee..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/chardistribution.js +++ /dev/null @@ -1,285 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharDistributionAnalysis = function() { - var ENOUGH_DATA_THRESHOLD = 1024; - var SURE_YES = 0.99; - var SURE_NO = 0.01; - var MINIMUM_DATA_THRESHOLD = 3; - - var self = this; - - function init() { - self._mCharToFreqOrder = null; // Mapping table to get frequency order from char order (get from GetOrder()) - self._mTableSize = null; // Size of above table - self._mTypicalDistributionRatio = null; // This is a constant value which varies from language to language, used in calculating confidence. See http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html for further detail. - self.reset(); - } - - /** - * reset analyser, clear any state - */ - this.reset = function() { - this._mDone = false; // If this flag is set to constants.True, detection is done and conclusion has been made - this._mTotalChars = 0; // Total characters encountered - this._mFreqChars = 0; // The number of characters whose frequency order is less than 512 - } - - /** - * feed a character with known length - */ - this.feed = function(aStr, aCharLen) { - if( aCharLen == 2 ) { - // we only care about 2-bytes character in our distribution analysis - var order = this.getOrder(aStr); - } else { - order = -1; - } - if( order >= 0 ) { - this._mTotalChars++; - // order is valid - if( order < this._mTableSize ) { - if( 512 > this._mCharToFreqOrder[order] ) { - this._mFreqChars++; - } - } - } - } - - /** - * return confidence based on existing data - */ - this.getConfidence = function() { - // if we didn't receive any character in our consideration range, return negative answer - if( this._mTotalChars <= 0 || this._mFreqChars <= MINIMUM_DATA_THRESHOLD) { - return SURE_NO; - } - if( this._mTotalChars != this._mFreqChars ) { - var r = this._mFreqChars / ((this._mTotalChars - this._mFreqChars) * this._mTypicalDistributionRatio); - if( r < SURE_YES ) { - return r; - } - } - - // normalize confidence (we don't want to be 100% sure) - return SURE_YES; - } - - this.gotEnoughData = function() { - // It is not necessary to receive all data to draw conclusion. For charset detection, - // certain amount of data is enough - return this._mTotalChars > ENOUGH_DATA_THRESHOLD; - } - - this.getOrder = function(aStr) { - // We do not handle characters based on the original encoding string, but - // convert this encoding string to a number, here called order. - // This allows multiple encodings of a language to share one frequency table. - return -1; - } - - init(); -} - -jschardet.EUCTWDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.EUCTWCharToFreqOrder; - self._mTableSize = jschardet.EUCTW_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.EUCTW_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-TW encoding, we are interested - // first byte range: 0xc4 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xC4 ) { - return 94 * (aStr.charCodeAt(0) - 0xC4) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCTWDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.EUCKRDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.EUCKRCharToFreqOrder; - self._mTableSize = jschardet.EUCKR_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.EUCKR_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-KR encoding, we are interested - // first byte range: 0xb0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xB0 ) { - return 94 * (aStr.charCodeAt(0) - 0xB0) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCKRDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.GB2312DistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.GB2312CharToFreqOrder; - self._mTableSize = jschardet.GB2312_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.GB2312_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for GB2312 encoding, we are interested - // first byte range: 0xb0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xB0 && aStr.charCodeAt(1) >= 0xA1 ) { - return 94 * (aStr.charCodeAt(0) - 0xB0) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.GB2312DistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.Big5DistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.Big5CharToFreqOrder; - self._mTableSize = jschardet.BIG5_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.BIG5_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for big5 encoding, we are interested - // first byte range: 0xa4 -- 0xfe - // second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0xA4 ) { - if( aStr.charCodeAt(1) >= 0xA1 ) { - return 157 * (aStr.charCodeAt(0) - 0xA4) + aStr.charCodeAt(1) - 0xA1 + 63; - } else { - return 157 * (aStr.charCodeAt(0) - 0xA4) + aStr.charCodeAt(1) - 0x40; - } - } else { - return -1; - } - } - - init(); -} -jschardet.Big5DistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.SJISDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.JISCharToFreqOrder; - self._mTableSize = jschardet.JIS_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for sjis encoding, we are interested - // first byte range: 0x81 -- 0x9f , 0xe0 -- 0xef - // second byte range: 0x40 -- 0x7e, 0x80 -- 0xfc - // no validation needed here. State machine has done that - if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) { - var order = 188 * (aStr.charCodeAt(0) - 0x81); - } else if( aStr.charCodeAt(0) >= 0xE0 && aStr.charCodeAt(0) <= 0xEF ) { - order = 188 * (aStr.charCodeAt(0) - 0xE0 + 31); - } else { - return -1; - } - order += aStr.charCodeAt(1) - 0x40; - if( aStr.charCodeAt(1) < 0x40 || aStr.charCodeAt(1) === 0x7F || aStr.charCodeAt(1) > 0xFC) { - order = -1; - } - return order; - } - - init(); -} -jschardet.SJISDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -jschardet.EUCJPDistributionAnalysis = function() { - jschardet.CharDistributionAnalysis.apply(this); - - var self = this; - - function init() { - self._mCharToFreqOrder = jschardet.JISCharToFreqOrder; - self._mTableSize = jschardet.JIS_TABLE_SIZE; - self._mTypicalDistributionRatio = jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO; - } - - this.getOrder = function(aStr) { - // for euc-JP encoding, we are interested - // first byte range: 0xa0 -- 0xfe - // second byte range: 0xa1 -- 0xfe - // no validation needed here. State machine has done that - if( aStr[0] >= "\xA0" ) { - return 94 * (aStr.charCodeAt(0) - 0xA1) + aStr.charCodeAt(1) - 0xA1; - } else { - return -1; - } - } - - init(); -} -jschardet.EUCJPDistributionAnalysis.prototype = new jschardet.CharDistributionAnalysis(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/charsetgroupprober.js b/tools/eslint/node_modules/jschardet/src/charsetgroupprober.js deleted file mode 100755 index c846452e00c85c..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/charsetgroupprober.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharSetGroupProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mActiveNum = 0; - self._mProbers = []; - self._mBestGuessProber = null; - } - - this.reset = function() { - jschardet.CharSetGroupProber.prototype.reset.apply(this); - this._mActiveNum = 0; - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( prober ) { - prober.reset(); - prober.active = true; - this._mActiveNum++; - } - } - this._mBestGuessProber = null; - } - - this.getCharsetName = function() { - if( !this._mBestGuessProber ) { - this.getConfidence(); - if( !this._mBestGuessProber ) return null; - } - return this._mBestGuessProber.getCharsetName(); - } - - this.feed = function(aBuf) { - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( !prober || !prober.active ) continue; - var st = prober.feed(aBuf); - if( !st ) continue; - if( st == jschardet.Constants.foundIt ) { - this._mBestGuessProber = prober; - return this.getState(); - } else if( st == jschardet.Constants.notMe ) { - prober.active = false; - this._mActiveNum--; - if( this._mActiveNum <= 0 ) { - this._mState = jschardet.Constants.notMe; - return this.getState(); - } - } - } - return this.getState(); - } - - this.getConfidence = function() { - var st = this.getState(); - if( st == jschardet.Constants.foundIt ) { - return 0.99; - } else if( st == jschardet.Constants.notMe ) { - return 0.01; - } - var bestConf = 0.0; - this._mBestGuessProber = null; - for( var i = 0, prober; prober = this._mProbers[i]; i++ ) { - if( !prober ) continue; - if( !prober.active ) { - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " not active\n"); - } - continue; - } - var cf = prober.getConfidence(); - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " confidence = " + cf + "\n"); - } - if( bestConf < cf ) { - bestConf = cf; - this._mBestGuessProber = prober; - } - } - if( !this._mBestGuessProber ) return 0.0; - return bestConf; - } - - init(); -} -jschardet.CharSetGroupProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/charsetprober.js b/tools/eslint/node_modules/jschardet/src/charsetprober.js deleted file mode 100755 index 15ec54be135148..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/charsetprober.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CharSetProber = function() { - this.reset = function() { - this._mState = jschardet.Constants.detecting; - } - - this.getCharsetName = function() { - return null; - } - - this.feed = function(aBuf) { - } - - this.getState = function() { - return this._mState; - } - - this.getConfidence = function() { - return 0.0; - } - - this.filterHighBitOnly = function(aBuf) { - aBuf = aBuf.replace(/[\x00-\x7F]+/g, " "); - return aBuf; - } - - this.filterWithoutEnglishLetters = function(aBuf) { - aBuf = aBuf.replace(/[A-Za-z]+/g, " "); - return aBuf; - } - - // Input: aBuf is a string containing all different types of characters - // Output: a string that contains all alphabetic letters, high-byte characters, and word immediately preceding `>`, but nothing else within `<>` - // Ex: input - '¡£º
abcdef
apples! * and oranges 9jd93jd>' - // output - '¡£º blah div apples and oranges jd jd ' - this.filterWithEnglishLetters = function(aBuf) { - var result = ''; - var inTag = false; - var prev = 0; - - for (var curr = 0; curr < aBuf.length; curr++) { - var c = aBuf[curr]; - - if (c == '>') { - inTag = false; - } else if (c == '<') { - inTag = true; - } - - var isAlpha = /[a-zA-Z]/.test(c); - var isASCII = /^[\x00-\x7F]*$/.test(c); - - if (isASCII && !isAlpha) { - if (curr > prev && !inTag) { - result = result + aBuf.substring(prev, curr) + ' '; - } - - prev = curr + 1; - } - } - - if (!inTag) { - result = result + aBuf.substring(prev); - } - - return result; - } -} - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/codingstatemachine.js b/tools/eslint/node_modules/jschardet/src/codingstatemachine.js deleted file mode 100755 index 0de7fbafd9fc9b..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/codingstatemachine.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.CodingStateMachine = function(sm) { - var self = this; - - function init(sm) { - self._mModel = sm; - self._mCurrentBytePos = 0; - self._mCurrentCharLen = 0; - self.reset(); - } - - this.reset = function() { - this._mCurrentState = jschardet.Constants.start; - } - - this.nextState = function(c) { - // for each byte we get its class - // if it is first byte, we also get byte length - var byteCls = this._mModel.classTable[c.charCodeAt(0)]; - if( this._mCurrentState == jschardet.Constants.start ) { - this._mCurrentBytePos = 0; - this._mCurrentCharLen = this._mModel.charLenTable[byteCls]; - } - // from byte's class and stateTable, we get its next state - this._mCurrentState = this._mModel.stateTable[this._mCurrentState * this._mModel.classFactor + byteCls]; - this._mCurrentBytePos++; - return this._mCurrentState; - } - - this.getCurrentCharLen = function() { - return this._mCurrentCharLen; - } - - this.getCodingStateMachine = function() { - return this._mModel.name; - } - - init(sm); -} - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/constants.js b/tools/eslint/node_modules/jschardet/src/constants.js deleted file mode 100755 index 2707736c0fe48a..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/constants.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.Constants = { - _debug : false, - - detecting : 0, - foundIt : 1, - notMe : 2, - - start : 0, - error : 1, - itsMe : 2, - - MINIMUM_THRESHOLD : 0.20, - SHORTCUT_THRESHOLD : 0.95 -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/escprober.js b/tools/eslint/node_modules/jschardet/src/escprober.js deleted file mode 100755 index 39e0e2341bf798..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/escprober.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EscCharSetProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = [ - new jschardet.CodingStateMachine(jschardet.HZSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022CNSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022JPSMModel), - new jschardet.CodingStateMachine(jschardet.ISO2022KRSMModel) - ]; - self.reset(); - } - - this.reset = function() { - jschardet.EscCharSetProber.prototype.reset.apply(this); - for( var i = 0, codingSM; codingSM = this._mCodingSM[i]; i++ ) { - if( !codingSM ) continue; - codingSM.active = true; - codingSM.reset(); - } - this._mActiveSM = self._mCodingSM.length; - this._mDetectedCharset = null; - } - - this.getCharsetName = function() { - return this._mDetectedCharset; - } - - this.getConfidence = function() { - if( this._mDetectedCharset ) { - return 0.99; - } else { - return 0.00; - } - } - - this.feed = function(aBuf) { - for( var i = 0, c; i < aBuf.length; i++ ) { - c = aBuf[i]; - for( var j = 0, codingSM; codingSM = this._mCodingSM[j]; j++ ) { - if( !codingSM || !codingSM.active ) continue; - var codingState = codingSM.nextState(c); - if( codingState == jschardet.Constants.error ) { - codingSM.active = false; - this._mActiveSM--; - if( this._mActiveSM <= 0 ) { - this._mState = jschardet.Constants.notMe; - return this.getState(); - } - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - this._mDetectedCharset = codingSM.getCodingStateMachine(); - return this.getState(); - } - } - } - - return this.getState(); - } - - init(); -} -jschardet.EscCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/escsm.js b/tools/eslint/node_modules/jschardet/src/escsm.js deleted file mode 100755 index 3cad48e1143f00..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/escsm.js +++ /dev/null @@ -1,254 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -var consts = jschardet.Constants; - -jschardet.HZ_cls = [ - 1,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,0,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,4,0,5,2,0, // 78 - 7f - 1,1,1,1,1,1,1,1, // 80 - 87 - 1,1,1,1,1,1,1,1, // 88 - 8f - 1,1,1,1,1,1,1,1, // 90 - 97 - 1,1,1,1,1,1,1,1, // 98 - 9f - 1,1,1,1,1,1,1,1, // a0 - a7 - 1,1,1,1,1,1,1,1, // a8 - af - 1,1,1,1,1,1,1,1, // b0 - b7 - 1,1,1,1,1,1,1,1, // b8 - bf - 1,1,1,1,1,1,1,1, // c0 - c7 - 1,1,1,1,1,1,1,1, // c8 - cf - 1,1,1,1,1,1,1,1, // d0 - d7 - 1,1,1,1,1,1,1,1, // d8 - df - 1,1,1,1,1,1,1,1, // e0 - e7 - 1,1,1,1,1,1,1,1, // e8 - ef - 1,1,1,1,1,1,1,1, // f0 - f7 - 1,1,1,1,1,1,1,1 // f8 - ff -]; - -jschardet.HZ_st = [ - consts.start,consts.error, 3,consts.start,consts.start,consts.start,consts.error,consts.error, // 00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start, 4,consts.error, // 10-17 - 5,consts.error, 6,consts.error, 5, 5, 4,consts.error, // 18-1f - 4,consts.error, 4, 4, 4,consts.error, 4,consts.error, // 20-27 - 4,consts.itsMe,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start // 28-2f -]; - -jschardet.HZCharLenTable = [0, 0, 0, 0, 0, 0]; - -jschardet.HZSMModel = { - "classTable" : jschardet.HZ_cls, - "classFactor" : 6, - "stateTable" : jschardet.HZ_st, - "charLenTable" : jschardet.HZCharLenTable, - "name" : "HZ-GB-2312" -}; - -jschardet.ISO2022CN_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,4,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022CN_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, // 00-07 - consts.start,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 08-0f - consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 10-17 - consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.error, 4,consts.error, // 18-1f - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 20-27 - 5, 6,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 28-2f - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 30-37 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.start // 38-3f -]; - -jschardet.ISO2022CNCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022CNSMModel = { - "classTable" : jschardet.ISO2022CN_cls, - "classFactor" : 9, - "stateTable" : jschardet.ISO2022CN_st, - "charLenTable" : jschardet.ISO2022CNCharLenTable, - "name" : "ISO-2022-CN" -}; - -jschardet.ISO2022JP_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,2,2, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,7,0,0,0, // 20 - 27 - 3,0,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 6,0,4,0,8,0,0,0, // 40 - 47 - 0,9,5,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022JP_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, // 00-07 - consts.start,consts.start,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, // 08-0f - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 10-17 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error, // 18-1f - consts.error, 5,consts.error,consts.error,consts.error, 4,consts.error,consts.error, // 20-27 - consts.error,consts.error,consts.error, 6,consts.itsMe,consts.error,consts.itsMe,consts.error, // 28-2f - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, // 30-37 - consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.error,consts.error,consts.error, // 38-3f - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.error,consts.start,consts.start // 40-47 -]; - -jschardet.ISO2022JPCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022JPSMModel = { - "classTable" : jschardet.ISO2022JP_cls, - "classFactor" : 10, - "stateTable" : jschardet.ISO2022JP_st, - "charLenTable" : jschardet.ISO2022JPCharLenTable, - "name" : "ISO-2022-JP" -}; - -jschardet.ISO2022KR_cls = [ - 2,0,0,0,0,0,0,0, // 00 - 07 - 0,0,0,0,0,0,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,1,0,0,0,0, // 18 - 1f - 0,0,0,0,3,0,0,0, // 20 - 27 - 0,4,0,0,0,0,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,5,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 2,2,2,2,2,2,2,2, // 80 - 87 - 2,2,2,2,2,2,2,2, // 88 - 8f - 2,2,2,2,2,2,2,2, // 90 - 97 - 2,2,2,2,2,2,2,2, // 98 - 9f - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,2 // f8 - ff -]; - -jschardet.ISO2022KR_st = [ - consts.start, 3,consts.error,consts.start,consts.start,consts.start,consts.error,consts.error, // 00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, // 08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.error, 4,consts.error,consts.error, // 10-17 - consts.error,consts.error,consts.error,consts.error, 5,consts.error,consts.error,consts.error, // 18-1f - consts.error,consts.error,consts.error,consts.itsMe,consts.start,consts.start,consts.start,consts.start // 20-27 -]; - -jschardet.ISO2022KRCharLenTable = [0, 0, 0, 0, 0, 0]; - -jschardet.ISO2022KRSMModel = { - "classTable" : jschardet.ISO2022KR_cls, - "classFactor" : 6, - "stateTable" : jschardet.ISO2022KR_st, - "charLenTable" : jschardet.ISO2022KRCharLenTable, - "name" : "ISO-2022-KR" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/eucjpprober.js b/tools/eslint/node_modules/jschardet/src/eucjpprober.js deleted file mode 100755 index a55298316f2d3c..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/eucjpprober.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCJPProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCJPSMModel); - self._mDistributionAnalyzer = new jschardet.EUCJPDistributionAnalysis(); - self._mContextAnalyzer = new jschardet.EUCJPContextAnalysis(); - self.reset(); - } - - this.reset = function() { - jschardet.EUCJPProber.prototype.reset.apply(this); - this._mContextAnalyzer.reset(); - } - - this.getCharsetName = function() { - return "EUC-JP"; - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mContextAnalyzer.feed(this._mLastChar, charLen); - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mContextAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - this._mDistributionAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mContextAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var contxtCf = this._mContextAnalyzer.getConfidence(); - var distribCf = this._mDistributionAnalyzer.getConfidence(); - - return Math.max(contxtCf, distribCf); - } - - init(); -} -jschardet.EUCJPProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/euckrfreq.js b/tools/eslint/node_modules/jschardet/src/euckrfreq.js deleted file mode 100755 index dfa7d09c366b8a..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/euckrfreq.js +++ /dev/null @@ -1,601 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// Sampling from about 20M text materials include literature and computer technology - -// 128 --> 0.79 -// 256 --> 0.92 -// 512 --> 0.986 -// 1024 --> 0.99944 -// 2048 --> 0.99999 -// -// Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24 -// Random Distribution Ration = 512 / (2350-512) = 0.279. -// -// Typical Distribution Ratio - -jschardet.EUCKR_TYPICAL_DISTRIBUTION_RATIO = 6.0; - -jschardet.EUCKR_TABLE_SIZE = 2352; - -// Char to FreqOrder table , -jschardet.EUCKRCharToFreqOrder = [ - 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, -1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, -1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, - 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, - 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, - 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, -1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, - 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, - 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, -1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, -1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, -1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, -1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, -1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, - 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, -1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, -1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, -1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, -1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, - 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, -1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, - 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, - 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, -1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, - 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, -1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, - 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, - 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, -1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, -1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, -1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, -1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, - 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, -1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, - 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, - 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, -1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, -1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, -1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, -1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, -1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, -1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, - 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, - 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, - 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, -1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, - 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, -1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, - 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, - 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, -2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, - 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, - 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, -2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, -2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, -2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, - 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, - 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, -2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, - 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, -1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, -2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, -1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, -2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, -2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, -1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, - 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, -2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, -2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, - 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, - 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, -2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, -1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, -2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, -2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, -2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, -2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, -2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, -2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, -1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, -2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, -2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, -2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, -2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, -2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, -1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, -1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, -2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, -1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, -2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, -1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, - 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, -2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, - 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, -2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, - 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, -2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, -2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, - 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, -2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, -1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, - 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, -1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, -2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, -1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, -2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, - 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, -2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, -1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, -2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, -1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, -2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, -1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, - 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, -2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, -2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, - 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, - 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, -1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, -1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, - 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, -2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, -2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, - 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, - 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, - 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, -2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, - 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, - 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, -2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, -2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, - 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, -2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, -1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, - 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, -2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, -2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, -2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, - 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, - 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, - 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, -2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, -2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, -2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, -1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, -2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, - 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, // 512, 256 -//Everything below is of no interest for detection purpose -2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658, -2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674, -2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690, -2691,2692,2693,2694,2695,2696,2697,2698,2699,1542, 880,2700,2701,2702,2703,2704, -2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720, -2721,2722,2723,2724,2725,1543,2726,2727,2728,2729,2730,2731,2732,1544,2733,2734, -2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750, -2751,2752,2753,2754,1545,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765, -2766,1546,2767,1547,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779, -2780,2781,2782,2783,2784,2785,2786,1548,2787,2788,2789,1109,2790,2791,2792,2793, -2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809, -2810,2811,2812,1329,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824, -2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840, -2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856, -1549,2857,2858,2859,2860,1550,2861,2862,1551,2863,2864,2865,2866,2867,2868,2869, -2870,2871,2872,2873,2874,1110,1330,2875,2876,2877,2878,2879,2880,2881,2882,2883, -2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899, -2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915, -2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,1331, -2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,1552,2944,2945, -2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961, -2962,2963,2964,1252,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976, -2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992, -2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008, -3009,3010,3011,3012,1553,3013,3014,3015,3016,3017,1554,3018,1332,3019,3020,3021, -3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037, -3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,1555,3051,3052, -3053,1556,1557,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066, -3067,1558,3068,3069,3070,3071,3072,3073,3074,3075,3076,1559,3077,3078,3079,3080, -3081,3082,3083,1253,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095, -3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,1152,3109,3110, -3111,3112,3113,1560,3114,3115,3116,3117,1111,3118,3119,3120,3121,3122,3123,3124, -3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140, -3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156, -3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172, -3173,3174,3175,3176,1333,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187, -3188,3189,1561,3190,3191,1334,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201, -3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217, -3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233, -3234,1562,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248, -3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264, -3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,1563,3278,3279, -3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295, -3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311, -3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327, -3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343, -3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359, -3360,3361,3362,3363,3364,1335,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374, -3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,1336,3388,3389, -3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405, -3406,3407,3408,3409,3410,3411,3412,3413,3414,1337,3415,3416,3417,3418,3419,1338, -3420,3421,3422,1564,1565,3423,3424,3425,3426,3427,3428,3429,3430,3431,1254,3432, -3433,3434,1339,3435,3436,3437,3438,3439,1566,3440,3441,3442,3443,3444,3445,3446, -3447,3448,3449,3450,3451,3452,3453,3454,1255,3455,3456,3457,3458,3459,1567,1191, -3460,1568,1569,3461,3462,3463,1570,3464,3465,3466,3467,3468,1571,3469,3470,3471, -3472,3473,1572,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486, -1340,3487,3488,3489,3490,3491,3492,1021,3493,3494,3495,3496,3497,3498,1573,3499, -1341,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,1342,3512,3513, -3514,3515,3516,1574,1343,3517,3518,3519,1575,3520,1576,3521,3522,3523,3524,3525, -3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541, -3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557, -3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573, -3574,3575,3576,3577,3578,3579,3580,1577,3581,3582,1578,3583,3584,3585,3586,3587, -3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603, -3604,1579,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618, -3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,1580,3630,3631,1581,3632, -3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648, -3649,3650,3651,3652,3653,3654,3655,3656,1582,3657,3658,3659,3660,3661,3662,3663, -3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679, -3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695, -3696,3697,3698,3699,3700,1192,3701,3702,3703,3704,1256,3705,3706,3707,3708,1583, -1257,3709,3710,3711,3712,3713,3714,3715,3716,1584,3717,3718,3719,3720,3721,3722, -3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738, -3739,3740,3741,3742,3743,3744,3745,1344,3746,3747,3748,3749,3750,3751,3752,3753, -3754,3755,3756,1585,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,1586,3767, -3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,1345,3779,3780,3781,3782, -3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,1346,1587,3796, -3797,1588,3798,3799,3800,3801,3802,3803,3804,3805,3806,1347,3807,3808,3809,3810, -3811,1589,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,1590,3822,3823,1591, -1348,3824,3825,3826,3827,3828,3829,3830,1592,3831,3832,1593,3833,3834,3835,3836, -3837,3838,3839,3840,3841,3842,3843,3844,1349,3845,3846,3847,3848,3849,3850,3851, -3852,3853,3854,3855,3856,3857,3858,1594,3859,3860,3861,3862,3863,3864,3865,3866, -3867,3868,3869,1595,3870,3871,3872,3873,1596,3874,3875,3876,3877,3878,3879,3880, -3881,3882,3883,3884,3885,3886,1597,3887,3888,3889,3890,3891,3892,3893,3894,3895, -1598,3896,3897,3898,1599,1600,3899,1350,3900,1351,3901,3902,1352,3903,3904,3905, -3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921, -3922,3923,3924,1258,3925,3926,3927,3928,3929,3930,3931,1193,3932,1601,3933,3934, -3935,3936,3937,3938,3939,3940,3941,3942,3943,1602,3944,3945,3946,3947,3948,1603, -3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964, -3965,1604,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,1353,3978, -3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,1354,3992,3993, -3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009, -4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,1355,4024, -4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040, -1605,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055, -4056,4057,4058,4059,4060,1606,4061,4062,4063,4064,1607,4065,4066,4067,4068,4069, -4070,4071,4072,4073,4074,4075,4076,1194,4077,4078,1608,4079,4080,4081,4082,4083, -4084,4085,4086,4087,1609,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098, -4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,1259,4109,4110,4111,4112,4113, -4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,1195,4125,4126,4127,1610, -4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,1356,4138,4139,4140,4141,4142, -4143,4144,1611,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157, -4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173, -4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189, -4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205, -4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,1612,4220, -4221,4222,4223,4224,4225,4226,4227,1357,4228,1613,4229,4230,4231,4232,4233,4234, -4235,4236,4237,4238,4239,4240,4241,4242,4243,1614,4244,4245,4246,4247,4248,4249, -4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265, -4266,4267,4268,4269,4270,1196,1358,4271,4272,4273,4274,4275,4276,4277,4278,4279, -4280,4281,4282,4283,4284,4285,4286,4287,1615,4288,4289,4290,4291,4292,4293,4294, -4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310, -4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326, -4327,4328,4329,4330,4331,4332,4333,4334,1616,4335,4336,4337,4338,4339,4340,4341, -4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357, -4358,4359,4360,1617,4361,4362,4363,4364,4365,1618,4366,4367,4368,4369,4370,4371, -4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387, -4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403, -4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,1619,4417,4418, -4419,4420,4421,4422,4423,4424,4425,1112,4426,4427,4428,4429,4430,1620,4431,4432, -4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,1260,1261,4443,4444,4445,4446, -4447,4448,4449,4450,4451,4452,4453,4454,4455,1359,4456,4457,4458,4459,4460,4461, -4462,4463,4464,4465,1621,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476, -4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,1055,4490,4491, -4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507, -4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,1622,4519,4520,4521,1623, -4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,1360,4536, -4537,4538,4539,4540,4541,4542,4543, 975,4544,4545,4546,4547,4548,4549,4550,4551, -4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567, -4568,4569,4570,4571,1624,4572,4573,4574,4575,4576,1625,4577,4578,4579,4580,4581, -4582,4583,4584,1626,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,1627, -4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611, -4612,4613,4614,4615,1628,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626, -4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642, -4643,4644,4645,4646,4647,4648,4649,1361,4650,4651,4652,4653,4654,4655,4656,4657, -4658,4659,4660,4661,1362,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672, -4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,1629,4683,4684,4685,4686,4687, -1630,4688,4689,4690,4691,1153,4692,4693,4694,1113,4695,4696,4697,4698,4699,4700, -4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,1197,4712,4713,4714,4715, -4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731, -4732,4733,4734,4735,1631,4736,1632,4737,4738,4739,4740,4741,4742,4743,4744,1633, -4745,4746,4747,4748,4749,1262,4750,4751,4752,4753,4754,1363,4755,4756,4757,4758, -4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,1634,4769,4770,4771,4772,4773, -4774,4775,4776,4777,4778,1635,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788, -4789,1636,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803, -4804,4805,4806,1637,4807,4808,4809,1638,4810,4811,4812,4813,4814,4815,4816,4817, -4818,1639,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832, -4833,1077,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847, -4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863, -4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879, -4880,4881,4882,4883,1640,4884,4885,1641,4886,4887,4888,4889,4890,4891,4892,4893, -4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909, -4910,4911,1642,4912,4913,4914,1364,4915,4916,4917,4918,4919,4920,4921,4922,4923, -4924,4925,4926,4927,4928,4929,4930,4931,1643,4932,4933,4934,4935,4936,4937,4938, -4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954, -4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970, -4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,1644,4981,4982,4983,4984,1645, -4985,4986,1646,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999, -5000,5001,5002,5003,5004,5005,1647,5006,1648,5007,5008,5009,5010,5011,5012,1078, -5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028, -1365,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,1649,5040,5041,5042, -5043,5044,5045,1366,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,1650,5056, -5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072, -5073,5074,5075,5076,5077,1651,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087, -5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103, -5104,5105,5106,5107,5108,5109,5110,1652,5111,5112,5113,5114,5115,5116,5117,5118, -1367,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,1653,5130,5131,5132, -5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148, -5149,1368,5150,1654,5151,1369,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161, -5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177, -5178,1370,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192, -5193,5194,5195,5196,5197,5198,1655,5199,5200,5201,5202,1656,5203,5204,5205,5206, -1371,5207,1372,5208,5209,5210,5211,1373,5212,5213,1374,5214,5215,5216,5217,5218, -5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234, -5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,1657,5248,5249, -5250,5251,1658,1263,5252,5253,5254,5255,5256,1375,5257,5258,5259,5260,5261,5262, -5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278, -5279,5280,5281,5282,5283,1659,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293, -5294,5295,5296,5297,5298,5299,5300,1660,5301,5302,5303,5304,5305,5306,5307,5308, -5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,1376,5322,5323, -5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,1198,5334,5335,5336,5337,5338, -5339,5340,5341,5342,5343,1661,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353, -5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369, -5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385, -5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,1264,5399,5400, -5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,1662,5413,5414,5415, -5416,1663,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430, -5431,5432,5433,5434,5435,5436,5437,5438,1664,5439,5440,5441,5442,5443,5444,5445, -5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461, -5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477, -5478,1154,5479,5480,5481,5482,5483,5484,5485,1665,5486,5487,5488,5489,5490,5491, -5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507, -5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523, -5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539, -5540,5541,5542,5543,5544,5545,5546,5547,5548,1377,5549,5550,5551,5552,5553,5554, -5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570, -1114,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585, -5586,5587,5588,5589,5590,5591,5592,1378,5593,5594,5595,5596,5597,5598,5599,5600, -5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,1379,5615, -5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631, -5632,5633,5634,1380,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646, -5647,5648,5649,1381,1056,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660, -1666,5661,5662,5663,5664,5665,5666,5667,5668,1667,5669,1668,5670,5671,5672,5673, -5674,5675,5676,5677,5678,1155,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688, -5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,1669,5699,5700,5701,5702,5703, -5704,5705,1670,5706,5707,5708,5709,5710,1671,5711,5712,5713,5714,1382,5715,5716, -5717,5718,5719,5720,5721,5722,5723,5724,5725,1672,5726,5727,1673,1674,5728,5729, -5730,5731,5732,5733,5734,5735,5736,1675,5737,5738,5739,5740,5741,5742,5743,5744, -1676,5745,5746,5747,5748,5749,5750,5751,1383,5752,5753,5754,5755,5756,5757,5758, -5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,1677,5769,5770,5771,5772,5773, -1678,5774,5775,5776, 998,5777,5778,5779,5780,5781,5782,5783,5784,5785,1384,5786, -5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,1679,5801, -5802,5803,1115,1116,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815, -5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831, -5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847, -5848,5849,5850,5851,5852,5853,5854,5855,1680,5856,5857,5858,5859,5860,5861,5862, -5863,5864,1681,5865,5866,5867,1682,5868,5869,5870,5871,5872,5873,5874,5875,5876, -5877,5878,5879,1683,5880,1684,5881,5882,5883,5884,1685,5885,5886,5887,5888,5889, -5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905, -5906,5907,1686,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, -5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,1687, -5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951, -5952,1688,1689,5953,1199,5954,5955,5956,5957,5958,5959,5960,5961,1690,5962,5963, -5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979, -5980,5981,1385,5982,1386,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993, -5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6008,6009, -6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025, -6026,6027,1265,6028,6029,1691,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039, -6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055, -6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071, -6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,1692,6085,6086, -6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102, -6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118, -6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,1693,6132,6133, -6134,6135,6136,1694,6137,6138,6139,6140,6141,1695,6142,6143,6144,6145,6146,6147, -6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163, -6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179, -6180,6181,6182,6183,6184,6185,1696,6186,6187,6188,6189,6190,6191,6192,6193,6194, -6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210, -6211,6212,6213,6214,6215,6216,6217,6218,6219,1697,6220,6221,6222,6223,6224,6225, -6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241, -6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,1698,6254,6255,6256, -6257,6258,6259,6260,6261,6262,6263,1200,6264,6265,6266,6267,6268,6269,6270,6271, //1024 -6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287, -6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,1699, -6303,6304,1700,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317, -6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333, -6334,6335,6336,6337,6338,6339,1701,6340,6341,6342,6343,6344,1387,6345,6346,6347, -6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363, -6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379, -6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395, -6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411, -6412,6413,1702,6414,6415,6416,6417,6418,6419,6420,6421,6422,1703,6423,6424,6425, -6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,1704,6439,6440, -6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456, -6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472, -6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488, -6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,1266, -6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519, -6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533,6534,6535, -6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551, -1705,1706,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565, -6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581, -6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597, -6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613, -6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629, -6630,6631,6632,6633,6634,6635,6636,6637,1388,6638,6639,6640,6641,6642,6643,6644, -1707,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659, -6660,6661,6662,6663,1708,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674, -1201,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689, -6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705, -6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721, -6722,6723,6724,6725,1389,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736, -1390,1709,6737,6738,6739,6740,6741,6742,1710,6743,6744,6745,6746,1391,6747,6748, -6749,6750,6751,6752,6753,6754,6755,6756,6757,1392,6758,6759,6760,6761,6762,6763, -6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779, -6780,1202,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794, -6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,1711, -6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822,6823,6824,6825, -6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,1393,6837,6838,6839,6840, -6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856, -6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872, -6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888, -6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,1712,6903, -6904,6905,6906,6907,6908,6909,6910,1713,6911,6912,6913,6914,6915,6916,6917,6918, -6919,6920,6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934, -6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950, -6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966, -6967,6968,6969,6970,6971,6972,6973,6974,1714,6975,6976,6977,6978,6979,6980,6981, -6982,6983,6984,6985,6986,6987,6988,1394,6989,6990,6991,6992,6993,6994,6995,6996, -6997,6998,6999,7000,1715,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011, -7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027, -7028,1716,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042, -7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058, -7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074, -7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090, -7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106, -7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122, -7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138, -7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154, -7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170, -7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186, -7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202, -7203,7204,7205,7206,7207,1395,7208,7209,7210,7211,7212,7213,1717,7214,7215,7216, -7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232, -7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248, -7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264, -7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280, -7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296, -7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312, -7313,1718,7314,7315,7316,7317,7318,7319,7320,7321,7322,7323,7324,7325,7326,7327, -7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343, -7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359, -7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375, -7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391, -7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407, -7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418,7419,7420,7421,7422,7423, -7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439, -7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455, -7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471, -7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487, -7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503, -7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519, -7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535, -7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551, -7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, -7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583, -7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599, -7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615, -7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631, -7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647, -7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663, -7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679, -7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695, -7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711, -7712,7713,7714,7715,7716,7717,7718,7719,7720,7721,7722,7723,7724,7725,7726,7727, -7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743, -7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759, -7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775, -7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791, -7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807, -7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823, -7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839, -7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855, -7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871, -7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887, -7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903, -7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919, -7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, -7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, -7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, -7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, -7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, -8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, -8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, -8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, -8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, -8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, -8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, -8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, -8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, -8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, -8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, -8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, -8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, -8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, -8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, -8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, -8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, -8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, -8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287, -8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303, -8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319, -8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335, -8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351, -8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367, -8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383, -8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399, -8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415, -8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431, -8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447, -8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463, -8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479, -8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495, -8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511, -8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527, -8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543, -8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559, -8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575, -8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591, -8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607, -8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623, -8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639, -8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655, -8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671, -8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687, -8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, -8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719, -8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735, -8736,8737,8738,8739,8740,8741 -]; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/euckrprober.js b/tools/eslint/node_modules/jschardet/src/euckrprober.js deleted file mode 100755 index f55e42f07a9bb0..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/euckrprober.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCKRProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCKRSMModel); - self._mDistributionAnalyzer = new jschardet.EUCKRDistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "EUC-KR"; - } - - init(); -} -jschardet.EUCKRProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/euctwfreq.js b/tools/eslint/node_modules/jschardet/src/euctwfreq.js deleted file mode 100755 index c601e6c9108350..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/euctwfreq.js +++ /dev/null @@ -1,433 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// EUCTW frequency table -// Converted from big5 work -// by Taiwan's Mandarin Promotion Council -// - -// 128 --> 0.42261 -// 256 --> 0.57851 -// 512 --> 0.74851 -// 1024 --> 0.89384 -// 2048 --> 0.97583 -// -// Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 -// Random Distribution Ration = 512/(5401-512)=0.105 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR - -jschardet.EUCTW_TYPICAL_DISTRIBUTION_RATIO = 0.75; - -// Char to FreqOrder table , -jschardet.EUCTW_TABLE_SIZE = 8102; - -jschardet.EUCTWCharToFreqOrder = [ - 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, // 2742 -3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, // 2758 -1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, // 2774 - 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, // 2790 -3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, // 2806 -4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, // 2822 -7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, // 2838 - 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, // 2854 - 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, // 2870 - 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, // 2886 -2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, // 2902 -1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, // 2918 -3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, // 2934 - 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, // 2950 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, // 2966 -3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, // 2982 -2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, // 2998 - 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, // 3014 -3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, // 3030 -1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, // 3046 -7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, // 3062 - 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, // 3078 -7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, // 3094 -1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, // 3110 - 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, // 3126 - 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, // 3142 -3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, // 3158 -3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, // 3174 - 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, // 3190 -2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, // 3206 -2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, // 3222 - 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, // 3238 - 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, // 3254 -3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, // 3270 -1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, // 3286 -1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, // 3302 -1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, // 3318 -2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, // 3334 - 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, // 3350 -4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, // 3366 -1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, // 3382 -7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, // 3398 -2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, // 3414 - 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, // 3430 - 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, // 3446 - 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, // 3462 - 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, // 3478 -7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, // 3494 - 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, // 3510 -1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, // 3526 - 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, // 3542 - 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, // 3558 -7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, // 3574 -1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, // 3590 - 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, // 3606 -3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, // 3622 -4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, // 3638 -3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, // 3654 - 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, // 3670 - 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, // 3686 -1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, // 3702 -4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, // 3718 -3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, // 3734 -3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, // 3750 -2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, // 3766 -7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, // 3782 -3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, // 3798 -7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, // 3814 -1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, // 3830 -2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, // 3846 -1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, // 3862 - 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, // 3878 -1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, // 3894 -4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, // 3910 -3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, // 3926 - 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, // 3942 - 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, // 3958 - 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, // 3974 -2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, // 3990 -7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, // 4006 -1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, // 4022 -2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, // 4038 -1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, // 4054 -1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, // 4070 -7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, // 4086 -7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, // 4102 -7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, // 4118 -3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, // 4134 -4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, // 4150 -1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, // 4166 -7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, // 4182 -2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, // 4198 -7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, // 4214 -3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, // 4230 -3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, // 4246 -7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, // 4262 -2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, // 4278 -7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, // 4294 - 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, // 4310 -4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, // 4326 -2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, // 4342 -7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, // 4358 -3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, // 4374 -2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, // 4390 -2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, // 4406 - 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, // 4422 -2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, // 4438 -1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, // 4454 -1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, // 4470 -2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, // 4486 -1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, // 4502 -7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, // 4518 -7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, // 4534 -2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, // 4550 -4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, // 4566 -1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, // 4582 -7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, // 4598 - 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, // 4614 -4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, // 4630 - 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, // 4646 -2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, // 4662 - 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, // 4678 -1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, // 4694 -1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, // 4710 - 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, // 4726 -3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, // 4742 -3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, // 4758 -1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, // 4774 -3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, // 4790 -7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, // 4806 -7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, // 4822 -1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, // 4838 -2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, // 4854 -1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, // 4870 -3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, // 4886 -2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, // 4902 -3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, // 4918 -2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, // 4934 -4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, // 4950 -4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, // 4966 -3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, // 4982 - 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, // 4998 -3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, // 5014 - 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, // 5030 -3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, // 5046 -3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, // 5062 -3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, // 5078 -1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, // 5094 -7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, // 5110 - 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, // 5126 -7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, // 5142 -1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, // 5158 - 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, // 5174 -4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, // 5190 -3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, // 5206 - 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, // 5222 -2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, // 5238 -2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, // 5254 -3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, // 5270 -1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, // 5286 -4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, // 5302 -2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, // 5318 -1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, // 5334 -1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, // 5350 -2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, // 5366 -3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, // 5382 -1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, // 5398 -7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, // 5414 -1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, // 5430 -4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, // 5446 -1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, // 5462 - 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, // 5478 -1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, // 5494 -3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, // 5510 -3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, // 5526 -2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, // 5542 -1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, // 5558 -4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, // 5574 - 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, // 5590 -7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, // 5606 -2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, // 5622 -3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, // 5638 -4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, // 5654 - 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, // 5670 -7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, // 5686 -7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, // 5702 -1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, // 5718 -4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, // 5734 -3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, // 5750 -2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, // 5766 -3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, // 5782 -3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, // 5798 -2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, // 5814 -1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, // 5830 -4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, // 5846 -3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, // 5862 -3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, // 5878 -2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, // 5894 -4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, // 5910 -7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, // 5926 -3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, // 5942 -2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, // 5958 -3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, // 5974 -1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, // 5990 -2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, // 6006 -3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, // 6022 -4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, // 6038 -2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, // 6054 -2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, // 6070 -7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, // 6086 -1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, // 6102 -2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, // 6118 -1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, // 6134 -3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, // 6150 -4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, // 6166 -2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, // 6182 -3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, // 6198 -3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, // 6214 -2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, // 6230 -4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, // 6246 -2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, // 6262 -3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, // 6278 -4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, // 6294 -7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, // 6310 -3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, // 6326 - 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, // 6342 -1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, // 6358 -4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, // 6374 -1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, // 6390 -4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, // 6406 -7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, // 6422 - 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, // 6438 -7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, // 6454 -2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, // 6470 -1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, // 6486 -1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, // 6502 -3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, // 6518 - 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, // 6534 - 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, // 6550 - 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, // 6566 -3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, // 6582 -2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, // 6598 - 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, // 6614 -7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, // 6630 -1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, // 6646 -3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, // 6662 -7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, // 6678 -1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, // 6694 -7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, // 6710 -4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, // 6726 -1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, // 6742 -2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, // 6758 -2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, // 6774 -4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, // 6790 - 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, // 6806 - 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, // 6822 -3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, // 6838 -3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, // 6854 -1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, // 6870 -2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, // 6886 -7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, // 6902 -1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, // 6918 -1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, // 6934 -3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, // 6950 - 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, // 6966 -1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, // 6982 -4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, // 6998 -7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, // 7014 -2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, // 7030 -3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, // 7046 - 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, // 7062 -1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, // 7078 -2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, // 7094 -2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, // 7110 -7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, // 7126 -7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, // 7142 -7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, // 7158 -2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, // 7174 -2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, // 7190 -1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, // 7206 -4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, // 7222 -3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, // 7238 -3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, // 7254 -4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, // 7270 -4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, // 7286 -2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, // 7302 -2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, // 7318 -7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, // 7334 -4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, // 7350 -7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, // 7366 -2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, // 7382 -1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, // 7398 -3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, // 7414 -4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, // 7430 -2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, // 7446 - 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, // 7462 -2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, // 7478 -1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, // 7494 -2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, // 7510 -2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, // 7526 -4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, // 7542 -7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, // 7558 -1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, // 7574 -3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, // 7590 -7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, // 7606 -1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, // 7622 -8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, // 7638 -2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, // 7654 -8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, // 7670 -2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, // 7686 -2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, // 7702 -8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, // 7718 -8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, // 7734 -8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, // 7750 - 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, // 7766 -8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, // 7782 -4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, // 7798 -3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, // 7814 -8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, // 7830 -1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, // 7846 -8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, // 7862 - 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, // 7878 -1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, // 7894 - 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, // 7910 -4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, // 7926 -1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, // 7942 -4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, // 7958 -1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, // 7974 - 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, // 7990 -3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, // 8006 -4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, // 8022 -8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, // 8038 - 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, // 8054 -3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, // 8070 - 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, // 8086 -2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, // 8102 -//Everything below is of no interest for detection purpose -2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122, // 8118 -2493,3016,3734,8123,8124,2192,8125,8126,2162,8127,8128,8129,8130,8131,8132,8133, // 8134 -8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149, // 8150 -8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165, // 8166 -8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181, // 8182 -8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197, // 8198 -8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213, // 8214 -8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229, // 8230 -8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245, // 8246 -8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261, // 8262 -8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277, // 8278 -8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293, // 8294 -8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309, // 8310 -8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325, // 8326 -8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341, // 8342 -8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357, // 8358 -8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373, // 8374 -8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389, // 8390 -8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405, // 8406 -8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421, // 8422 -8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437, // 8438 -8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453, // 8454 -8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469, // 8470 -8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485, // 8486 -8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501, // 8502 -8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517, // 8518 -8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533, // 8534 -8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549, // 8550 -8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565, // 8566 -8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581, // 8582 -8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597, // 8598 -8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613, // 8614 -8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629, // 8630 -8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645, // 8646 -8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661, // 8662 -8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677, // 8678 -8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, // 8694 -8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, // 8710 -8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, // 8726 -8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741 -]; // 8742 - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/euctwprober.js b/tools/eslint/node_modules/jschardet/src/euctwprober.js deleted file mode 100755 index 97b9d2c1536b72..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/euctwprober.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.EUCTWProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.EUCTWSMModel); - self._mDistributionAnalyzer = new jschardet.EUCTWDistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "EUC-TW"; - } - - init(); -} -jschardet.EUCTWProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/gb2312freq.js b/tools/eslint/node_modules/jschardet/src/gb2312freq.js deleted file mode 100755 index 090b0f3f896688..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/gb2312freq.js +++ /dev/null @@ -1,477 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// GB2312 most frequently used character table -// -// Char to FreqOrder table , from hz6763 - -// 512 --> 0.79 -- 0.79 -// 1024 --> 0.92 -- 0.13 -// 2048 --> 0.98 -- 0.06 -// 6768 --> 1.00 -- 0.02 -// -// Ideal Distribution Ratio = 0.79135/(1-0.79135) = 3.79 -// Random Distribution Ration = 512 / (3755 - 512) = 0.157 -// -// Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR - -jschardet.GB2312_TYPICAL_DISTRIBUTION_RATIO = 0.9; - -jschardet.GB2312_TABLE_SIZE = 3760; - -jschardet.GB2312CharToFreqOrder = [ -1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, -2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, -2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, - 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, -1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, -1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, - 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, -1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, -2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, -3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, - 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, -1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, - 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, -2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, - 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, -2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, -1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, -3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, - 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, -1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, - 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, -2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, -1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, -3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, -1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, -2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, -1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, - 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, -3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, -3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, - 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, -3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, - 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, -1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, -3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, -2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, -1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, - 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, -1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, -4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, - 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, -3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, -3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, - 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, -1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, -2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, -1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, -1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, - 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, -3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, -3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, -4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, - 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, -3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, -1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, -1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, -4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, - 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, - 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, -3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, -1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, - 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, -1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, -2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, - 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, - 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, - 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, -3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, -4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, -3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, - 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, -2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, -2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, -2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, - 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, -2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, - 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, - 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, - 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, -3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, -2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, -2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, -1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, - 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, -2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, - 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, - 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, -1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, -1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, - 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, - 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, -1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, -2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, -3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, -2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, -2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, -2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, -3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, -1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, -1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, -2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, -1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, -3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, -1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, -1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, -3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, - 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, -2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, -1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, -4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, -1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, -1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, -3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, -1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, - 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, - 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, -1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, - 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, -1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, -1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, - 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, -3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, -4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, -3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, -2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, -2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, -1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, -3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, -2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, -1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, -1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, - 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, -2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, -2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, -3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, -4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, -3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, - 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, -3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, -2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, -1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, - 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, - 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, -3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, -4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, -2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, -1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, -1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, - 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, -1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, -3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, - 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, - 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, -1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, - 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, -1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, - 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, -2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, - 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, -2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, -2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, -1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, -1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, -2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, - 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, -1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, -1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, -2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, -2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, -3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, -1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, -4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, - 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, - 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, -3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, -1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, - 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, -3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, -1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, -4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, -1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, -2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, -1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, - 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, -1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, -3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, - 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, -2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, - 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, -1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, -1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, -1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, -3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, -2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, -3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, -3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, -3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, - 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, -2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, - 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, -2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, - 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, -1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, - 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, - 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, -1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, -3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, -3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, -1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, -1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, -3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, -2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, -2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, -1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, -3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, - 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, -4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, -1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, -2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, -3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, -3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, -1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, - 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, - 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, -2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, - 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, -1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, - 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, -1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, -1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, -1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, -1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, -1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, - 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, - 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, // last 512 -//Everything below is of no interest for detection purpose -5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636, -5509,3257,5510,5973,5445,5872,4941,4403,3174,4627,5873,6276,2286,4230,5446,5874, -5122,6102,6103,4162,5447,5123,5323,4849,6277,3980,3851,5066,4246,5774,5067,6278, -3001,2807,5695,3346,5775,5974,5158,5448,6487,5975,5976,5776,3598,6279,5696,4806, -4211,4154,6280,6488,6489,6490,6281,4212,5037,3374,4171,6491,4562,4807,4722,4827, -5977,6104,4532,4079,5159,5324,5160,4404,3858,5359,5875,3975,4288,4610,3486,4512, -5325,3893,5360,6282,6283,5560,2522,4231,5978,5186,5449,2569,3878,6284,5401,3578, -4415,6285,4656,5124,5979,2506,4247,4449,3219,3417,4334,4969,4329,6492,4576,4828, -4172,4416,4829,5402,6286,3927,3852,5361,4369,4830,4477,4867,5876,4173,6493,6105, -4657,6287,6106,5877,5450,6494,4155,4868,5451,3700,5629,4384,6288,6289,5878,3189, -4881,6107,6290,6495,4513,6496,4692,4515,4723,5100,3356,6497,6291,3810,4080,5561, -3570,4430,5980,6498,4355,5697,6499,4724,6108,6109,3764,4050,5038,5879,4093,3226, -6292,5068,5217,4693,3342,5630,3504,4831,4377,4466,4309,5698,4431,5777,6293,5778, -4272,3706,6110,5326,3752,4676,5327,4273,5403,4767,5631,6500,5699,5880,3475,5039, -6294,5562,5125,4348,4301,4482,4068,5126,4593,5700,3380,3462,5981,5563,3824,5404, -4970,5511,3825,4738,6295,6501,5452,4516,6111,5881,5564,6502,6296,5982,6503,4213, -4163,3454,6504,6112,4009,4450,6113,4658,6297,6114,3035,6505,6115,3995,4904,4739, -4563,4942,4110,5040,3661,3928,5362,3674,6506,5292,3612,4791,5565,4149,5983,5328, -5259,5021,4725,4577,4564,4517,4364,6298,5405,4578,5260,4594,4156,4157,5453,3592, -3491,6507,5127,5512,4709,4922,5984,5701,4726,4289,6508,4015,6116,5128,4628,3424, -4241,5779,6299,4905,6509,6510,5454,5702,5780,6300,4365,4923,3971,6511,5161,3270, -3158,5985,4100, 867,5129,5703,6117,5363,3695,3301,5513,4467,6118,6512,5455,4232, -4242,4629,6513,3959,4478,6514,5514,5329,5986,4850,5162,5566,3846,4694,6119,5456, -4869,5781,3779,6301,5704,5987,5515,4710,6302,5882,6120,4392,5364,5705,6515,6121, -6516,6517,3736,5988,5457,5989,4695,2457,5883,4551,5782,6303,6304,6305,5130,4971, -6122,5163,6123,4870,3263,5365,3150,4871,6518,6306,5783,5069,5706,3513,3498,4409, -5330,5632,5366,5458,5459,3991,5990,4502,3324,5991,5784,3696,4518,5633,4119,6519, -4630,5634,4417,5707,4832,5992,3418,6124,5993,5567,4768,5218,6520,4595,3458,5367, -6125,5635,6126,4202,6521,4740,4924,6307,3981,4069,4385,6308,3883,2675,4051,3834, -4302,4483,5568,5994,4972,4101,5368,6309,5164,5884,3922,6127,6522,6523,5261,5460, -5187,4164,5219,3538,5516,4111,3524,5995,6310,6311,5369,3181,3386,2484,5188,3464, -5569,3627,5708,6524,5406,5165,4677,4492,6312,4872,4851,5885,4468,5996,6313,5709, -5710,6128,2470,5886,6314,5293,4882,5785,3325,5461,5101,6129,5711,5786,6525,4906, -6526,6527,4418,5887,5712,4808,2907,3701,5713,5888,6528,3765,5636,5331,6529,6530, -3593,5889,3637,4943,3692,5714,5787,4925,6315,6130,5462,4405,6131,6132,6316,5262, -6531,6532,5715,3859,5716,5070,4696,5102,3929,5788,3987,4792,5997,6533,6534,3920, -4809,5000,5998,6535,2974,5370,6317,5189,5263,5717,3826,6536,3953,5001,4883,3190, -5463,5890,4973,5999,4741,6133,6134,3607,5570,6000,4711,3362,3630,4552,5041,6318, -6001,2950,2953,5637,4646,5371,4944,6002,2044,4120,3429,6319,6537,5103,4833,6538, -6539,4884,4647,3884,6003,6004,4758,3835,5220,5789,4565,5407,6540,6135,5294,4697, -4852,6320,6321,3206,4907,6541,6322,4945,6542,6136,6543,6323,6005,4631,3519,6544, -5891,6545,5464,3784,5221,6546,5571,4659,6547,6324,6137,5190,6548,3853,6549,4016, -4834,3954,6138,5332,3827,4017,3210,3546,4469,5408,5718,3505,4648,5790,5131,5638, -5791,5465,4727,4318,6325,6326,5792,4553,4010,4698,3439,4974,3638,4335,3085,6006, -5104,5042,5166,5892,5572,6327,4356,4519,5222,5573,5333,5793,5043,6550,5639,5071, -4503,6328,6139,6551,6140,3914,3901,5372,6007,5640,4728,4793,3976,3836,4885,6552, -4127,6553,4451,4102,5002,6554,3686,5105,6555,5191,5072,5295,4611,5794,5296,6556, -5893,5264,5894,4975,5466,5265,4699,4976,4370,4056,3492,5044,4886,6557,5795,4432, -4769,4357,5467,3940,4660,4290,6141,4484,4770,4661,3992,6329,4025,4662,5022,4632, -4835,4070,5297,4663,4596,5574,5132,5409,5895,6142,4504,5192,4664,5796,5896,3885, -5575,5797,5023,4810,5798,3732,5223,4712,5298,4084,5334,5468,6143,4052,4053,4336, -4977,4794,6558,5335,4908,5576,5224,4233,5024,4128,5469,5225,4873,6008,5045,4729, -4742,4633,3675,4597,6559,5897,5133,5577,5003,5641,5719,6330,6560,3017,2382,3854, -4406,4811,6331,4393,3964,4946,6561,2420,3722,6562,4926,4378,3247,1736,4442,6332, -5134,6333,5226,3996,2918,5470,4319,4003,4598,4743,4744,4485,3785,3902,5167,5004, -5373,4394,5898,6144,4874,1793,3997,6334,4085,4214,5106,5642,4909,5799,6009,4419, -4189,3330,5899,4165,4420,5299,5720,5227,3347,6145,4081,6335,2876,3930,6146,3293, -3786,3910,3998,5900,5300,5578,2840,6563,5901,5579,6147,3531,5374,6564,6565,5580, -4759,5375,6566,6148,3559,5643,6336,6010,5517,6337,6338,5721,5902,3873,6011,6339, -6567,5518,3868,3649,5722,6568,4771,4947,6569,6149,4812,6570,2853,5471,6340,6341, -5644,4795,6342,6012,5723,6343,5724,6013,4349,6344,3160,6150,5193,4599,4514,4493, -5168,4320,6345,4927,3666,4745,5169,5903,5005,4928,6346,5725,6014,4730,4203,5046, -4948,3395,5170,6015,4150,6016,5726,5519,6347,5047,3550,6151,6348,4197,4310,5904, -6571,5581,2965,6152,4978,3960,4291,5135,6572,5301,5727,4129,4026,5905,4853,5728, -5472,6153,6349,4533,2700,4505,5336,4678,3583,5073,2994,4486,3043,4554,5520,6350, -6017,5800,4487,6351,3931,4103,5376,6352,4011,4321,4311,4190,5136,6018,3988,3233, -4350,5906,5645,4198,6573,5107,3432,4191,3435,5582,6574,4139,5410,6353,5411,3944, -5583,5074,3198,6575,6354,4358,6576,5302,4600,5584,5194,5412,6577,6578,5585,5413, -5303,4248,5414,3879,4433,6579,4479,5025,4854,5415,6355,4760,4772,3683,2978,4700, -3797,4452,3965,3932,3721,4910,5801,6580,5195,3551,5907,3221,3471,3029,6019,3999, -5908,5909,5266,5267,3444,3023,3828,3170,4796,5646,4979,4259,6356,5647,5337,3694, -6357,5648,5338,4520,4322,5802,3031,3759,4071,6020,5586,4836,4386,5048,6581,3571, -4679,4174,4949,6154,4813,3787,3402,3822,3958,3215,3552,5268,4387,3933,4950,4359, -6021,5910,5075,3579,6358,4234,4566,5521,6359,3613,5049,6022,5911,3375,3702,3178, -4911,5339,4521,6582,6583,4395,3087,3811,5377,6023,6360,6155,4027,5171,5649,4421, -4249,2804,6584,2270,6585,4000,4235,3045,6156,5137,5729,4140,4312,3886,6361,4330, -6157,4215,6158,3500,3676,4929,4331,3713,4930,5912,4265,3776,3368,5587,4470,4855, -3038,4980,3631,6159,6160,4132,4680,6161,6362,3923,4379,5588,4255,6586,4121,6587, -6363,4649,6364,3288,4773,4774,6162,6024,6365,3543,6588,4274,3107,3737,5050,5803, -4797,4522,5589,5051,5730,3714,4887,5378,4001,4523,6163,5026,5522,4701,4175,2791, -3760,6589,5473,4224,4133,3847,4814,4815,4775,3259,5416,6590,2738,6164,6025,5304, -3733,5076,5650,4816,5590,6591,6165,6592,3934,5269,6593,3396,5340,6594,5804,3445, -3602,4042,4488,5731,5732,3525,5591,4601,5196,6166,6026,5172,3642,4612,3202,4506, -4798,6366,3818,5108,4303,5138,5139,4776,3332,4304,2915,3415,4434,5077,5109,4856, -2879,5305,4817,6595,5913,3104,3144,3903,4634,5341,3133,5110,5651,5805,6167,4057, -5592,2945,4371,5593,6596,3474,4182,6367,6597,6168,4507,4279,6598,2822,6599,4777, -4713,5594,3829,6169,3887,5417,6170,3653,5474,6368,4216,2971,5228,3790,4579,6369, -5733,6600,6601,4951,4746,4555,6602,5418,5475,6027,3400,4665,5806,6171,4799,6028, -5052,6172,3343,4800,4747,5006,6370,4556,4217,5476,4396,5229,5379,5477,3839,5914, -5652,5807,4714,3068,4635,5808,6173,5342,4192,5078,5419,5523,5734,6174,4557,6175, -4602,6371,6176,6603,5809,6372,5735,4260,3869,5111,5230,6029,5112,6177,3126,4681, -5524,5915,2706,3563,4748,3130,6178,4018,5525,6604,6605,5478,4012,4837,6606,4534, -4193,5810,4857,3615,5479,6030,4082,3697,3539,4086,5270,3662,4508,4931,5916,4912, -5811,5027,3888,6607,4397,3527,3302,3798,2775,2921,2637,3966,4122,4388,4028,4054, -1633,4858,5079,3024,5007,3982,3412,5736,6608,3426,3236,5595,3030,6179,3427,3336, -3279,3110,6373,3874,3039,5080,5917,5140,4489,3119,6374,5812,3405,4494,6031,4666, -4141,6180,4166,6032,5813,4981,6609,5081,4422,4982,4112,3915,5653,3296,3983,6375, -4266,4410,5654,6610,6181,3436,5082,6611,5380,6033,3819,5596,4535,5231,5306,5113, -6612,4952,5918,4275,3113,6613,6376,6182,6183,5814,3073,4731,4838,5008,3831,6614, -4888,3090,3848,4280,5526,5232,3014,5655,5009,5737,5420,5527,6615,5815,5343,5173, -5381,4818,6616,3151,4953,6617,5738,2796,3204,4360,2989,4281,5739,5174,5421,5197, -3132,5141,3849,5142,5528,5083,3799,3904,4839,5480,2880,4495,3448,6377,6184,5271, -5919,3771,3193,6034,6035,5920,5010,6036,5597,6037,6378,6038,3106,5422,6618,5423, -5424,4142,6619,4889,5084,4890,4313,5740,6620,3437,5175,5307,5816,4199,5198,5529, -5817,5199,5656,4913,5028,5344,3850,6185,2955,5272,5011,5818,4567,4580,5029,5921, -3616,5233,6621,6622,6186,4176,6039,6379,6380,3352,5200,5273,2908,5598,5234,3837, -5308,6623,6624,5819,4496,4323,5309,5201,6625,6626,4983,3194,3838,4167,5530,5922, -5274,6381,6382,3860,3861,5599,3333,4292,4509,6383,3553,5481,5820,5531,4778,6187, -3955,3956,4324,4389,4218,3945,4325,3397,2681,5923,4779,5085,4019,5482,4891,5382, -5383,6040,4682,3425,5275,4094,6627,5310,3015,5483,5657,4398,5924,3168,4819,6628, -5925,6629,5532,4932,4613,6041,6630,4636,6384,4780,4204,5658,4423,5821,3989,4683, -5822,6385,4954,6631,5345,6188,5425,5012,5384,3894,6386,4490,4104,6632,5741,5053, -6633,5823,5926,5659,5660,5927,6634,5235,5742,5824,4840,4933,4820,6387,4859,5928, -4955,6388,4143,3584,5825,5346,5013,6635,5661,6389,5014,5484,5743,4337,5176,5662, -6390,2836,6391,3268,6392,6636,6042,5236,6637,4158,6638,5744,5663,4471,5347,3663, -4123,5143,4293,3895,6639,6640,5311,5929,5826,3800,6189,6393,6190,5664,5348,3554, -3594,4749,4603,6641,5385,4801,6043,5827,4183,6642,5312,5426,4761,6394,5665,6191, -4715,2669,6643,6644,5533,3185,5427,5086,5930,5931,5386,6192,6044,6645,4781,4013, -5745,4282,4435,5534,4390,4267,6045,5746,4984,6046,2743,6193,3501,4087,5485,5932, -5428,4184,4095,5747,4061,5054,3058,3862,5933,5600,6646,5144,3618,6395,3131,5055, -5313,6396,4650,4956,3855,6194,3896,5202,4985,4029,4225,6195,6647,5828,5486,5829, -3589,3002,6648,6397,4782,5276,6649,6196,6650,4105,3803,4043,5237,5830,6398,4096, -3643,6399,3528,6651,4453,3315,4637,6652,3984,6197,5535,3182,3339,6653,3096,2660, -6400,6654,3449,5934,4250,4236,6047,6401,5831,6655,5487,3753,4062,5832,6198,6199, -6656,3766,6657,3403,4667,6048,6658,4338,2897,5833,3880,2797,3780,4326,6659,5748, -5015,6660,5387,4351,5601,4411,6661,3654,4424,5935,4339,4072,5277,4568,5536,6402, -6662,5238,6663,5349,5203,6200,5204,6201,5145,4536,5016,5056,4762,5834,4399,4957, -6202,6403,5666,5749,6664,4340,6665,5936,5177,5667,6666,6667,3459,4668,6404,6668, -6669,4543,6203,6670,4276,6405,4480,5537,6671,4614,5205,5668,6672,3348,2193,4763, -6406,6204,5937,5602,4177,5669,3419,6673,4020,6205,4443,4569,5388,3715,3639,6407, -6049,4058,6206,6674,5938,4544,6050,4185,4294,4841,4651,4615,5488,6207,6408,6051, -5178,3241,3509,5835,6208,4958,5836,4341,5489,5278,6209,2823,5538,5350,5206,5429, -6675,4638,4875,4073,3516,4684,4914,4860,5939,5603,5389,6052,5057,3237,5490,3791, -6676,6409,6677,4821,4915,4106,5351,5058,4243,5539,4244,5604,4842,4916,5239,3028, -3716,5837,5114,5605,5390,5940,5430,6210,4332,6678,5540,4732,3667,3840,6053,4305, -3408,5670,5541,6410,2744,5240,5750,6679,3234,5606,6680,5607,5671,3608,4283,4159, -4400,5352,4783,6681,6411,6682,4491,4802,6211,6412,5941,6413,6414,5542,5751,6683, -4669,3734,5942,6684,6415,5943,5059,3328,4670,4144,4268,6685,6686,6687,6688,4372, -3603,6689,5944,5491,4373,3440,6416,5543,4784,4822,5608,3792,4616,5838,5672,3514, -5391,6417,4892,6690,4639,6691,6054,5673,5839,6055,6692,6056,5392,6212,4038,5544, -5674,4497,6057,6693,5840,4284,5675,4021,4545,5609,6418,4454,6419,6213,4113,4472, -5314,3738,5087,5279,4074,5610,4959,4063,3179,4750,6058,6420,6214,3476,4498,4716, -5431,4960,4685,6215,5241,6694,6421,6216,6695,5841,5945,6422,3748,5946,5179,3905, -5752,5545,5947,4374,6217,4455,6423,4412,6218,4803,5353,6696,3832,5280,6219,4327, -4702,6220,6221,6059,4652,5432,6424,3749,4751,6425,5753,4986,5393,4917,5948,5030, -5754,4861,4733,6426,4703,6697,6222,4671,5949,4546,4961,5180,6223,5031,3316,5281, -6698,4862,4295,4934,5207,3644,6427,5842,5950,6428,6429,4570,5843,5282,6430,6224, -5088,3239,6060,6699,5844,5755,6061,6431,2701,5546,6432,5115,5676,4039,3993,3327, -4752,4425,5315,6433,3941,6434,5677,4617,4604,3074,4581,6225,5433,6435,6226,6062, -4823,5756,5116,6227,3717,5678,4717,5845,6436,5679,5846,6063,5847,6064,3977,3354, -6437,3863,5117,6228,5547,5394,4499,4524,6229,4605,6230,4306,4500,6700,5951,6065, -3693,5952,5089,4366,4918,6701,6231,5548,6232,6702,6438,4704,5434,6703,6704,5953, -4168,6705,5680,3420,6706,5242,4407,6066,3812,5757,5090,5954,4672,4525,3481,5681, -4618,5395,5354,5316,5955,6439,4962,6707,4526,6440,3465,4673,6067,6441,5682,6708, -5435,5492,5758,5683,4619,4571,4674,4804,4893,4686,5493,4753,6233,6068,4269,6442, -6234,5032,4705,5146,5243,5208,5848,6235,6443,4963,5033,4640,4226,6236,5849,3387, -6444,6445,4436,4437,5850,4843,5494,4785,4894,6709,4361,6710,5091,5956,3331,6237, -4987,5549,6069,6711,4342,3517,4473,5317,6070,6712,6071,4706,6446,5017,5355,6713, -6714,4988,5436,6447,4734,5759,6715,4735,4547,4456,4754,6448,5851,6449,6450,3547, -5852,5318,6451,6452,5092,4205,6716,6238,4620,4219,5611,6239,6072,4481,5760,5957, -5958,4059,6240,6453,4227,4537,6241,5761,4030,4186,5244,5209,3761,4457,4876,3337, -5495,5181,6242,5959,5319,5612,5684,5853,3493,5854,6073,4169,5613,5147,4895,6074, -5210,6717,5182,6718,3830,6243,2798,3841,6075,6244,5855,5614,3604,4606,5496,5685, -5118,5356,6719,6454,5960,5357,5961,6720,4145,3935,4621,5119,5962,4261,6721,6455, -4786,5963,4375,4582,6245,6246,6247,6076,5437,4877,5856,3376,4380,6248,4160,6722, -5148,6456,5211,6457,6723,4718,6458,6724,6249,5358,4044,3297,6459,6250,5857,5615, -5497,5245,6460,5498,6725,6251,6252,5550,3793,5499,2959,5396,6461,6462,4572,5093, -5500,5964,3806,4146,6463,4426,5762,5858,6077,6253,4755,3967,4220,5965,6254,4989, -5501,6464,4352,6726,6078,4764,2290,5246,3906,5438,5283,3767,4964,2861,5763,5094, -6255,6256,4622,5616,5859,5860,4707,6727,4285,4708,4824,5617,6257,5551,4787,5212, -4965,4935,4687,6465,6728,6466,5686,6079,3494,4413,2995,5247,5966,5618,6729,5967, -5764,5765,5687,5502,6730,6731,6080,5397,6467,4990,6258,6732,4538,5060,5619,6733, -4719,5688,5439,5018,5149,5284,5503,6734,6081,4607,6259,5120,3645,5861,4583,6260, -4584,4675,5620,4098,5440,6261,4863,2379,3306,4585,5552,5689,4586,5285,6735,4864, -6736,5286,6082,6737,4623,3010,4788,4381,4558,5621,4587,4896,3698,3161,5248,4353, -4045,6262,3754,5183,4588,6738,6263,6739,6740,5622,3936,6741,6468,6742,6264,5095, -6469,4991,5968,6743,4992,6744,6083,4897,6745,4256,5766,4307,3108,3968,4444,5287, -3889,4343,6084,4510,6085,4559,6086,4898,5969,6746,5623,5061,4919,5249,5250,5504, -5441,6265,5320,4878,3242,5862,5251,3428,6087,6747,4237,5624,5442,6266,5553,4539, -6748,2585,3533,5398,4262,6088,5150,4736,4438,6089,6267,5505,4966,6749,6268,6750, -6269,5288,5554,3650,6090,6091,4624,6092,5690,6751,5863,4270,5691,4277,5555,5864, -6752,5692,4720,4865,6470,5151,4688,4825,6753,3094,6754,6471,3235,4653,6755,5213, -5399,6756,3201,4589,5865,4967,6472,5866,6473,5019,3016,6757,5321,4756,3957,4573, -6093,4993,5767,4721,6474,6758,5625,6759,4458,6475,6270,6760,5556,4994,5214,5252, -6271,3875,5768,6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970, -3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703, -5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978, -4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767 -]; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/gb2312prober.js b/tools/eslint/node_modules/jschardet/src/gb2312prober.js deleted file mode 100755 index 99b6bdc949942a..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/gb2312prober.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.GB2312Prober = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.GB2312SMModel); - self._mDistributionAnalyzer = new jschardet.GB2312DistributionAnalysis(); - self.reset(); - } - - this.getCharsetName = function() { - return "GB2312"; - } - - init(); -} -jschardet.GB2312Prober.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/hebrewprober.js b/tools/eslint/node_modules/jschardet/src/hebrewprober.js deleted file mode 100755 index b2e48cecc5685a..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/hebrewprober.js +++ /dev/null @@ -1,322 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// This prober doesn't actually recognize a language or a charset. -// It is a helper prober for the use of the Hebrew model probers - -////// General ideas of the Hebrew charset recognition ////// -// -// Four main charsets exist in Hebrew: -// "ISO-8859-8" - Visual Hebrew -// "windows-1255" - Logical Hebrew -// "ISO-8859-8-I" - Logical Hebrew -// "x-mac-hebrew" - ?? Logical Hebrew ?? -// -// Both "ISO" charsets use a completely identical set of code points, whereas -// "windows-1255" and "x-mac-hebrew" are two different proper supersets of -// these code points. windows-1255 defines additional characters in the range -// 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific -// diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. -// x-mac-hebrew defines similar additional code points but with a different -// mapping. -// -// As far as an average Hebrew text with no diacritics is concerned, all four -// charsets are identical with respect to code points. Meaning that for the -// main Hebrew alphabet, all four map the same values to all 27 Hebrew letters -// (including final letters). -// -// The dominant difference between these charsets is their directionality. -// "Visual" directionality means that the text is ordered as if the renderer is -// not aware of a BIDI rendering algorithm. The renderer sees the text and -// draws it from left to right. The text itself when ordered naturally is read -// backwards. A buffer of Visual Hebrew generally looks like so: -// "[last word of first line spelled backwards] [whole line ordered backwards -// and spelled backwards] [first word of first line spelled backwards] -// [end of line] [last word of second line] ... etc' " -// adding punctuation marks, numbers and English text to visual text is -// naturally also "visual" and from left to right. -// -// "Logical" directionality means the text is ordered "naturally" according to -// the order it is read. It is the responsibility of the renderer to display -// the text from right to left. A BIDI algorithm is used to place general -// punctuation marks, numbers and English text in the text. -// -// Texts in x-mac-hebrew are almost impossible to find on the Internet. From -// what little evidence I could find, it seems that its general directionality -// is Logical. -// -// To sum up all of the above, the Hebrew probing mechanism knows about two -// charsets: -// Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are -// backwards while line order is natural. For charset recognition purposes -// the line order is unimportant (In fact, for this implementation, even -// word order is unimportant). -// Logical Hebrew - "windows-1255" - normal, naturally ordered text. -// -// "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be -// specifically identified. -// "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew -// that contain special punctuation marks or diacritics is displayed with -// some unconverted characters showing as question marks. This problem might -// be corrected using another model prober for x-mac-hebrew. Due to the fact -// that x-mac-hebrew texts are so rare, writing another model prober isn't -// worth the effort and performance hit. -// -//////// The Prober //////// -// -// The prober is divided between two SBCharSetProbers and a HebrewProber, -// all of which are managed, created, fed data, inquired and deleted by the -// SBCSGroupProber. The two SBCharSetProbers identify that the text is in -// fact some kind of Hebrew, Logical or Visual. The final decision about which -// one is it is made by the HebrewProber by combining final-letter scores -// with the scores of the two SBCharSetProbers to produce a final answer. -// -// The SBCSGroupProber is responsible for stripping the original text of HTML -// tags, English characters, numbers, low-ASCII punctuation characters, spaces -// and new lines. It reduces any sequence of such characters to a single space. -// The buffer fed to each prober in the SBCS group prober is pure text in -// high-ASCII. -// The two SBCharSetProbers (model probers) share the same language model: -// Win1255Model. -// The first SBCharSetProber uses the model normally as any other -// SBCharSetProber does, to recognize windows-1255, upon which this model was -// built. The second SBCharSetProber is told to make the pair-of-letter -// lookup in the language model backwards. This in practice exactly simulates -// a visual Hebrew model using the windows-1255 logical Hebrew model. -// -// The HebrewProber is not using any language model. All it does is look for -// final-letter evidence suggesting the text is either logical Hebrew or visual -// Hebrew. Disjointed from the model probers, the results of the HebrewProber -// alone are meaningless. HebrewProber always returns 0.00 as confidence -// since it never identifies a charset by itself. Instead, the pointer to the -// HebrewProber is passed to the model probers as a helper "Name Prober". -// When the Group prober receives a positive identification from any prober, -// it asks for the name of the charset identified. If the prober queried is a -// Hebrew model prober, the model prober forwards the call to the -// HebrewProber to make the final decision. In the HebrewProber, the -// decision is made according to the final-letters scores maintained and Both -// model probers scores. The answer is returned in the form of the name of the -// charset identified, either "windows-1255" or "ISO-8859-8". - -jschardet.HebrewProber = function() { - jschardet.CharSetProber.apply(this); - - // windows-1255 / ISO-8859-8 code points of interest - var FINAL_KAF = '\xea' - var NORMAL_KAF = '\xeb' - var FINAL_MEM = '\xed' - var NORMAL_MEM = '\xee' - var FINAL_NUN = '\xef' - var NORMAL_NUN = '\xf0' - var FINAL_PE = '\xf3' - var NORMAL_PE = '\xf4' - var FINAL_TSADI = '\xf5' - var NORMAL_TSADI = '\xf6' - - // Minimum Visual vs Logical final letter score difference. - // If the difference is below this, don't rely solely on the final letter score distance. - var MIN_FINAL_CHAR_DISTANCE = 5 - - // Minimum Visual vs Logical model score difference. - // If the difference is below this, don't rely at all on the model score distance. - var MIN_MODEL_DISTANCE = 0.01 - - var VISUAL_HEBREW_NAME = "ISO-8859-8" - var LOGICAL_HEBREW_NAME = "windows-1255" - var self = this; - - function init() { - self._mLogicalProber = null; - self._mVisualProber = null; - self.reset(); - } - - this.reset = function() { - this._mFinalCharLogicalScore = 0; - this._mFinalCharVisualScore = 0; - // The two last characters seen in the previous buffer, - // mPrev and mBeforePrev are initialized to space in order to simulate a word - // delimiter at the beginning of the data - this._mPrev = " "; - this._mBeforePrev = " "; - // These probers are owned by the group prober. - } - - this.setModelProbers = function(logicalProber, visualProber) { - this._mLogicalProber = logicalProber; - this._mVisualProber = visualProber; - } - - this.isFinal = function(c) { - return [FINAL_KAF, FINAL_MEM, FINAL_NUN, FINAL_PE, FINAL_TSADI].indexOf(c) != -1; - } - - this.isNonFinal = function(c) { - // The normal Tsadi is not a good Non-Final letter due to words like - // 'lechotet' (to chat) containing an apostrophe after the tsadi. This - // apostrophe is converted to a space in FilterWithoutEnglishLetters causing - // the Non-Final tsadi to appear at an end of a word even though this is not - // the case in the original text. - // The letters Pe and Kaf rarely display a related behavior of not being a - // good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' for - // example legally end with a Non-Final Pe or Kaf. However, the benefit of - // these letters as Non-Final letters outweighs the damage since these words - // are quite rare. - return [NORMAL_KAF, NORMAL_MEM, NORMAL_NUN, NORMAL_PE].indexOf(c) != -1; - } - - this.feed = function(aBuf) { - // Final letter analysis for logical-visual decision. - // Look for evidence that the received buffer is either logical Hebrew or - // visual Hebrew. - // The following cases are checked: - // 1) A word longer than 1 letter, ending with a final letter. This is an - // indication that the text is laid out "naturally" since the final letter - // really appears at the end. +1 for logical score. - // 2) A word longer than 1 letter, ending with a Non-Final letter. In normal - // Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, should not end with - // the Non-Final form of that letter. Exceptions to this rule are mentioned - // above in isNonFinal(). This is an indication that the text is laid out - // backwards. +1 for visual score - // 3) A word longer than 1 letter, starting with a final letter. Final letters - // should not appear at the beginning of a word. This is an indication that - // the text is laid out backwards. +1 for visual score. - // - // The visual score and logical score are accumulated throughout the text and - // are finally checked against each other in GetCharSetName(). - // No checking for final letters in the middle of words is done since that case - // is not an indication for either Logical or Visual text. - // - // We automatically filter out all 7-bit characters (replace them with spaces) - // so the word boundary detection works properly. [MAP] - - if( this.getState() == jschardet.Constants.notMe ) { - // Both model probers say it's not them. No reason to continue. - return jschardet.Constants.notMe; - } - - aBuf = this.filterHighBitOnly(aBuf); - - for( var i = 0, cur; i < aBuf.length; i++ ) { - cur = aBuf[i]; - if( cur == " " ) { - // We stand on a space - a word just ended - if( this._mBeforePrev != " " ) { - // next-to-last char was not a space so self._mPrev is not a 1 letter word - if( this.isFinal(this._mPrev) ) { - // case (1) [-2:not space][-1:final letter][cur:space] - this._mFinalCharLogicalScore++; - } else if( this.isNonFinal(this._mPrev) ) { - // case (2) [-2:not space][-1:Non-Final letter][cur:space] - this._mFinalCharVisualScore++; - } - } - } else { - // Not standing on a space - if( this._mBeforePrev == " " && this.isFinal(this._mPrev) && cur != " " ) { - // case (3) [-2:space][-1:final letter][cur:not space] - this._mFinalCharVisualScore++; - } - } - this._mBeforePrev = this._mPrev; - this._mPrev = cur; - } - // Forever detecting, till the end or until both model probers return eNotMe (handled above) - return jschardet.Constants.detecting; - } - - this.getCharsetName = function() { - // Make the decision: is it Logical or Visual? - // If the final letter score distance is dominant enough, rely on it. - var finalsub = this._mFinalCharLogicalScore - this._mFinalCharVisualScore; - if( finalsub >= MIN_FINAL_CHAR_DISTANCE ) { - return LOGICAL_HEBREW_NAME; - } - if( finalsub <= -MIN_FINAL_CHAR_DISTANCE ) { - return VISUAL_HEBREW_NAME; - } - - // It's not dominant enough, try to rely on the model scores instead. - var modelsub = this._mLogicalProber.getConfidence() - this._mVisualProber.getConfidence(); - if( modelsub > MIN_MODEL_DISTANCE ) { - return LOGICAL_HEBREW_NAME; - } - if( modelsub < -MIN_MODEL_DISTANCE ) { - return VISUAL_HEBREW_NAME; - } - - // Still no good, back to final letter distance, maybe it'll save the day. - if( finalsub < 0 ) { - return VISUAL_HEBREW_NAME; - } - - // (finalsub > 0 - Logical) or (don't know what to do) default to Logical. - return LOGICAL_HEBREW_NAME; - } - - this.getState = function() { - // Remain active as long as any of the model probers are active. - if( this._mLogicalProber.getState() == jschardet.Constants.notMe && - this._mVisualProber.getState() == jschardet.Constants.notMe ) { - return jschardet.Constants.notMe; - } - return jschardet.Constants.detecting; - } - - init(); -} -jschardet.HebrewProber.prototype = new jschardet.CharSetProber(); - -// https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/IndexOf -if (!Array.prototype.indexOf) -{ - Array.prototype.indexOf = function(elt /*, from*/) - { - var len = this.length >>> 0; - - var from = Number(arguments[1]) || 0; - from = (from < 0) - ? Math.ceil(from) - : Math.floor(from); - if (from < 0) - from += len; - - for (; from < len; from++) - { - if (from in this && - this[from] === elt) - return from; - } - return -1; - }; -} - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/index.js b/tools/eslint/node_modules/jschardet/src/index.js deleted file mode 100755 index afbb15384bde42..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./init') \ No newline at end of file diff --git a/tools/eslint/node_modules/jschardet/src/init.js b/tools/eslint/node_modules/jschardet/src/init.js deleted file mode 100755 index 4987bc80b94c89..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/init.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -var jschardet = exports; - -require('./constants'); -require('./codingstatemachine'); -require('./escsm'); -require('./mbcssm'); -require('./charsetprober'); -require('./mbcharsetprober'); -require('./jisfreq'); -require('./gb2312freq'); -require('./euckrfreq'); -require('./big5freq'); -require('./euctwfreq'); -require('./chardistribution'); -require('./jpcntx'); -require('./sjisprober'); -require('./utf8prober'); -require('./charsetgroupprober'); -require('./eucjpprober'); -require('./gb2312prober'); -require('./euckrprober'); -require('./big5prober'); -require('./euctwprober'); -require('./mbcsgroupprober'); -require('./sbcharsetprober'); -require('./langgreekmodel'); -require('./langthaimodel'); -require('./langbulgarianmodel'); -require('./langcyrillicmodel'); -require('./hebrewprober'); -require('./langhebrewmodel'); -require('./langhungarianmodel'); -require('./sbcsgroupprober'); -require('./latin1prober'); -require('./escprober'); -require('./universaldetector'); - -jschardet.VERSION = "1.4.1"; -jschardet.detect = function(buffer) { - var u = new jschardet.UniversalDetector(); - u.reset(); - if( typeof Buffer == 'function' && buffer instanceof Buffer ) { - u.feed(buffer.toString('binary')); - } else { - u.feed(buffer); - } - u.close(); - return u.result; -} -jschardet.log = function() { - console.log.apply(console, arguments); -} diff --git a/tools/eslint/node_modules/jschardet/src/jisfreq.js b/tools/eslint/node_modules/jschardet/src/jisfreq.js deleted file mode 100755 index f58b79b5d42176..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/jisfreq.js +++ /dev/null @@ -1,573 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// Sampling from about 20M text materials include literature and computer technology -// -// Japanese frequency table, applied to both S-JIS and EUC-JP -// They are sorted in order. -// -// 128 --> 0.77094 -// 256 --> 0.85710 -// 512 --> 0.92635 -// 1024 --> 0.97130 -// 2048 --> 0.99431 -// -// Ideal Distribution Ratio = 0.92635 / (1-0.92635) = 12.58 -// Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191 -// -// Typical Distribution Ratio, 25% of IDR - -jschardet.JIS_TYPICAL_DISTRIBUTION_RATIO = 3.0; - -jschardet.JIS_TABLE_SIZE = 4368; - -jschardet.JISCharToFreqOrder = [ - 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, // 16 -3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, // 32 -1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, // 48 -2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, // 64 -2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, // 80 -5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, // 96 -1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, // 112 -5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, // 128 -5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, // 144 -5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, // 160 -5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, // 176 -5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, // 192 -5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, // 208 -1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, // 224 -1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, // 240 -1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, // 256 -2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, // 272 -3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, // 288 -3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, // 304 - 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, // 320 - 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, // 336 -1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, // 352 - 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, // 368 -5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, // 384 - 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, // 400 - 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, // 416 - 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, // 432 - 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, // 448 - 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, // 464 -5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, // 480 -5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, // 496 -5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, // 512 -4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, // 528 -5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, // 544 -5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, // 560 -5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, // 576 -5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, // 592 -5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, // 608 -5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, // 624 -5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, // 640 -5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, // 656 -5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, // 672 -3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, // 688 -5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, // 704 -5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, // 720 -5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, // 736 -5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, // 752 -5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, // 768 -5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, // 784 -5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, // 800 -5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, // 816 -5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, // 832 -5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, // 848 -5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, // 864 -5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, // 880 -5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, // 896 -5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, // 912 -5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, // 928 -5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, // 944 -5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, // 960 -5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, // 976 -5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, // 992 -5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, // 1008 -5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, // 1024 -5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, // 1040 -5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, // 1056 -5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, // 1072 -5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, // 1088 -5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, // 1104 -5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, // 1120 -5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, // 1136 -5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, // 1152 -5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, // 1168 -5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, // 1184 -5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, // 1200 -5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, // 1216 -5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, // 1232 -5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, // 1248 -5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, // 1264 -5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, // 1280 -5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, // 1296 -6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, // 1312 -6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, // 1328 -6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, // 1344 -6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, // 1360 -6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, // 1376 -6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, // 1392 -6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, // 1408 -6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, // 1424 -4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, // 1440 - 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, // 1456 - 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, // 1472 -1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, // 1488 -1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, // 1504 - 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, // 1520 -3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, // 1536 -3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, // 1552 - 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, // 1568 -3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, // 1584 -3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, // 1600 - 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, // 1616 -2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, // 1632 - 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, // 1648 -3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, // 1664 -1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, // 1680 - 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, // 1696 -1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, // 1712 - 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, // 1728 -2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, // 1744 -2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, // 1760 -2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, // 1776 -2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, // 1792 -1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, // 1808 -1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, // 1824 -1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, // 1840 -1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, // 1856 -2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, // 1872 -1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, // 1888 -2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, // 1904 -1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, // 1920 -1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, // 1936 -1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, // 1952 -1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, // 1968 -1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, // 1984 -1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, // 2000 - 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, // 2016 - 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, // 2032 -1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, // 2048 -2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, // 2064 -2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, // 2080 -2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, // 2096 -3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, // 2112 -3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, // 2128 - 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, // 2144 -3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, // 2160 -1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, // 2176 - 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, // 2192 -2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, // 2208 -1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, // 2224 - 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, // 2240 -3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, // 2256 -4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, // 2272 -2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, // 2288 -1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, // 2304 -2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, // 2320 -1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, // 2336 - 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, // 2352 - 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, // 2368 -1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, // 2384 -2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, // 2400 -2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, // 2416 -2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, // 2432 -3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, // 2448 -1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, // 2464 -2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, // 2480 - 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, // 2496 - 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, // 2512 - 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, // 2528 -1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, // 2544 -2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, // 2560 - 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, // 2576 -1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, // 2592 -1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, // 2608 - 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, // 2624 -1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, // 2640 -1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, // 2656 -1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, // 2672 - 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, // 2688 -2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, // 2704 - 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, // 2720 -2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, // 2736 -3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, // 2752 -2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, // 2768 -1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, // 2784 -6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, // 2800 -1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, // 2816 -2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, // 2832 -1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, // 2848 - 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, // 2864 - 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, // 2880 -3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, // 2896 -3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, // 2912 -1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, // 2928 -1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, // 2944 -1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, // 2960 -1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, // 2976 - 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, // 2992 - 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, // 3008 -2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, // 3024 - 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, // 3040 -3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, // 3056 -2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, // 3072 - 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, // 3088 -1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, // 3104 -2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, // 3120 - 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, // 3136 -1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, // 3152 - 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, // 3168 -4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, // 3184 -2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, // 3200 -1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, // 3216 - 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, // 3232 -1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, // 3248 -2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, // 3264 - 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, // 3280 -6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, // 3296 -1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, // 3312 -1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, // 3328 -2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, // 3344 -3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, // 3360 - 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, // 3376 -3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, // 3392 -1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, // 3408 - 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, // 3424 -1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, // 3440 - 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, // 3456 -3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, // 3472 - 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, // 3488 -2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, // 3504 - 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, // 3520 -4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, // 3536 -2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, // 3552 -1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, // 3568 -1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, // 3584 -1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, // 3600 - 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, // 3616 -1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, // 3632 -3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, // 3648 -1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, // 3664 -3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, // 3680 - 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, // 3696 - 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, // 3712 - 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, // 3728 -2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, // 3744 -1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, // 3760 - 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, // 3776 -1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, // 3792 - 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, // 3808 -1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, // 3824 - 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, // 3840 - 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, // 3856 - 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, // 3872 -1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, // 3888 -1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, // 3904 -2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, // 3920 -4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, // 3936 - 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, // 3952 -1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, // 3968 - 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, // 3984 -1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, // 4000 -3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, // 4016 -1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, // 4032 -2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, // 4048 -2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, // 4064 -1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, // 4080 -1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, // 4096 -2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, // 4112 - 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, // 4128 -2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, // 4144 -1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, // 4160 -1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, // 4176 -1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, // 4192 -1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, // 4208 -3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, // 4224 -2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, // 4240 -2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, // 4256 - 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, // 4272 -3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, // 4288 -3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, // 4304 -1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, // 4320 -2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, // 4336 -1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, // 4352 -2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, // 4368 //last 512 -//Everything below is of no interest for detection purpose -2138,2122,3730,2888,1995,1820,1044,6190,6191,6192,6193,6194,6195,6196,6197,6198, // 4384 -6199,6200,6201,6202,6203,6204,6205,4670,6206,6207,6208,6209,6210,6211,6212,6213, // 4400 -6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229, // 4416 -6230,6231,6232,6233,6234,6235,6236,6237,3187,6238,6239,3969,6240,6241,6242,6243, // 4432 -6244,4671,6245,6246,4672,6247,6248,4133,6249,6250,4364,6251,2923,2556,2613,4673, // 4448 -4365,3970,6252,6253,6254,6255,4674,6256,6257,6258,2768,2353,4366,4675,4676,3188, // 4464 -4367,3463,6259,4134,4677,4678,6260,2267,6261,3842,3332,4368,3543,6262,6263,6264, // 4480 -3013,1954,1928,4135,4679,6265,6266,2478,3091,6267,4680,4369,6268,6269,1699,6270, // 4496 -3544,4136,4681,6271,4137,6272,4370,2804,6273,6274,2593,3971,3972,4682,6275,2236, // 4512 -4683,6276,6277,4684,6278,6279,4138,3973,4685,6280,6281,3258,6282,6283,6284,6285, // 4528 -3974,4686,2841,3975,6286,6287,3545,6288,6289,4139,4687,4140,6290,4141,6291,4142, // 4544 -6292,6293,3333,6294,6295,6296,4371,6297,3399,6298,6299,4372,3976,6300,6301,6302, // 4560 -4373,6303,6304,3843,3731,6305,4688,4374,6306,6307,3259,2294,6308,3732,2530,4143, // 4576 -6309,4689,6310,6311,6312,3048,6313,6314,4690,3733,2237,6315,6316,2282,3334,6317, // 4592 -6318,3844,6319,6320,4691,6321,3400,4692,6322,4693,6323,3049,6324,4375,6325,3977, // 4608 -6326,6327,6328,3546,6329,4694,3335,6330,4695,4696,6331,6332,6333,6334,4376,3978, // 4624 -6335,4697,3979,4144,6336,3980,4698,6337,6338,6339,6340,6341,4699,4700,4701,6342, // 4640 -6343,4702,6344,6345,4703,6346,6347,4704,6348,4705,4706,3135,6349,4707,6350,4708, // 4656 -6351,4377,6352,4709,3734,4145,6353,2506,4710,3189,6354,3050,4711,3981,6355,3547, // 4672 -3014,4146,4378,3735,2651,3845,3260,3136,2224,1986,6356,3401,6357,4712,2594,3627, // 4688 -3137,2573,3736,3982,4713,3628,4714,4715,2682,3629,4716,6358,3630,4379,3631,6359, // 4704 -6360,6361,3983,6362,6363,6364,6365,4147,3846,4717,6366,6367,3737,2842,6368,4718, // 4720 -2628,6369,3261,6370,2386,6371,6372,3738,3984,4719,3464,4720,3402,6373,2924,3336, // 4736 -4148,2866,6374,2805,3262,4380,2704,2069,2531,3138,2806,2984,6375,2769,6376,4721, // 4752 -4722,3403,6377,6378,3548,6379,6380,2705,3092,1979,4149,2629,3337,2889,6381,3338, // 4768 -4150,2557,3339,4381,6382,3190,3263,3739,6383,4151,4723,4152,2558,2574,3404,3191, // 4784 -6384,6385,4153,6386,4724,4382,6387,6388,4383,6389,6390,4154,6391,4725,3985,6392, // 4800 -3847,4155,6393,6394,6395,6396,6397,3465,6398,4384,6399,6400,6401,6402,6403,6404, // 4816 -4156,6405,6406,6407,6408,2123,6409,6410,2326,3192,4726,6411,6412,6413,6414,4385, // 4832 -4157,6415,6416,4158,6417,3093,3848,6418,3986,6419,6420,3849,6421,6422,6423,4159, // 4848 -6424,6425,4160,6426,3740,6427,6428,6429,6430,3987,6431,4727,6432,2238,6433,6434, // 4864 -4386,3988,6435,6436,3632,6437,6438,2843,6439,6440,6441,6442,3633,6443,2958,6444, // 4880 -6445,3466,6446,2364,4387,3850,6447,4388,2959,3340,6448,3851,6449,4728,6450,6451, // 4896 -3264,4729,6452,3193,6453,4389,4390,2706,3341,4730,6454,3139,6455,3194,6456,3051, // 4912 -2124,3852,1602,4391,4161,3853,1158,3854,4162,3989,4392,3990,4731,4732,4393,2040, // 4928 -4163,4394,3265,6457,2807,3467,3855,6458,6459,6460,3991,3468,4733,4734,6461,3140, // 4944 -2960,6462,4735,6463,6464,6465,6466,4736,4737,4738,4739,6467,6468,4164,2403,3856, // 4960 -6469,6470,2770,2844,6471,4740,6472,6473,6474,6475,6476,6477,6478,3195,6479,4741, // 4976 -4395,6480,2867,6481,4742,2808,6482,2493,4165,6483,6484,6485,6486,2295,4743,6487, // 4992 -6488,6489,3634,6490,6491,6492,6493,6494,6495,6496,2985,4744,6497,6498,4745,6499, // 5008 -6500,2925,3141,4166,6501,6502,4746,6503,6504,4747,6505,6506,6507,2890,6508,6509, // 5024 -6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,3469,4167,6520,6521,6522,4748, // 5040 -4396,3741,4397,4749,4398,3342,2125,4750,6523,4751,4752,4753,3052,6524,2961,4168, // 5056 -6525,4754,6526,4755,4399,2926,4169,6527,3857,6528,4400,4170,6529,4171,6530,6531, // 5072 -2595,6532,6533,6534,6535,3635,6536,6537,6538,6539,6540,6541,6542,4756,6543,6544, // 5088 -6545,6546,6547,6548,4401,6549,6550,6551,6552,4402,3405,4757,4403,6553,6554,6555, // 5104 -4172,3742,6556,6557,6558,3992,3636,6559,6560,3053,2726,6561,3549,4173,3054,4404, // 5120 -6562,6563,3993,4405,3266,3550,2809,4406,6564,6565,6566,4758,4759,6567,3743,6568, // 5136 -4760,3744,4761,3470,6569,6570,6571,4407,6572,3745,4174,6573,4175,2810,4176,3196, // 5152 -4762,6574,4177,6575,6576,2494,2891,3551,6577,6578,3471,6579,4408,6580,3015,3197, // 5168 -6581,3343,2532,3994,3858,6582,3094,3406,4409,6583,2892,4178,4763,4410,3016,4411, // 5184 -6584,3995,3142,3017,2683,6585,4179,6586,6587,4764,4412,6588,6589,4413,6590,2986, // 5200 -6591,2962,3552,6592,2963,3472,6593,6594,4180,4765,6595,6596,2225,3267,4414,6597, // 5216 -3407,3637,4766,6598,6599,3198,6600,4415,6601,3859,3199,6602,3473,4767,2811,4416, // 5232 -1856,3268,3200,2575,3996,3997,3201,4417,6603,3095,2927,6604,3143,6605,2268,6606, // 5248 -3998,3860,3096,2771,6607,6608,3638,2495,4768,6609,3861,6610,3269,2745,4769,4181, // 5264 -3553,6611,2845,3270,6612,6613,6614,3862,6615,6616,4770,4771,6617,3474,3999,4418, // 5280 -4419,6618,3639,3344,6619,4772,4182,6620,2126,6621,6622,6623,4420,4773,6624,3018, // 5296 -6625,4774,3554,6626,4183,2025,3746,6627,4184,2707,6628,4421,4422,3097,1775,4185, // 5312 -3555,6629,6630,2868,6631,6632,4423,6633,6634,4424,2414,2533,2928,6635,4186,2387, // 5328 -6636,4775,6637,4187,6638,1891,4425,3202,3203,6639,6640,4776,6641,3345,6642,6643, // 5344 -3640,6644,3475,3346,3641,4000,6645,3144,6646,3098,2812,4188,3642,3204,6647,3863, // 5360 -3476,6648,3864,6649,4426,4001,6650,6651,6652,2576,6653,4189,4777,6654,6655,6656, // 5376 -2846,6657,3477,3205,4002,6658,4003,6659,3347,2252,6660,6661,6662,4778,6663,6664, // 5392 -6665,6666,6667,6668,6669,4779,4780,2048,6670,3478,3099,6671,3556,3747,4004,6672, // 5408 -6673,6674,3145,4005,3748,6675,6676,6677,6678,6679,3408,6680,6681,6682,6683,3206, // 5424 -3207,6684,6685,4781,4427,6686,4782,4783,4784,6687,6688,6689,4190,6690,6691,3479, // 5440 -6692,2746,6693,4428,6694,6695,6696,6697,6698,6699,4785,6700,6701,3208,2727,6702, // 5456 -3146,6703,6704,3409,2196,6705,4429,6706,6707,6708,2534,1996,6709,6710,6711,2747, // 5472 -6712,6713,6714,4786,3643,6715,4430,4431,6716,3557,6717,4432,4433,6718,6719,6720, // 5488 -6721,3749,6722,4006,4787,6723,6724,3644,4788,4434,6725,6726,4789,2772,6727,6728, // 5504 -6729,6730,6731,2708,3865,2813,4435,6732,6733,4790,4791,3480,6734,6735,6736,6737, // 5520 -4436,3348,6738,3410,4007,6739,6740,4008,6741,6742,4792,3411,4191,6743,6744,6745, // 5536 -6746,6747,3866,6748,3750,6749,6750,6751,6752,6753,6754,6755,3867,6756,4009,6757, // 5552 -4793,4794,6758,2814,2987,6759,6760,6761,4437,6762,6763,6764,6765,3645,6766,6767, // 5568 -3481,4192,6768,3751,6769,6770,2174,6771,3868,3752,6772,6773,6774,4193,4795,4438, // 5584 -3558,4796,4439,6775,4797,6776,6777,4798,6778,4799,3559,4800,6779,6780,6781,3482, // 5600 -6782,2893,6783,6784,4194,4801,4010,6785,6786,4440,6787,4011,6788,6789,6790,6791, // 5616 -6792,6793,4802,6794,6795,6796,4012,6797,6798,6799,6800,3349,4803,3483,6801,4804, // 5632 -4195,6802,4013,6803,6804,4196,6805,4014,4015,6806,2847,3271,2848,6807,3484,6808, // 5648 -6809,6810,4441,6811,4442,4197,4443,3272,4805,6812,3412,4016,1579,6813,6814,4017, // 5664 -6815,3869,6816,2964,6817,4806,6818,6819,4018,3646,6820,6821,4807,4019,4020,6822, // 5680 -6823,3560,6824,6825,4021,4444,6826,4198,6827,6828,4445,6829,6830,4199,4808,6831, // 5696 -6832,6833,3870,3019,2458,6834,3753,3413,3350,6835,4809,3871,4810,3561,4446,6836, // 5712 -6837,4447,4811,4812,6838,2459,4448,6839,4449,6840,6841,4022,3872,6842,4813,4814, // 5728 -6843,6844,4815,4200,4201,4202,6845,4023,6846,6847,4450,3562,3873,6848,6849,4816, // 5744 -4817,6850,4451,4818,2139,6851,3563,6852,6853,3351,6854,6855,3352,4024,2709,3414, // 5760 -4203,4452,6856,4204,6857,6858,3874,3875,6859,6860,4819,6861,6862,6863,6864,4453, // 5776 -3647,6865,6866,4820,6867,6868,6869,6870,4454,6871,2869,6872,6873,4821,6874,3754, // 5792 -6875,4822,4205,6876,6877,6878,3648,4206,4455,6879,4823,6880,4824,3876,6881,3055, // 5808 -4207,6882,3415,6883,6884,6885,4208,4209,6886,4210,3353,6887,3354,3564,3209,3485, // 5824 -2652,6888,2728,6889,3210,3755,6890,4025,4456,6891,4825,6892,6893,6894,6895,4211, // 5840 -6896,6897,6898,4826,6899,6900,4212,6901,4827,6902,2773,3565,6903,4828,6904,6905, // 5856 -6906,6907,3649,3650,6908,2849,3566,6909,3567,3100,6910,6911,6912,6913,6914,6915, // 5872 -4026,6916,3355,4829,3056,4457,3756,6917,3651,6918,4213,3652,2870,6919,4458,6920, // 5888 -2438,6921,6922,3757,2774,4830,6923,3356,4831,4832,6924,4833,4459,3653,2507,6925, // 5904 -4834,2535,6926,6927,3273,4027,3147,6928,3568,6929,6930,6931,4460,6932,3877,4461, // 5920 -2729,3654,6933,6934,6935,6936,2175,4835,2630,4214,4028,4462,4836,4215,6937,3148, // 5936 -4216,4463,4837,4838,4217,6938,6939,2850,4839,6940,4464,6941,6942,6943,4840,6944, // 5952 -4218,3274,4465,6945,6946,2710,6947,4841,4466,6948,6949,2894,6950,6951,4842,6952, // 5968 -4219,3057,2871,6953,6954,6955,6956,4467,6957,2711,6958,6959,6960,3275,3101,4843, // 5984 -6961,3357,3569,6962,4844,6963,6964,4468,4845,3570,6965,3102,4846,3758,6966,4847, // 6000 -3878,4848,4849,4029,6967,2929,3879,4850,4851,6968,6969,1733,6970,4220,6971,6972, // 6016 -6973,6974,6975,6976,4852,6977,6978,6979,6980,6981,6982,3759,6983,6984,6985,3486, // 6032 -3487,6986,3488,3416,6987,6988,6989,6990,6991,6992,6993,6994,6995,6996,6997,4853, // 6048 -6998,6999,4030,7000,7001,3211,7002,7003,4221,7004,7005,3571,4031,7006,3572,7007, // 6064 -2614,4854,2577,7008,7009,2965,3655,3656,4855,2775,3489,3880,4222,4856,3881,4032, // 6080 -3882,3657,2730,3490,4857,7010,3149,7011,4469,4858,2496,3491,4859,2283,7012,7013, // 6096 -7014,2365,4860,4470,7015,7016,3760,7017,7018,4223,1917,7019,7020,7021,4471,7022, // 6112 -2776,4472,7023,7024,7025,7026,4033,7027,3573,4224,4861,4034,4862,7028,7029,1929, // 6128 -3883,4035,7030,4473,3058,7031,2536,3761,3884,7032,4036,7033,2966,2895,1968,4474, // 6144 -3276,4225,3417,3492,4226,2105,7034,7035,1754,2596,3762,4227,4863,4475,3763,4864, // 6160 -3764,2615,2777,3103,3765,3658,3418,4865,2296,3766,2815,7036,7037,7038,3574,2872, // 6176 -3277,4476,7039,4037,4477,7040,7041,4038,7042,7043,7044,7045,7046,7047,2537,7048, // 6192 -7049,7050,7051,7052,7053,7054,4478,7055,7056,3767,3659,4228,3575,7057,7058,4229, // 6208 -7059,7060,7061,3660,7062,3212,7063,3885,4039,2460,7064,7065,7066,7067,7068,7069, // 6224 -7070,7071,7072,7073,7074,4866,3768,4867,7075,7076,7077,7078,4868,3358,3278,2653, // 6240 -7079,7080,4479,3886,7081,7082,4869,7083,7084,7085,7086,7087,7088,2538,7089,7090, // 6256 -7091,4040,3150,3769,4870,4041,2896,3359,4230,2930,7092,3279,7093,2967,4480,3213, // 6272 -4481,3661,7094,7095,7096,7097,7098,7099,7100,7101,7102,2461,3770,7103,7104,4231, // 6288 -3151,7105,7106,7107,4042,3662,7108,7109,4871,3663,4872,4043,3059,7110,7111,7112, // 6304 -3493,2988,7113,4873,7114,7115,7116,3771,4874,7117,7118,4232,4875,7119,3576,2336, // 6320 -4876,7120,4233,3419,4044,4877,4878,4482,4483,4879,4484,4234,7121,3772,4880,1045, // 6336 -3280,3664,4881,4882,7122,7123,7124,7125,4883,7126,2778,7127,4485,4486,7128,4884, // 6352 -3214,3887,7129,7130,3215,7131,4885,4045,7132,7133,4046,7134,7135,7136,7137,7138, // 6368 -7139,7140,7141,7142,7143,4235,7144,4886,7145,7146,7147,4887,7148,7149,7150,4487, // 6384 -4047,4488,7151,7152,4888,4048,2989,3888,7153,3665,7154,4049,7155,7156,7157,7158, // 6400 -7159,7160,2931,4889,4890,4489,7161,2631,3889,4236,2779,7162,7163,4891,7164,3060, // 6416 -7165,1672,4892,7166,4893,4237,3281,4894,7167,7168,3666,7169,3494,7170,7171,4050, // 6432 -7172,7173,3104,3360,3420,4490,4051,2684,4052,7174,4053,7175,7176,7177,2253,4054, // 6448 -7178,7179,4895,7180,3152,3890,3153,4491,3216,7181,7182,7183,2968,4238,4492,4055, // 6464 -7184,2990,7185,2479,7186,7187,4493,7188,7189,7190,7191,7192,4896,7193,4897,2969, // 6480 -4494,4898,7194,3495,7195,7196,4899,4495,7197,3105,2731,7198,4900,7199,7200,7201, // 6496 -4056,7202,3361,7203,7204,4496,4901,4902,7205,4497,7206,7207,2315,4903,7208,4904, // 6512 -7209,4905,2851,7210,7211,3577,7212,3578,4906,7213,4057,3667,4907,7214,4058,2354, // 6528 -3891,2376,3217,3773,7215,7216,7217,7218,7219,4498,7220,4908,3282,2685,7221,3496, // 6544 -4909,2632,3154,4910,7222,2337,7223,4911,7224,7225,7226,4912,4913,3283,4239,4499, // 6560 -7227,2816,7228,7229,7230,7231,7232,7233,7234,4914,4500,4501,7235,7236,7237,2686, // 6576 -7238,4915,7239,2897,4502,7240,4503,7241,2516,7242,4504,3362,3218,7243,7244,7245, // 6592 -4916,7246,7247,4505,3363,7248,7249,7250,7251,3774,4506,7252,7253,4917,7254,7255, // 6608 -3284,2991,4918,4919,3219,3892,4920,3106,3497,4921,7256,7257,7258,4922,7259,4923, // 6624 -3364,4507,4508,4059,7260,4240,3498,7261,7262,4924,7263,2992,3893,4060,3220,7264, // 6640 -7265,7266,7267,7268,7269,4509,3775,7270,2817,7271,4061,4925,4510,3776,7272,4241, // 6656 -4511,3285,7273,7274,3499,7275,7276,7277,4062,4512,4926,7278,3107,3894,7279,7280, // 6672 -4927,7281,4513,7282,7283,3668,7284,7285,4242,4514,4243,7286,2058,4515,4928,4929, // 6688 -4516,7287,3286,4244,7288,4517,7289,7290,7291,3669,7292,7293,4930,4931,4932,2355, // 6704 -4933,7294,2633,4518,7295,4245,7296,7297,4519,7298,7299,4520,4521,4934,7300,4246, // 6720 -4522,7301,7302,7303,3579,7304,4247,4935,7305,4936,7306,7307,7308,7309,3777,7310, // 6736 -4523,7311,7312,7313,4248,3580,7314,4524,3778,4249,7315,3581,7316,3287,7317,3221, // 6752 -7318,4937,7319,7320,7321,7322,7323,7324,4938,4939,7325,4525,7326,7327,7328,4063, // 6768 -7329,7330,4940,7331,7332,4941,7333,4526,7334,3500,2780,1741,4942,2026,1742,7335, // 6784 -7336,3582,4527,2388,7337,7338,7339,4528,7340,4250,4943,7341,7342,7343,4944,7344, // 6800 -7345,7346,3020,7347,4945,7348,7349,7350,7351,3895,7352,3896,4064,3897,7353,7354, // 6816 -7355,4251,7356,7357,3898,7358,3779,7359,3780,3288,7360,7361,4529,7362,4946,4530, // 6832 -2027,7363,3899,4531,4947,3222,3583,7364,4948,7365,7366,7367,7368,4949,3501,4950, // 6848 -3781,4951,4532,7369,2517,4952,4252,4953,3155,7370,4954,4955,4253,2518,4533,7371, // 6864 -7372,2712,4254,7373,7374,7375,3670,4956,3671,7376,2389,3502,4065,7377,2338,7378, // 6880 -7379,7380,7381,3061,7382,4957,7383,7384,7385,7386,4958,4534,7387,7388,2993,7389, // 6896 -3062,7390,4959,7391,7392,7393,4960,3108,4961,7394,4535,7395,4962,3421,4536,7396, // 6912 -4963,7397,4964,1857,7398,4965,7399,7400,2176,3584,4966,7401,7402,3422,4537,3900, // 6928 -3585,7403,3782,7404,2852,7405,7406,7407,4538,3783,2654,3423,4967,4539,7408,3784, // 6944 -3586,2853,4540,4541,7409,3901,7410,3902,7411,7412,3785,3109,2327,3903,7413,7414, // 6960 -2970,4066,2932,7415,7416,7417,3904,3672,3424,7418,4542,4543,4544,7419,4968,7420, // 6976 -7421,4255,7422,7423,7424,7425,7426,4067,7427,3673,3365,4545,7428,3110,2559,3674, // 6992 -7429,7430,3156,7431,7432,3503,7433,3425,4546,7434,3063,2873,7435,3223,4969,4547, // 7008 -4548,2898,4256,4068,7436,4069,3587,3786,2933,3787,4257,4970,4971,3788,7437,4972, // 7024 -3064,7438,4549,7439,7440,7441,7442,7443,4973,3905,7444,2874,7445,7446,7447,7448, // 7040 -3021,7449,4550,3906,3588,4974,7450,7451,3789,3675,7452,2578,7453,4070,7454,7455, // 7056 -7456,4258,3676,7457,4975,7458,4976,4259,3790,3504,2634,4977,3677,4551,4260,7459, // 7072 -7460,7461,7462,3907,4261,4978,7463,7464,7465,7466,4979,4980,7467,7468,2213,4262, // 7088 -7469,7470,7471,3678,4981,7472,2439,7473,4263,3224,3289,7474,3908,2415,4982,7475, // 7104 -4264,7476,4983,2655,7477,7478,2732,4552,2854,2875,7479,7480,4265,7481,4553,4984, // 7120 -7482,7483,4266,7484,3679,3366,3680,2818,2781,2782,3367,3589,4554,3065,7485,4071, // 7136 -2899,7486,7487,3157,2462,4072,4555,4073,4985,4986,3111,4267,2687,3368,4556,4074, // 7152 -3791,4268,7488,3909,2783,7489,2656,1962,3158,4557,4987,1963,3159,3160,7490,3112, // 7168 -4988,4989,3022,4990,4991,3792,2855,7491,7492,2971,4558,7493,7494,4992,7495,7496, // 7184 -7497,7498,4993,7499,3426,4559,4994,7500,3681,4560,4269,4270,3910,7501,4075,4995, // 7200 -4271,7502,7503,4076,7504,4996,7505,3225,4997,4272,4077,2819,3023,7506,7507,2733, // 7216 -4561,7508,4562,7509,3369,3793,7510,3590,2508,7511,7512,4273,3113,2994,2616,7513, // 7232 -7514,7515,7516,7517,7518,2820,3911,4078,2748,7519,7520,4563,4998,7521,7522,7523, // 7248 -7524,4999,4274,7525,4564,3682,2239,4079,4565,7526,7527,7528,7529,5000,7530,7531, // 7264 -5001,4275,3794,7532,7533,7534,3066,5002,4566,3161,7535,7536,4080,7537,3162,7538, // 7280 -7539,4567,7540,7541,7542,7543,7544,7545,5003,7546,4568,7547,7548,7549,7550,7551, // 7296 -7552,7553,7554,7555,7556,5004,7557,7558,7559,5005,7560,3795,7561,4569,7562,7563, // 7312 -7564,2821,3796,4276,4277,4081,7565,2876,7566,5006,7567,7568,2900,7569,3797,3912, // 7328 -7570,7571,7572,4278,7573,7574,7575,5007,7576,7577,5008,7578,7579,4279,2934,7580, // 7344 -7581,5009,7582,4570,7583,4280,7584,7585,7586,4571,4572,3913,7587,4573,3505,7588, // 7360 -5010,7589,7590,7591,7592,3798,4574,7593,7594,5011,7595,4281,7596,7597,7598,4282, // 7376 -5012,7599,7600,5013,3163,7601,5014,7602,3914,7603,7604,2734,4575,4576,4577,7605, // 7392 -7606,7607,7608,7609,3506,5015,4578,7610,4082,7611,2822,2901,2579,3683,3024,4579, // 7408 -3507,7612,4580,7613,3226,3799,5016,7614,7615,7616,7617,7618,7619,7620,2995,3290, // 7424 -7621,4083,7622,5017,7623,7624,7625,7626,7627,4581,3915,7628,3291,7629,5018,7630, // 7440 -7631,7632,7633,4084,7634,7635,3427,3800,7636,7637,4582,7638,5019,4583,5020,7639, // 7456 -3916,7640,3801,5021,4584,4283,7641,7642,3428,3591,2269,7643,2617,7644,4585,3592, // 7472 -7645,4586,2902,7646,7647,3227,5022,7648,4587,7649,4284,7650,7651,7652,4588,2284, // 7488 -7653,5023,7654,7655,7656,4589,5024,3802,7657,7658,5025,3508,4590,7659,7660,7661, // 7504 -1969,5026,7662,7663,3684,1821,2688,7664,2028,2509,4285,7665,2823,1841,7666,2689, // 7520 -3114,7667,3917,4085,2160,5027,5028,2972,7668,5029,7669,7670,7671,3593,4086,7672, // 7536 -4591,4087,5030,3803,7673,7674,7675,7676,7677,7678,7679,4286,2366,4592,4593,3067, // 7552 -2328,7680,7681,4594,3594,3918,2029,4287,7682,5031,3919,3370,4288,4595,2856,7683, // 7568 -3509,7684,7685,5032,5033,7686,7687,3804,2784,7688,7689,7690,7691,3371,7692,7693, // 7584 -2877,5034,7694,7695,3920,4289,4088,7696,7697,7698,5035,7699,5036,4290,5037,5038, // 7600 -5039,7700,7701,7702,5040,5041,3228,7703,1760,7704,5042,3229,4596,2106,4089,7705, // 7616 -4597,2824,5043,2107,3372,7706,4291,4090,5044,7707,4091,7708,5045,3025,3805,4598, // 7632 -4292,4293,4294,3373,7709,4599,7710,5046,7711,7712,5047,5048,3806,7713,7714,7715, // 7648 -5049,7716,7717,7718,7719,4600,5050,7720,7721,7722,5051,7723,4295,3429,7724,7725, // 7664 -7726,7727,3921,7728,3292,5052,4092,7729,7730,7731,7732,7733,7734,7735,5053,5054, // 7680 -7736,7737,7738,7739,3922,3685,7740,7741,7742,7743,2635,5055,7744,5056,4601,7745, // 7696 -7746,2560,7747,7748,7749,7750,3923,7751,7752,7753,7754,7755,4296,2903,7756,7757, // 7712 -7758,7759,7760,3924,7761,5057,4297,7762,7763,5058,4298,7764,4093,7765,7766,5059, // 7728 -3925,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,3595,7777,4299,5060,4094, // 7744 -7778,3293,5061,7779,7780,4300,7781,7782,4602,7783,3596,7784,7785,3430,2367,7786, // 7760 -3164,5062,5063,4301,7787,7788,4095,5064,5065,7789,3374,3115,7790,7791,7792,7793, // 7776 -7794,7795,7796,3597,4603,7797,7798,3686,3116,3807,5066,7799,7800,5067,7801,7802, // 7792 -4604,4302,5068,4303,4096,7803,7804,3294,7805,7806,5069,4605,2690,7807,3026,7808, // 7808 -7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824, // 7824 -7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7840 -7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856, // 7856 -7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872, // 7872 -7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888, // 7888 -7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904, // 7904 -7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920, // 7920 -7921,7922,7923,7924,3926,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, // 7936 -7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, // 7952 -7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, // 7968 -7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, // 7984 -7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, // 8000 -8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, // 8016 -8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, // 8032 -8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, // 8048 -8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, // 8064 -8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, // 8080 -8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, // 8096 -8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, // 8112 -8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, // 8128 -8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, // 8144 -8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, // 8160 -8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, // 8176 -8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, // 8192 -8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, // 8208 -8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, // 8224 -8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, // 8240 -8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, // 8256 -8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271 // 8272 -]; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/jpcntx.js b/tools/eslint/node_modules/jschardet/src/jpcntx.js deleted file mode 100755 index 2481aec9c936c1..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/jpcntx.js +++ /dev/null @@ -1,242 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// This is hiragana 2-char sequence table, the number in each cell represents its frequency category -jschardet.jp2CharContext = [ -[0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1], -[2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4], -[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,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1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3], -[0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1] -]; - -jschardet.JapaneseContextAnalysis = function() { - var NUM_OF_CATEGORY = 6; - var DONT_KNOW = -1; - var ENOUGH_REL_THRESHOLD = 100; - var MAX_REL_THRESHOLD = 1000; - var MINIMUM_DATA_THRESHOLD = 4; - var self = this; - - function init() { - self.reset(); - } - - this.reset = function() { - this._mTotalRel = 0; // total sequence received - this._mRelSample = []; // category counters, each interger counts sequence in its category - for( var i = 0; i < NUM_OF_CATEGORY; this._mRelSample[i++] = 0 ); - this._mNeedToSkipCharNum = 0; // if last byte in current buffer is not the last byte of a character, we need to know how many bytes to skip in next buffer - this._mLastCharOrder = -1; // The order of previous char - this._mDone = false; // If this flag is set to true, detection is done and conclusion has been made - } - - this.feed = function(aBuf, aLen) { - if( this._mDone ) return; - - // The buffer we got is byte oriented, and a character may span in more than one - // buffers. In case the last one or two byte in last buffer is not complete, we - // record how many byte needed to complete that character and skip these bytes here. - // We can choose to record those bytes as well and analyse the character once it - // is complete, but since a character will not make much difference, by simply skipping - // this character will simply our logic and improve performance. - var i = this._mNeedToSkipCharNum; - while( i < aLen ) { - var rets = this.getOrder(aBuf.slice(i,i+2)); - var order = rets[0]; - var charLen = rets[1]; - i += charLen; - if( i > aLen ) { - this._mNeedToSkipCharNum = i - aLen; - this._mLastCharOrder = -1; - } else { - if( order != -1 && this._mLastCharOrder != -1 ) { - this._mTotalRel += 1; - if( this._mTotalRel > MAX_REL_THRESHOLD ) { - this._mDone = true; - break; - } - this._mRelSample[jschardet.jp2CharContext[this._mLastCharOrder][order]] += 1; - } - this._mLastCharOrder = order; - } - } - } - - this.gotEnoughData = function() { - return this._mTotalRel > ENOUGH_REL_THRESHOLD; - } - - this.getConfidence = function() { - // This is just one way to calculate confidence. It works well for me. - if( this._mTotalRel > MINIMUM_DATA_THRESHOLD ) { - return (this._mTotalRel - this._mRelSample[0]) / this._mTotalRel; - } else { - return DONT_KNOW; - } - } - - this.getOrder = function(aStr) { - return [-1, 1]; - } - - init(); -} - -jschardet.SJISContextAnalysis = function() { - this.getOrder = function(aStr) { - if( !aStr ) return [-1, 1]; - // find out current char's byte length - if( (aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F) || - (aStr.charCodeAt(0) >= 0xE0 && aStr.charCodeAt(0) <= 0xFC) ) { - var charLen = 2; - } else { - charLen = 1; - } - - // return its order if it is hiragana - if( aStr.length > 1 ) { - if( aStr.charCodeAt(0) == 0x82 && aStr.charCodeAt(1) >= 0x9F && - aStr.charCodeAt(0) <= 0xF1 ) { - return [aStr.charCodeAt(1) - 0x9F, charLen]; - } - } - - return [-1, charLen]; - } -} -jschardet.SJISContextAnalysis.prototype = new jschardet.JapaneseContextAnalysis(); - -jschardet.EUCJPContextAnalysis = function() { - this.getOrder = function(aStr) { - if( !aStr ) return [-1, 1]; - // find out current char's byte length - if( aStr.charCodeAt(0) >= 0x8E || - (aStr.charCodeAt(0) >= 0xA1 && aStr.charCodeAt(0) <= 0xFE) ) { - var charLen = 2; - } else if( aStr.charCodeAt(0) == 0x8F ) { - charLen = 3; - } else { - charLen = 1; - } - - // return its order if it is hiragana - if( aStr.length > 1 ) { - if( aStr.charCodeAt(0) == 0xA4 && aStr.charCodeAt(1) >= 0xA1 && - aStr.charCodeAt(1) <= 0xF3 ) { - return [aStr.charCodeAt(1) - 0xA1, charLen]; - } - } - - return [-1, charLen]; - } -} -jschardet.EUCJPContextAnalysis.prototype = new jschardet.JapaneseContextAnalysis(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langbulgarianmodel.js b/tools/eslint/node_modules/jschardet/src/langbulgarianmodel.js deleted file mode 100755 index b1102cf76ccaf4..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langbulgarianmodel.js +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -// this table is modified base on win1251BulgarianCharToOrderMap, so -// only number <64 is sure valid - -jschardet.Latin5_BulgarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, // 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, // 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, // 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, // 70 -194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, // 80 -210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, // 90 - 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, // a0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, // b0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, // c0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, // d0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, // e0 - 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253 // f0 -]; - -jschardet.win1251BulgarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, // 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, // 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, // 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, // 70 -206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, // 80 -221, 78, 64, 83,121, 98,117,105,222,223,224,225,226,227,228,229, // 90 - 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, // a0 - 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, // b0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, // c0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, // d0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, // e0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16 // f0 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 96.9392% -// first 1024 sequences:3.0618% -// rest sequences: 0.2992% -// negative sequences: 0.0020% -jschardet.BulgarianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2, -3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1, -0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,0,3,1,0, -0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,1,3,3,3,3,2,2,2,1,1,2,0,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,2,3,2,2,3,3,1,1,2,3,3,2,3,3,3,3,2,1,2,0,2,0,3,0,0, -0,0,0,0,0,0,0,1,0,0,2,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0,1,1,1,0,1,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 -]; - -jschardet.Latin5BulgarianModel = { - "charToOrderMap" : jschardet.Latin5_BulgarianCharToOrderMap, - "precedenceMatrix" : jschardet.BulgarianLangModel, - "mTypicalPositiveRatio" : 0.969392, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-5" -}; - -jschardet.Win1251BulgarianModel = { - "charToOrderMap" : jschardet.win1251BulgarianCharToOrderMap, - "precedenceMatrix" : jschardet.BulgarianLangModel, - "mTypicalPositiveRatio" : 0.969392, - "keepEnglishLetter" : false, - "charsetName" : "windows-1251" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langcyrillicmodel.js b/tools/eslint/node_modules/jschardet/src/langcyrillicmodel.js deleted file mode 100755 index b0d4ec36dd3d19..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langcyrillicmodel.js +++ /dev/null @@ -1,333 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// KOI8-R language model -// Character Mapping Table: -jschardet.KOI8R_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, // 80 -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, // 90 -223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, // a0 -238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, // b0 - 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, // c0 - 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, // d0 - 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, // e0 - 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70 // f0 -]; - -jschardet.win1251_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246, 68,247,248,249,250,251,252,253, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16 -]; - -jschardet.latin5_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255 -]; - -jschardet.macCyrillic_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255 -]; - -jschardet.IBM855_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 -191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, -206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, - 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, -220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, -230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, - 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, - 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, -250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255 -]; - -jschardet.IBM866_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, // 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, // 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, // 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, // 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 97.6601% -// first 1024 sequences: 2.3389% -// rest sequences: 0.1237% -// negative sequences: 0.0009% -jschardet.RussianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,2,2,2,3,1,3,3,1,3,3,3,3,2,2,3,0,2,2,2,3,3,2,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3,3,3,2,1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,0,1, -1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, -0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 -]; - -jschardet.Koi8rModel = { - "charToOrderMap" : jschardet.KOI8R_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "KOI8-R" -}; - -jschardet.Win1251CyrillicModel = { - "charToOrderMap" : jschardet.win1251_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "windows-1251" -}; - -jschardet.Latin5CyrillicModel = { - "charToOrderMap" : jschardet.latin5_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-5" -}; - -jschardet.MacCyrillicModel = { - "charToOrderMap" : jschardet.macCyrillic_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "MacCyrillic" -}; - -jschardet.Ibm866Model = { - "charToOrderMap" : jschardet.IBM866_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "IBM866" -}; - -jschardet.Ibm855Model = { - "charToOrderMap" : jschardet.IBM855_CharToOrderMap, - "precedenceMatrix" : jschardet.RussianLangModel, - "mTypicalPositiveRatio" : 0.976601, - "keepEnglishLetter" : false, - "charsetName" : "IBM855" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langgreekmodel.js b/tools/eslint/node_modules/jschardet/src/langgreekmodel.js deleted file mode 100755 index 6d71dd8cb51d47..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langgreekmodel.js +++ /dev/null @@ -1,229 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -jschardet.Latin7_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, // 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, // 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, // 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, // 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 90 -253,233, 90,253,253,253,253,253,253,253,253,253,253, 74,253,253, // a0 -253,253,253,253,247,248, 61, 36, 46, 71, 73,253, 54,253,108,123, // b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, // c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, // d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, // e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253 // f0 -]; - -jschardet.win1253_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, // 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, // 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, // 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, // 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 90 -253,233, 61,253,253,253,253,253,253,253,253,253,253, 74,253,253, // a0 -253,253,253,253,247,253,253, 36, 46, 71, 73,253, 54,253,108,123, // b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, // c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, // d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, // e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253 // f0 -] - -// Model Table: -// total sequences: 100% -// first 512 sequences: 98.2851% -// first 1024 sequences:1.7001% -// rest sequences: 0.0359% -// negative sequences: 0.0148% -jschardet.GreekLangModel = [ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,2,2,3,3,3,3,3,3,3,3,1,3,3,3,0,2,2,3,3,0,3,0,3,2,0,3,3,3,0, -3,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,0,3,3,0,3,2,3,3,0,3,2,3,3,3,0,0,3,0,3,0,3,3,2,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, -0,2,3,2,2,3,3,3,3,3,3,3,3,0,3,3,3,3,0,2,3,3,0,3,3,3,3,2,3,3,3,0, -2,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,2,1,3,3,3,3,2,3,3,2,3,3,2,0, -0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,0,3,3,3,3,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,2,3,3,0, -2,0,1,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,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,1,0,0,0,0,0,0,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.Latin7GreekModel = { - "charToOrderMap" : jschardet.Latin7_CharToOrderMap, - "precedenceMatrix" : jschardet.GreekLangModel, - "mTypicalPositiveRatio" : 0.982851, - "keepEnglishLetter" : false, - "charsetName" : "ISO-8859-7" -}; - -jschardet.Win1253GreekModel = { - "charToOrderMap" : jschardet.win1253_CharToOrderMap, - "precedenceMatrix" : jschardet.GreekLangModel, - "mTypicalPositiveRatio" : 0.982851, - "keepEnglishLetter" : false, - "charsetName" : "windows-1253" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langhebrewmodel.js b/tools/eslint/node_modules/jschardet/src/langhebrewmodel.js deleted file mode 100755 index c999c4010a73d8..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langhebrewmodel.js +++ /dev/null @@ -1,203 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Windows-1255 language model -// Character Mapping Table: -jschardet.win1255_CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, // 40 - 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, // 50 -253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, // 60 - 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, // 70 -124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, -215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, - 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, -106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, - 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, -238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, - 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, - 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0 -]; - -jschardet.Win1255HebrewModel = { - "charToOrderMap" : jschardet.win1255_CharToOrderMap, - "precedenceMatrix" : jschardet.HebrewLangModel, - "mTypicalPositiveRatio" : 0.984004, - "keepEnglishLetter" : false, - "charsetName" : "windows-1255" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langhungarianmodel.js b/tools/eslint/node_modules/jschardet/src/langhungarianmodel.js deleted file mode 100755 index 8f120c9f5642df..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langhungarianmodel.js +++ /dev/null @@ -1,229 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// Character Mapping Table: -jschardet.Latin2_HungarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174, -175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205, - 79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241, - 82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85, -245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253 -] - -jschardet.win1250HungarianCharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176, -177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205, - 81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241, - 84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87, -245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 94.7368% -// first 1024 sequences:5.2623% -// rest sequences: 0.8894% -// negative sequences: 0.0009% -jschardet.HungarianLangModel = [ -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2, -3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,1,2,3,3,3,3,2,3,3,1,1,3,3,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0, -3,2,1,3,3,3,3,3,2,3,3,3,3,3,1,1,2,3,3,3,3,3,3,3,1,1,3,2,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,1,1,2,3,3,3,1,3,3,3,3,3,1,3,3,2,2,0,3,2,3, -0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,3,3,2,3,3,2,2,3,2,3,2,0,3,2,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,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,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -0,1,1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, -0,0,0,1,0,0,0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, -2,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.Latin2HungarianModel = { - "charToOrderMap" : jschardet.Latin2_HungarianCharToOrderMap, - "precedenceMatrix" : jschardet.HungarianLangModel, - "mTypicalPositiveRatio" : 0.947368, - "keepEnglishLetter" : true, - "charsetName" : "ISO-8859-2" -}; - -jschardet.Win1250HungarianModel = { - "charToOrderMap" : jschardet.win1250HungarianCharToOrderMap, - "precedenceMatrix" : jschardet.HungarianLangModel, - "mTypicalPositiveRatio" : 0.947368, - "keepEnglishLetter" : true, - "charsetName" : "windows-1250" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/langthaimodel.js b/tools/eslint/node_modules/jschardet/src/langthaimodel.js deleted file mode 100755 index bb39d4a5899eaa..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/langthaimodel.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -// 255: Control characters that usually does not exist in any text -// 254: Carriage/Return -// 253: symbol (punctuation) that does not belong to word -// 252: 0 - 9 - -// The following result for thai was collected from a limited sample (1M). - -// Character Mapping Table: -jschardet.TIS620CharToOrderMap = [ -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, // 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, // 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, // 30 -253,182,106,107,100,183,184,185,101, 94,186,187,108,109,110,111, // 40 -188,189,190, 89, 95,112,113,191,192,193,194,253,253,253,253,253, // 50 -253, 64, 72, 73,114, 74,115,116,102, 81,201,117, 90,103, 78, 82, // 60 - 96,202, 91, 79, 84,104,105, 97, 98, 92,203,253,253,253,253,253, // 70 -209,210,211,212,213, 88,214,215,216,217,218,219,220,118,221,222, -223,224, 99, 85, 83,225,226,227,228,229,230,231,232,233,234,235, -236, 5, 30,237, 24,238, 75, 8, 26, 52, 34, 51,119, 47, 58, 57, - 49, 53, 55, 43, 20, 19, 44, 14, 48, 3, 17, 25, 39, 62, 31, 54, - 45, 9, 16, 2, 61, 15,239, 12, 42, 46, 18, 21, 76, 4, 66, 63, - 22, 10, 1, 36, 23, 13, 40, 27, 32, 35, 86,240,241,242,243,244, - 11, 28, 41, 29, 33,245, 50, 37, 6, 7, 67, 77, 38, 93,246,247, - 68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253 -]; - -// Model Table: -// total sequences: 100% -// first 512 sequences: 92.6386% -// first 1024 sequences:7.3177% -// rest sequences: 1.0230% -// negative sequences: 0.0436% -jschardet.ThaiLangModel = [ -0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3, -0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2, -3,0,3,3,2,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,3,2,3,0,2,2,2,3, -0,2,3,0,0,0,0,1,0,1,2,3,1,1,3,2,2,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,2,3,2,3,3,2,2,2, -3,1,2,3,0,3,3,2,2,1,2,3,3,1,2,0,1,3,0,1,0,0,1,0,0,0,0,0,0,0,1,1, -3,3,2,2,3,3,3,3,1,2,3,3,3,3,3,2,2,2,2,3,3,2,2,3,3,2,2,3,2,3,2,2, -3,3,1,2,3,1,2,2,3,3,1,0,2,1,0,0,3,1,2,1,0,0,1,0,0,0,0,0,0,1,0,1, -3,3,3,3,3,3,2,2,3,3,3,3,2,3,2,2,3,3,2,2,3,2,2,2,2,1,1,3,1,2,1,1, -3,2,1,0,2,1,0,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,3,2,3,2,3,3,2,2,3,2,3,3,2,3,1,1,2,3,2,2,2,3,2,2,2,2,2,1,2,1, -2,2,1,1,3,3,2,1,0,1,2,2,0,1,3,0,0,0,1,1,0,0,0,0,0,2,3,0,0,2,1,1, -3,3,2,3,3,2,0,0,3,3,0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,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,1,0,0,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -]; - -jschardet.TIS620ThaiModel = { - "charToOrderMap" : jschardet.TIS620CharToOrderMap, - "precedenceMatrix" : jschardet.ThaiLangModel, - "mTypicalPositiveRatio" : 0.926386, - "keepEnglishLetter" : false, - "charsetName" : "TIS-620" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/latin1prober.js b/tools/eslint/node_modules/jschardet/src/latin1prober.js deleted file mode 100755 index 9e5ac2d89436b3..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/latin1prober.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -(function() { - var UDF = 0; // undefined - var OTH = 1; // other - jschardet.OTH = 1; - var ASC = 2; // ascii capital letter - var ASS = 3; // ascii small letter - var ACV = 4; // accent capital vowel - var ACO = 5; // accent capital other - var ASV = 6; // accent small vowel - var ASO = 7; // accent small other - - jschardet.Latin1_CharToClass = [ - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 00 - 07 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 08 - 0F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 10 - 17 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 18 - 1F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 20 - 27 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 28 - 2F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 30 - 37 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 38 - 3F - OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 40 - 47 - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 48 - 4F - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 50 - 57 - ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, // 58 - 5F - OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 60 - 67 - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 68 - 6F - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 70 - 77 - ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, // 78 - 7F - OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, // 80 - 87 - OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, // 88 - 8F - UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 90 - 97 - OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, // 98 - 9F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A0 - A7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A8 - AF - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B0 - B7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B8 - BF - ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, // C0 - C7 - ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, // C8 - CF - ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, // D0 - D7 - ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, // D8 - DF - ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, // E0 - E7 - ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, // E8 - EF - ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, // F0 - F7 - ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO // F8 - FF - ]; - - // 0 : illegal - // 1 : very unlikely - // 2 : normal - // 3 : very likely - jschardet.Latin1ClassModel = [ - // UDF OTH ASC ASS ACV ACO ASV ASO - 0, 0, 0, 0, 0, 0, 0, 0, // UDF - 0, 3, 3, 3, 3, 3, 3, 3, // OTH - 0, 3, 3, 3, 3, 3, 3, 3, // ASC - 0, 3, 3, 3, 1, 1, 3, 3, // ASS - 0, 3, 3, 3, 1, 2, 1, 2, // ACV - 0, 3, 3, 3, 3, 3, 3, 3, // ACO - 0, 3, 1, 3, 1, 1, 1, 3, // ASV - 0, 3, 1, 3, 1, 1, 3, 3 // ASO - ]; -})(); - -jschardet.Latin1Prober = function() { - jschardet.CharSetProber.apply(this); - - var FREQ_CAT_NUM = 4; - var CLASS_NUM = 8; // total classes - var self = this; - - function init() { - self.reset(); - } - - this.reset = function() { - this._mLastCharClass = jschardet.OTH; - this._mFreqCounter = []; - for( var i = 0; i < FREQ_CAT_NUM; this._mFreqCounter[i++] = 0 ); - jschardet.Latin1Prober.prototype.reset.apply(this); - } - - this.getCharsetName = function() { - return "windows-1252"; - } - - this.feed = function(aBuf) { - aBuf = this.filterWithEnglishLetters(aBuf); - for( var i = 0; i < aBuf.length; i++ ) { - var c = aBuf.charCodeAt(i); - var charClass = jschardet.Latin1_CharToClass[c]; - var freq = jschardet.Latin1ClassModel[(this._mLastCharClass * CLASS_NUM) + charClass]; - if( freq == 0 ) { - this._mState = jschardet.Constants.notMe; - break; - } - this._mFreqCounter[freq]++; - this._mLastCharClass = charClass; - } - - return this.getState(); - } - - this.getConfidence = function() { - var confidence; - var constants; - - if( this.getState() == jschardet.Constants.notMe ) { - return 0.01; - } - - var total = 0; - for( var i = 0; i < this._mFreqCounter.length; i++ ) { - total += this._mFreqCounter[i]; - } - if( total < 0.01 ) { - constants = 0.0; - } else { - confidence = (this._mFreqCounter[3] / total) - (this._mFreqCounter[1] * 20 / total); - } - if( confidence < 0 ) { - confidence = 0.0; - } - // lower the confidence of latin1 so that other more accurate detector - // can take priority. - // - // antonio.afonso: need to change this otherwise languages like pt, es, fr using latin1 will never be detected. - confidence = confidence * 0.95; - return confidence; - } - - init(); -} -jschardet.Latin1Prober.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/mbcharsetprober.js b/tools/eslint/node_modules/jschardet/src/mbcharsetprober.js deleted file mode 100755 index e60b8730050e84..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/mbcharsetprober.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.MultiByteCharSetProber = function() { - jschardet.CharSetProber.apply(this); - - var self = this; - - function init() { - self._mDistributionAnalyzer = null; - self._mCodingSM = null; - //self._mLastChar = ["\x00", "\x00"]; - self._mLastChar = "\x00\x00"; - } - - this.reset = function() { - jschardet.MultiByteCharSetProber.prototype.reset.apply(this); - if( this._mCodingSM ) { - this._mCodingSM.reset(); - } - if( this._mDistributionAnalyzer ) { - this._mDistributionAnalyzer.reset(); - } - //this._mLastChar = ["\x00", "\x00"]; - this._mLastChar = "\x00\x00"; - } - - this.getCharsetName = function() { - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mDistributionAnalyzer.feed(aBuf.slice(i-1,i+1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mDistributionAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - return this._mDistributionAnalyzer.getConfidence(); - } -} -jschardet.MultiByteCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/mbcsgroupprober.js b/tools/eslint/node_modules/jschardet/src/mbcsgroupprober.js deleted file mode 100755 index 61ebd85c2719bd..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/mbcsgroupprober.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.MBCSGroupProber = function() { - jschardet.CharSetGroupProber.apply(this); - this._mProbers = [ - new jschardet.UTF8Prober(), - new jschardet.SJISProber(), - new jschardet.EUCJPProber(), - new jschardet.GB2312Prober(), - new jschardet.EUCKRProber(), - new jschardet.Big5Prober(), - new jschardet.EUCTWProber() - ]; - this.reset(); -} -jschardet.MBCSGroupProber.prototype = new jschardet.CharSetGroupProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/mbcssm.js b/tools/eslint/node_modules/jschardet/src/mbcssm.js deleted file mode 100755 index 2596bd845eb376..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/mbcssm.js +++ /dev/null @@ -1,556 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -var consts = jschardet.Constants; - -// BIG5 - -jschardet.BIG5_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 //allow 0x00 as legal value - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,1, // 78 - 7f - 4,4,4,4,4,4,4,4, // 80 - 87 - 4,4,4,4,4,4,4,4, // 88 - 8f - 4,4,4,4,4,4,4,4, // 90 - 97 - 4,4,4,4,4,4,4,4, // 98 - 9f - 4,3,3,3,3,3,3,3, // a0 - a7 - 3,3,3,3,3,3,3,3, // a8 - af - 3,3,3,3,3,3,3,3, // b0 - b7 - 3,3,3,3,3,3,3,3, // b8 - bf - 3,3,3,3,3,3,3,3, // c0 - c7 - 3,3,3,3,3,3,3,3, // c8 - cf - 3,3,3,3,3,3,3,3, // d0 - d7 - 3,3,3,3,3,3,3,3, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,3,3,3, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,3,3,0 // f8 - ff -]; - -jschardet.BIG5_st = [ - consts.error,consts.start,consts.start, 3,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error, //08-0f - consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //10-17 -]; - -jschardet.Big5CharLenTable = [0, 1, 1, 2, 0]; - -jschardet.Big5SMModel = { - "classTable" : jschardet.BIG5_cls, - "classFactor" : 5, - "stateTable" : jschardet.BIG5_st, - "charLenTable" : jschardet.Big5CharLenTable, - "name" : "Big5" -}; - -// EUC-JP - -jschardet.EUCJP_cls = [ - 4,4,4,4,4,4,4,4, // 00 - 07 - 4,4,4,4,4,4,5,5, // 08 - 0f - 4,4,4,4,4,4,4,4, // 10 - 17 - 4,4,4,5,4,4,4,4, // 18 - 1f - 4,4,4,4,4,4,4,4, // 20 - 27 - 4,4,4,4,4,4,4,4, // 28 - 2f - 4,4,4,4,4,4,4,4, // 30 - 37 - 4,4,4,4,4,4,4,4, // 38 - 3f - 4,4,4,4,4,4,4,4, // 40 - 47 - 4,4,4,4,4,4,4,4, // 48 - 4f - 4,4,4,4,4,4,4,4, // 50 - 57 - 4,4,4,4,4,4,4,4, // 58 - 5f - 4,4,4,4,4,4,4,4, // 60 - 67 - 4,4,4,4,4,4,4,4, // 68 - 6f - 4,4,4,4,4,4,4,4, // 70 - 77 - 4,4,4,4,4,4,4,4, // 78 - 7f - 5,5,5,5,5,5,5,5, // 80 - 87 - 5,5,5,5,5,5,1,3, // 88 - 8f - 5,5,5,5,5,5,5,5, // 90 - 97 - 5,5,5,5,5,5,5,5, // 98 - 9f - 5,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,0,5 // f8 - ff -]; - -jschardet.EUCJP_st = [ - 3, 4, 3, 5,consts.start,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.start,consts.error,consts.start,consts.error,consts.error,consts.error, //10-17 - consts.error,consts.error,consts.start,consts.error,consts.error,consts.error, 3,consts.error, //18-1f - 3,consts.error,consts.error,consts.error,consts.start,consts.start,consts.start,consts.start //20-27 -]; - -jschardet.EUCJPCharLenTable = [2, 2, 2, 3, 1, 0]; - -jschardet.EUCJPSMModel = { - "classTable" : jschardet.EUCJP_cls, - "classFactor" : 6, - "stateTable" : jschardet.EUCJP_st, - "charLenTable" : jschardet.EUCJPCharLenTable, - "name" : "EUC-JP" -}; - -// EUC-KR - -jschardet.EUCKR_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 1,1,1,1,1,1,1,1, // 40 - 47 - 1,1,1,1,1,1,1,1, // 48 - 4f - 1,1,1,1,1,1,1,1, // 50 - 57 - 1,1,1,1,1,1,1,1, // 58 - 5f - 1,1,1,1,1,1,1,1, // 60 - 67 - 1,1,1,1,1,1,1,1, // 68 - 6f - 1,1,1,1,1,1,1,1, // 70 - 77 - 1,1,1,1,1,1,1,1, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,3,3,3, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,3,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 2,2,2,2,2,2,2,2, // e0 - e7 - 2,2,2,2,2,2,2,2, // e8 - ef - 2,2,2,2,2,2,2,2, // f0 - f7 - 2,2,2,2,2,2,2,0 // f8 - ff -]; - -jschardet.EUCKR_st = [ - consts.error,consts.start, 3,consts.error,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start //08-0f -]; - -jschardet.EUCKRCharLenTable = [0, 1, 2, 0]; - -jschardet.EUCKRSMModel = { - "classTable" : jschardet.EUCKR_cls, - "classFactor" : 4, - "stateTable" : jschardet.EUCKR_st, - "charLenTable" : jschardet.EUCKRCharLenTable, - "name" : "EUC-KR" -}; - -// EUC-TW - -jschardet.EUCTW_cls = [ - 2,2,2,2,2,2,2,2, // 00 - 07 - 2,2,2,2,2,2,0,0, // 08 - 0f - 2,2,2,2,2,2,2,2, // 10 - 17 - 2,2,2,0,2,2,2,2, // 18 - 1f - 2,2,2,2,2,2,2,2, // 20 - 27 - 2,2,2,2,2,2,2,2, // 28 - 2f - 2,2,2,2,2,2,2,2, // 30 - 37 - 2,2,2,2,2,2,2,2, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,2, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,6,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,3,4,4,4,4,4,4, // a0 - a7 - 5,5,1,1,1,1,1,1, // a8 - af - 1,1,1,1,1,1,1,1, // b0 - b7 - 1,1,1,1,1,1,1,1, // b8 - bf - 1,1,3,1,3,3,3,3, // c0 - c7 - 3,3,3,3,3,3,3,3, // c8 - cf - 3,3,3,3,3,3,3,3, // d0 - d7 - 3,3,3,3,3,3,3,3, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,3,3,3, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,3,3,0 // f8 - ff -]; - -jschardet.EUCTW_st = [ - consts.error,consts.error,consts.start, 3, 3, 3, 4,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.start,consts.error, //10-17 - consts.start,consts.start,consts.start,consts.error,consts.error,consts.error,consts.error,consts.error, //18-1f - 5,consts.error,consts.error,consts.error,consts.start,consts.error,consts.start,consts.start, //20-27 - consts.start,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //28-2f -]; - -jschardet.EUCTWCharLenTable = [0, 0, 1, 2, 2, 2, 3]; - -jschardet.EUCTWSMModel = { - "classTable" : jschardet.EUCTW_cls, - "classFactor" : 7, - "stateTable" : jschardet.EUCTW_st, - "charLenTable" : jschardet.EUCTWCharLenTable, - "name" : "x-euc-tw" -}; - -// GB2312 - -jschardet.GB2312_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 3,3,3,3,3,3,3,3, // 30 - 37 - 3,3,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,4, // 78 - 7f - 5,6,6,6,6,6,6,6, // 80 - 87 - 6,6,6,6,6,6,6,6, // 88 - 8f - 6,6,6,6,6,6,6,6, // 90 - 97 - 6,6,6,6,6,6,6,6, // 98 - 9f - 6,6,6,6,6,6,6,6, // a0 - a7 - 6,6,6,6,6,6,6,6, // a8 - af - 6,6,6,6,6,6,6,6, // b0 - b7 - 6,6,6,6,6,6,6,6, // b8 - bf - 6,6,6,6,6,6,6,6, // c0 - c7 - 6,6,6,6,6,6,6,6, // c8 - cf - 6,6,6,6,6,6,6,6, // d0 - d7 - 6,6,6,6,6,6,6,6, // d8 - df - 6,6,6,6,6,6,6,6, // e0 - e7 - 6,6,6,6,6,6,6,6, // e8 - ef - 6,6,6,6,6,6,6,6, // f0 - f7 - 6,6,6,6,6,6,6,0 // f8 - ff -]; - -jschardet.GB2312_st = [ - consts.error,consts.start,consts.start,consts.start,consts.start,consts.start, 3,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start, //10-17 - 4,consts.error,consts.start,consts.start,consts.error,consts.error,consts.error,consts.error, //18-1f - consts.error,consts.error, 5,consts.error,consts.error,consts.error,consts.itsMe,consts.error, //20-27 - consts.error,consts.error,consts.start,consts.start,consts.start,consts.start,consts.start,consts.start //28-2f -]; - -// To be accurate, the length of class 6 can be either 2 or 4. -// But it is not necessary to discriminate between the two since -// it is used for frequency analysis only, and we are validing -// each code range there as well. So it is safe to set it to be -// 2 here. -jschardet.GB2312CharLenTable = [0, 1, 1, 1, 1, 1, 2]; - -jschardet.GB2312SMModel = { - "classTable" : jschardet.GB2312_cls, - "classFactor" : 7, - "stateTable" : jschardet.GB2312_st, - "charLenTable" : jschardet.GB2312CharLenTable, - "name" : "GB2312" -}; - -// Shift_JIS - -jschardet.SJIS_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 2,2,2,2,2,2,2,2, // 40 - 47 - 2,2,2,2,2,2,2,2, // 48 - 4f - 2,2,2,2,2,2,2,2, // 50 - 57 - 2,2,2,2,2,2,2,2, // 58 - 5f - 2,2,2,2,2,2,2,2, // 60 - 67 - 2,2,2,2,2,2,2,2, // 68 - 6f - 2,2,2,2,2,2,2,2, // 70 - 77 - 2,2,2,2,2,2,2,1, // 78 - 7f - 3,3,3,3,3,3,3,3, // 80 - 87 - 3,3,3,3,3,3,3,3, // 88 - 8f - 3,3,3,3,3,3,3,3, // 90 - 97 - 3,3,3,3,3,3,3,3, // 98 - 9f - // 0xa0 is illegal in sjis encoding, but some pages does - // contain such byte. We need to be more consts.error forgiven. - 2,2,2,2,2,2,2,2, // a0 - a7 - 2,2,2,2,2,2,2,2, // a8 - af - 2,2,2,2,2,2,2,2, // b0 - b7 - 2,2,2,2,2,2,2,2, // b8 - bf - 2,2,2,2,2,2,2,2, // c0 - c7 - 2,2,2,2,2,2,2,2, // c8 - cf - 2,2,2,2,2,2,2,2, // d0 - d7 - 2,2,2,2,2,2,2,2, // d8 - df - 3,3,3,3,3,3,3,3, // e0 - e7 - 3,3,3,3,3,4,4,4, // e8 - ef - 3,3,3,3,3,3,3,3, // f0 - f7 - 3,3,3,3,3,0,0,0 // f8 - ff -]; - -jschardet.SJIS_st = [ - consts.error,consts.start,consts.start, 3,consts.error,consts.error,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe,consts.error,consts.error,consts.start,consts.start,consts.start,consts.start //10-17 -]; - -jschardet.SJISCharLenTable = [0, 1, 1, 2, 0, 0]; - -jschardet.SJISSMModel = { - "classTable" : jschardet.SJIS_cls, - "classFactor" : 6, - "stateTable" : jschardet.SJIS_st, - "charLenTable" : jschardet.SJISCharLenTable, - "name" : "Shift_JIS" -}; - -//UCS2-BE - -jschardet.UCS2BE_cls = [ - 0,0,0,0,0,0,0,0, // 00 - 07 - 0,0,1,0,0,2,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,3,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,3,3,3,3,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,0,0,0,0,0,0,0, // a0 - a7 - 0,0,0,0,0,0,0,0, // a8 - af - 0,0,0,0,0,0,0,0, // b0 - b7 - 0,0,0,0,0,0,0,0, // b8 - bf - 0,0,0,0,0,0,0,0, // c0 - c7 - 0,0,0,0,0,0,0,0, // c8 - cf - 0,0,0,0,0,0,0,0, // d0 - d7 - 0,0,0,0,0,0,0,0, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,4,5 // f8 - ff -]; - -jschardet.UCS2BE_st = [ - 5, 7, 7,consts.error, 4, 3,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe, 6, 6, 6, 6,consts.error,consts.error, //10-17 - 6, 6, 6, 6, 6,consts.itsMe, 6, 6, //18-1f - 6, 6, 6, 6, 5, 7, 7,consts.error, //20-27 - 5, 8, 6, 6,consts.error, 6, 6, 6, //28-2f - 6, 6, 6, 6,consts.error,consts.error,consts.start,consts.start //30-37 -]; - -jschardet.UCS2BECharLenTable = [2, 2, 2, 0, 2, 2]; - -jschardet.UCS2BESMModel = { - "classTable" : jschardet.UCS2BE_cls, - "classFactor" : 6, - "stateTable" : jschardet.UCS2BE_st, - "charLenTable" : jschardet.UCS2BECharLenTable, - "name" : "UTF-16BE" -}; - -// UCS2-LE - -jschardet.UCS2LE_cls = [ - 0,0,0,0,0,0,0,0, // 00 - 07 - 0,0,1,0,0,2,0,0, // 08 - 0f - 0,0,0,0,0,0,0,0, // 10 - 17 - 0,0,0,3,0,0,0,0, // 18 - 1f - 0,0,0,0,0,0,0,0, // 20 - 27 - 0,3,3,3,3,3,0,0, // 28 - 2f - 0,0,0,0,0,0,0,0, // 30 - 37 - 0,0,0,0,0,0,0,0, // 38 - 3f - 0,0,0,0,0,0,0,0, // 40 - 47 - 0,0,0,0,0,0,0,0, // 48 - 4f - 0,0,0,0,0,0,0,0, // 50 - 57 - 0,0,0,0,0,0,0,0, // 58 - 5f - 0,0,0,0,0,0,0,0, // 60 - 67 - 0,0,0,0,0,0,0,0, // 68 - 6f - 0,0,0,0,0,0,0,0, // 70 - 77 - 0,0,0,0,0,0,0,0, // 78 - 7f - 0,0,0,0,0,0,0,0, // 80 - 87 - 0,0,0,0,0,0,0,0, // 88 - 8f - 0,0,0,0,0,0,0,0, // 90 - 97 - 0,0,0,0,0,0,0,0, // 98 - 9f - 0,0,0,0,0,0,0,0, // a0 - a7 - 0,0,0,0,0,0,0,0, // a8 - af - 0,0,0,0,0,0,0,0, // b0 - b7 - 0,0,0,0,0,0,0,0, // b8 - bf - 0,0,0,0,0,0,0,0, // c0 - c7 - 0,0,0,0,0,0,0,0, // c8 - cf - 0,0,0,0,0,0,0,0, // d0 - d7 - 0,0,0,0,0,0,0,0, // d8 - df - 0,0,0,0,0,0,0,0, // e0 - e7 - 0,0,0,0,0,0,0,0, // e8 - ef - 0,0,0,0,0,0,0,0, // f0 - f7 - 0,0,0,0,0,0,4,5 // f8 - ff -]; - -jschardet.UCS2LE_st = [ - 6, 6, 7, 6, 4, 3,consts.error,consts.error, //00-07 - consts.error,consts.error,consts.error,consts.error,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //08-0f - consts.itsMe,consts.itsMe, 5, 5, 5,consts.error,consts.itsMe,consts.error, //10-17 - 5, 5, 5,consts.error, 5,consts.error, 6, 6, //18-1f - 7, 6, 8, 8, 5, 5, 5,consts.error, //20-27 - 5, 5, 5,consts.error,consts.error,consts.error, 5, 5, //28-2f - 5, 5, 5,consts.error, 5,consts.error,consts.start,consts.start //30-37 -]; - -jschardet.UCS2LECharLenTable = [2, 2, 2, 2, 2, 2]; - -jschardet.UCS2LESMModel = { - "classTable" : jschardet.UCS2LE_cls, - "classFactor" : 6, - "stateTable" : jschardet.UCS2LE_st, - "charLenTable" : jschardet.UCS2LECharLenTable, - "name" : "UTF-16LE" -}; - -// UTF-8 - -jschardet.UTF8_cls = [ - 1,1,1,1,1,1,1,1, // 00 - 07 //allow 0x00 as a legal value - 1,1,1,1,1,1,0,0, // 08 - 0f - 1,1,1,1,1,1,1,1, // 10 - 17 - 1,1,1,0,1,1,1,1, // 18 - 1f - 1,1,1,1,1,1,1,1, // 20 - 27 - 1,1,1,1,1,1,1,1, // 28 - 2f - 1,1,1,1,1,1,1,1, // 30 - 37 - 1,1,1,1,1,1,1,1, // 38 - 3f - 1,1,1,1,1,1,1,1, // 40 - 47 - 1,1,1,1,1,1,1,1, // 48 - 4f - 1,1,1,1,1,1,1,1, // 50 - 57 - 1,1,1,1,1,1,1,1, // 58 - 5f - 1,1,1,1,1,1,1,1, // 60 - 67 - 1,1,1,1,1,1,1,1, // 68 - 6f - 1,1,1,1,1,1,1,1, // 70 - 77 - 1,1,1,1,1,1,1,1, // 78 - 7f - 2,2,2,2,3,3,3,3, // 80 - 87 - 4,4,4,4,4,4,4,4, // 88 - 8f - 4,4,4,4,4,4,4,4, // 90 - 97 - 4,4,4,4,4,4,4,4, // 98 - 9f - 5,5,5,5,5,5,5,5, // a0 - a7 - 5,5,5,5,5,5,5,5, // a8 - af - 5,5,5,5,5,5,5,5, // b0 - b7 - 5,5,5,5,5,5,5,5, // b8 - bf - 0,0,6,6,6,6,6,6, // c0 - c7 - 6,6,6,6,6,6,6,6, // c8 - cf - 6,6,6,6,6,6,6,6, // d0 - d7 - 6,6,6,6,6,6,6,6, // d8 - df - 7,8,8,8,8,8,8,8, // e0 - e7 - 8,8,8,8,8,9,8,8, // e8 - ef - 10,11,11,11,11,11,11,11, // f0 - f7 - 12,13,13,13,14,15,0,0 // f8 - ff -]; - -jschardet.UTF8_st = [ - consts.error,consts.start,consts.error,consts.error,consts.error,consts.error, 12, 10, //00-07 - 9, 11, 8, 7, 6, 5, 4, 3, //08-0f - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //10-17 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //18-1f - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //20-27 - consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe,consts.itsMe, //28-2f - consts.error,consts.error, 5, 5, 5, 5,consts.error,consts.error, //30-37 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //38-3f - consts.error,consts.error,consts.error, 5, 5, 5,consts.error,consts.error, //40-47 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //48-4f - consts.error,consts.error, 7, 7, 7, 7,consts.error,consts.error, //50-57 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //58-5f - consts.error,consts.error,consts.error,consts.error, 7, 7,consts.error,consts.error, //60-67 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //68-6f - consts.error,consts.error, 9, 9, 9, 9,consts.error,consts.error, //70-77 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //78-7f - consts.error,consts.error,consts.error,consts.error,consts.error, 9,consts.error,consts.error, //80-87 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //88-8f - consts.error,consts.error, 12, 12, 12, 12,consts.error,consts.error, //90-97 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //98-9f - consts.error,consts.error,consts.error,consts.error,consts.error, 12,consts.error,consts.error, //a0-a7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //a8-af - consts.error,consts.error, 12, 12, 12,consts.error,consts.error,consts.error, //b0-b7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error, //b8-bf - consts.error,consts.error,consts.start,consts.start,consts.start,consts.start,consts.error,consts.error, //c0-c7 - consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error,consts.error //c8-cf -]; - -jschardet.UTF8CharLenTable = [0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6]; - -jschardet.UTF8SMModel = { - "classTable" : jschardet.UTF8_cls, - "classFactor" : 16, - "stateTable" : jschardet.UTF8_st, - "charLenTable" : jschardet.UTF8CharLenTable, - "name" : "UTF-8" -}; - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/sbcharsetprober.js b/tools/eslint/node_modules/jschardet/src/sbcharsetprober.js deleted file mode 100755 index 81e727924b68e2..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/sbcharsetprober.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SingleByteCharSetProber = function(model, reversed, nameProber) { - jschardet.CharSetProber.apply(this); - - var SAMPLE_SIZE = 64; - var SB_ENOUGH_REL_THRESHOLD = 1024; - var POSITIVE_SHORTCUT_THRESHOLD = 0.95; - var NEGATIVE_SHORTCUT_THRESHOLD = 0.05; - var SYMBOL_CAT_ORDER = 250; - var NUMBER_OF_SEQ_CAT = 4; - var POSITIVE_CAT = NUMBER_OF_SEQ_CAT - 1; - //var NEGATIVE_CAT = 0; - - var self = this; - - function init(model, reversed, nameProber) { - self._mModel = model; - self._mReversed = reversed; // "true" if we need to reverse every pair in the model lookup - self._mNameProber = nameProber; // Optional auxiliary prober for name decision - self.reset(); - } - - this.reset = function() { - jschardet.SingleByteCharSetProber.prototype.reset.apply(this); - this._mLastOrder = 255; // char order of last character - this._mSeqCounters = []; - for( var i = 0; i < NUMBER_OF_SEQ_CAT; this._mSeqCounters[i++] = 0 ); - this._mTotalSeqs = 0; - this._mTotalChar = 0; - this._mFreqChar = 0; // characters that fall in our sampling range - } - - this.getCharsetName = function() { - if( this._mNameProber ) { - return this._mNameProber.getCharsetName(); - } else { - return this._mModel.charsetName; - } - } - - this.feed = function(aBuf) { - if( ! this._mModel.keepEnglishLetter ) { - aBuf = this.filterWithoutEnglishLetters(aBuf); - } - var aLen = aBuf.length; - if( !aLen ) { - return this.getState(); - } - for( var i = 0, c; i < aLen; i++ ) - { - c = aBuf.charCodeAt(i); - var order = this._mModel.charToOrderMap[c]; - if( order < SYMBOL_CAT_ORDER ) { - this._mTotalChar++; - } - if( order < SAMPLE_SIZE ) { - this._mFreqChar++; - if( this._mLastOrder < SAMPLE_SIZE ) { - this._mTotalSeqs++; - if( !this._mReversed ) { - this._mSeqCounters[this._mModel.precedenceMatrix[(this._mLastOrder * SAMPLE_SIZE) + order]]++; - } else { // reverse the order of the letters in the lookup - this._mSeqCounters[this._mModel.precedenceMatrix[(order * SAMPLE_SIZE) + this._mLastOrder]]++; - } - } - } - this._mLastOrder = order; - } - - if( this.getState() == jschardet.Constants.detecting ) { - if( self._mTotalSeqs > SB_ENOUGH_REL_THRESHOLD ) { - var cf = this.getConfidence(); - if( cf > POSITIVE_SHORTCUT_THRESHOLD ) { - if( jschardet.Constants._debug ) { - jschardet.log(this._mModel.charsetName + " confidence = " + cf + ", we have a winner\n"); - } - } else if( cf < NEGATIVE_SHORTCUT_THRESHOLD ) { - if( jschardet.Constants._debug ) { - jschardet.log(this._mModel.charsetName + " confidence = " + cf + ", below negative shortcut threshhold " + NEGATIVE_SHORTCUT_THRESHOLD + "\n"); - } - this._mState = jschardet.Constants.notMe; - } - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var r = 0.01; - if( this._mTotalSeqs > 0 ) { - //jschardet.log(this._mSeqCounters[POSITIVE_CAT] + " " + this._mTotalSeqs + " " + this._mModel.mTypicalPositiveRatio); - r = (1.0 * this._mSeqCounters[POSITIVE_CAT]) / this._mTotalSeqs / this._mModel.mTypicalPositiveRatio; - //jschardet.log(r + " " + this._mFreqChar + " " + this._mTotalChar); - r *= this._mFreqChar / this._mTotalChar; - if( r >= 1.0 ) { - r = 0.99; - } - } - return r; - } - - reversed = reversed !== undefined ? reversed : false; - nameProber = nameProber !== undefined ? nameProber : null; - init(model, reversed, nameProber); -} -jschardet.SingleByteCharSetProber.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/sbcsgroupprober.js b/tools/eslint/node_modules/jschardet/src/sbcsgroupprober.js deleted file mode 100755 index 3ba4148a3d1045..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/sbcsgroupprober.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SBCSGroupProber = function() { - jschardet.CharSetGroupProber.apply(this); - - var self = this; - - function init() { - self._mProbers = [ - new jschardet.SingleByteCharSetProber(jschardet.Win1251CyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.Koi8rModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin5CyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.MacCyrillicModel), - new jschardet.SingleByteCharSetProber(jschardet.Ibm866Model), - new jschardet.SingleByteCharSetProber(jschardet.Ibm855Model), - new jschardet.SingleByteCharSetProber(jschardet.Latin7GreekModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1253GreekModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin5BulgarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1251BulgarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Latin2HungarianModel), - new jschardet.SingleByteCharSetProber(jschardet.Win1250HungarianModel), - new jschardet.SingleByteCharSetProber(jschardet.TIS620ThaiModel) - ]; - var hebrewProber = new jschardet.HebrewProber(); - var logicalHebrewProber = new jschardet.SingleByteCharSetProber(jschardet.Win1255HebrewModel, false, hebrewProber); - var visualHebrewProber = new jschardet.SingleByteCharSetProber(jschardet.Win1255HebrewModel, true, hebrewProber); - hebrewProber.setModelProbers(logicalHebrewProber, visualHebrewProber); - self._mProbers.push(hebrewProber, logicalHebrewProber, visualHebrewProber); - - self.reset(); - } - - init(); -} -jschardet.SBCSGroupProber.prototype = new jschardet.CharSetGroupProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/sjisprober.js b/tools/eslint/node_modules/jschardet/src/sjisprober.js deleted file mode 100755 index a6b2d7254ced42..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/sjisprober.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.SJISProber = function() { - jschardet.MultiByteCharSetProber.apply(this); - - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.SJISSMModel); - self._mDistributionAnalyzer = new jschardet.SJISDistributionAnalysis(); - self._mContextAnalyzer = new jschardet.SJISContextAnalysis(); - self.reset(); - } - - this.reset = function() { - jschardet.SJISProber.prototype.reset.apply(this); - this._mContextAnalyzer.reset(); - } - - this.getCharsetName = function() { - return "SHIFT_JIS"; - } - - this.feed = function(aBuf) { - var aLen = aBuf.length; - for( var i = 0; i < aLen; i++ ) { - var codingState = this._mCodingSM.nextState(aBuf[i]); - if( codingState == jschardet.Constants.error ) { - if( jschardet.Constants._debug ) { - jschardet.log(this.getCharsetName() + " prober hit error at byte " + i + "\n"); - } - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - var charLen = this._mCodingSM.getCurrentCharLen(); - if( i == 0 ) { - this._mLastChar[1] = aBuf[0]; - this._mContextAnalyzer.feed(this._mLastChar.slice(2 - charLen), charLen); - this._mDistributionAnalyzer.feed(this._mLastChar, charLen); - } else { - this._mContextAnalyzer.feed(aBuf.slice(i + 1 - charLen, i + 3 - charLen), charLen); - this._mDistributionAnalyzer.feed(aBuf.slice(i - 1, i + 1), charLen); - } - } - } - - this._mLastChar[0] = aBuf[aLen - 1]; - - if( this.getState() == jschardet.Constants.detecting ) { - if( this._mContextAnalyzer.gotEnoughData() && - this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var contxtCf = this._mContextAnalyzer.getConfidence(); - var distribCf = this._mDistributionAnalyzer.getConfidence(); - return Math.max(contxtCf, distribCf); - } - - init(); -} -jschardet.SJISProber.prototype = new jschardet.MultiByteCharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/universaldetector.js b/tools/eslint/node_modules/jschardet/src/universaldetector.js deleted file mode 100755 index 7a8062f4a01eb8..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/universaldetector.js +++ /dev/null @@ -1,210 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -/** - * This is a port from the python port, version "2.0.1" - */ - -!function(jschardet) { - -jschardet.UniversalDetector = function() { - var MINIMUM_THRESHOLD = jschardet.Constants.MINIMUM_THRESHOLD; - var _state = { - pureAscii : 0, - escAscii : 1, - highbyte : 2 - }; - var self = this; - - function init() { - self._highBitDetector = /[\x80-\xFF]/; - self._escDetector = /(\x1B|~\{)/; - self._mEscCharsetProber = null; - self._mCharsetProbers = []; - self.reset(); - } - - this.reset = function() { - this.result = {"encoding": null, "confidence": 0.0}; - this.done = false; - this._mStart = true; - this._mGotData = false; - this._mInputState = _state.pureAscii; - this._mLastChar = ""; - this._mBOM = ""; - if( this._mEscCharsetProber ) { - this._mEscCharsetProber.reset(); - } - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - prober.reset(); - } - } - - this.feed = function(aBuf) { - if( this.done ) return; - - var aLen = aBuf.length; - if( !aLen ) return; - - if( !this._mGotData ) { - this._mBOM += aBuf; - // If the data starts with BOM, we know it is UTF - if( this._mBOM.slice(0,3) == "\xEF\xBB\xBF" ) { - // EF BB BF UTF-8 with BOM - this.result = {"encoding": "UTF-8", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\xFF\xFE\x00\x00" ) { - // FF FE 00 00 UTF-32, little-endian BOM - this.result = {"encoding": "UTF-32LE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\x00\x00\xFE\xFF" ) { - // 00 00 FE FF UTF-32, big-endian BOM - this.result = {"encoding": "UTF-32BE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\xFE\xFF\x00\x00" ) { - // FE FF 00 00 UCS-4, unusual octet order BOM (3412) - this.result = {"encoding": "X-ISO-10646-UCS-4-3412", "confidence": 1.0}; - } else if( this._mBOM.slice(0,4) == "\x00\x00\xFF\xFE" ) { - // 00 00 FF FE UCS-4, unusual octet order BOM (2143) - this.result = {"encoding": "X-ISO-10646-UCS-4-2143", "confidence": 1.0}; - } else if( this._mBOM.slice(0,2) == "\xFF\xFE" ) { - // FF FE UTF-16, little endian BOM - this.result = {"encoding": "UTF-16LE", "confidence": 1.0}; - } else if( this._mBOM.slice(0,2) == "\xFE\xFF" ) { - // FE FF UTF-16, big endian BOM - this.result = {"encoding": "UTF-16BE", "confidence": 1.0}; - } - - // If we got to 4 chars without being able to detect a BOM we - // stop trying. - if( this._mBOM.length > 3 ) { - this._mGotData = true; - } - } - - if( this.result.encoding && (this.result.confidence > 0.0) ) { - this.done = true; - return; - } - - if( this._mInputState == _state.pureAscii ) { - if( this._highBitDetector.test(aBuf) ) { - this._mInputState = _state.highbyte; - } else if( this._escDetector.test(this._mLastChar + aBuf) ) { - this._mInputState = _state.escAscii; - } - } - - this._mLastChar = aBuf.slice(-1); - - if( this._mInputState == _state.escAscii ) { - if( !this._mEscCharsetProber ) { - this._mEscCharsetProber = new jschardet.EscCharSetProber(); - } - if( this._mEscCharsetProber.feed(aBuf) == jschardet.Constants.foundIt ) { - this.result = { - "encoding": this._mEscCharsetProber.getCharsetName(), - "confidence": this._mEscCharsetProber.getConfidence() - }; - this.done = true; - } - } else if( this._mInputState == _state.highbyte ) { - if( this._mCharsetProbers.length == 0 ) { - this._mCharsetProbers = [ - new jschardet.MBCSGroupProber(), - new jschardet.SBCSGroupProber(), - new jschardet.Latin1Prober() - ]; - } - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( prober.feed(aBuf) == jschardet.Constants.foundIt ) { - this.result = { - "encoding": prober.getCharsetName(), - "confidence": prober.getConfidence() - }; - this.done = true; - break; - } - } - } - } - - this.close = function() { - if( this.done ) return; - if( this._mBOM.length === 0 ) { - if( jschardet.Constants._debug ) { - jschardet.log("no data received!\n"); - } - return; - } - this.done = true; - - if( this._mInputState == _state.pureAscii ) { - if( jschardet.Constants._debug ) { - jschardet.log("pure ascii") - } - this.result = {"encoding": "ascii", "confidence": 1.0}; - return this.result; - } - - if( this._mInputState == _state.highbyte ) { - var proberConfidence = null; - var maxProberConfidence = 0.0; - var maxProber = null; - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( !prober ) continue; - proberConfidence = prober.getConfidence(); - if( proberConfidence > maxProberConfidence ) { - maxProberConfidence = proberConfidence; - maxProber = prober; - } - if( jschardet.Constants._debug ) { - jschardet.log(prober.getCharsetName() + " confidence " + prober.getConfidence()); - } - } - if( maxProber && maxProberConfidence > MINIMUM_THRESHOLD ) { - this.result = { - "encoding": maxProber.getCharsetName(), - "confidence": maxProber.getConfidence() - }; - return this.result; - } - } - - if( jschardet.Constants._debug ) { - jschardet.log("no probers hit minimum threshhold\n"); - for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { - if( !prober ) continue; - jschardet.log(prober.getCharsetName() + " confidence = " + - prober.getConfidence() + "\n"); - } - } - } - - init(); -} - -}(require('./init')); diff --git a/tools/eslint/node_modules/jschardet/src/utf8prober.js b/tools/eslint/node_modules/jschardet/src/utf8prober.js deleted file mode 100755 index 6c9a8d5dd1c64e..00000000000000 --- a/tools/eslint/node_modules/jschardet/src/utf8prober.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The Original Code is Mozilla Universal charset detector code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * António Afonso (antonio.afonso gmail.com) - port to JavaScript - * Mark Pilgrim - port to Python - * Shy Shalom - original C code - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -!function(jschardet) { - -jschardet.UTF8Prober = function() { - jschardet.CharSetProber.apply(this); - - var ONE_CHAR_PROB = 0.5; - var self = this; - - function init() { - self._mCodingSM = new jschardet.CodingStateMachine(jschardet.UTF8SMModel); - self.reset(); - } - - this.reset = function() { - jschardet.UTF8Prober.prototype.reset.apply(this); - this._mCodingSM.reset(); - this._mNumOfMBChar = 0; - } - - this.getCharsetName = function() { - return "UTF-8"; - } - - this.feed = function(aBuf) { - for( var i = 0, c; i < aBuf.length; i++ ) { - c = aBuf[i]; - var codingState = this._mCodingSM.nextState(c); - if( codingState == jschardet.Constants.error ) { - this._mState = jschardet.Constants.notMe; - break; - } else if( codingState == jschardet.Constants.itsMe ) { - this._mState = jschardet.Constants.foundIt; - break; - } else if( codingState == jschardet.Constants.start ) { - if( this._mCodingSM.getCurrentCharLen() >= 2 ) { - this._mNumOfMBChar++; - } - } - } - - if( this.getState() == jschardet.Constants.detecting ) { - if( this.getConfidence() > jschardet.Constants.SHORTCUT_THRESHOLD ) { - this._mState = jschardet.Constants.foundIt; - } - } - - return this.getState(); - } - - this.getConfidence = function() { - var unlike = 0.99; - if( this._mNumOfMBChar < 6 ) { - for( var i = 0; i < this._mNumOfMBChar; i++ ) { - unlike *= ONE_CHAR_PROB; - } - return 1 - unlike; - } else { - return unlike; - } - } - - init(); -} -jschardet.UTF8Prober.prototype = new jschardet.CharSetProber(); - -}(require('./init')); diff --git a/tools/eslint/node_modules/json-stable-stringify/LICENSE b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/LICENSE similarity index 100% rename from tools/eslint/node_modules/json-stable-stringify/LICENSE rename to tools/eslint/node_modules/json-stable-stringify-without-jsonify/LICENSE diff --git a/tools/eslint/node_modules/json-stable-stringify/index.js b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/index.js similarity index 91% rename from tools/eslint/node_modules/json-stable-stringify/index.js rename to tools/eslint/node_modules/json-stable-stringify-without-jsonify/index.js index 6a4131d44e3065..a6f40c7b71a4e3 100644 --- a/tools/eslint/node_modules/json-stable-stringify/index.js +++ b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/index.js @@ -1,5 +1,3 @@ -var json = typeof JSON !== 'undefined' ? JSON : require('jsonify'); - module.exports = function (obj, opts) { if (!opts) opts = {}; if (typeof opts === 'function') opts = { cmp: opts }; @@ -33,19 +31,19 @@ module.exports = function (obj, opts) { return; } if (typeof node !== 'object' || node === null) { - return json.stringify(node); + return JSON.stringify(node); } if (isArray(node)) { var out = []; for (var i = 0; i < node.length; i++) { - var item = stringify(node, i, node[i], level+1) || json.stringify(null); + var item = stringify(node, i, node[i], level+1) || JSON.stringify(null); out.push(indent + space + item); } return '[' + out.join(',') + indent + ']'; } else { if (seen.indexOf(node) !== -1) { - if (cycles) return json.stringify('__cycle__'); + if (cycles) return JSON.stringify('__cycle__'); throw new TypeError('Converting circular structure to JSON'); } else seen.push(node); @@ -58,7 +56,7 @@ module.exports = function (obj, opts) { if(!value) continue; - var keyValue = json.stringify(key) + var keyValue = JSON.stringify(key) + colonSeparator + value; ; diff --git a/tools/eslint/node_modules/json-stable-stringify/package.json b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/package.json similarity index 54% rename from tools/eslint/node_modules/json-stable-stringify/package.json rename to tools/eslint/node_modules/json-stable-stringify-without-jsonify/package.json index 08d536ebb969f6..ffbb8a39c6b454 100644 --- a/tools/eslint/node_modules/json-stable-stringify/package.json +++ b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/package.json @@ -1,16 +1,16 @@ { - "_from": "json-stable-stringify@^1.0.1", - "_id": "json-stable-stringify@1.0.1", + "_from": "json-stable-stringify-without-jsonify@^1.0.1", + "_id": "json-stable-stringify-without-jsonify@1.0.1", "_inBundle": false, - "_integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "_location": "/eslint/json-stable-stringify", + "_integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "_location": "/eslint/json-stable-stringify-without-jsonify", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "json-stable-stringify@^1.0.1", - "name": "json-stable-stringify", - "escapedName": "json-stable-stringify", + "raw": "json-stable-stringify-without-jsonify@^1.0.1", + "name": "json-stable-stringify-without-jsonify", + "escapedName": "json-stable-stringify-without-jsonify", "rawSpec": "^1.0.1", "saveSpec": null, "fetchSpec": "^1.0.1" @@ -18,9 +18,9 @@ "_requiredBy": [ "/eslint" ], - "_resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "_shasum": "9a759d39c5f2ff503fd5300646ed445f88c4f9af", - "_spec": "json-stable-stringify@^1.0.1", + "_resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "_shasum": "9db7b59496ad3f3cfef30a75142d2d930ad72651", + "_spec": "json-stable-stringify-without-jsonify@^1.0.1", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint", "author": { "name": "James Halliday", @@ -28,18 +28,16 @@ "url": "http://substack.net" }, "bugs": { - "url": "https://github.com/substack/json-stable-stringify/issues" + "url": "https://github.com/samn/json-stable-stringify/issues" }, "bundleDependencies": false, - "dependencies": { - "jsonify": "~0.0.0" - }, + "dependencies": {}, "deprecated": false, - "description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results", + "description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies", "devDependencies": { "tape": "~1.0.4" }, - "homepage": "https://github.com/substack/json-stable-stringify", + "homepage": "https://github.com/samn/json-stable-stringify", "keywords": [ "json", "stringify", @@ -50,10 +48,10 @@ ], "license": "MIT", "main": "index.js", - "name": "json-stable-stringify", + "name": "json-stable-stringify-without-jsonify", "repository": { "type": "git", - "url": "git://github.com/substack/json-stable-stringify.git" + "url": "git://github.com/samn/json-stable-stringify.git" }, "scripts": { "test": "tape test/*.js" diff --git a/tools/eslint/node_modules/json-stable-stringify/readme.markdown b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/readme.markdown similarity index 95% rename from tools/eslint/node_modules/json-stable-stringify/readme.markdown rename to tools/eslint/node_modules/json-stable-stringify-without-jsonify/readme.markdown index 406c3c72614ba7..e95b468ab4f8eb 100644 --- a/tools/eslint/node_modules/json-stable-stringify/readme.markdown +++ b/tools/eslint/node_modules/json-stable-stringify-without-jsonify/readme.markdown @@ -1,5 +1,7 @@ # json-stable-stringify +This is the same as https://github.com/substack/json-stable-stringify but it doesn't depend on libraries without licenses (jsonify). + deterministic version of `JSON.stringify()` so you can get a consistent hash from stringified results diff --git a/tools/eslint/node_modules/jsonify/README.markdown b/tools/eslint/node_modules/jsonify/README.markdown deleted file mode 100644 index 71d9a93b5974ee..00000000000000 --- a/tools/eslint/node_modules/jsonify/README.markdown +++ /dev/null @@ -1,34 +0,0 @@ -jsonify -======= - -This module provides Douglas Crockford's JSON implementation without modifying -any globals. - -`stringify` and `parse` are merely exported without respect to whether or not a -global `JSON` object exists. - -methods -======= - -var json = require('jsonify'); - -json.parse(source, reviver) ---------------------------- - -Return a new javascript object from a parse of the `source` string. - -If a `reviver` function is specified, walk the structure passing each name/value -pair to `reviver.call(parent, key, value)` to transform the `value` before -parsing it. - -json.stringify(value, replacer, space) --------------------------------------- - -Return a string representation for `value`. - -If `replacer` is specified, walk the structure passing each name/value pair to -`replacer.call(parent, key, value)` to transform the `value` before stringifying -it. - -If `space` is a number, indent the result by that many spaces. -If `space` is a string, use `space` as the indentation. diff --git a/tools/eslint/node_modules/jsonify/index.js b/tools/eslint/node_modules/jsonify/index.js deleted file mode 100644 index f728a1605a824d..00000000000000 --- a/tools/eslint/node_modules/jsonify/index.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.parse = require('./lib/parse'); -exports.stringify = require('./lib/stringify'); diff --git a/tools/eslint/node_modules/jsonify/lib/parse.js b/tools/eslint/node_modules/jsonify/lib/parse.js deleted file mode 100644 index 30e2f014363514..00000000000000 --- a/tools/eslint/node_modules/jsonify/lib/parse.js +++ /dev/null @@ -1,273 +0,0 @@ -var at, // The index of the current character - ch, // The current character - escapee = { - '"': '"', - '\\': '\\', - '/': '/', - b: '\b', - f: '\f', - n: '\n', - r: '\r', - t: '\t' - }, - text, - - error = function (m) { - // Call error when something is wrong. - throw { - name: 'SyntaxError', - message: m, - at: at, - text: text - }; - }, - - next = function (c) { - // If a c parameter is provided, verify that it matches the current character. - if (c && c !== ch) { - error("Expected '" + c + "' instead of '" + ch + "'"); - } - - // Get the next character. When there are no more characters, - // return the empty string. - - ch = text.charAt(at); - at += 1; - return ch; - }, - - number = function () { - // Parse a number value. - var number, - string = ''; - - if (ch === '-') { - string = '-'; - next('-'); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - if (ch === '.') { - string += '.'; - while (next() && ch >= '0' && ch <= '9') { - string += ch; - } - } - if (ch === 'e' || ch === 'E') { - string += ch; - next(); - if (ch === '-' || ch === '+') { - string += ch; - next(); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - } - number = +string; - if (!isFinite(number)) { - error("Bad number"); - } else { - return number; - } - }, - - string = function () { - // Parse a string value. - var hex, - i, - string = '', - uffff; - - // When parsing for string values, we must look for " and \ characters. - if (ch === '"') { - while (next()) { - if (ch === '"') { - next(); - return string; - } else if (ch === '\\') { - next(); - if (ch === 'u') { - uffff = 0; - for (i = 0; i < 4; i += 1) { - hex = parseInt(next(), 16); - if (!isFinite(hex)) { - break; - } - uffff = uffff * 16 + hex; - } - string += String.fromCharCode(uffff); - } else if (typeof escapee[ch] === 'string') { - string += escapee[ch]; - } else { - break; - } - } else { - string += ch; - } - } - } - error("Bad string"); - }, - - white = function () { - -// Skip whitespace. - - while (ch && ch <= ' ') { - next(); - } - }, - - word = function () { - -// true, false, or null. - - switch (ch) { - case 't': - next('t'); - next('r'); - next('u'); - next('e'); - return true; - case 'f': - next('f'); - next('a'); - next('l'); - next('s'); - next('e'); - return false; - case 'n': - next('n'); - next('u'); - next('l'); - next('l'); - return null; - } - error("Unexpected '" + ch + "'"); - }, - - value, // Place holder for the value function. - - array = function () { - -// Parse an array value. - - var array = []; - - if (ch === '[') { - next('['); - white(); - if (ch === ']') { - next(']'); - return array; // empty array - } - while (ch) { - array.push(value()); - white(); - if (ch === ']') { - next(']'); - return array; - } - next(','); - white(); - } - } - error("Bad array"); - }, - - object = function () { - -// Parse an object value. - - var key, - object = {}; - - if (ch === '{') { - next('{'); - white(); - if (ch === '}') { - next('}'); - return object; // empty object - } - while (ch) { - key = string(); - white(); - next(':'); - if (Object.hasOwnProperty.call(object, key)) { - error('Duplicate key "' + key + '"'); - } - object[key] = value(); - white(); - if (ch === '}') { - next('}'); - return object; - } - next(','); - white(); - } - } - error("Bad object"); - }; - -value = function () { - -// Parse a JSON value. It could be an object, an array, a string, a number, -// or a word. - - white(); - switch (ch) { - case '{': - return object(); - case '[': - return array(); - case '"': - return string(); - case '-': - return number(); - default: - return ch >= '0' && ch <= '9' ? number() : word(); - } -}; - -// Return the json_parse function. It will have access to all of the above -// functions and variables. - -module.exports = function (source, reviver) { - var result; - - text = source; - at = 0; - ch = ' '; - result = value(); - white(); - if (ch) { - error("Syntax error"); - } - - // If there is a reviver function, we recursively walk the new structure, - // passing each name/value pair to the reviver function for possible - // transformation, starting with a temporary root object that holds the result - // in an empty key. If there is not a reviver function, we simply return the - // result. - - return typeof reviver === 'function' ? (function walk(holder, key) { - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - }({'': result}, '')) : result; -}; diff --git a/tools/eslint/node_modules/jsonify/lib/stringify.js b/tools/eslint/node_modules/jsonify/lib/stringify.js deleted file mode 100644 index 13458708144dea..00000000000000 --- a/tools/eslint/node_modules/jsonify/lib/stringify.js +++ /dev/null @@ -1,154 +0,0 @@ -var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - -function quote(string) { - // If the string contains no control characters, no quote characters, and no - // backslash characters, then we can safely slap some quotes around it. - // Otherwise we must also replace the offending characters with safe escape - // sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; -} - -function str(key, holder) { - // Produce a string from holder[key]. - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - - // If the value has a toJSON method, call it to obtain a replacement value. - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - - // If we were called with a replacer function, then call the replacer to - // obtain a replacement value. - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - - // What happens next depends on the value's type. - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - // JSON numbers must be finite. Encode non-finite numbers as null. - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - // If the value is a boolean or null, convert it to a string. Note: - // typeof null does not produce 'null'. The case is included here in - // the remote chance that this gets fixed someday. - return String(value); - - case 'object': - if (!value) return 'null'; - gap += indent; - partial = []; - - // Array.isArray - if (Object.prototype.toString.apply(value) === '[object Array]') { - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - - // Join all of the elements together, separated with commas, and - // wrap them in brackets. - v = partial.length === 0 ? '[]' : gap ? - '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - - // If the replacer is an array, use it to select the members to be - // stringified. - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - k = rep[i]; - if (typeof k === 'string') { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - else { - // Otherwise, iterate through all of the keys in the object. - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - - // Join all of the member texts together, separated with commas, - // and wrap them in braces. - - v = partial.length === 0 ? '{}' : gap ? - '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : - '{' + partial.join(',') + '}'; - gap = mind; - return v; - } -} - -module.exports = function (value, replacer, space) { - var i; - gap = ''; - indent = ''; - - // If the space parameter is a number, make an indent string containing that - // many spaces. - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - } - // If the space parameter is a string, it will be used as the indent string. - else if (typeof space === 'string') { - indent = space; - } - - // If there is a replacer, it must be a function or an array. - // Otherwise, throw an error. - rep = replacer; - if (replacer && typeof replacer !== 'function' - && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - - // Make a fake root object containing our value under the key of ''. - // Return the result of stringifying the value. - return str('', {'': value}); -}; diff --git a/tools/eslint/node_modules/jsonify/package.json b/tools/eslint/node_modules/jsonify/package.json deleted file mode 100644 index 56bea38f2411cb..00000000000000 --- a/tools/eslint/node_modules/jsonify/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "jsonify@~0.0.0", - "_id": "jsonify@0.0.0", - "_inBundle": false, - "_integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "_location": "/eslint/jsonify", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "jsonify@~0.0.0", - "name": "jsonify", - "escapedName": "jsonify", - "rawSpec": "~0.0.0", - "saveSpec": null, - "fetchSpec": "~0.0.0" - }, - "_requiredBy": [ - "/eslint/json-stable-stringify" - ], - "_resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "_shasum": "2c74b6ee41d93ca51b7b5aaee8f503631d252a73", - "_spec": "jsonify@~0.0.0", - "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/json-stable-stringify", - "author": { - "name": "Douglas Crockford", - "url": "http://crockford.com/" - }, - "bugs": { - "url": "https://github.com/substack/jsonify/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "JSON without touching any globals", - "devDependencies": { - "garbage": "0.0.x", - "tap": "0.0.x" - }, - "directories": { - "lib": ".", - "test": "test" - }, - "engines": { - "node": "*" - }, - "homepage": "https://github.com/substack/jsonify#readme", - "keywords": [ - "json", - "browser" - ], - "license": "Public Domain", - "main": "index.js", - "name": "jsonify", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/substack/jsonify.git" - }, - "scripts": { - "test": "tap test" - }, - "version": "0.0.0" -} diff --git a/tools/eslint/node_modules/unified/package.json b/tools/eslint/node_modules/unified/package.json index e87298c38db4e6..015e48121c43d9 100644 --- a/tools/eslint/node_modules/unified/package.json +++ b/tools/eslint/node_modules/unified/package.json @@ -1,8 +1,8 @@ { "_from": "unified@^6.1.2", - "_id": "unified@6.1.5", + "_id": "unified@6.1.6", "_inBundle": false, - "_integrity": "sha1-cWk3hyYhpjE15iztLzrGoGPG+4c=", + "_integrity": "sha512-pW2f82bCIo2ifuIGYcV12fL96kMMYgw7JKVEgh7ODlrM9rj6vXSY3BV+H6lCcv1ksxynFf582hwWLnA1qRFy4w==", "_location": "/unified", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/eslint-plugin-markdown" ], - "_resolved": "https://registry.npmjs.org/unified/-/unified-6.1.5.tgz", - "_shasum": "716937872621a63135e62ced2f3ac6a063c6fb87", + "_resolved": "https://registry.npmjs.org/unified/-/unified-6.1.6.tgz", + "_shasum": "5ea7f807a0898f1f8acdeefe5f25faa010cc42b1", "_spec": "unified@^6.1.2", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/eslint-plugin-markdown", "author": { @@ -53,7 +53,7 @@ "browserify": "^14.0.0", "esmangle": "^1.0.0", "nyc": "^11.0.0", - "remark-cli": "^3.0.0", + "remark-cli": "^4.0.0", "remark-preset-wooorm": "^3.0.0", "tape": "^4.4.0", "xo": "^0.18.1" @@ -100,7 +100,7 @@ "test-api": "node test", "test-coverage": "nyc --reporter lcov tape test" }, - "version": "6.1.5", + "version": "6.1.6", "xo": { "space": true, "esnext": false, diff --git a/tools/eslint/node_modules/unified/readme.md b/tools/eslint/node_modules/unified/readme.md index 431349459a9d0c..abe0fd4cc6d5d9 100644 --- a/tools/eslint/node_modules/unified/readme.md +++ b/tools/eslint/node_modules/unified/readme.md @@ -2,15 +2,15 @@ [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] +[![Chat][chat-badge]][chat] -**unified** is an interface for processing text using syntax trees. -It’s what powers [**remark**][remark], [**retext**][retext], and -[**rehype**][rehype], but it also allows for processing between -multiple syntaxes. +**unified** is an interface for processing text using syntax trees. It’s what +powers [**remark**][remark], [**retext**][retext], and [**rehype**][rehype], +but it also allows for processing between multiple syntaxes. -[`unifiedjs.github.io`][site], the website for **unified** provides a less -technical, more practical, introduction to unified. Make sure to visit it -and try its introductionary [Guides][]. +The website for **unified**, [`unifiedjs.github.io`][site], provides a less +technical and more practical introduction to unified. Make sure to visit it +and try its introductory [Guides][]. ## Installation @@ -29,7 +29,7 @@ var remark2rehype = require('remark-rehype'); var doc = require('rehype-document'); var format = require('rehype-format'); var html = require('rehype-stringify'); -var reporter = require('vfile-reporter'); +var report = require('vfile-reporter'); unified() .use(markdown) @@ -38,7 +38,7 @@ unified() .use(format) .use(html) .process('# Hello world!', function (err, file) { - console.error(reporter(err || file)); + console.error(report(err || file)); console.log(String(file)); }); ``` @@ -81,86 +81,95 @@ no issues found ## Description -**unified** is an interface for processing text using syntax trees. -Syntax trees are a representation understandable to programs. -Those programs, called [**plug-in**][plugin]s, take these trees and -modify them, amongst other things. To get to the syntax tree from -input text, there’s a [**parser**][parser], and, to get from that -back to text, there’s a [**compiler**][compiler]. This is the +**unified** is an interface for processing text using syntax trees. Syntax +trees are a representation understandable to programs. Those programs, called +[**plugin**][plugin]s, take these trees and modify them, amongst other things. +To get to the syntax tree from input text there’s a [**parser**][parser]. To +get from that back to text there’s a [**compiler**][compiler]. This is the [**process**][process] of a **processor**. ```ascii - ┌──────────────┐ - ┌─ │ Transformers │ ─┐ - ▲ └──────────────┘ ▼ - └────────┐ ┌────────┘ - │ │ - ┌────────┐ │ │ ┌──────────┐ - Input ──▶ │ Parser │ ──▶ Tree ──▶ │ Compiler │ ──▶ Output - └────────┘ └──────────┘ +| ....................... process() ......................... | +| ......... parse() ..... | run() | ..... stringify() ....... | + + +--------+ +----------+ +Input ->- | Parser | ->- Syntax Tree ->- | Compiler | ->- Output + +--------+ | +----------+ + X + | + +--------------+ + | Transformers | + +--------------+ ``` ###### Processors -Every processor implements another processor. To create a new -processor, invoke another processor. This creates a processor that is -configured to function the same as its ancestor. But, when -the descendant processor is configured in the future, that -configuration does not change the ancestral processor. +Every processor implements another processor. To create a new processor invoke +another processor. This creates a processor that is configured to function the +same as its ancestor. But when the descendant processor is configured in the +future it does not affect the ancestral processor. -Often, when processors are exposed from a library (for example, -unified itself), they should not be configured directly, as that -would change their behaviour for all users. Those processors are -[**frozen**][freeze], and new processors should be made from them before -they are used, by invoking them. +When processors are exposed from a module (for example, unified itself) they +should not be configured directly, as that would change their behaviour for all +module users. Those processors are [**frozen**][freeze] and they should be +invoked to create a new processor before they are used. ###### Node -The syntax trees used in **unified** are [**Unist**][unist] nodes, -which are plain JavaScript objects with a `type` property. The -semantics of those `type`s are defined by other projects. +The syntax trees used in **unified** are [**Unist**][unist] nodes: plain +JavaScript objects with a `type` property. The semantics of those `type`s are +defined by other projects. -There are several [utilities][unist-utilities] for working with these -nodes. +There are several [utilities][unist-utilities] for working with these nodes. ###### List of Processors -The following projects process different syntax trees. They parse -text to their respective syntax tree, and they compile their syntax -trees back to text. These processors can be used as-is, or their -parsers and compilers can be mixed and matched with other plug-ins -to process between different syntaxes. +The following projects process different syntax trees. They parse text to +their respective syntax tree and they compile their syntax trees back to text. +These processors can be used as-is, or their parsers and compilers can be mixed +and matched with **unified** and other plugins to process between different +syntaxes. * [**rehype**][rehype] ([**HAST**][hast]) — HTML * [**remark**][remark] ([**MDAST**][mdast]) — Markdown * [**retext**][retext] ([**NLCST**][nlcst]) — Natural language +###### List of Plugins + +The below plugins work with **unified**, unrelated to what flavour the syntax +tree is in: + +* [`unified-diff`](https://github.com/unifiedjs/unified-diff) + — Ignore messages for unchanged lines in Travis + +See [**remark**][remark-plugins], [**rehype**][rehype-plugins], and +[**retext**][retext-plugins] for lists of their plugins. + ###### File -When processing documents, metadata is often gathered about that -document. [**VFile**][vfile] is a virtual file format which stores -data, and handles metadata and messages for **unified** and its -plug-ins. +When processing documents metadata is often gathered about that document. +[**VFile**][vfile] is a virtual file format which stores data and handles +metadata and messages for **unified** and its plugins. -There are several [utilities][vfile-utilities] for working with these -files. +There are several [utilities][vfile-utilities] for working with these files. ###### Configuration -To configure a processor, invoke its [`use`][use] method, supply it a -[**plug-in**][plugin], and optionally settings. +To configure a processor invoke its [`use`][use] method, supply it a +[**plugin**][plugin], and optionally settings. ###### Integrations **unified** can integrate with the file-system through -[**unified-engine**][engine]. On top of that, CLI apps can be created -with [**unified-args**][args], Gulp plug-ins with -[**unified-engine-gulp**][gulp], and Atom Linters with -[**unified-engine-atom**][atom]. +[`unified-engine`][engine]. On top of that, CLI apps can be created with +[`unified-args`][args], Gulp plugins with [`unified-engine-gulp`][gulp], and +Atom Linters with [`unified-engine-atom`][atom]. + +A streaming interface is provided through [`unified-stream`][stream]. ###### Programming interface -The API gives access to processing metadata (such as lint messages), and +The API gives access to processing metadata (such as lint messages) and supports multiple passed through files: ```js @@ -172,7 +181,7 @@ var english = require('retext-english'); var equality = require('retext-equality'); var remark2rehype = require('remark-rehype'); var html = require('rehype-stringify'); -var reporter = require('vfile-reporter'); +var report = require('vfile-reporter'); unified() .use(markdown) @@ -181,12 +190,12 @@ unified() .use(remark2rehype) .use(html) .process('*Emphasis* and _importance_, you guys!', function (err, file) { - console.error(reporter(err || file)); + console.error(report(err || file)); console.log(String(file)); }); ``` -Which yields: +Yields: ```txt 1:16-1:28 warning Emphasis should use `*` as a marker emphasis-marker remark-lint @@ -200,24 +209,23 @@ Which yields: The processors can be combined in two modes. -**Bridge** mode transforms the syntax tree from one flavour (the origin) -to another (the destination). Then, transformations are applied on that -tree. Finally, the origin processor continues transforming the original -syntax tree. +**Bridge** mode transforms the syntax tree from one flavour (the origin) to +another (the destination). Then, transformations are applied on that tree. +Finally, the origin processor continues transforming the original syntax tree. -**Mutate** mode also transforms the syntax tree from one flavour to -another. But then the origin processor continues transforming the -destination syntax tree. +**Mutate** mode also transforms the syntax tree from one flavour to another. +But then the origin processor continues transforming the destination syntax +tree. -In the previous example (“Programming interface”), `remark-retext` is -used in bridge mode: the origin syntax tree is kept after retext is -finished; whereas `remark-rehype` is used in mutate mode: it sets a -new syntax tree and discards the original. +In the previous example (“Programming interface”), `remark-retext` is used in +bridge mode: the origin syntax tree is kept after retext is done; whereas +`remark-rehype` is used in mutate mode: it sets a new syntax tree and discards +the original. -* [**remark-retext**][remark-retext] -* [**remark-rehype**][remark-rehype] -* [**rehype-retext**][rehype-retext] -* [**rehype-remark**][rehype-remark] +* [`remark-retext`][remark-retext] +* [`remark-rehype`][remark-rehype] +* [`rehype-retext`][rehype-retext] +* [`rehype-remark`][rehype-remark] ## API @@ -227,15 +235,14 @@ Object describing how to process text. ###### Returns -`Function` — A new [**unfrozen**][freeze] processor which is -configured to function the same as its ancestor. But, when the -descendant processor is configured in the future, that configuration -does not change the ancestral processor. +`Function` — New [**unfrozen**][freeze] processor which is configured to +function the same as its ancestor. But when the descendant processor is +configured in the future it does not affect the ancestral processor. ###### Example -The following example shows how a new processor can be created (from -the remark processor) and linked to **stdin**(4) and **stdout**(4). +The following example shows how a new processor can be created (from the remark +processor) and linked to **stdin**(4) and **stdout**(4). ```js var remark = require('remark'); @@ -248,8 +255,8 @@ process.stdin.pipe(concat(function (buf) { ### `processor.use(plugin[, options])` -Configure the processor to use a [**plug-in**][plugin], and configure -that plug-in with optional options. +Configure the processor to use a [**plugin**][plugin] and optionally configure +that plugin with options. ###### Signatures @@ -263,8 +270,8 @@ that plug-in with optional options. * `options` (`*`, optional) — Configuration for `plugin` * `preset` (`Object`) — Object with an optional `plugins` (set to `list`), and/or an optional `settings` object -* `list` (`Array`) — plugins, presets, and arguments (a plugin and options - in an array), in an array +* `list` (`Array`) — List of plugins, presets, and pairs (`plugin` and + `options` in an array) ###### Returns @@ -277,8 +284,8 @@ first to create a new unfrozen processor. ###### Example -There are many ways to pass plugins to `.use()`. The below example -gives an overview. +There are many ways to pass plugins to `.use()`. The below example gives an +overview. ```js var unified = require('unified'); @@ -305,29 +312,30 @@ Parse text to a syntax tree. ###### Parameters -* `file` ([**VFile**][file]) +* `file` ([`VFile`][file]) — Or anything which can be given to `vfile()` ###### Returns -[**Node**][node] — Syntax tree representation of input. +[`Node`][node] — Syntax tree representation of input. ###### Note -`parse` [freezes][freeze] the processor, if not already frozen. +`parse` [freezes][freeze] the processor if not already frozen. #### `processor.Parser` Function handling the parsing of text to a syntax tree. Used in the -[**parse**][parse] phase in the process and invoked with a `string` -and [**VFile**][file] representation of the document to parse. +[**parse**][parse] phase in the process and invoked with a `string` and +[`VFile`][file] representation of the document to parse. -If `Parser` is a normal parser, it should return a [`Node`][node]: the syntax -tree representation of the given file. +`Parser` can be a normal function in which case it must return a +[`Node`][node]: the syntax tree representation of the given file. -`Parser` can also be a constructor function, in which case it’s invoked with -`new`. In that case, instances should have a `parse` method, which is invoked -(without arguments), and should return a [`Node`][node]. +`Parser` can also be a constructor function (a function with keys in its +`prototype`) in which case it’s invoked with `new`. Instances must have a +`parse` method which is invoked without arguments and must return a +[`Node`][node]. ### `processor.stringify(node[, file])` @@ -335,8 +343,8 @@ Compile a syntax tree to text. ###### Parameters -* `node` ([**Node**][node]) -* `file` ([**VFile**][file], optional); +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional); — Or anything which can be given to `vfile()` ###### Returns @@ -345,103 +353,101 @@ Compile a syntax tree to text. ###### Note -`stringify` [freezes][freeze] the processor, if not already frozen. +`stringify` [freezes][freeze] the processor if not already frozen. #### `processor.Compiler` Function handling the compilation of syntax tree to a text. Used in the [**stringify**][stringify] phase in the process and invoked with a -[`Node`][node] and [**VFile**][file] representation of the document to -stringify. +[`Node`][node] and [`VFile`][file] representation of the document to stringify. -If `Compiler` is a normal stringifier, it should return a `string`: the text -representation of the given syntax tree. +`Compiler` can be a normal function in which case it must return a `string`: +the text representation of the given syntax tree. -`Compiler` can also be a constructor function, in which case it’s invoked with -`new`. In that case, instances should have a `compile` method, which is invoked -(without arguments), and should return a `string`. +`Compiler` can also be a constructor function (a function with keys in its +`prototype`) in which case it’s invoked with `new`. Instances must have a +`compile` method which is invoked without arguments and must return a `string`. ### `processor.run(node[, file][, done])` -Transform a syntax tree by applying [**plug-in**][plugin]s to it. +Transform a syntax tree by applying [**plugin**][plugin]s to it. ###### Parameters -* `node` ([**Node**][node]) -* `file` ([**VFile**][file], optional) +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional) — Or anything which can be given to `vfile()` * `done` ([`Function`][run-done], optional) ###### Returns -[**Promise**][promise], if `done` is not given. Rejected with an error, -or resolved with the resulting syntax tree. +[`Promise`][promise] if `done` is not given. Rejected with an error, or +resolved with the resulting syntax tree. ###### Note -`run` [freezes][freeze] the processor, if not already frozen. +`run` [freezes][freeze] the processor if not already frozen. ##### `function done(err[, node, file])` -Invoked when transformation is complete. Either invoked with an -error, or a syntax tree and a file. +Invoked when transformation is complete. Either invoked with an error or a +syntax tree and a file. ###### Parameters * `err` (`Error`) — Fatal error -* `node` ([**Node**][node]) -* `file` ([**VFile**][file]) +* `node` ([`Node`][node]) +* `file` ([`VFile`][file]) ### `processor.runSync(node[, file])` -Transform a syntax tree by applying [**plug-in**][plugin]s to it. +Transform a syntax tree by applying [**plugin**][plugin]s to it. -If asynchronous [**plug-in**][plugin]s are configured, an error is thrown. +If asynchronous [**plugin**][plugin]s are configured an error is thrown. ###### Parameters -* `node` ([**Node**][node]) -* `file` ([**VFile**][file], optional) +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional) — Or anything which can be given to `vfile()` ###### Returns -[**Node**][node] — The given syntax tree. +[`Node`][node] — The given syntax tree. ###### Note -`runSync` [freezes][freeze] the processor, if not already frozen. +`runSync` [freezes][freeze] the processor if not already frozen. ### `processor.process(file|value[, done])` -Process the given representation of a file as configured on the -processor. The process invokes `parse`, `run`, and `stringify` -internally. +Process the given representation of a file as configured on the processor. The +process invokes `parse`, `run`, and `stringify` internally. ###### Parameters -* `file` ([**VFile**][file]) +* `file` ([`VFile`][file]) * `value` (`string`) — String representation of a file * `done` ([`Function`][process-done], optional) ###### Returns -[**Promise**][promise], if `done` is not given. Rejected with an error, -or resolved with the resulting file. +[`Promise`][promise] if `done` is not given. Rejected with an error or +resolved with the resulting file. ###### Note -`process` [freezes][freeze] the processor, if not already frozen. +`process` [freezes][freeze] the processor if not already frozen. #### `function done(err, file)` -Invoked when the process is complete. Invoked with a fatal error, if -any, and the [**VFile**][file]. +Invoked when the process is complete. Invoked with a fatal error, if any, and +the [`VFile`][file]. ###### Parameters * `err` (`Error`, optional) — Fatal error -* `file` ([**VFile**][file]) +* `file` ([`VFile`][file]) ###### Example @@ -452,7 +458,6 @@ var remark2rehype = require('remark-rehype'); var doc = require('rehype-document'); var format = require('rehype-format'); var html = require('rehype-stringify'); -var reporter = require('vfile-reporter'); unified() .use(markdown) @@ -485,24 +490,23 @@ Yields: ### `processor.processSync(file|value)` -Process the given representation of a file as configured on the -processor. The process invokes `parse`, `run`, and `stringify` -internally. +Process the given representation of a file as configured on the processor. The +process invokes `parse`, `run`, and `stringify` internally. -If asynchronous [**plug-in**][plugin]s are configured, an error is thrown. +If asynchronous [**plugin**][plugin]s are configured an error is thrown. ###### Parameters -* `file` ([**VFile**][file]) +* `file` ([`VFile`][file]) * `value` (`string`) — String representation of a file ###### Returns -[**VFile**][file] — Virtual file with modified [`contents`][vfile-contents]. +[`VFile`][file] — Virtual file with modified [`contents`][vfile-contents]. ###### Note -`processSync` [freezes][freeze] the processor, if not already frozen. +`processSync` [freezes][freeze] the processor if not already frozen. ###### Example @@ -513,7 +517,6 @@ var remark2rehype = require('remark-rehype'); var doc = require('rehype-document'); var format = require('rehype-format'); var html = require('rehype-stringify'); -var reporter = require('vfile-reporter'); var processor = unified() .use(markdown) @@ -542,10 +545,9 @@ Yields: ### `processor.data(key[, value])` -Get or set information in an in-memory key-value store accessible to -all phases of the process. An example is a list of HTML elements -which are self-closing (i.e., do not need a closing tag), which is -needed when parsing, transforming, and compiling HTML. +Get or set information in an in-memory key-value store accessible to all phases +of the process. An example is a list of HTML elements which are self-closing, +which is needed when parsing, transforming, and compiling HTML. ###### Parameters @@ -580,11 +582,11 @@ bravo ### `processor.freeze()` -Freeze a processor. Frozen processors are meant to be extended, and not to -be configured or processed directly. +Freeze a processor. Frozen processors are meant to be extended and not to be +configured or processed directly. -Once a processor is frozen, it cannot be unfrozen. But, a new processor -functioning just like it can be created by invoking the processor. +Once a processor is frozen it cannot be unfrozen. New processors functioning +just like it can be created by invoking the processor. It’s possible to freeze processors explicitly, by calling `.freeze()`, but [`.parse()`][parse], [`.run()`][run], [`.stringify()`][stringify], and @@ -596,8 +598,8 @@ It’s possible to freeze processors explicitly, by calling `.freeze()`, but ###### Example -The following example, `index.js`, shows how [**rehype**][rehype] -prevents extensions to itself: +The following example, `index.js`, shows how [**rehype**][rehype] prevents +extensions to itself: ```js var unified = require('unified'); @@ -607,8 +609,7 @@ var stringify = require('rehype-stringify'); module.exports = unified().use(parse).use(stringify).freeze(); ``` -The below example, `a.js`, shows how that processor can be used and -configured. +The below example, `a.js`, shows how that processor can be used and configured. ```js var rehype = require('rehype'); @@ -620,10 +621,10 @@ rehype() // ... ``` -The below example, `b.js`, shows a similar looking example which -operates on the frozen [**rehype**][rehype] interface. If this -behaviour was allowed it would result in unexpected behaviour, so -an error is thrown. **This is invalid**: +The below example, `b.js`, shows a similar looking example which operates on +the frozen [**rehype**][rehype] interface. If this behaviour was allowed it +would result in unexpected behaviour so an error is thrown. **This is +invalid**: ```js var rehype = require('rehype'); @@ -651,15 +652,15 @@ Create a new processor first, by invoking it: use `processor()` instead of `proc ## `Plugin` -A **unified** plugin changes the way the applied-on processor works, -in the following ways: +**unified** plugins change the way the applied-on processor works in the +following ways: -* It modifies the [**processor**][processor]: such as changing the - parser, the compiler, or linking the processor to other processors -* It transforms the [**syntax tree**][node] representation of a file -* It modifies metadata of a file +* They modify the [**processor**][processor]: such as changing the parser, + the compiler, or linking it to other processors +* They transform [**syntax tree**][node] representation of files +* They modify metadata of files -Plug-in’s are a concept which materialise as [**attacher**][attacher]s. +Plugins are a concept. They materialise as [`attacher`][attacher]s. ###### Example @@ -693,7 +694,7 @@ var parse = require('remark-parse'); var remark2rehype = require('remark-rehype'); var stringify = require('rehype-stringify'); var vfile = require('to-vfile'); -var reporter = require('vfile-reporter'); +var report = require('vfile-reporter'); var move = require('./move'); unified() @@ -702,7 +703,7 @@ unified() .use(move, {extname: '.html'}) .use(stringify) .process(vfile.readSync('index.md'), function (err, file) { - console.error(reporter(err || file)); + console.error(report(err || file)); if (file) { vfile.writeSync(file); // Written to `index.html`. } @@ -711,12 +712,12 @@ unified() ### `function attacher([options])` -An attacher is the thing passed to [`use`][use]. It configures the -processor and in turn can receive options. +An attacher is the thing passed to [`use`][use]. It configures the processor +and in turn can receive options. -Attachers can configure processors, such as by interacting with parsers -and compilers, linking them to other processors, or by specifying how -the syntax tree is handled. +Attachers can configure processors, such as by interacting with parsers and +compilers, linking them to other processors, or by specifying how the syntax +tree is handled. ###### Context @@ -739,47 +740,44 @@ time. ### `function transformer(node, file[, next])` -Transformers modify the syntax tree or metadata of a file. -A transformer is a function which is invoked each time a file is -passed through the transform phase. If an error occurs (either -because it’s thrown, returned, rejected, or passed to [`next`][next]), -the process stops. +Transformers modify the syntax tree or metadata of a file. A transformer is a +function which is invoked each time a file is passed through the transform +phase. If an error occurs (either because it’s thrown, returned, rejected, or +passed to [`next`][next]), the process stops. -The transformation process in **unified** is handled by [`trough`][trough], -see it’s documentation for the exact semantics of transformers. +The transformation process in **unified** is handled by [`trough`][trough], see +it’s documentation for the exact semantics of transformers. ###### Parameters -* `node` ([**Node**][node]) -* `file` ([**VFile**][file]) +* `node` ([`Node`][node]) +* `file` ([`VFile`][file]) * `next` ([`Function`][next], optional) ###### Returns * `Error` — Can be returned to stop the process -* [**Node**][node] — Can be returned and results in further - transformations and `stringify`s to be performed on the new - tree -* `Promise` — If a promise is returned, the function is asynchronous, - and **must** be resolved (optionally with a [**Node**][node]) or - rejected (optionally with an `Error`) +* [`Node`][node] — Can be returned and results in further transformations + and `stringify`s to be performed on the new tree +* `Promise` — If a promise is returned, the function is asynchronous, and + **must** be resolved (optionally with a [`Node`][node]) or rejected + (optionally with an `Error`) #### `function next(err[, tree[, file]])` -If the signature of a transformer includes `next` (third argument), -the function **may** finish asynchronous, and **must** invoke `next()`. +If the signature of a transformer includes `next` (third argument), the +function **may** finish asynchronous, and **must** invoke `next()`. ###### Parameters * `err` (`Error`, optional) — Stop the process -* `node` ([**Node**][node], optional) — New syntax tree -* `file` ([**VFile**][file], optional) — New virtual file +* `node` ([`Node`][node], optional) — New syntax tree +* `file` ([`VFile`][file], optional) — New virtual file ## `Preset` -A **unified** preset provides a potentially sharable way to configure -processors. They can contain multiple plugins and optionally settings as -well. +Presets provide a potentially sharable way to configure processors. They can +contain multiple plugins and optionally settings as well. ###### Example @@ -802,13 +800,13 @@ exports.plugins = [ ```js var remark = require('remark'); var vfile = require('to-vfile'); -var reporter = require('vfile-reporter'); +var report = require('vfile-reporter'); var preset = require('./preset'); remark() .use(preset) .process(vfile.readSync('index.md'), function (err, file) { - console.error(reporter(err || file)); + console.error(report(err || file)); if (file) { vfile.writeSync(file); @@ -822,7 +820,7 @@ remark() -[logo]: https://cdn.rawgit.com/unifiedjs/unified/84f55c8/logo.svg +[logo]: https://cdn.rawgit.com/unifiedjs/unified/0cd3a41/logo.svg [travis-badge]: https://img.shields.io/travis/unifiedjs/unified.svg @@ -832,6 +830,10 @@ remark() [codecov]: https://codecov.io/github/unifiedjs/unified +[chat-badge]: https://img.shields.io/gitter/room/unifiedjs/Lobby.svg + +[chat]: https://gitter.im/unifiedjs/Lobby + [npm]: https://docs.npmjs.com/cli/install [license]: LICENSE @@ -917,3 +919,11 @@ remark() [trough]: https://github.com/wooorm/trough#function-fninput-next [promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise + +[remark-plugins]: https://github.com/wooorm/remark/blob/master/doc/plugins.md#list-of-plugins + +[rehype-plugins]: https://github.com/wooorm/rehype/blob/master/doc/plugins.md#list-of-plugins + +[retext-plugins]: https://github.com/wooorm/retext/blob/master/doc/plugins.md#list-of-plugins + +[stream]: https://github.com/unifiedjs/unified-stream diff --git a/tools/eslint/node_modules/unist-util-is/LICENSE b/tools/eslint/node_modules/unist-util-is/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-is/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/unist-util-is/index.js b/tools/eslint/node_modules/unist-util-is/index.js new file mode 100644 index 00000000000000..290259a7986d89 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-is/index.js @@ -0,0 +1,119 @@ +'use strict'; + +/* eslint-disable max-params */ + +/* Expose. */ +module.exports = is; + +/* Assert if `test` passes for `node`. + * When a `parent` node is known the `index` of node */ +function is(test, node, index, parent, context) { + var hasParent = parent !== null && parent !== undefined; + var hasIndex = index !== null && index !== undefined; + var check = convert(test); + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node'); + } + + if (hasParent && (!is(null, parent) || !parent.children)) { + throw new Error('Expected parent node'); + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false; + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index'); + } + + return Boolean(check.call(context, node, index, parent)); +} + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test); + } + + if (test === null || test === undefined) { + return ok; + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test); + } + + if (typeof test === 'function') { + return test; + } + + throw new Error('Expected function, string, or object as test'); +} + +function convertAll(tests) { + var results = []; + var length = tests.length; + var index = -1; + + while (++index < length) { + results[index] = convert(tests[index]); + } + + return results; +} + +/* Utility assert each property in `test` is represented + * in `node`, and each values are strictly equal. */ +function matchesFactory(test) { + return matches; + + function matches(node) { + var key; + + for (key in test) { + if (node[key] !== test[key]) { + return false; + } + } + + return true; + } +} + +function anyFactory(tests) { + var checks = convertAll(tests); + var length = checks.length; + + return matches; + + function matches() { + var index = -1; + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true; + } + } + + return false; + } +} + +/* Utility to convert a string into a function which checks + * a given node’s type for said string. */ +function typeFactory(test) { + return type; + + function type(node) { + return Boolean(node && node.type === test); + } +} + +/* Utility to return true. */ +function ok() { + return true; +} diff --git a/tools/eslint/node_modules/unist-util-is/package.json b/tools/eslint/node_modules/unist-util-is/package.json new file mode 100644 index 00000000000000..51cdd1833ebf88 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-is/package.json @@ -0,0 +1,105 @@ +{ + "_from": "unist-util-is@^2.1.1", + "_id": "unist-util-is@2.1.1", + "_inBundle": false, + "_integrity": "sha1-DDEmKeP5YMZukx6BLT2A53AQlHs=", + "_location": "/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^2.1.1", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.1.tgz", + "_shasum": "0c312629e3f960c66e931e812d3d80e77010947b", + "_spec": "unist-util-is@^2.1.1", + "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/hast-util-to-html/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Utility to check if a node passes a test", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.1", + "nyc": "^11.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.0.0", + "xo": "^0.18.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "node", + "is", + "equal", + "test", + "type", + "util", + "utility" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s unistUtilIs > unist-util-is.js", + "build-mangle": "esmangle < unist-util-is.js > unist-util-is.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "2.1.1", + "xo": { + "space": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/tools/eslint/node_modules/unist-util-is/readme.md b/tools/eslint/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000000000..09bb5fc4952b1b --- /dev/null +++ b/tools/eslint/node_modules/unist-util-is/readme.md @@ -0,0 +1,120 @@ +# unist-util-is [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +[**Unist**][unist] utility to check if a node passes a test. + +## Installation + +[npm][]: + +```bash +npm install unist-util-is +``` + +## Usage + +```js +var is = require('unist-util-is'); + +var node = {type: 'strong'}; +var parent = {type: 'paragraph', children: [node]}; + +function test(node, n) { return n === 5 } + +is(); // false +is(null, {children: []}); // false +is(null, node); // true +is('strong', node); // true +is('emphasis', node); // false + +is(node, node) // true +is({type: 'paragraph'}, parent) // true +is({type: 'strong'}, parent) // false + +is(test, node); // false +is(test, node, 4, parent); // false +is(test, node, 5, parent); // true +``` + +## API + +### `is(test, node[, index, parent[, context]])` + +###### Parameters + +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `function (node) {return + node.type === test}`. + When `array`, checks any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have (strictly) equal values +* `node` ([`Node`][node]) — Node to check. `false` is returned +* `index` (`number`, optional) — Position of `node` in `parent` +* `parent` (`Node`, optional) — Parent of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed _and_ `node` is a [`Node`][node] (object +with `type` set to non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` (`Node`) — Node to test +* `index` (`number?`) — Position of `node` in `parent` +* `parent` (`Node?`) — Parent of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[travis]: https://travis-ci.org/syntax-tree/unist-util-is + +[codecov-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[codecov]: https://codecov.io/github/syntax-tree/unist-util-is + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[test]: #function-testnode-index-parent diff --git a/tools/eslint/node_modules/unist-util-stringify-position/package.json b/tools/eslint/node_modules/unist-util-stringify-position/package.json index c3e3712a826795..8634a80e40b0af 100644 --- a/tools/eslint/node_modules/unist-util-stringify-position/package.json +++ b/tools/eslint/node_modules/unist-util-stringify-position/package.json @@ -16,7 +16,8 @@ "fetchSpec": "^1.0.0" }, "_requiredBy": [ - "/vfile" + "/vfile", + "/vfile-message" ], "_resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz", "_shasum": "3ccbdc53679eed6ecf3777dd7f5e3229c1b6aa3c", diff --git a/tools/eslint/node_modules/unist-util-visit/index.js b/tools/eslint/node_modules/unist-util-visit/index.js index 885059059e7e56..d51a97513be252 100644 --- a/tools/eslint/node_modules/unist-util-visit/index.js +++ b/tools/eslint/node_modules/unist-util-visit/index.js @@ -3,12 +3,14 @@ /* Expose. */ module.exports = visit; +var is = require('unist-util-is'); + /* Visit. */ -function visit(tree, type, visitor, reverse) { - if (typeof type === 'function') { +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor; - visitor = type; - type = null; + visitor = test; + test = null; } one(tree); @@ -19,7 +21,7 @@ function visit(tree, type, visitor, reverse) { index = index || (parent ? 0 : null); - if (!type || node.type === type) { + if (!test || node.type === test || is(test, node, index, parent || null)) { result = visitor(node, index, parent || null); } diff --git a/tools/eslint/node_modules/unist-util-visit/package.json b/tools/eslint/node_modules/unist-util-visit/package.json index e183a1761b1197..f2964f8390d9be 100644 --- a/tools/eslint/node_modules/unist-util-visit/package.json +++ b/tools/eslint/node_modules/unist-util-visit/package.json @@ -1,8 +1,8 @@ { "_from": "unist-util-visit@^1.1.0", - "_id": "unist-util-visit@1.1.3", + "_id": "unist-util-visit@1.2.0", "_inBundle": false, - "_integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=", + "_integrity": "sha512-lI+jyPlDztHZ2CJhUchcRMQ7MNc0yASgYFxwRTxs0EZ+9HbYFBLVGDJ2FchTBy+pra0O1LVEn0Wkgf19mDVDzw==", "_location": "/unist-util-visit", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/unist-util-remove-position" ], - "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", - "_shasum": "ec268e731b9d277a79a5b5aa0643990e405d600b", + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.2.0.tgz", + "_shasum": "9dc78d1f95cd242e865f7f93f327d3296bb9a718", "_spec": "unist-util-visit@^1.1.0", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/unist-util-remove-position", "author": { @@ -36,16 +36,27 @@ "name": "Titus Wormer", "email": "tituswormer@gmail.com", "url": "http://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" } ], + "dependencies": { + "unist-util-is": "^2.1.1" + }, "deprecated": false, "description": "Recursively walk over unist nodes", "devDependencies": { "browserify": "^14.0.0", "esmangle": "^1.0.0", "nyc": "^11.0.0", - "remark": "^7.0.0", - "remark-cli": "^3.0.0", + "remark": "^8.0.0", + "remark-cli": "^4.0.0", "remark-preset-wooorm": "^3.0.0", "tape": "^4.5.1", "xo": "^0.18.2" @@ -94,7 +105,7 @@ "test-api": "node test", "test-coverage": "nyc --reporter lcov tape test.js" }, - "version": "1.1.3", + "version": "1.2.0", "xo": { "space": true, "esnext": false, diff --git a/tools/eslint/node_modules/unist-util-visit/readme.md b/tools/eslint/node_modules/unist-util-visit/readme.md index 6d32c4f89417e1..1d68eef6f857d4 100644 --- a/tools/eslint/node_modules/unist-util-visit/readme.md +++ b/tools/eslint/node_modules/unist-util-visit/readme.md @@ -39,16 +39,16 @@ Yields: ## API -### `visit(node[, type], visitor[, reverse])` +### `visit(node[, test], visitor[, reverse])` -Visit nodes. Optionally by node type. Optionally in reverse. +Visit nodes. Optionally filtering nodes. Optionally in reverse. ###### Parameters * `node` ([`Node`][node]) — Node to search -* `type` (`string`, optional) - — Node type +* `test` ([`Test`][is], optional) + — Node type or other [`is`][is]-compatible test * `visitor` ([Function][visitor]) — Visitor invoked when a node is found * `reverse` (`boolean`, default: `false`) @@ -59,7 +59,7 @@ Visit nodes. Optionally by node type. Optionally in reverse. #### `stop? = visitor(node, index, parent)` -Invoked when a node (when `type` is given, matching `type`) is found. +Invoked when a node (matching `test`, if given) is found. ###### Parameters @@ -114,4 +114,6 @@ Invoked when a node (when `type` is given, matching `type`) is found. [node]: https://github.com/syntax-tree/unist#node +[is]: https://github.com/syntax-tree/unist-util-is#istest-node-index-parent-context + [visitor]: #stop--visitornode-index-parent diff --git a/tools/eslint/node_modules/vfile-message/LICENSE b/tools/eslint/node_modules/vfile-message/LICENSE new file mode 100644 index 00000000000000..045ffe0e075da4 --- /dev/null +++ b/tools/eslint/node_modules/vfile-message/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2017 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/vfile-message/index.js b/tools/eslint/node_modules/vfile-message/index.js new file mode 100644 index 00000000000000..89417cf2402723 --- /dev/null +++ b/tools/eslint/node_modules/vfile-message/index.js @@ -0,0 +1,94 @@ +'use strict'; + +var stringify = require('unist-util-stringify-position'); + +module.exports = VMessage; + +/* Inherit from `Error#`. */ +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype; +VMessage.prototype = new VMessagePrototype(); + +/* Message properties. */ +var proto = VMessage.prototype; + +proto.file = ''; +proto.name = ''; +proto.reason = ''; +proto.message = ''; +proto.stack = ''; +proto.fatal = null; +proto.column = null; +proto.line = null; + +/* Construct a new VMessage. + * + * Note: We cannot invoke `Error` on the created context, + * as that adds readonly `line` and `column` attributes on + * Safari 9, thus throwing and failing the data. */ +function VMessage(reason, position, origin) { + var parts; + var range; + var location; + + if (typeof position === 'string') { + origin = position; + position = null; + } + + parts = parseOrigin(origin); + range = stringify(position) || '1:1'; + + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + }; + + /* Node. */ + if (position && position.position) { + position = position.position; + } + + if (position) { + /* Position. */ + if (position.start) { + location = position; + position = position.start; + } else { + /* Point. */ + location.start = position; + } + } + + if (reason.stack) { + this.stack = reason.stack; + reason = reason.message; + } + + this.message = reason; + this.name = range; + this.reason = reason; + this.line = position ? position.line : null; + this.column = position ? position.column : null; + this.location = location; + this.source = parts[0]; + this.ruleId = parts[1]; +} + +function parseOrigin(origin) { + var result = [null, null]; + var index; + + if (typeof origin === 'string') { + index = origin.indexOf(':'); + + if (index === -1) { + result[1] = origin; + } else { + result[0] = origin.slice(0, index); + result[1] = origin.slice(index + 1); + } + } + + return result; +} diff --git a/tools/eslint/node_modules/vfile-message/package.json b/tools/eslint/node_modules/vfile-message/package.json new file mode 100644 index 00000000000000..ed2286f7c6c799 --- /dev/null +++ b/tools/eslint/node_modules/vfile-message/package.json @@ -0,0 +1,99 @@ +{ + "_from": "vfile-message@^1.0.0", + "_id": "vfile-message@1.0.0", + "_inBundle": false, + "_integrity": "sha512-HPREhzTOB/sNDc9/Mxf8w0FmHnThg5CRSJdR9VRFkD2riqYWs+fuXlj5z8mIpv2LrD7uU41+oPWFOL4Mjlf+dw==", + "_location": "/vfile-message", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile-message@^1.0.0", + "name": "vfile-message", + "escapedName": "vfile-message", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/vfile" + ], + "_resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.0.0.tgz", + "_shasum": "a6adb0474ea400fa25d929f1d673abea6a17e359", + "_spec": "vfile-message@^1.0.0", + "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/vfile", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/vfile/vfile-message/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "unist-util-stringify-position": "^1.1.1" + }, + "deprecated": false, + "description": "Create a virtual message", + "devDependencies": { + "browserify": "^14.1.0", + "esmangle": "^1.0.1", + "nyc": "^11.0.0", + "remark-cli": "^4.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.0.0", + "xo": "^0.18.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/vfile/vfile-message#readme", + "keywords": [ + "vfile", + "virtual", + "message" + ], + "license": "MIT", + "name": "vfile-message", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/vfile-message.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s vfileMessage > vfile-message.js", + "build-mangle": "esmangle vfile-message.js > vfile-message.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "esnext": false, + "ignores": [ + "vfile-message.js" + ] + } +} diff --git a/tools/eslint/node_modules/vfile-message/readme.md b/tools/eslint/node_modules/vfile-message/readme.md new file mode 100644 index 00000000000000..21a32912fc9196 --- /dev/null +++ b/tools/eslint/node_modules/vfile-message/readme.md @@ -0,0 +1,166 @@ +# vfile-message [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Create [vfile][] messages. + +## Installation + +[npm][]: + +```bash +npm install vfile-message +``` + +## Usage + +```js +var VMessage = require('vfile-message'); + +var message = new VMessage('`braavo` is misspelt; did you mean `bravo`?', {line: 1, column: 8}, 'spell:typo'); + +console.log(message); +``` + +Yields: + +```js +{ [1:8: `braavo` is misspelt; did you mean `bravo`?] + reason: '`braavo` is misspelt; did you mean `bravo`?', + fatal: null, + line: 1, + column: 8, + location: + { start: { line: 1, column: 8 }, + end: { line: null, column: null } }, + source: 'spell', + ruleId: 'typo' } +``` + +## API + +### `VMessage(reason[, position][, origin])` + +Constructor of a message for `reason` at `position` from `origin`. When +an error is passed in as `reason`, copies the stack. + +##### Parameters + +###### `reason` + +Reason for message (`string` or `Error`). Uses the stack and message of the +error if given. + +###### `position` + +Place at which the message occurred in a file ([`Node`][node], +[`Position`][position], or [`Point`][point], optional). + +###### `origin` + +Place in code the message originates from (`string`, optional). + +Can either be the [`ruleId`][ruleid] (`'rule'`), or a string with both a +[`source`][source] and a [`ruleId`][ruleid] delimited with a colon +(`'source:rule'`). + +##### Extends + +[`Error`][error]. + +##### Returns + +An instance of itself. + +##### Properties + +###### `reason` + +Reason for message (`string`). + +###### `fatal` + +If `true`, marks associated file as no longer processable (`boolean?`). If +`false`, necessitates a (potential) change. The value can also be `null` or +`undefined`. + +###### `line` + +Starting line of error (`number?`). + +###### `column` + +Starting column of error (`number?`). + +###### `location` + +Full range information, when available ([`Position`][position]). Has `start` +and `end` properties, both set to an object with `line` and `column`, set to +`number?`. + +###### `source` + +Namespace of warning (`string?`). + +###### `ruleId` + +Category of message (`string?`). + +###### `stack` + +Stack of message (`string?`). + +##### Custom properties + +It’s OK to store custom data directly on the `VFileMessage`, some of those are +handled by [utilities][util]. + +###### `file` + +You may add a `file` property with a path of a file (used throughout the +[**VFile**][vfile] ecosystem). + +###### `note` + +You may add a `note` property with a long form description of the message +(supported by [`vfile-reporter`][reporter]). + +###### `url` + +You may add a `url` property with a link to documentation for the message. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/vfile/vfile-message.svg + +[travis]: https://travis-ci.org/vfile/vfile-message + +[codecov-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg + +[codecov]: https://codecov.io/github/vfile/vfile-message + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[vfile]: https://github.com/vfile/vfile + +[util]: https://github.com/vfile/vfile#utilities + +[reporter]: https://github.com/vfile/vfile-reporter + +[ruleid]: #ruleid + +[source]: #source diff --git a/tools/eslint/node_modules/vfile/core.js b/tools/eslint/node_modules/vfile/core.js new file mode 100644 index 00000000000000..2d88a333993a08 --- /dev/null +++ b/tools/eslint/node_modules/vfile/core.js @@ -0,0 +1,169 @@ +'use strict'; + +var path = require('path'); +var replace = require('replace-ext'); +var buffer = require('is-buffer'); + +module.exports = VFile; + +var own = {}.hasOwnProperty; +var proto = VFile.prototype; + +proto.toString = toString; + +/* Order of setting (least specific to most), we need this because + * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path + * is needed before a stem can be set. */ +var order = [ + 'history', + 'path', + 'basename', + 'stem', + 'extname', + 'dirname' +]; + +/* Construct a new file. */ +function VFile(options) { + var prop; + var index; + var length; + + if (!options) { + options = {}; + } else if (typeof options === 'string' || buffer(options)) { + options = {contents: options}; + } else if ('message' in options && 'messages' in options) { + return options; + } + + if (!(this instanceof VFile)) { + return new VFile(options); + } + + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = process.cwd(); + + /* Set path related properties in the correct order. */ + index = -1; + length = order.length; + + while (++index < length) { + prop = order[index]; + + if (own.call(options, prop)) { + this[prop] = options[prop]; + } + } + + /* Set non-path related properties. */ + for (prop in options) { + if (order.indexOf(prop) === -1) { + this[prop] = options[prop]; + } + } +} + +/* Access full path (`~/index.min.js`). */ +Object.defineProperty(proto, 'path', { + get: function () { + return this.history[this.history.length - 1]; + }, + set: function (path) { + assertNonEmpty(path, 'path'); + + if (path !== this.path) { + this.history.push(path); + } + } +}); + +/* Access parent path (`~`). */ +Object.defineProperty(proto, 'dirname', { + get: function () { + return typeof this.path === 'string' ? path.dirname(this.path) : undefined; + }, + set: function (dirname) { + assertPath(this.path, 'dirname'); + this.path = path.join(dirname || '', this.basename); + } +}); + +/* Access basename (`index.min.js`). */ +Object.defineProperty(proto, 'basename', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path) : undefined; + }, + set: function (basename) { + assertNonEmpty(basename, 'basename'); + assertPart(basename, 'basename'); + this.path = path.join(this.dirname || '', basename); + } +}); + +/* Access extname (`.js`). */ +Object.defineProperty(proto, 'extname', { + get: function () { + return typeof this.path === 'string' ? path.extname(this.path) : undefined; + }, + set: function (extname) { + var ext = extname || ''; + + assertPart(ext, 'extname'); + assertPath(this.path, 'extname'); + + if (ext) { + if (ext.charAt(0) !== '.') { + throw new Error('`extname` must start with `.`'); + } + + if (ext.indexOf('.', 1) !== -1) { + throw new Error('`extname` cannot contain multiple dots'); + } + } + + this.path = replace(this.path, ext); + } +}); + +/* Access stem (`index.min`). */ +Object.defineProperty(proto, 'stem', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; + }, + set: function (stem) { + assertNonEmpty(stem, 'stem'); + assertPart(stem, 'stem'); + this.path = path.join(this.dirname || '', stem + (this.extname || '')); + } +}); + +/* Get the value of the file. */ +function toString(encoding) { + var value = this.contents || ''; + return buffer(value) ? value.toString(encoding) : String(value); +} + +/* Assert that `part` is not a path (i.e., does + * not contain `path.sep`). */ +function assertPart(part, name) { + if (part.indexOf(path.sep) !== -1) { + throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); + } +} + +/* Assert that `part` is not empty. */ +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty'); + } +} + +/* Assert `path` exists. */ +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too'); + } +} diff --git a/tools/eslint/node_modules/vfile/index.js b/tools/eslint/node_modules/vfile/index.js index 26ec88bc97d12f..9b3c7e0d10e109 100644 --- a/tools/eslint/node_modules/vfile/index.js +++ b/tools/eslint/node_modules/vfile/index.js @@ -1,16 +1,12 @@ 'use strict'; -var path = require('path'); -var replace = require('replace-ext'); -var stringify = require('unist-util-stringify-position'); -var buffer = require('is-buffer'); +var VMessage = require('vfile-message'); +var VFile = require('./core.js'); module.exports = VFile; -var own = {}.hasOwnProperty; var proto = VFile.prototype; -proto.toString = toString; proto.message = message; proto.info = info; proto.fail = fail; @@ -18,188 +14,22 @@ proto.fail = fail; /* Slight backwards compatibility. Remove in the future. */ proto.warn = message; -/* Order of setting (least specific to most), we need this because - * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path - * is needed before a stem can be set. */ -var order = [ - 'history', - 'path', - 'basename', - 'stem', - 'extname', - 'dirname' -]; - -/* Construct a new file. */ -function VFile(options) { - var prop; - var index; - var length; - - if (!options) { - options = {}; - } else if (typeof options === 'string' || buffer(options)) { - options = {contents: options}; - } else if ('message' in options && 'messages' in options) { - return options; - } - - if (!(this instanceof VFile)) { - return new VFile(options); - } - - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = process.cwd(); - - /* Set path related properties in the correct order. */ - index = -1; - length = order.length; - - while (++index < length) { - prop = order[index]; - - if (own.call(options, prop)) { - this[prop] = options[prop]; - } - } - - /* Set non-path related properties. */ - for (prop in options) { - if (order.indexOf(prop) === -1) { - this[prop] = options[prop]; - } - } -} - -/* Access full path (`~/index.min.js`). */ -Object.defineProperty(proto, 'path', { - get: function () { - return this.history[this.history.length - 1]; - }, - set: function (path) { - assertNonEmpty(path, 'path'); - - if (path !== this.path) { - this.history.push(path); - } - } -}); - -/* Access parent path (`~`). */ -Object.defineProperty(proto, 'dirname', { - get: function () { - return typeof this.path === 'string' ? path.dirname(this.path) : undefined; - }, - set: function (dirname) { - assertPath(this.path, 'dirname'); - this.path = path.join(dirname || '', this.basename); - } -}); - -/* Access basename (`index.min.js`). */ -Object.defineProperty(proto, 'basename', { - get: function () { - return typeof this.path === 'string' ? path.basename(this.path) : undefined; - }, - set: function (basename) { - assertNonEmpty(basename, 'basename'); - assertPart(basename, 'basename'); - this.path = path.join(this.dirname || '', basename); - } -}); - -/* Access extname (`.js`). */ -Object.defineProperty(proto, 'extname', { - get: function () { - return typeof this.path === 'string' ? path.extname(this.path) : undefined; - }, - set: function (extname) { - var ext = extname || ''; - - assertPart(ext, 'extname'); - assertPath(this.path, 'extname'); - - if (ext) { - if (ext.charAt(0) !== '.') { - throw new Error('`extname` must start with `.`'); - } - - if (ext.indexOf('.', 1) !== -1) { - throw new Error('`extname` cannot contain multiple dots'); - } - } - - this.path = replace(this.path, ext); - } -}); - -/* Access stem (`index.min`). */ -Object.defineProperty(proto, 'stem', { - get: function () { - return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; - }, - set: function (stem) { - assertNonEmpty(stem, 'stem'); - assertPart(stem, 'stem'); - this.path = path.join(this.dirname || '', stem + (this.extname || '')); - } -}); - -/* Get the value of the file. */ -function toString(encoding) { - var value = this.contents || ''; - return buffer(value) ? value.toString(encoding) : String(value); -} - /* Create a message with `reason` at `position`. * When an error is passed in as `reason`, copies the stack. */ -function message(reason, position, ruleId) { +function message(reason, position, origin) { var filePath = this.path; - var range = stringify(position) || '1:1'; - var location; - var err; - - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - }; + var message = new VMessage(reason, position, origin); - if (position && position.position) { - position = position.position; + if (filePath) { + message.name = filePath + ':' + message.name; + message.file = filePath; } - if (position) { - /* Location. */ - if (position.start) { - location = position; - position = position.start; - } else { - /* Position. */ - location.start = position; - } - } + message.fatal = false; - err = new VMessage(reason.message || reason); + this.messages.push(message); - err.name = (filePath ? filePath + ':' : '') + range; - err.file = filePath || ''; - err.reason = reason.message || reason; - err.line = position ? position.line : null; - err.column = position ? position.column : null; - err.location = location; - err.ruleId = ruleId || null; - err.source = null; - err.fatal = false; - - if (reason.stack) { - err.stack = reason.stack; - } - - this.messages.push(err); - - return err; + return message; } /* Fail. Creates a vmessage, associates it with the file, @@ -221,51 +51,3 @@ function info() { return message; } - -/* Inherit from `Error#`. */ -function VMessagePrototype() {} -VMessagePrototype.prototype = Error.prototype; -VMessage.prototype = new VMessagePrototype(); - -/* Message properties. */ -proto = VMessage.prototype; - -proto.file = ''; -proto.name = ''; -proto.reason = ''; -proto.message = ''; -proto.stack = ''; -proto.fatal = null; -proto.column = null; -proto.line = null; - -/* Construct a new file message. - * - * Note: We cannot invoke `Error` on the created context, - * as that adds readonly `line` and `column` attributes on - * Safari 9, thus throwing and failing the data. */ -function VMessage(reason) { - this.message = reason; -} - -/* Assert that `part` is not a path (i.e., does - * not contain `path.sep`). */ -function assertPart(part, name) { - if (part.indexOf(path.sep) !== -1) { - throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); - } -} - -/* Assert that `part` is not empty. */ -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty'); - } -} - -/* Assert `path` exists. */ -function assertPath(path, name) { - if (!path) { - throw new Error('Setting `' + name + '` requires `path` to be set too'); - } -} diff --git a/tools/eslint/node_modules/vfile/package.json b/tools/eslint/node_modules/vfile/package.json index 00909011d39e62..8e2ba1045863c7 100644 --- a/tools/eslint/node_modules/vfile/package.json +++ b/tools/eslint/node_modules/vfile/package.json @@ -1,8 +1,8 @@ { "_from": "vfile@^2.0.0", - "_id": "vfile@2.2.0", + "_id": "vfile@2.3.0", "_inBundle": false, - "_integrity": "sha1-zkek+zNZIrIz5TXbD32BIdj87U4=", + "_integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", "_location": "/vfile", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/unified" ], - "_resolved": "https://registry.npmjs.org/vfile/-/vfile-2.2.0.tgz", - "_shasum": "ce47a4fb335922b233e535db0f7d8121d8fced4e", + "_resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "_shasum": "e62d8e72b20e83c324bc6c67278ee272488bf84a", "_spec": "vfile@^2.0.0", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/unified", "author": { @@ -61,7 +61,8 @@ "dependencies": { "is-buffer": "^1.1.4", "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0" + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" }, "deprecated": false, "description": "Virtual file format for text processing", @@ -69,12 +70,13 @@ "browserify": "^14.0.0", "esmangle": "^1.0.0", "nyc": "^11.0.0", - "remark-cli": "^3.0.0", + "remark-cli": "^4.0.0", "remark-preset-wooorm": "^3.0.0", "tape": "^4.4.0", "xo": "^0.18.0" }, "files": [ + "core.js", "index.js" ], "homepage": "https://github.com/vfile/vfile#readme", @@ -116,7 +118,7 @@ "test-api": "node test", "test-coverage": "nyc --reporter lcov tape test.js" }, - "version": "2.2.0", + "version": "2.3.0", "xo": { "space": true, "esnext": false, diff --git a/tools/eslint/node_modules/vfile/readme.md b/tools/eslint/node_modules/vfile/readme.md index dc814456a63363..1488031d7edd0a 100644 --- a/tools/eslint/node_modules/vfile/readme.md +++ b/tools/eslint/node_modules/vfile/readme.md @@ -15,6 +15,16 @@ place to store [messages][] about them. Plus, they work in the browser. > in that it has a smaller API, a smaller size, and focuses on > [messages][]. +VFile can be used anywhere where files need a lightweight representation. +For example, it’s used in: + +* [`documentation`](https://github.com/documentationjs/documentation) + — The documentation system for modern JavaScript +* [`weh`](https://github.com/wehjs/weh) + — Declarative small site generator +* [`geojsonhint`](https://github.com/mapbox/geojsonhint) + — Complete, fast, standards-based validation for geojson + ## Installation [npm][]: @@ -41,10 +51,9 @@ npm install vfile * [vfile.messages](#vfilemessages) * [vfile.data](#vfiledata) * [VFile#toString(\[encoding\])](#vfiletostringencoding) - * [VFile#message(reason\[, position\[, ruleId\]\])](#vfilemessagereason-position-ruleid) - * [VFile#info(reason\[, position\[, ruleId\]\])](#vfileinforeason-position-ruleid) - * [VFile#fail(reason\[, position\[, ruleId\]\])](#vfilefailreason-position-ruleid) - * [VFileMessage](#vfilemessage) + * [VFile#message(reason\[, position\]\[, origin\])](#vfilemessagereason-position-origin) + * [VFile#info(reason\[, position\]\[, origin\])](#vfileinforeason-position-origin) + * [VFile#fail(reason\[, position\]\[, origin\])](#vfilefailreason-position-origin) * [License](#license) ## Usage @@ -94,7 +103,7 @@ files. See [**Unist**][unist] for projects working with nodes. * [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile) — Convert from [Vinyl][] * [`is-vfile-message`](https://github.com/shinnn/is-vfile-message) - — Check if a value is a `VFileMessage` object + — Check if a value is a `VMessage` object * [`to-vfile`](https://github.com/vfile/to-vfile) — Create a virtual file from a file-path (and optionally read it) * [`vfile-find-down`](https://github.com/vfile/vfile-find-down) @@ -119,7 +128,7 @@ Reporters _must_ accept `Array.` as their first argument, and return `string`. Reporters _may_ accept other values too, in which case it’s suggested to stick to `vfile-reporter`s interface. -* [`vfile-reporter`](https://github.com/vfile/vfile-reporter) +* [`vfile-reporter`][reporter] — Stylish reporter * [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json) — JSON reporter @@ -191,7 +200,7 @@ there’s no `path` yet. ### `vfile.messages` -`Array.` — List of messages associated with the file. +[`Array.`][message] — List of messages associated with the file. ### `vfile.data` @@ -204,63 +213,34 @@ privacy. Convert contents of `vfile` to string. If `contents` is a buffer, `encoding` is used to stringify buffers (default: `'utf8'`). -### `VFile#message(reason[, position[, ruleId]])` - -Associates a message with the file for `reason` at `position`. When an -error is passed in as `reason`, copies the stack. Each message has a `fatal` -property which by default is set to `false` (ie. `warning`). +### `VFile#message(reason[, position][, origin])` -###### Parameters +Associates a message with the file, where `fatal` is set to `false`. +Constructs a new [`VMessage`][vmessage] and adds it to +[`vfile.messages`][messages]. -* `reason` (`string` or `Error`) - — Reason for message, uses the stack and message of the error if given -* `position` (`Node`, `Location`, or `Position`, optional) - — Place at which the message occurred in `vfile` -* `ruleId` (`string`, optional) - — Category of message +##### Returns -###### Returns +[`VMessage`][vmessage]. -[`VFileMessage`][message]. - -### `VFile#info(reason[, position[, ruleId]])` +### `VFile#info(reason[, position][, origin])` Associates an informational message with the file, where `fatal` is set to -`null`. Calls [`#message()`][messages] internally. +`null`. Calls [`#message()`][message] internally. -###### Returns +##### Returns -[`VFileMessage`][message]. +[`VMessage`][vmessage]. -### `VFile#fail(reason[, position[, ruleId]])` +### `VFile#fail(reason[, position][, origin])` Associates a fatal message with the file, then immediately throws it. Note: fatal errors mean a file is no longer processable. -Calls [`#message()`][messages] internally. - -###### Throws +Calls [`#message()`][message] internally. -[`VFileMessage`][message]. +##### Throws -### `VFileMessage` - -File-related message describing something at certain position (extends -`Error`). - -###### Properties - -* `file` (`string`) — File-path (when the message was triggered) -* `reason` (`string`) — Reason for message -* `ruleId` (`string?`) — Category of message -* `source` (`string?`) — Namespace of warning -* `stack` (`string?`) — Stack of message -* `fatal` (`boolean?`) — If `true`, marks associated file as no longer - processable -* `line` (`number?`) — Starting line of error -* `column` (`number?`) — Starting column of error -* `location` (`object`) — Full range information, when available. Has - `start` and `end` properties, both set to an object with `line` and - `column`, set to `number?` +[`VMessage`][vmessage]. ## License @@ -282,7 +262,7 @@ File-related message describing something at certain position (extends [author]: http://wooorm.com -[vfile]: https://cdn.rawgit.com/vfile/vfile/a20a566/logo.svg +[vfile]: https://cdn.rawgit.com/vfile/vfile/f65510e/logo.svg [unified]: https://github.com/unifiedjs/unified @@ -296,6 +276,10 @@ File-related message describing something at certain position (extends [unist]: https://github.com/syntax-tree/unist#list-of-utilities -[messages]: #vfilemessagereason-position-ruleid +[reporter]: https://github.com/vfile/vfile-reporter + +[vmessage]: https://github.com/vfile/vfile-message + +[messages]: #vfilemessages -[message]: #vfilemessage +[message]: #vfilemessagereason-position-origin diff --git a/tools/eslint/package.json b/tools/eslint/package.json index a508d8cd91f838..dec10304f74af0 100644 --- a/tools/eslint/package.json +++ b/tools/eslint/package.json @@ -1,8 +1,8 @@ { "_from": "eslint@latest", - "_id": "eslint@4.10.0", + "_id": "eslint@4.12.0", "_inBundle": false, - "_integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", + "_integrity": "sha512-Ohv4NU0FffkEe4so8DBrdfRUbGUtM4XnBTDll2pY7OdW3VkjBOZPerx3Bmuhg6S6D6r8+cli0EezN0xawUfYwg==", "_location": "/eslint", "_phantomChildren": {}, "_requested": { @@ -19,8 +19,8 @@ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", - "_shasum": "f25d0d7955c81968c2309aa5c9a229e045176bb7", + "_resolved": "https://registry.npmjs.org/eslint/-/eslint-4.12.0.tgz", + "_shasum": "a7ce78eba8cc8f2443acfbbc870cc31a65135884", "_spec": "eslint@latest", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp", "author": { @@ -35,29 +35,29 @@ }, "bundleDependencies": false, "dependencies": { - "ajv": "^5.2.0", + "ajv": "^5.3.0", "babel-code-frame": "^6.22.0", "chalk": "^2.1.0", "concat-stream": "^1.6.0", "cross-spawn": "^5.1.0", "debug": "^3.0.1", - "doctrine": "^2.0.0", + "doctrine": "^2.0.2", "eslint-plugin-markdown": "^1.0.0-beta.7", "eslint-scope": "^3.7.1", - "espree": "^3.5.1", + "espree": "^3.5.2", "esquery": "^1.0.0", "estraverse": "^4.2.0", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", - "globals": "^9.17.0", + "globals": "^11.0.1", "ignore": "^3.3.3", "imurmurhash": "^0.1.4", "inquirer": "^3.0.6", "is-resolvable": "^1.0.0", "js-yaml": "^3.9.1", - "json-stable-stringify": "^1.0.1", + "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", "lodash": "^4.17.4", "minimatch": "^3.0.2", @@ -90,7 +90,9 @@ "ejs": "^2.5.6", "eslint-plugin-eslint-plugin": "^1.2.0", "eslint-plugin-node": "^5.1.0", + "eslint-plugin-rulesdir": "^0.1.0", "eslint-release": "^0.10.1", + "eslint-rule-composer": "^0.1.0", "eslump": "1.6.0", "esprima": "^4.0.0", "esprima-fb": "^15001.1001.0-dev-harmony-fb", @@ -110,7 +112,6 @@ "phantomjs-prebuilt": "^2.1.14", "proxyquire": "^1.8.0", "shelljs": "^0.7.7", - "shelljs-nodecli": "~0.1.1", "sinon": "^3.2.1", "temp": "^0.8.3", "through": "^2.3.8" @@ -156,5 +157,5 @@ "release": "node Makefile.js release", "test": "node Makefile.js test" }, - "version": "4.10.0" + "version": "4.12.0" } From 5736dc4ab9a839996db56a46a64f842b0be08026 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 22 Nov 2017 12:01:11 +0200 Subject: [PATCH 211/379] module: fix for #17130 shared loader cjs dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17131 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Timothy Gu Reviewed-By: Bradley Farias --- lib/internal/loader/ModuleRequest.js | 13 +++++++++++-- lib/module.js | 4 +++- test/es-module/test-esm-shared-loader-dep.mjs | 7 +++++++ .../es-module-loaders/loader-shared-dep.mjs | 7 +++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 test/es-module/test-esm-shared-loader-dep.mjs create mode 100644 test/fixtures/es-module-loaders/loader-shared-dep.mjs diff --git a/lib/internal/loader/ModuleRequest.js b/lib/internal/loader/ModuleRequest.js index 72f3dd3ee570c2..93baf2a597fc1a 100644 --- a/lib/internal/loader/ModuleRequest.js +++ b/lib/internal/loader/ModuleRequest.js @@ -2,6 +2,7 @@ const fs = require('fs'); const internalCJSModule = require('internal/module'); +const CJSModule = require('module'); const internalURLModule = require('internal/url'); const internalFS = require('internal/fs'); const NativeModule = require('native_module'); @@ -35,11 +36,19 @@ loaders.set('esm', async (url) => { }); // Strategy for loading a node-style CommonJS module +const isWindows = process.platform === 'win32'; +const winSepRegEx = /\//g; loaders.set('cjs', async (url) => { + const pathname = internalURLModule.getPathFromURL(new URL(url)); + const module = CJSModule._cache[ + isWindows ? pathname.replace(winSepRegEx, '\\') : pathname]; + if (module && module.loaded) { + const ctx = createDynamicModule(['default'], url, undefined); + ctx.reflect.exports.default.set(module.exports); + return ctx; + } return createDynamicModule(['default'], url, (reflect) => { debug(`Loading CJSModule ${url}`); - const CJSModule = require('module'); - const pathname = internalURLModule.getPathFromURL(new URL(url)); CJSModule._load(pathname); }); }); diff --git a/lib/module.js b/lib/module.js index ee9bf967bfb4b4..69e6feb6c9109d 100644 --- a/lib/module.js +++ b/lib/module.js @@ -39,6 +39,9 @@ const experimentalModules = !!process.binding('config').experimentalModules; const errors = require('internal/errors'); +module.exports = Module; + +// these are below module.exports for the circular reference const Loader = require('internal/loader/Loader'); const ModuleJob = require('internal/loader/ModuleJob'); const { createDynamicModule } = require('internal/loader/ModuleWrap'); @@ -72,7 +75,6 @@ function Module(id, parent) { this.loaded = false; this.children = []; } -module.exports = Module; const builtinModules = Object.keys(NativeModule._source) .filter(NativeModule.nonInternalExists); diff --git a/test/es-module/test-esm-shared-loader-dep.mjs b/test/es-module/test-esm-shared-loader-dep.mjs new file mode 100644 index 00000000000000..970bfd7121a721 --- /dev/null +++ b/test/es-module/test-esm-shared-loader-dep.mjs @@ -0,0 +1,7 @@ +// Flags: --experimental-modules --loader ./test/fixtures/es-module-loaders/loader-shared-dep.mjs +/* eslint-disable required-modules */ +import assert from 'assert'; +import './test-esm-ok.mjs'; +import dep from '../fixtures/es-module-loaders/loader-dep.js'; + +assert.strictEqual(dep.format, 'esm'); diff --git a/test/fixtures/es-module-loaders/loader-shared-dep.mjs b/test/fixtures/es-module-loaders/loader-shared-dep.mjs new file mode 100644 index 00000000000000..e2a1cbd75d2535 --- /dev/null +++ b/test/fixtures/es-module-loaders/loader-shared-dep.mjs @@ -0,0 +1,7 @@ +import dep from './loader-dep.js'; +import assert from 'assert'; + +export function resolve(specifier, base, defaultResolve) { + assert.equal(dep.format, 'esm'); + return defaultResolve(specifier, base); +} From 9d657247dfe108e789e6889500c1efbfb04ee842 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 25 Nov 2017 11:58:53 -0500 Subject: [PATCH 212/379] process: slightly simplify next tick execution Get rid of separate function to call callback from _tickCallback as it no longer yields worthwhile performance improvement. Move some code from nextTick & internalNextTick into TickObject constructor to minimize duplication. PR-URL: https://github.com/nodejs/node/pull/16888 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Timothy Gu --- benchmark/process/next-tick-breadth-args.js | 2 +- benchmark/process/next-tick-breadth.js | 2 +- benchmark/process/next-tick-exec-args.js | 25 ++++++ benchmark/process/next-tick-exec.js | 18 +++++ lib/internal/process/next_tick.js | 77 ++++++++----------- test/message/nexttick_throw.out | 1 - test/message/stdin_messages.out | 7 +- .../unhandled_promise_trace_warnings.out | 2 - 8 files changed, 81 insertions(+), 53 deletions(-) create mode 100644 benchmark/process/next-tick-exec-args.js create mode 100644 benchmark/process/next-tick-exec.js diff --git a/benchmark/process/next-tick-breadth-args.js b/benchmark/process/next-tick-breadth-args.js index cc038dd348faac..ca608f15daa743 100644 --- a/benchmark/process/next-tick-breadth-args.js +++ b/benchmark/process/next-tick-breadth-args.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [2] + millions: [4] }); function main(conf) { diff --git a/benchmark/process/next-tick-breadth.js b/benchmark/process/next-tick-breadth.js index 8f8d0adc618dad..51951ce0afd645 100644 --- a/benchmark/process/next-tick-breadth.js +++ b/benchmark/process/next-tick-breadth.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [2] + millions: [4] }); function main(conf) { diff --git a/benchmark/process/next-tick-exec-args.js b/benchmark/process/next-tick-exec-args.js new file mode 100644 index 00000000000000..5ff017bb29cd5b --- /dev/null +++ b/benchmark/process/next-tick-exec-args.js @@ -0,0 +1,25 @@ +'use strict'; +const common = require('../common.js'); +const bench = common.createBenchmark(main, { + millions: [5] +}); + +function main(conf) { + var n = +conf.millions * 1e6; + + bench.start(); + for (var i = 0; i < n; i++) { + if (i % 4 === 0) + process.nextTick(onNextTick, i, true, 10, 'test'); + else if (i % 3 === 0) + process.nextTick(onNextTick, i, true, 10); + else if (i % 2 === 0) + process.nextTick(onNextTick, i, 20); + else + process.nextTick(onNextTick, i); + } + function onNextTick(i) { + if (i + 1 === n) + bench.end(+conf.millions); + } +} diff --git a/benchmark/process/next-tick-exec.js b/benchmark/process/next-tick-exec.js new file mode 100644 index 00000000000000..12c9d4624a903c --- /dev/null +++ b/benchmark/process/next-tick-exec.js @@ -0,0 +1,18 @@ +'use strict'; +const common = require('../common.js'); +const bench = common.createBenchmark(main, { + millions: [5] +}); + +function main(conf) { + var n = +conf.millions * 1e6; + + bench.start(); + for (var i = 0; i < n; i++) { + process.nextTick(onNextTick, i); + } + function onNextTick(i) { + if (i + 1 === n) + bench.end(+conf.millions); + } +} diff --git a/lib/internal/process/next_tick.js b/lib/internal/process/next_tick.js index 83a833dc596c24..4c8b5f7d2d4181 100644 --- a/lib/internal/process/next_tick.js +++ b/lib/internal/process/next_tick.js @@ -60,7 +60,7 @@ function setupNextTick() { // Grab the constants necessary for working with internal arrays. const { kInit, kDestroy, kAsyncIdCounter } = async_wrap.constants; const { async_id_symbol, trigger_async_id_symbol } = async_wrap; - var nextTickQueue = new NextTickQueue(); + const nextTickQueue = new NextTickQueue(); var microtasksScheduled = false; // Used to run V8's micro task queue. @@ -99,7 +99,6 @@ function setupNextTick() { const microTasksTickObject = { callback: runMicrotasksCallback, args: undefined, - domain: null, [async_id_symbol]: 0, [trigger_async_id_symbol]: 0 }; @@ -125,26 +124,6 @@ function setupNextTick() { } } - function _combinedTickCallback(args, callback) { - if (args === undefined) { - callback(); - } else { - switch (args.length) { - case 1: - callback(args[0]); - break; - case 2: - callback(args[0], args[1]); - break; - case 3: - callback(args[0], args[1], args[2]); - break; - default: - callback(...args); - } - } - } - // Run callbacks that have no domain. // Using domains will cause this to be overridden. function _tickCallback() { @@ -152,8 +131,6 @@ function setupNextTick() { while (tickInfo[kIndex] < tickInfo[kLength]) { ++tickInfo[kIndex]; const tock = nextTickQueue.shift(); - const callback = tock.callback; - const args = tock.args; // CHECK(Number.isSafeInteger(tock[async_id_symbol])) // CHECK(tock[async_id_symbol] > 0) @@ -173,10 +150,11 @@ function setupNextTick() { if (async_hook_fields[kDestroy] > 0) emitDestroy(tock[async_id_symbol]); - // Using separate callback execution functions allows direct - // callback invocation with small numbers of arguments to avoid the - // performance hit associated with using `fn.apply()` - _combinedTickCallback(args, callback); + const callback = tock.callback; + if (tock.args === undefined) + callback(); + else + Reflect.apply(callback, undefined, tock.args); emitAfter(tock[async_id_symbol]); @@ -191,11 +169,21 @@ function setupNextTick() { class TickObject { constructor(callback, args, asyncId, triggerAsyncId) { + // this must be set to null first to avoid function tracking + // on the hidden class, revisit in V8 versions after 6.2 + this.callback = null; this.callback = callback; this.args = args; - this.domain = process.domain || null; + this[async_id_symbol] = asyncId; this[trigger_async_id_symbol] = triggerAsyncId; + + if (async_hook_fields[kInit] > 0) { + emitInit(asyncId, + 'TickObject', + triggerAsyncId, + this); + } } } @@ -220,13 +208,14 @@ function setupNextTick() { args[i - 1] = arguments[i]; } - const asyncId = ++async_id_fields[kAsyncIdCounter]; - const triggerAsyncId = initTriggerId(); - const obj = new TickObject(callback, args, asyncId, triggerAsyncId); - nextTickQueue.push(obj); + // In V8 6.2, moving tickInfo & async_id_fields[kAsyncIdCounter] into the + // TickObject incurs a significant performance penalty in the + // next-tick-breadth-args benchmark (revisit later) ++tickInfo[kLength]; - if (async_hook_fields[kInit] > 0) - emitInit(asyncId, 'TickObject', triggerAsyncId, obj); + nextTickQueue.push(new TickObject(callback, + args, + ++async_id_fields[kAsyncIdCounter], + initTriggerId())); } // `internalNextTick()` will not enqueue any callback when the process is @@ -240,10 +229,6 @@ function setupNextTick() { if (process._exiting) return; - if (triggerAsyncId === null) { - triggerAsyncId = async_hooks.initTriggerId(); - } - var args; switch (arguments.length) { case 2: break; @@ -256,11 +241,15 @@ function setupNextTick() { args[i - 2] = arguments[i]; } - const asyncId = ++async_id_fields[kAsyncIdCounter]; - const obj = new TickObject(callback, args, asyncId, triggerAsyncId); - nextTickQueue.push(obj); + if (triggerAsyncId === null) + triggerAsyncId = initTriggerId(); + // In V8 6.2, moving tickInfo & async_id_fields[kAsyncIdCounter] into the + // TickObject incurs a significant performance penalty in the + // next-tick-breadth-args benchmark (revisit later) ++tickInfo[kLength]; - if (async_hook_fields[kInit] > 0) - emitInit(asyncId, 'TickObject', triggerAsyncId, obj); + nextTickQueue.push(new TickObject(callback, + args, + ++async_id_fields[kAsyncIdCounter], + triggerAsyncId)); } } diff --git a/test/message/nexttick_throw.out b/test/message/nexttick_throw.out index 1b72ea2d3cfb69..1c9eca8405d928 100644 --- a/test/message/nexttick_throw.out +++ b/test/message/nexttick_throw.out @@ -4,7 +4,6 @@ ^ ReferenceError: undefined_reference_error_maker is not defined at *test*message*nexttick_throw.js:*:* - at _combinedTickCallback (internal/process/next_tick.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) at Function.Module.runMain (module.js:*:*) at startup (bootstrap_node.js:*:*) diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out index 3145d50894771b..d934523a726772 100644 --- a/test/message/stdin_messages.out +++ b/test/message/stdin_messages.out @@ -11,7 +11,6 @@ SyntaxError: Strict mode code may not include a with statement at Socket. (bootstrap_node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) 42 42 @@ -29,7 +28,7 @@ Error: hello at Socket. (bootstrap_node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) + at process._tickCallback (internal/process/next_tick.js:*:*) [stdin]:1 throw new Error("hello") ^ @@ -44,7 +43,7 @@ Error: hello at Socket. (bootstrap_node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) + at process._tickCallback (internal/process/next_tick.js:*:*) 100 [stdin]:1 var x = 100; y = x; @@ -60,7 +59,7 @@ ReferenceError: y is not defined at Socket. (bootstrap_node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) + at process._tickCallback (internal/process/next_tick.js:*:*) [stdin]:1 var ______________________________________________; throw 10 diff --git a/test/message/unhandled_promise_trace_warnings.out b/test/message/unhandled_promise_trace_warnings.out index 410b3bf4e36d41..c9c7a5c8700b26 100644 --- a/test/message/unhandled_promise_trace_warnings.out +++ b/test/message/unhandled_promise_trace_warnings.out @@ -15,7 +15,6 @@ at * at * at * - at * (node:*) Error: This was rejected at * (*test*message*unhandled_promise_trace_warnings.js:*) at * @@ -34,7 +33,6 @@ at * at * at * - at * (node:*) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) at getAsynchronousRejectionWarningObject (internal/process/promises.js:*) at rejectionHandled (internal/process/promises.js:*) From 4e789a3bf82d661975278dd675e5012f285ba649 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 25 Nov 2017 23:58:05 +0900 Subject: [PATCH 213/379] test: add common.dns.errorLookupMock PR-URL: https://github.com/nodejs/node/pull/17296 Refs: https://github.com/nodejs/help/issues/687 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/common/README.md | 21 ++++++++++++++++++++- test/common/dns.js | 26 +++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index 32a14382ff5c51..54604568681612 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -419,7 +419,26 @@ called before the callback is invoked. ## DNS Module -The `DNS` module provides a naïve DNS parser/serializer. +The `DNS` module provides utilities related to the `dns` built-in module. + +### errorLookupMock(code, syscall) + +* `code` [<String>] Defaults to `dns.mockedErrorCode`. +* `syscall` [<String>] Defaults to `dns.mockedSysCall`. +* return [<Function>] + + +A mock for the `lookup` option of `net.connect()` that would result in an error +with the `code` and the `syscall` specified. Returns a function that has the +same signature as `dns.lookup()`. + +### mockedErrorCode + +The default `code` of errors generated by `errorLookupMock`. + +### mockedSysCall + +The default `syscall` of errors generated by `errorLookupMock`. ### readDomainFromPacket(buffer, offset) diff --git a/test/common/dns.js b/test/common/dns.js index 432d1b764dde29..69c67ac541cf98 100644 --- a/test/common/dns.js +++ b/test/common/dns.js @@ -1,8 +1,6 @@ /* eslint-disable required-modules */ 'use strict'; -// Naïve DNS parser/serializer. - const assert = require('assert'); const os = require('os'); @@ -22,6 +20,8 @@ const classes = { IN: 1 }; +// Naïve DNS parser/serializer. + function readDomainFromPacket(buffer, offset) { assert.ok(offset < buffer.length); const length = buffer[offset]; @@ -287,6 +287,26 @@ function writeDNSPacket(parsed) { })); } +const mockedErrorCode = 'ENOTFOUND'; +const mockedSysCall = 'getaddrinfo'; + +function errorLookupMock(code = mockedErrorCode, syscall = mockedSysCall) { + return function lookupWithError(host, dnsopts, cb) { + const err = new Error(`${syscall} ${code} ${host}`); + err.code = code; + err.errno = code; + err.syscall = syscall; + err.hostname = host; + cb(err); + }; +} + module.exports = { - types, classes, writeDNSPacket, parseDNSPacket + types, + classes, + writeDNSPacket, + parseDNSPacket, + errorLookupMock, + mockedErrorCode, + mockedSysCall }; From 3d45a94b563b63b97b8c85af3b9bbf9d7cc1c918 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 25 Nov 2017 23:58:24 +0900 Subject: [PATCH 214/379] test: mock the lookup function in parallel tests These tests should not make any DNS calls. The lookup would fail when the DNS requests are hijacked and time out instead of erroring out. PR-URL: https://github.com/nodejs/node/pull/17296 Refs: https://github.com/nodejs/help/issues/687 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott Reviewed-By: James M Snell --- ...-http-client-req-error-dont-double-fire.js | 16 ++++++++-- ...net-better-error-messages-port-hostname.js | 27 +++++++++++------ .../test-net-connect-immediate-finish.js | 29 ++++++++++++------- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/test/parallel/test-http-client-req-error-dont-double-fire.js b/test/parallel/test-http-client-req-error-dont-double-fire.js index 996540fc96c72e..d2c526eab69c6c 100644 --- a/test/parallel/test-http-client-req-error-dont-double-fire.js +++ b/test/parallel/test-http-client-req-error-dont-double-fire.js @@ -1,11 +1,21 @@ 'use strict'; + +// This tests that the error emitted on the socket does +// not get fired again when the 'error' event handler throws +// an error. + const assert = require('assert'); const http = require('http'); const common = require('../common'); +const { addresses } = require('../common/internet'); +const { errorLookupMock } = require('../common/dns'); + +const host = addresses.INVALID_HOST; -// Invalid hostname as per https://tools.ietf.org/html/rfc2606#section-2 -const host = 'this.hostname.is.invalid'; -const req = http.get({ host }); +const req = http.get({ + host, + lookup: common.mustCall(errorLookupMock()) +}); const err = new Error('mock unexpected code error'); req.on('error', common.mustCall(() => { throw err; diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index 818ea4bfff41f6..1a8aa770b44a22 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -1,21 +1,30 @@ 'use strict'; + +// This tests that the error thrown from net.createConnection +// comes with host and port properties. +// See https://github.com/nodejs/node-v0.x-archive/issues/7005 + const common = require('../common'); const net = require('net'); const assert = require('assert'); +const { addresses } = require('../common/internet'); +const { + errorLookupMock, + mockedErrorCode +} = require('../common/dns'); + // Using port 0 as hostname used is already invalid. -const c = net.createConnection(0, 'this.hostname.is.invalid'); +const c = net.createConnection({ + port: 0, + host: addresses.INVALID_HOST, + lookup: common.mustCall(errorLookupMock()) +}); c.on('connect', common.mustNotCall()); c.on('error', common.mustCall(function(e) { - // If Name Service Switch is available on the operating system then it - // might be configured differently (/etc/nsswitch.conf). - // If the system is configured with no dns the error code will be EAI_AGAIN, - // but if there are more services after the dns entry, for example some - // linux distributions ship a myhostname service by default which would - // still produce the ENOTFOUND error. - assert.ok(e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN'); + assert.strictEqual(e.code, mockedErrorCode); assert.strictEqual(e.port, 0); - assert.strictEqual(e.hostname, 'this.hostname.is.invalid'); + assert.strictEqual(e.hostname, addresses.INVALID_HOST); })); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index e2e5e1c6715b9a..9adf8c31128b00 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -20,28 +20,35 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; + +// This tests that if the socket is still in the 'connecting' state +// when the user calls socket.end() ('finish'), the socket would emit +// 'connect' and defer the handling until the 'connect' event is handled. + const common = require('../common'); const assert = require('assert'); const net = require('net'); +const { addresses } = require('../common/internet'); +const { + errorLookupMock, + mockedErrorCode, + mockedSysCall +} = require('../common/dns'); + const client = net.connect({ - host: 'this.hostname.is.invalid', - port: common.PORT + host: addresses.INVALID_HOST, + port: common.PORT, + lookup: common.mustCall(errorLookupMock()) }); client.once('error', common.mustCall((err) => { assert(err); assert.strictEqual(err.code, err.errno); - // If Name Service Switch is available on the operating system then it - // might be configured differently (/etc/nsswitch.conf). - // If the system is configured with no dns the error code will be EAI_AGAIN, - // but if there are more services after the dns entry, for example some - // linux distributions ship a myhostname service by default which would - // still produce the ENOTFOUND error. - assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN'); + assert.strictEqual(err.code, mockedErrorCode); assert.strictEqual(err.host, err.hostname); - assert.strictEqual(err.host, 'this.hostname.is.invalid'); - assert.strictEqual(err.syscall, 'getaddrinfo'); + assert.strictEqual(err.host, addresses.INVALID_HOST); + assert.strictEqual(err.syscall, mockedSysCall); })); client.end(); From e5f92cda7ed404d2b3c5593b9015423e6f5ecb8d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 25 Nov 2017 08:26:46 -0800 Subject: [PATCH 215/379] http2: general cleanups PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- lib/internal/http2/core.js | 49 +++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 80a23116faf8f4..cc942559ea1e5a 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -28,6 +28,8 @@ const { _connectionListener: httpConnectionListener } = require('http'); const { createPromise, promiseResolve } = process.binding('util'); const debug = util.debuglog('http2'); +const kMaxFrameSize = (2 ** 24) - 1; +const kMaxInt = (2 ** 32) - 1; const kMaxStreams = (2 ** 31) - 1; const { @@ -330,9 +332,9 @@ function emitGoaway(self, code, lastStreamID, buf) { return; if (!state.shuttingDown && !state.shutdown) { self.shutdown({}, self.destroy.bind(self)); - } else { - self.destroy(); + return; } + self.destroy(); } // Called by the native layer when a goaway frame has been received @@ -580,14 +582,15 @@ function doShutdown(options) { function submitShutdown(options) { const type = this[kType]; debug(`Http2Session ${sessionName(type)}: submitting shutdown request`); + const fn = doShutdown.bind(this, options); if (type === NGHTTP2_SESSION_SERVER && options.graceful === true) { // first send a shutdown notice this[kHandle].shutdownNotice(); // then, on flip of the event loop, do the actual shutdown - setImmediate(doShutdown.bind(this), options); - } else { - doShutdown.call(this, options); + setImmediate(fn); + return; } + fn(); } function finishSessionDestroy(socket) { @@ -842,19 +845,19 @@ class Http2Session extends EventEmitter { settings = Object.assign(Object.create(null), settings); assertWithinRange('headerTableSize', settings.headerTableSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('initialWindowSize', settings.initialWindowSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('maxFrameSize', settings.maxFrameSize, - 16384, 2 ** 24 - 1); + 16384, kMaxFrameSize); assertWithinRange('maxConcurrentStreams', settings.maxConcurrentStreams, 0, kMaxStreams); assertWithinRange('maxHeaderListSize', settings.maxHeaderListSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); if (settings.enablePush !== undefined && typeof settings.enablePush !== 'boolean') { const err = new errors.TypeError('ERR_HTTP2_INVALID_SETTING_VALUE', @@ -869,11 +872,12 @@ class Http2Session extends EventEmitter { debug(`Http2Session ${sessionName(this[kType])}: sending settings`); state.pendingAck++; + const fn = submitSettings.bind(this, settings); if (state.connecting) { - this.once('connect', submitSettings.bind(this, settings)); + this.once('connect', fn); return; } - submitSettings.call(this, settings); + fn(); } // Destroy the Http2Session @@ -959,13 +963,14 @@ class Http2Session extends EventEmitter { this.on('shutdown', callback); } + const fn = submitShutdown.bind(this, options); if (state.connecting) { - this.once('connect', submitShutdown.bind(this, options)); + this.once('connect', fn); return; } debug(`Http2Session ${sessionName(type)}: sending shutdown`); - submitShutdown.call(this, options); + fn(); } _onTimeout() { @@ -1366,7 +1371,7 @@ class Http2Stream extends Duplex { rstStream(code = NGHTTP2_NO_ERROR) { if (typeof code !== 'number') throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'code', 'number'); - if (code < 0 || code > 2 ** 32 - 1) + if (code < 0 || code > kMaxInt) throw new errors.RangeError('ERR_OUT_OF_RANGE', 'code'); const fn = submitRstStream.bind(this, code); @@ -2360,19 +2365,19 @@ function getPackedSettings(settings) { settings = settings || Object.create(null); assertWithinRange('headerTableSize', settings.headerTableSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('initialWindowSize', settings.initialWindowSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('maxFrameSize', settings.maxFrameSize, - 16384, 2 ** 24 - 1); + 16384, kMaxFrameSize); assertWithinRange('maxConcurrentStreams', settings.maxConcurrentStreams, 0, kMaxStreams); assertWithinRange('maxHeaderListSize', settings.maxHeaderListSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); if (settings.enablePush !== undefined && typeof settings.enablePush !== 'boolean') { const err = new errors.TypeError('ERR_HTTP2_INVALID_SETTING_VALUE', @@ -2423,22 +2428,22 @@ function getUnpackedSettings(buf, options = {}) { if (options != null && options.validate) { assertWithinRange('headerTableSize', settings.headerTableSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('enablePush', settings.enablePush, 0, 1); assertWithinRange('initialWindowSize', settings.initialWindowSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); assertWithinRange('maxFrameSize', settings.maxFrameSize, - 16384, 2 ** 24 - 1); + 16384, kMaxFrameSize); assertWithinRange('maxConcurrentStreams', settings.maxConcurrentStreams, 0, kMaxStreams); assertWithinRange('maxHeaderListSize', settings.maxHeaderListSize, - 0, 2 ** 32 - 1); + 0, kMaxInt); } if (settings.enablePush !== undefined) { From 67abc1e697a58eef2933d4b762f1ed0c27d667c1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 25 Nov 2017 12:44:07 -0800 Subject: [PATCH 216/379] http2: reduce code duplication in settings PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- lib/internal/http2/core.js | 106 ++++++------------ test/parallel/test-http2-getpackedsettings.js | 10 +- 2 files changed, 35 insertions(+), 81 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index cc942559ea1e5a..025b0e363356ea 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -659,6 +659,33 @@ function pingCallback(cb) { }; } +function validateSettings(settings) { + settings = Object.assign({}, settings); + assertWithinRange('headerTableSize', + settings.headerTableSize, + 0, kMaxInt); + assertWithinRange('initialWindowSize', + settings.initialWindowSize, + 0, kMaxInt); + assertWithinRange('maxFrameSize', + settings.maxFrameSize, + 16384, kMaxFrameSize); + assertWithinRange('maxConcurrentStreams', + settings.maxConcurrentStreams, + 0, kMaxStreams); + assertWithinRange('maxHeaderListSize', + settings.maxHeaderListSize, + 0, kMaxInt); + if (settings.enablePush !== undefined && + typeof settings.enablePush !== 'boolean') { + const err = new errors.TypeError('ERR_HTTP2_INVALID_SETTING_VALUE', + 'enablePush', settings.enablePush); + err.actual = settings.enablePush; + throw err; + } + return settings; +} + // Upon creation, the Http2Session takes ownership of the socket. The session // may not be ready to use immediately if the socket is not yet fully connected. class Http2Session extends EventEmitter { @@ -842,29 +869,7 @@ class Http2Session extends EventEmitter { // Validate the input first assertIsObject(settings, 'settings'); - settings = Object.assign(Object.create(null), settings); - assertWithinRange('headerTableSize', - settings.headerTableSize, - 0, kMaxInt); - assertWithinRange('initialWindowSize', - settings.initialWindowSize, - 0, kMaxInt); - assertWithinRange('maxFrameSize', - settings.maxFrameSize, - 16384, kMaxFrameSize); - assertWithinRange('maxConcurrentStreams', - settings.maxConcurrentStreams, - 0, kMaxStreams); - assertWithinRange('maxHeaderListSize', - settings.maxHeaderListSize, - 0, kMaxInt); - if (settings.enablePush !== undefined && - typeof settings.enablePush !== 'boolean') { - const err = new errors.TypeError('ERR_HTTP2_INVALID_SETTING_VALUE', - 'enablePush', settings.enablePush); - err.actual = settings.enablePush; - throw err; - } + settings = validateSettings(settings); if (state.pendingAck === state.maxPendingAck) { throw new errors.Error('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', this[kState].pendingAck); @@ -2362,30 +2367,7 @@ function createServer(options, handler) { // HTTP2-Settings header frame. function getPackedSettings(settings) { assertIsObject(settings, 'settings'); - settings = settings || Object.create(null); - assertWithinRange('headerTableSize', - settings.headerTableSize, - 0, kMaxInt); - assertWithinRange('initialWindowSize', - settings.initialWindowSize, - 0, kMaxInt); - assertWithinRange('maxFrameSize', - settings.maxFrameSize, - 16384, kMaxFrameSize); - assertWithinRange('maxConcurrentStreams', - settings.maxConcurrentStreams, - 0, kMaxStreams); - assertWithinRange('maxHeaderListSize', - settings.maxHeaderListSize, - 0, kMaxInt); - if (settings.enablePush !== undefined && - typeof settings.enablePush !== 'boolean') { - const err = new errors.TypeError('ERR_HTTP2_INVALID_SETTING_VALUE', - 'enablePush', settings.enablePush); - err.actual = settings.enablePush; - throw err; - } - updateSettingsBuffer(settings); + updateSettingsBuffer(validateSettings(settings)); return binding.packSettings(); } @@ -2396,7 +2378,7 @@ function getUnpackedSettings(buf, options = {}) { } if (buf.length % 6 !== 0) throw new errors.RangeError('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH'); - const settings = Object.create(null); + const settings = {}; let offset = 0; while (offset < buf.length) { const id = buf.readUInt16BE(offset); @@ -2407,7 +2389,7 @@ function getUnpackedSettings(buf, options = {}) { settings.headerTableSize = value; break; case NGHTTP2_SETTINGS_ENABLE_PUSH: - settings.enablePush = value; + settings.enablePush = value !== 0; break; case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: settings.maxConcurrentStreams = value; @@ -2425,30 +2407,8 @@ function getUnpackedSettings(buf, options = {}) { offset += 4; } - if (options != null && options.validate) { - assertWithinRange('headerTableSize', - settings.headerTableSize, - 0, kMaxInt); - assertWithinRange('enablePush', - settings.enablePush, - 0, 1); - assertWithinRange('initialWindowSize', - settings.initialWindowSize, - 0, kMaxInt); - assertWithinRange('maxFrameSize', - settings.maxFrameSize, - 16384, kMaxFrameSize); - assertWithinRange('maxConcurrentStreams', - settings.maxConcurrentStreams, - 0, kMaxStreams); - assertWithinRange('maxHeaderListSize', - settings.maxHeaderListSize, - 0, kMaxInt); - } - - if (settings.enablePush !== undefined) { - settings.enablePush = !!settings.enablePush; - } + if (options != null && options.validate) + validateSettings(settings); return settings; } diff --git a/test/parallel/test-http2-getpackedsettings.js b/test/parallel/test-http2-getpackedsettings.js index 7461176c5fcde7..16c84913893d0c 100644 --- a/test/parallel/test-http2-getpackedsettings.js +++ b/test/parallel/test-http2-getpackedsettings.js @@ -128,7 +128,6 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); assert.strictEqual(settings.enablePush, true); } -//should throw if enablePush is not 0 or 1 { const packed = Buffer.from([ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00]); @@ -140,13 +139,8 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); const packed = Buffer.from([ 0x00, 0x02, 0x00, 0x00, 0x00, 0x64]); - assert.throws(() => { - http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ - code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - type: RangeError, - message: 'Invalid value for setting "enablePush": 100' - })); + const settings = http2.getUnpackedSettings(packed, { validate: true }); + assert.strictEqual(settings.enablePush, true); } //check for what happens if passing {validate: true} and no errors happen From 047bac247514fbd450baf940a38680d840811d33 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 11:40:50 -0800 Subject: [PATCH 217/379] test: fixup test-http2-create-client-secure-session General improvements to test and verify that a secureConnect handler is present PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- ...test-http2-create-client-secure-session.js | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/test/parallel/test-http2-create-client-secure-session.js b/test/parallel/test-http2-create-client-secure-session.js index 62a79148dcac47..811ef772d5903a 100644 --- a/test/parallel/test-http2-create-client-secure-session.js +++ b/test/parallel/test-http2-create-client-secure-session.js @@ -20,10 +20,7 @@ function loadKey(keyname) { function onStream(stream, headers) { const socket = stream.session[kSocket]; assert(headers[':authority'].startsWith(socket.servername)); - stream.respond({ - 'content-type': 'text/html', - ':status': 200 - }); + stream.respond({ 'content-type': 'application/json' }); stream.end(JSON.stringify({ servername: socket.servername, alpnProtocol: socket.alpnProtocol @@ -33,35 +30,32 @@ function onStream(stream, headers) { function verifySecureSession(key, cert, ca, opts) { const server = h2.createSecureServer({ cert, key }); server.on('stream', common.mustCall(onStream)); - server.listen(0); - server.on('listening', common.mustCall(function() { - const headers = { ':path': '/' }; - if (!opts) { - opts = {}; - } + server.listen(0, common.mustCall(() => { + opts = opts || { }; opts.secureContext = tls.createSecureContext({ ca }); - const client = h2.connect(`https://localhost:${this.address().port}`, opts, function() { - const req = client.request(headers); + const client = h2.connect(`https://localhost:${server.address().port}`, + opts); + // Verify that a 'secureConnect' listener is attached + assert.strictEqual(client.socket.listenerCount('secureConnect'), 1); + const req = client.request(); - req.on('response', common.mustCall(function(headers) { - assert.strictEqual(headers[':status'], 200, 'status code is set'); - assert.strictEqual(headers['content-type'], 'text/html', - 'content type is set'); - assert(headers['date'], 'there is a date'); - })); + req.on('response', common.mustCall((headers) => { + assert.strictEqual(headers[':status'], 200); + assert.strictEqual(headers['content-type'], 'application/json'); + assert(headers['date']); + })); - let data = ''; - req.setEncoding('utf8'); - req.on('data', (d) => data += d); - req.on('end', common.mustCall(() => { - const jsonData = JSON.parse(data); - assert.strictEqual(jsonData.servername, opts.servername || 'localhost'); - assert.strictEqual(jsonData.alpnProtocol, 'h2'); - server.close(); - client[kSocket].destroy(); - })); - req.end(); - }); + let data = ''; + req.setEncoding('utf8'); + req.on('data', (d) => data += d); + req.on('end', common.mustCall(() => { + const jsonData = JSON.parse(data); + assert.strictEqual(jsonData.servername, + opts.servername || 'localhost'); + assert.strictEqual(jsonData.alpnProtocol, 'h2'); + server.close(); + client[kSocket].destroy(); + })); })); } From 4994d5789011c1f382bccbcec143b2c972f461e0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 11:50:59 -0800 Subject: [PATCH 218/379] http2: remove unnecessary event handlers PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- lib/internal/http2/compat.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 5ddde39d387785..ec1f0ba64eff0a 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -122,20 +122,6 @@ function onStreamDrain() { response.emit('drain'); } -// TODO Http2Stream does not emit 'close' -function onStreamClosedRequest() { - const request = this[kRequest]; - if (request !== undefined) - request.push(null); -} - -// TODO Http2Stream does not emit 'close' -function onStreamClosedResponse() { - const response = this[kResponse]; - if (response !== undefined) - response.emit('finish'); -} - function onStreamAbortedRequest() { const request = this[kRequest]; if (request !== undefined && request[kState].closed === false) { @@ -247,7 +233,6 @@ class Http2ServerRequest extends Readable { stream.on('trailers', onStreamTrailers); stream.on('end', onStreamEnd); stream.on('error', onStreamError); - stream.on('close', onStreamClosedRequest); stream.on('aborted', onStreamAbortedRequest); const onfinish = this[kFinish].bind(this); stream.on('close', onfinish); @@ -380,7 +365,6 @@ class Http2ServerResponse extends Stream { stream[kResponse] = this; this.writable = true; stream.on('drain', onStreamDrain); - stream.on('close', onStreamClosedResponse); stream.on('aborted', onStreamAbortedResponse); const onfinish = this[kFinish].bind(this); stream.on('close', onfinish); From 658338e317ef1056ecd108e34baa7ff046aed5d9 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 12:02:14 -0800 Subject: [PATCH 219/379] http2: use more descriptive names PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- lib/internal/http2/core.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 025b0e363356ea..78446d2fb6e112 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -582,15 +582,15 @@ function doShutdown(options) { function submitShutdown(options) { const type = this[kType]; debug(`Http2Session ${sessionName(type)}: submitting shutdown request`); - const fn = doShutdown.bind(this, options); + const shutdownFn = doShutdown.bind(this, options); if (type === NGHTTP2_SESSION_SERVER && options.graceful === true) { // first send a shutdown notice this[kHandle].shutdownNotice(); // then, on flip of the event loop, do the actual shutdown - setImmediate(fn); + setImmediate(shutdownFn); return; } - fn(); + shutdownFn(); } function finishSessionDestroy(socket) { @@ -877,12 +877,12 @@ class Http2Session extends EventEmitter { debug(`Http2Session ${sessionName(this[kType])}: sending settings`); state.pendingAck++; - const fn = submitSettings.bind(this, settings); + const settingsFn = submitSettings.bind(this, settings); if (state.connecting) { - this.once('connect', fn); + this.once('connect', settingsFn); return; } - fn(); + settingsFn(); } // Destroy the Http2Session @@ -968,14 +968,14 @@ class Http2Session extends EventEmitter { this.on('shutdown', callback); } - const fn = submitShutdown.bind(this, options); + const shutdownFn = submitShutdown.bind(this, options); if (state.connecting) { - this.once('connect', fn); + this.once('connect', shutdownFn); return; } debug(`Http2Session ${sessionName(type)}: sending shutdown`); - fn(); + shutdownFn(); } _onTimeout() { @@ -1379,12 +1379,12 @@ class Http2Stream extends Duplex { if (code < 0 || code > kMaxInt) throw new errors.RangeError('ERR_OUT_OF_RANGE', 'code'); - const fn = submitRstStream.bind(this, code); + const rstStreamFn = submitRstStream.bind(this, code); if (this[kID] === undefined) { - this.once('ready', fn); + this.once('ready', rstStreamFn); return; } - fn(); + rstStreamFn(); } rstWithNoError() { @@ -1415,12 +1415,12 @@ class Http2Stream extends Duplex { options = Object.assign({}, options); validatePriorityOptions(options); - const fn = submitPriority.bind(this, options); + const priorityFn = submitPriority.bind(this, options); if (this[kID] === undefined) { - this.once('ready', fn); + this.once('ready', priorityFn); return; } - fn(); + priorityFn(); } // Called by this.destroy(). From cc91a00af6546ae290cba622d80c622fa7df2a66 Mon Sep 17 00:00:00 2001 From: Matthew Leon Date: Mon, 27 Nov 2017 15:33:36 -0500 Subject: [PATCH 220/379] doc: fix typo in stream.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17357 Reviewed-By: Vse Mozhet Byt Reviewed-By: Jon Moss Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- doc/api/stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index f8d9df9e6ac3ba..dec38202221b70 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2229,7 +2229,7 @@ object mode has an interesting side effect. Because it *is* a call to However, because the argument is an empty string, no data is added to the readable buffer so there is nothing for a user to consume. -### `highWaterMark` discrepency after calling `readable.setEncoding()` +### `highWaterMark` discrepancy after calling `readable.setEncoding()` The use of `readable.setEncoding()` will change the behavior of how the `highWaterMark` operates in non-object mode. @@ -2280,7 +2280,7 @@ contain multi-byte characters. [fs write streams]: fs.html#fs_class_fs_writestream [http-incoming-message]: http.html#http_class_http_incomingmessage [zlib]: zlib.html -[hwm-gotcha]: #stream_highwatermark_discrepency_after_calling_readable_setencoding +[hwm-gotcha]: #stream_highwatermark_discrepancy_after_calling_readable_setencoding [stream-_flush]: #stream_transform_flush_callback [stream-_read]: #stream_readable_read_size_1 [stream-_transform]: #stream_transform_transform_chunk_encoding_callback From f1b26be684c07096505cc4e4cc4f416d0a4a645d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 22 Nov 2017 14:02:19 -0800 Subject: [PATCH 221/379] test: remove common.tmpDirName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `common.tmpDirName` is used in only one test and can be replaced with `path.basename(common.tmpDir)`. PR-URL: https://github.com/nodejs/node/pull/17266 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Jeremiah Senkpiel Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: Gibson Fahnestock --- test/common/README.md | 5 ----- test/common/index.js | 6 +++--- test/parallel/test-fs-realpath.js | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index 54604568681612..e6371265d8b971 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -376,11 +376,6 @@ Synchronous version of `spawnPwd`. The realpath of the 'tmp' directory. -### tmpDirName -* return [<String>] - -Name of the temp directory used by tests. - ## Countdown Module The `Countdown` module provides a simple countdown mechanism for tests that diff --git a/test/common/index.js b/test/common/index.js index 838c7b60da21aa..56631aee8759dc 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -40,7 +40,7 @@ exports.fixturesDir = fixturesDir; // Using a `.` prefixed name, which is the convention for "hidden" on POSIX, // gets tools to ignore it by default or by simple rules, especially eslint. -exports.tmpDirName = '.tmp'; +let tmpDirName = '.tmp'; // PORT should match the definition in test/testpy/__init__.py. exports.PORT = +process.env.NODE_COMMON_PORT || 12346; exports.isWindows = process.platform === 'win32'; @@ -165,9 +165,9 @@ exports.refreshTmpDir = function() { if (process.env.TEST_THREAD_ID) { exports.PORT += process.env.TEST_THREAD_ID * 100; - exports.tmpDirName += `.${process.env.TEST_THREAD_ID}`; + tmpDirName += `.${process.env.TEST_THREAD_ID}`; } -exports.tmpDir = path.join(testRoot, exports.tmpDirName); +exports.tmpDir = path.join(testRoot, tmpDirName); let opensslCli = null; let inFreeBSDJail = null; diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 013e8015147d2f..4ea9bfdf48eb6f 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -111,7 +111,7 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) { const entry = `${tmpDir}/symlink`; const expected = `${tmpDir}/cycles/root.js`; [ - [entry, `../${common.tmpDirName}/cycles/root.js`] + [entry, `../${path.basename(tmpDir)}/cycles/root.js`] ].forEach(function(t) { try { fs.unlinkSync(t[0]); } catch (e) {} console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file'); From e0ce7cf1e9eb537e474b870e1e3306492b408845 Mon Sep 17 00:00:00 2001 From: Andreas Madsen Date: Mon, 20 Nov 2017 17:18:40 +0100 Subject: [PATCH 222/379] async_wrap: add provider types for net server Adds `TCPSERVERWRAP` and `PIPESERVERWRAP` as provider types. This makes it possible to distinguish servers from connections. Backport-PR-URL: https://github.com/nodejs/node/pull/17621 PR-URL: #17157 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- benchmark/net/tcp-raw-c2s.js | 6 +- benchmark/net/tcp-raw-pipe.js | 6 +- benchmark/net/tcp-raw-s2c.js | 6 +- doc/api/async_hooks.md | 12 +-- lib/_tls_wrap.js | 8 +- lib/child_process.js | 4 +- lib/internal/child_process.js | 6 +- lib/net.js | 32 ++++--- src/async_wrap.h | 2 + src/connection_wrap.cc | 4 +- src/pipe_wrap.cc | 48 +++++++++-- src/pipe_wrap.h | 11 ++- src/stream_wrap.cc | 2 +- src/tcp_wrap.cc | 41 +++++++-- src/tcp_wrap.h | 12 ++- src/udp_wrap.cc | 4 +- src/udp_wrap.h | 7 +- test/async-hooks/test-graph.pipeconnect.js | 10 +-- test/async-hooks/test-graph.shutdown.js | 12 +-- test/async-hooks/test-graph.tcp.js | 10 +-- test/async-hooks/test-graph.tls-write.js | 18 ++-- test/async-hooks/test-pipeconnectwrap.js | 44 +++++----- test/async-hooks/test-tcpwrap.js | 85 ++++++++++--------- test/common/index.js | 4 +- test/parallel/test-handle-wrap-isrefed.js | 4 +- test/parallel/test-net-connect-options-fd.js | 4 +- .../parallel/test-net-server-listen-handle.js | 8 +- test/parallel/test-process-wrap.js | 4 +- test/parallel/test-tcp-wrap-connect.js | 4 +- test/parallel/test-tcp-wrap-listen.js | 4 +- test/parallel/test-tcp-wrap.js | 4 +- test/sequential/test-async-wrap-getasyncid.js | 30 ++++--- 32 files changed, 288 insertions(+), 168 deletions(-) diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index 9b2e926d690504..bd41be87728308 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -36,7 +36,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -92,7 +92,7 @@ function client() { throw new Error(`invalid type: ${type}`); } - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 204b27b965a340..4dd06ed446d6c1 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -35,7 +35,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -89,7 +89,7 @@ function client() { throw new Error(`invalid type: ${type}`); } - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); var bytes = 0; diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index 412ded7355aa43..2ca6016ce017a1 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -35,7 +35,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -107,7 +107,7 @@ function server() { } function client() { - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 41352820816b3f..54bae4b1387088 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -236,7 +236,7 @@ resource's constructor. ```text FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, -SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPWRAP, TIMERWRAP, TTYWRAP, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVER, TCPWRAP, TIMERWRAP, TTYWRAP, UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject ``` @@ -275,13 +275,13 @@ require('net').createServer((conn) => {}).listen(8080); Output when hitting the server with `nc localhost 8080`: ```console -TCPWRAP(2): trigger: 1 execution: 1 +TCPSERVERWRAP(2): trigger: 1 execution: 1 TCPWRAP(4): trigger: 2 execution: 0 ``` -The first `TCPWRAP` is the server which receives the connections. +The `TCPSERVERWRAP` is the server which receives the connections. -The second `TCPWRAP` is the new connection from the client. When a new +The `TCPWRAP` is the new connection from the client. When a new connection is made the `TCPWrap` instance is immediately constructed. This happens outside of any JavaScript stack (side note: a `executionAsyncId()` of `0` means it's being executed from C++, with no JavaScript stack above it). @@ -354,7 +354,7 @@ require('net').createServer(() => {}).listen(8080, () => { Output from only starting the server: ```console -TCPWRAP(2): trigger: 1 execution: 1 +TCPSERVERWRAP(2): trigger: 1 execution: 1 TickObject(3): trigger: 2 execution: 1 before: 3 Timeout(4): trigger: 3 execution: 3 @@ -387,7 +387,7 @@ Only using `execution` to graph resource allocation results in the following: TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1) ``` -The `TCPWRAP` is not part of this graph, even though it was the reason for +The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for `console.log()` being called. This is because binding to a port without a hostname is a *synchronous* operation, but to maintain a completely asynchronous API the user's callback is placed in a `process.nextTick()`. diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 3e6f2b06423f44..d1764ce38d8d7c 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -34,8 +34,8 @@ const { Buffer } = require('buffer'); const debug = util.debuglog('tls'); const { Timer } = process.binding('timer_wrap'); const tls_wrap = process.binding('tls_wrap'); -const { TCP } = process.binding('tcp_wrap'); -const { Pipe } = process.binding('pipe_wrap'); +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); const errors = require('internal/errors'); const kConnectOptions = Symbol('connect-options'); const kDisableRenegotiation = Symbol('disable-renegotiation'); @@ -398,7 +398,9 @@ TLSSocket.prototype._wrapHandle = function(wrap) { var options = this._tlsOptions; if (!handle) { - handle = options.pipe ? new Pipe() : new TCP(); + handle = options.pipe ? + new Pipe(PipeConstants.SOCKET) : + new TCP(TCPConstants.SOCKET); handle.owner = this; } diff --git a/lib/child_process.js b/lib/child_process.js index b951caee10ce48..7b11d953d56559 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -28,7 +28,7 @@ const { createPromise, promiseResolve, promiseReject } = process.binding('util'); const debug = util.debuglog('child_process'); const { Buffer } = require('buffer'); -const { Pipe } = process.binding('pipe_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); const { errname } = process.binding('uv'); const child_process = require('internal/child_process'); const { @@ -103,7 +103,7 @@ exports.fork = function(modulePath /*, args, options*/) { exports._forkChild = function(fd) { // set process.send() - var p = new Pipe(true); + var p = new Pipe(PipeConstants.IPC); p.open(fd); p.unref(); const control = setupChannel(process, p); diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 2692d8554a8354..eb17ec21d406ba 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -10,7 +10,7 @@ const assert = require('assert'); const { Process } = process.binding('process_wrap'); const { WriteWrap } = process.binding('stream_wrap'); -const { Pipe } = process.binding('pipe_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); const { TTY } = process.binding('tty_wrap'); const { TCP } = process.binding('tcp_wrap'); const { UDP } = process.binding('udp_wrap'); @@ -863,7 +863,7 @@ function _validateStdio(stdio, sync) { }; if (!sync) - a.handle = new Pipe(); + a.handle = new Pipe(PipeConstants.SOCKET); acc.push(a); } else if (stdio === 'ipc') { @@ -876,7 +876,7 @@ function _validateStdio(stdio, sync) { throw new errors.Error('ERR_IPC_SYNC_FORK'); } - ipc = new Pipe(true); + ipc = new Pipe(PipeConstants.IPC); ipcFd = i; acc.push({ diff --git a/lib/net.js b/lib/net.js index 93b2279c7b167e..c3015f2954beef 100644 --- a/lib/net.js +++ b/lib/net.js @@ -37,8 +37,8 @@ const { const { Buffer } = require('buffer'); const TTYWrap = process.binding('tty_wrap'); -const { TCP } = process.binding('tcp_wrap'); -const { Pipe } = process.binding('pipe_wrap'); +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); const { TCPConnectWrap } = process.binding('tcp_wrap'); const { PipeConnectWrap } = process.binding('pipe_wrap'); const { ShutdownWrap, WriteWrap } = process.binding('stream_wrap'); @@ -57,10 +57,20 @@ const exceptionWithHostPort = util._exceptionWithHostPort; function noop() {} -function createHandle(fd) { +function createHandle(fd, is_server) { const type = TTYWrap.guessHandleType(fd); - if (type === 'PIPE') return new Pipe(); - if (type === 'TCP') return new TCP(); + if (type === 'PIPE') { + return new Pipe( + is_server ? PipeConstants.SERVER : PipeConstants.SOCKET + ); + } + + if (type === 'TCP') { + return new TCP( + is_server ? TCPConstants.SERVER : TCPConstants.SOCKET + ); + } + throw new errors.TypeError('ERR_INVALID_FD_TYPE', type); } @@ -200,7 +210,7 @@ function Socket(options) { this._handle = options.handle; // private this[async_id_symbol] = getNewAsyncId(this._handle); } else if (options.fd !== undefined) { - this._handle = createHandle(options.fd); + this._handle = createHandle(options.fd, false); this._handle.open(options.fd); this[async_id_symbol] = this._handle.getAsyncId(); // options.fd can be string (since it is user-defined), @@ -1009,7 +1019,9 @@ Socket.prototype.connect = function(...args) { debug('pipe', pipe, path); if (!this._handle) { - this._handle = pipe ? new Pipe() : new TCP(); + this._handle = pipe ? + new Pipe(PipeConstants.SOCKET) : + new TCP(TCPConstants.SOCKET); initSocketHandle(this); } @@ -1269,7 +1281,7 @@ function createServerHandle(address, port, addressType, fd) { var isTCP = false; if (typeof fd === 'number' && fd >= 0) { try { - handle = createHandle(fd); + handle = createHandle(fd, true); } catch (e) { // Not a fd we can listen on. This will trigger an error. debug('listen invalid fd=%d:', fd, e.message); @@ -1280,7 +1292,7 @@ function createServerHandle(address, port, addressType, fd) { handle.writable = true; assert(!address && !port); } else if (port === -1 && addressType === -1) { - handle = new Pipe(); + handle = new Pipe(PipeConstants.SERVER); if (process.platform === 'win32') { var instances = parseInt(process.env.NODE_PENDING_PIPE_INSTANCES); if (!isNaN(instances)) { @@ -1288,7 +1300,7 @@ function createServerHandle(address, port, addressType, fd) { } } } else { - handle = new TCP(); + handle = new TCP(TCPConstants.SERVER); isTCP = true; } diff --git a/src/async_wrap.h b/src/async_wrap.h index 98451ead3bc220..ec9e162ca79bc4 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -46,6 +46,7 @@ namespace node { V(HTTPPARSER) \ V(JSSTREAM) \ V(PIPECONNECTWRAP) \ + V(PIPESERVERWRAP) \ V(PIPEWRAP) \ V(PROCESSWRAP) \ V(PROMISE) \ @@ -54,6 +55,7 @@ namespace node { V(SIGNALWRAP) \ V(STATWATCHER) \ V(TCPCONNECTWRAP) \ + V(TCPSERVERWRAP) \ V(TCPWRAP) \ V(TIMERWRAP) \ V(TTYWRAP) \ diff --git a/src/connection_wrap.cc b/src/connection_wrap.cc index b620c387ff1cfc..d82e7195d76579 100644 --- a/src/connection_wrap.cc +++ b/src/connection_wrap.cc @@ -51,7 +51,9 @@ void ConnectionWrap::OnConnection(uv_stream_t* handle, if (status == 0) { env->set_init_trigger_async_id(wrap_data->get_async_id()); // Instantiate the client javascript object and handle. - Local client_obj = WrapType::Instantiate(env, wrap_data); + Local client_obj = WrapType::Instantiate(env, + wrap_data, + WrapType::SOCKET); // Unwrap the client javascript object. WrapType* wrap; diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 94510ed44bbc0a..5e061165e29bf8 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -40,6 +40,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Local; using v8::Object; using v8::String; @@ -48,14 +49,17 @@ using v8::Value; using AsyncHooks = Environment::AsyncHooks; -Local PipeWrap::Instantiate(Environment* env, AsyncWrap* parent) { +Local PipeWrap::Instantiate(Environment* env, + AsyncWrap* parent, + PipeWrap::SocketType type) { EscapableHandleScope handle_scope(env->isolate()); AsyncHooks::InitScope init_scope(env, parent->get_async_id()); CHECK_EQ(false, env->pipe_constructor_template().IsEmpty()); Local constructor = env->pipe_constructor_template()->GetFunction(); CHECK_EQ(false, constructor.IsEmpty()); + Local type_value = Int32::New(env->isolate(), type); Local instance = - constructor->NewInstance(env->context()).ToLocalChecked(); + constructor->NewInstance(env->context(), 1, &type_value).ToLocalChecked(); return handle_scope.Escape(instance); } @@ -107,6 +111,15 @@ void PipeWrap::Initialize(Local target, FIXED_ONE_BYTE_STRING(env->isolate(), "PipeConnectWrap"); cwt->SetClassName(wrapString); target->Set(wrapString, cwt->GetFunction()); + + // Define constants + Local constants = Object::New(env->isolate()); + NODE_DEFINE_CONSTANT(constants, SOCKET); + NODE_DEFINE_CONSTANT(constants, SERVER); + NODE_DEFINE_CONSTANT(constants, IPC); + target->Set(context, + FIXED_ONE_BYTE_STRING(env->isolate(), "constants"), + constants).FromJust(); } @@ -115,17 +128,40 @@ void PipeWrap::New(const FunctionCallbackInfo& args) { // Therefore we assert that we are not trying to call this as a // normal function. CHECK(args.IsConstructCall()); + CHECK(args[0]->IsInt32()); Environment* env = Environment::GetCurrent(args); - new PipeWrap(env, args.This(), args[0]->IsTrue()); + + int type_value = args[0].As()->Value(); + PipeWrap::SocketType type = static_cast(type_value); + + bool ipc; + ProviderType provider; + switch (type) { + case SOCKET: + provider = PROVIDER_PIPEWRAP; + ipc = false; + break; + case SERVER: + provider = PROVIDER_PIPESERVERWRAP; + ipc = false; + break; + case IPC: + provider = PROVIDER_PIPEWRAP; + ipc = true; + break; + default: + UNREACHABLE(); + } + + new PipeWrap(env, args.This(), provider, ipc); } PipeWrap::PipeWrap(Environment* env, Local object, + ProviderType provider, bool ipc) - : ConnectionWrap(env, - object, - AsyncWrap::PROVIDER_PIPEWRAP) { + : ConnectionWrap(env, object, provider) { int r = uv_pipe_init(env->event_loop(), &handle_, ipc); CHECK_EQ(r, 0); // How do we proxy this error up to javascript? // Suggestion: uv_pipe_init() returns void. diff --git a/src/pipe_wrap.h b/src/pipe_wrap.h index 6f22038b918f76..5a611c0f94b639 100644 --- a/src/pipe_wrap.h +++ b/src/pipe_wrap.h @@ -32,7 +32,15 @@ namespace node { class PipeWrap : public ConnectionWrap { public: - static v8::Local Instantiate(Environment* env, AsyncWrap* parent); + enum SocketType { + SOCKET, + SERVER, + IPC + }; + + static v8::Local Instantiate(Environment* env, + AsyncWrap* parent, + SocketType type); static void Initialize(v8::Local target, v8::Local unused, v8::Local context); @@ -42,6 +50,7 @@ class PipeWrap : public ConnectionWrap { private: PipeWrap(Environment* env, v8::Local object, + ProviderType provider, bool ipc); static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 43f8494f9d7241..1bd1d1d6390442 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -187,7 +187,7 @@ static Local AcceptHandle(Environment* env, LibuvStreamWrap* parent) { Local wrap_obj; UVType* handle; - wrap_obj = WrapType::Instantiate(env, parent); + wrap_obj = WrapType::Instantiate(env, parent, WrapType::SOCKET); if (wrap_obj.IsEmpty()) return Local(); diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index ce86108cb0acbb..7cb5d4735b9d40 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -42,6 +42,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Local; using v8::Object; @@ -51,14 +52,17 @@ using v8::Value; using AsyncHooks = Environment::AsyncHooks; -Local TCPWrap::Instantiate(Environment* env, AsyncWrap* parent) { +Local TCPWrap::Instantiate(Environment* env, + AsyncWrap* parent, + TCPWrap::SocketType type) { EscapableHandleScope handle_scope(env->isolate()); AsyncHooks::InitScope init_scope(env, parent->get_async_id()); CHECK_EQ(env->tcp_constructor_template().IsEmpty(), false); Local constructor = env->tcp_constructor_template()->GetFunction(); CHECK_EQ(constructor.IsEmpty(), false); + Local type_value = Int32::New(env->isolate(), type); Local instance = - constructor->NewInstance(env->context()).ToLocalChecked(); + constructor->NewInstance(env->context(), 1, &type_value).ToLocalChecked(); return handle_scope.Escape(instance); } @@ -122,6 +126,14 @@ void TCPWrap::Initialize(Local target, FIXED_ONE_BYTE_STRING(env->isolate(), "TCPConnectWrap"); cwt->SetClassName(wrapString); target->Set(wrapString, cwt->GetFunction()); + + // Define constants + Local constants = Object::New(env->isolate()); + NODE_DEFINE_CONSTANT(constants, SOCKET); + NODE_DEFINE_CONSTANT(constants, SERVER); + target->Set(context, + FIXED_ONE_BYTE_STRING(env->isolate(), "constants"), + constants).FromJust(); } @@ -130,15 +142,30 @@ void TCPWrap::New(const FunctionCallbackInfo& args) { // Therefore we assert that we are not trying to call this as a // normal function. CHECK(args.IsConstructCall()); + CHECK(args[0]->IsInt32()); Environment* env = Environment::GetCurrent(args); - new TCPWrap(env, args.This()); + + int type_value = args[0].As()->Value(); + TCPWrap::SocketType type = static_cast(type_value); + + ProviderType provider; + switch (type) { + case SOCKET: + provider = PROVIDER_TCPWRAP; + break; + case SERVER: + provider = PROVIDER_TCPSERVERWRAP; + break; + default: + UNREACHABLE(); + } + + new TCPWrap(env, args.This(), provider); } -TCPWrap::TCPWrap(Environment* env, Local object) - : ConnectionWrap(env, - object, - AsyncWrap::PROVIDER_TCPWRAP) { +TCPWrap::TCPWrap(Environment* env, Local object, ProviderType provider) + : ConnectionWrap(env, object, provider) { int r = uv_tcp_init(env->event_loop(), &handle_); CHECK_EQ(r, 0); // How do we proxy this error up to javascript? // Suggestion: uv_tcp_init() returns void. diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index fa6bac01386256..a7f6b1901981f6 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -32,7 +32,14 @@ namespace node { class TCPWrap : public ConnectionWrap { public: - static v8::Local Instantiate(Environment* env, AsyncWrap* parent); + enum SocketType { + SOCKET, + SERVER + }; + + static v8::Local Instantiate(Environment* env, + AsyncWrap* parent, + SocketType type); static void Initialize(v8::Local target, v8::Local unused, v8::Local context); @@ -46,7 +53,8 @@ class TCPWrap : public ConnectionWrap { int (*F)(const typename T::HandleType*, sockaddr*, int*)> friend void GetSockOrPeerName(const v8::FunctionCallbackInfo&); - TCPWrap(Environment* env, v8::Local object); + TCPWrap(Environment* env, v8::Local object, + ProviderType provider); ~TCPWrap(); static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 87afdc4a4cec43..6349b0bdc330e9 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -492,7 +492,9 @@ void UDPWrap::OnRecv(uv_udp_t* handle, } -Local UDPWrap::Instantiate(Environment* env, AsyncWrap* parent) { +Local UDPWrap::Instantiate(Environment* env, + AsyncWrap* parent, + UDPWrap::SocketType type) { EscapableHandleScope scope(env->isolate()); AsyncHooks::InitScope init_scope(env, parent->get_async_id()); // If this assert fires then Initialize hasn't been called yet. diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 254ae76131252c..7f0cc96d34d9bd 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -35,6 +35,9 @@ namespace node { class UDPWrap: public HandleWrap { public: + enum SocketType { + SOCKET + }; static void Initialize(v8::Local target, v8::Local unused, v8::Local context); @@ -58,7 +61,9 @@ class UDPWrap: public HandleWrap { static void SetTTL(const v8::FunctionCallbackInfo& args); static void BufferSize(const v8::FunctionCallbackInfo& args); - static v8::Local Instantiate(Environment* env, AsyncWrap* parent); + static v8::Local Instantiate(Environment* env, + AsyncWrap* parent, + SocketType type); uv_udp_t* UVHandle(); size_t self_size() const override { return sizeof(*this); } diff --git a/test/async-hooks/test-graph.pipeconnect.js b/test/async-hooks/test-graph.pipeconnect.js index a3486521d5a7ea..b3ea5c6e4219e9 100644 --- a/test/async-hooks/test-graph.pipeconnect.js +++ b/test/async-hooks/test-graph.pipeconnect.js @@ -28,11 +28,11 @@ function onexit() { hooks.disable(); verifyGraph( hooks, - [ { type: 'PIPEWRAP', id: 'pipe:1', triggerAsyncId: null }, - { type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: 'pipe:1' }, + [ { type: 'PIPESERVERWRAP', id: 'pipeserver:1', triggerAsyncId: null }, + { type: 'PIPEWRAP', id: 'pipe:1', triggerAsyncId: 'pipeserver:1' }, { type: 'PIPECONNECTWRAP', id: 'pipeconnect:1', - triggerAsyncId: 'pipe:2' }, - { type: 'PIPEWRAP', id: 'pipe:3', triggerAsyncId: 'pipe:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:3' } ] + triggerAsyncId: 'pipe:1' }, + { type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: 'pipeserver:1' }, + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:2' } ] ); } diff --git a/test/async-hooks/test-graph.shutdown.js b/test/async-hooks/test-graph.shutdown.js index 136f01821217c1..f4f077c0dd1c83 100644 --- a/test/async-hooks/test-graph.shutdown.js +++ b/test/async-hooks/test-graph.shutdown.js @@ -34,13 +34,13 @@ function onexit() { hooks.disable(); verifyGraph( hooks, - [ { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: null }, - { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcp:1' }, + [ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null }, + { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: 'tcpserver:1' }, { type: 'GETADDRINFOREQWRAP', - id: 'getaddrinforeq:1', triggerAsyncId: 'tcp:2' }, + id: 'getaddrinforeq:1', triggerAsyncId: 'tcp:1' }, { type: 'TCPCONNECTWRAP', - id: 'tcpconnect:1', triggerAsyncId: 'tcp:2' }, - { type: 'TCPWRAP', id: 'tcp:3', triggerAsyncId: 'tcp:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:3' } ] + id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, + { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] ); } diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index 2e0b387cbeaff4..c2458ef1def769 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -38,11 +38,11 @@ function onexit() { verifyGraph( hooks, - [ { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: null }, - { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: null }, + [ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null }, + { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: null }, { type: 'TCPCONNECTWRAP', - id: 'tcpconnect:1', triggerAsyncId: 'tcp:2' }, - { type: 'TCPWRAP', id: 'tcp:3', triggerAsyncId: 'tcp:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:3' } ] + id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, + { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] ); } diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index 4ba264c808392e..0c725d153d731b 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -55,21 +55,21 @@ function onexit() { verifyGraph( hooks, - [ { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: null }, - { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcp:1' }, - { type: 'TLSWRAP', id: 'tls:1', triggerAsyncId: 'tcp:1' }, + [ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null }, + { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: 'tcpserver:1' }, + { type: 'TLSWRAP', id: 'tls:1', triggerAsyncId: 'tcpserver:1' }, { type: 'GETADDRINFOREQWRAP', id: 'getaddrinforeq:1', triggerAsyncId: 'tls:1' }, { type: 'TCPCONNECTWRAP', - id: 'tcpconnect:1', triggerAsyncId: 'tcp:2' }, + id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, { type: 'WRITEWRAP', id: 'write:1', triggerAsyncId: 'tcpconnect:1' }, - { type: 'TCPWRAP', id: 'tcp:3', triggerAsyncId: 'tcp:1' }, - { type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcp:1' }, - { type: 'TIMERWRAP', id: 'timer:1', triggerAsyncId: 'tcp:1' }, + { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, + { type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' }, + { type: 'TIMERWRAP', id: 'timer:1', triggerAsyncId: 'tcpserver:1' }, { type: 'WRITEWRAP', id: 'write:2', triggerAsyncId: null }, { type: 'WRITEWRAP', id: 'write:3', triggerAsyncId: null }, { type: 'WRITEWRAP', id: 'write:4', triggerAsyncId: null }, - { type: 'Immediate', id: 'immediate:1', triggerAsyncId: 'tcp:2' }, - { type: 'Immediate', id: 'immediate:2', triggerAsyncId: 'tcp:3' } ] + { type: 'Immediate', id: 'immediate:1', triggerAsyncId: 'tcp:1' }, + { type: 'Immediate', id: 'immediate:2', triggerAsyncId: 'tcp:2' } ] ); } diff --git a/test/async-hooks/test-pipeconnectwrap.js b/test/async-hooks/test-pipeconnectwrap.js index bcab601d05952f..81a5abd42a3004 100644 --- a/test/async-hooks/test-pipeconnectwrap.js +++ b/test/async-hooks/test-pipeconnectwrap.js @@ -12,7 +12,8 @@ common.refreshTmpDir(); const hooks = initHooks(); hooks.enable(); -let pipe1, pipe2, pipe3; +let pipe1, pipe2; +let pipeserver; let pipeconnect; net.createServer(common.mustCall(function(c) { @@ -22,27 +23,27 @@ net.createServer(common.mustCall(function(c) { })).listen(common.PIPE, common.mustCall(onlisten)); function onlisten() { - let pipes = hooks.activitiesOfTypes('PIPEWRAP'); + const pipeservers = hooks.activitiesOfTypes('PIPESERVERWRAP'); let pipeconnects = hooks.activitiesOfTypes('PIPECONNECTWRAP'); - assert.strictEqual(pipes.length, 1); + assert.strictEqual(pipeservers.length, 1); assert.strictEqual(pipeconnects.length, 0); net.connect(common.PIPE, common.mustCall(maybeOnconnect.bind(null, 'client'))); - pipes = hooks.activitiesOfTypes('PIPEWRAP'); + const pipes = hooks.activitiesOfTypes('PIPEWRAP'); pipeconnects = hooks.activitiesOfTypes('PIPECONNECTWRAP'); - assert.strictEqual(pipes.length, 2); + assert.strictEqual(pipes.length, 1); assert.strictEqual(pipeconnects.length, 1); + pipeserver = pipeservers[0]; pipe1 = pipes[0]; - pipe2 = pipes[1]; pipeconnect = pipeconnects[0]; + assert.strictEqual(pipeserver.type, 'PIPESERVERWRAP'); assert.strictEqual(pipe1.type, 'PIPEWRAP'); - assert.strictEqual(pipe2.type, 'PIPEWRAP'); assert.strictEqual(pipeconnect.type, 'PIPECONNECTWRAP'); - for (const a of [ pipe1, pipe2, pipeconnect ]) { + for (const a of [ pipeserver, pipe1, pipeconnect ]) { assert.strictEqual(typeof a.uid, 'number'); assert.strictEqual(typeof a.triggerAsyncId, 'number'); checkInvocations(a, { init: 1 }, 'after net.connect'); @@ -60,18 +61,18 @@ function maybeOnconnect(source) { const pipes = hooks.activitiesOfTypes('PIPEWRAP'); const pipeconnects = hooks.activitiesOfTypes('PIPECONNECTWRAP'); - assert.strictEqual(pipes.length, 3); + assert.strictEqual(pipes.length, 2); assert.strictEqual(pipeconnects.length, 1); - pipe3 = pipes[2]; - assert.strictEqual(typeof pipe3.uid, 'number'); - assert.strictEqual(typeof pipe3.triggerAsyncId, 'number'); + pipe2 = pipes[1]; + assert.strictEqual(typeof pipe2.uid, 'number'); + assert.strictEqual(typeof pipe2.triggerAsyncId, 'number'); - checkInvocations(pipe1, { init: 1, before: 1, after: 1 }, - 'pipe1, client connected'); - checkInvocations(pipe2, { init: 1 }, 'pipe2, client connected'); + checkInvocations(pipeserver, { init: 1, before: 1, after: 1 }, + 'pipeserver, client connected'); + checkInvocations(pipe1, { init: 1 }, 'pipe1, client connected'); checkInvocations(pipeconnect, { init: 1, before: 1 }, 'pipeconnect, client connected'); - checkInvocations(pipe3, { init: 1 }, 'pipe3, client connected'); + checkInvocations(pipe2, { init: 1 }, 'pipe2, client connected'); tick(5); } @@ -80,14 +81,15 @@ process.on('exit', onexit); function onexit() { hooks.disable(); hooks.sanityCheck('PIPEWRAP'); + hooks.sanityCheck('PIPESERVERWRAP'); hooks.sanityCheck('PIPECONNECTWRAP'); // TODO(thlorenz) why have some of those 'before' and 'after' called twice - checkInvocations(pipe1, { init: 1, before: 1, after: 1, destroy: 1 }, + checkInvocations(pipeserver, { init: 1, before: 1, after: 1, destroy: 1 }, + 'pipeserver, process exiting'); + checkInvocations(pipe1, { init: 1, before: 2, after: 2, destroy: 1 }, 'pipe1, process exiting'); - checkInvocations(pipe2, { init: 1, before: 2, after: 2, destroy: 1 }, - 'pipe2, process exiting'); checkInvocations(pipeconnect, { init: 1, before: 1, after: 1, destroy: 1 }, 'pipeconnect, process exiting'); - checkInvocations(pipe3, { init: 1, before: 2, after: 2, destroy: 1 }, - 'pipe3, process exiting'); + checkInvocations(pipe2, { init: 1, before: 2, after: 2, destroy: 1 }, + 'pipe2, process exiting'); } diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index 1f4fc6af0d6b5f..e7d879caf70551 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -11,7 +11,8 @@ const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); const net = require('net'); -let tcp1, tcp2, tcp3; +let tcp1, tcp2; +let tcpserver; let tcpconnect; const hooks = initHooks(); @@ -24,15 +25,15 @@ const server = net // Calling server.listen creates a TCPWRAP synchronously { server.listen(common.PORT); - const tcps = hooks.activitiesOfTypes('TCPWRAP'); + const tcpsservers = hooks.activitiesOfTypes('TCPSERVERWRAP'); const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); - assert.strictEqual(tcps.length, 1); + assert.strictEqual(tcpsservers.length, 1); assert.strictEqual(tcpconnects.length, 0); - tcp1 = tcps[0]; - assert.strictEqual(tcp1.type, 'TCPWRAP'); - assert.strictEqual(typeof tcp1.uid, 'number'); - assert.strictEqual(typeof tcp1.triggerAsyncId, 'number'); - checkInvocations(tcp1, { init: 1 }, 'when calling server.listen'); + tcpserver = tcpsservers[0]; + assert.strictEqual(tcpserver.type, 'TCPSERVERWRAP'); + assert.strictEqual(typeof tcpserver.uid, 'number'); + assert.strictEqual(typeof tcpserver.triggerAsyncId, 'number'); + checkInvocations(tcpserver, { init: 1 }, 'when calling server.listen'); } // Calling net.connect creates another TCPWRAP synchronously @@ -41,24 +42,25 @@ const server = net { port: server.address().port, host: '::1' }, common.mustCall(onconnected)); const tcps = hooks.activitiesOfTypes('TCPWRAP'); - assert.strictEqual(tcps.length, 2); + assert.strictEqual(tcps.length, 1); process.nextTick(() => { const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); assert.strictEqual(tcpconnects.length, 1); }); - tcp2 = tcps[1]; - assert.strictEqual(tcps.length, 2); - assert.strictEqual(tcp2.type, 'TCPWRAP'); - assert.strictEqual(typeof tcp2.uid, 'number'); - assert.strictEqual(typeof tcp2.triggerAsyncId, 'number'); + tcp1 = tcps[0]; + assert.strictEqual(tcps.length, 1); + assert.strictEqual(tcp1.type, 'TCPWRAP'); + assert.strictEqual(typeof tcp1.uid, 'number'); + assert.strictEqual(typeof tcp1.triggerAsyncId, 'number'); + checkInvocations(tcpserver, { init: 1 }, + 'tcpserver when client is connecting'); checkInvocations(tcp1, { init: 1 }, 'tcp1 when client is connecting'); - checkInvocations(tcp2, { init: 1 }, 'tcp2 when client is connecting'); } function onlistening() { - assert.strictEqual(hooks.activitiesOfTypes('TCPWRAP').length, 2); + assert.strictEqual(hooks.activitiesOfTypes('TCPWRAP').length, 1); } // Depending on timing we see client: onconnected or server: onconnection first @@ -99,8 +101,8 @@ function onconnected() { const expected = serverConnected ? { init: 1, before: 1, after: 1 } : { init: 1 }; - checkInvocations(tcp1, expected, 'tcp1 when client connects'); - checkInvocations(tcp2, { init: 1 }, 'tcp2 when client connects'); + checkInvocations(tcpserver, expected, 'tcpserver when client connects'); + checkInvocations(tcp1, { init: 1 }, 'tcp1 when client connects'); } function onconnection(c) { @@ -109,32 +111,35 @@ function onconnection(c) { const tcps = hooks.activitiesOfTypes([ 'TCPWRAP' ]); const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); - assert.strictEqual(tcps.length, 3); + assert.strictEqual(tcps.length, 2); assert.strictEqual(tcpconnects.length, 1); - tcp3 = tcps[2]; - assert.strictEqual(tcp3.type, 'TCPWRAP'); - assert.strictEqual(typeof tcp3.uid, 'number'); - assert.strictEqual(typeof tcp3.triggerAsyncId, 'number'); + tcp2 = tcps[1]; + assert.strictEqual(tcp2.type, 'TCPWRAP'); + assert.strictEqual(typeof tcp2.uid, 'number'); + assert.strictEqual(typeof tcp2.triggerAsyncId, 'number'); - checkInvocations(tcp1, { init: 1, before: 1 }, - 'tcp1 when server receives connection'); + checkInvocations(tcpserver, { init: 1, before: 1 }, + 'tcpserver when server receives connection'); + checkInvocations(tcp1, { init: 1 }, 'tcp1 when server receives connection'); checkInvocations(tcp2, { init: 1 }, 'tcp2 when server receives connection'); - checkInvocations(tcp3, { init: 1 }, 'tcp3 when server receives connection'); c.end(); this.close(common.mustCall(onserverClosed)); } function onserverClosed() { - checkInvocations(tcp1, { init: 1, before: 1, after: 1, destroy: 1 }, - 'tcp1 when server is closed'); - checkInvocations(tcp2, { init: 1, before: 2, after: 2, destroy: 1 }, - 'tcp2 when server is closed'); - checkInvocations(tcp3, { init: 1, before: 1, after: 1 }, - 'tcp3 synchronously when server is closed'); + checkInvocations(tcpserver, { init: 1, before: 1, after: 1, destroy: 1 }, + 'tcpserver when server is closed'); + setImmediate(() => { + checkInvocations(tcp1, { init: 1, before: 2, after: 2, destroy: 1 }, + 'tcp1 after server is closed'); + }); + checkInvocations(tcp2, { init: 1, before: 1, after: 1 }, + 'tcp2 synchronously when server is closed'); + tick(2, () => { - checkInvocations(tcp3, { init: 1, before: 2, after: 2, destroy: 1 }, - 'tcp3 when server is closed'); + checkInvocations(tcp2, { init: 1, before: 2, after: 2, destroy: 1 }, + 'tcp2 when server is closed'); checkInvocations(tcpconnect, { init: 1, before: 1, after: 1, destroy: 1 }, 'tcpconnect when server is closed'); }); @@ -144,16 +149,16 @@ process.on('exit', onexit); function onexit() { hooks.disable(); - hooks.sanityCheck([ 'TCPWRAP', 'TCPCONNECTWRAP' ]); + hooks.sanityCheck([ 'TCPWRAP', 'TCPSERVERWRAP', 'TCPCONNECTWRAP' ]); - checkInvocations(tcp1, { init: 1, before: 1, after: 1, destroy: 1 }, - 'tcp1 when process exits'); + checkInvocations(tcpserver, { init: 1, before: 1, after: 1, destroy: 1 }, + 'tcpserver when process exits'); + checkInvocations( + tcp1, { init: 1, before: 2, after: 2, destroy: 1 }, + 'tcp1 when process exits'); checkInvocations( tcp2, { init: 1, before: 2, after: 2, destroy: 1 }, 'tcp2 when process exits'); - checkInvocations( - tcp3, { init: 1, before: 2, after: 2, destroy: 1 }, - 'tcp3 when process exits'); checkInvocations( tcpconnect, { init: 1, before: 1, after: 1, destroy: 1 }, 'tcpconnect when process exits'); diff --git a/test/common/index.js b/test/common/index.js index 56631aee8759dc..fc3a055c1bca0d 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -524,8 +524,8 @@ function _mustCallInner(fn, criteria = 1, field) { } exports.hasMultiLocalhost = function hasMultiLocalhost() { - const TCP = process.binding('tcp_wrap').TCP; - const t = new TCP(); + const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); + const t = new TCP(TCPConstants.SOCKET); const ret = t.bind('127.0.0.2', exports.PORT); t.close(); return ret === 0; diff --git a/test/parallel/test-handle-wrap-isrefed.js b/test/parallel/test-handle-wrap-isrefed.js index b4fccc0529c2fb..e1301b57f6baeb 100644 --- a/test/parallel/test-handle-wrap-isrefed.js +++ b/test/parallel/test-handle-wrap-isrefed.js @@ -66,8 +66,8 @@ const dgram = require('dgram'); // pipe { - const Pipe = process.binding('pipe_wrap').Pipe; - const handle = new Pipe(); + const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); + const handle = new Pipe(PipeConstants.SOCKET); strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'), true, 'pipe_wrap: hasRef() missing'); strictEqual(handle.hasRef(), diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index e0872cf7c5df3f..1ffc92257ced31 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -6,7 +6,7 @@ if (common.isWindows) const assert = require('assert'); const net = require('net'); const path = require('path'); -const Pipe = process.binding('pipe_wrap').Pipe; +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); common.refreshTmpDir(); @@ -71,7 +71,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); }) .listen({ path: serverPath }, common.mustCall(function serverOnListen() { const getSocketOpt = (index) => { - const handle = new Pipe(); + const handle = new Pipe(PipeConstants.SOCKET); const err = handle.bind(`${prefix}-client-${socketCounter++}`); assert(err >= 0, String(err)); assert.notStrictEqual(handle.fd, -1); diff --git a/test/parallel/test-net-server-listen-handle.js b/test/parallel/test-net-server-listen-handle.js index db8e639f94885f..de1f1ca375d98e 100644 --- a/test/parallel/test-net-server-listen-handle.js +++ b/test/parallel/test-net-server-listen-handle.js @@ -5,8 +5,8 @@ const assert = require('assert'); const net = require('net'); const fs = require('fs'); const uv = process.binding('uv'); -const TCP = process.binding('tcp_wrap').TCP; -const Pipe = process.binding('pipe_wrap').Pipe; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); common.refreshTmpDir(); @@ -36,12 +36,12 @@ function randomPipePath() { function randomHandle(type) { let handle, errno, handleName; if (type === 'tcp') { - handle = new TCP(); + handle = new TCP(TCPConstants.SOCKET); errno = handle.bind('0.0.0.0', 0); handleName = 'arbitrary tcp port'; } else { const path = randomPipePath(); - handle = new Pipe(); + handle = new Pipe(PipeConstants.SOCKET); errno = handle.bind(path); handleName = `pipe ${path}`; } diff --git a/test/parallel/test-process-wrap.js b/test/parallel/test-process-wrap.js index 5601328eef3585..b3cca47c463c19 100644 --- a/test/parallel/test-process-wrap.js +++ b/test/parallel/test-process-wrap.js @@ -23,8 +23,8 @@ require('../common'); const assert = require('assert'); const Process = process.binding('process_wrap').Process; -const Pipe = process.binding('pipe_wrap').Pipe; -const pipe = new Pipe(); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); +const pipe = new Pipe(PipeConstants.SOCKET); const p = new Process(); let processExited = false; diff --git a/test/parallel/test-tcp-wrap-connect.js b/test/parallel/test-tcp-wrap-connect.js index 77f9814db2ebe5..c2746bca64d198 100644 --- a/test/parallel/test-tcp-wrap-connect.js +++ b/test/parallel/test-tcp-wrap-connect.js @@ -1,12 +1,12 @@ 'use strict'; require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const ShutdownWrap = process.binding('stream_wrap').ShutdownWrap; function makeConnection() { - const client = new TCP(); + const client = new TCP(TCPConstants.SOCKET); const req = new TCPConnectWrap(); const err = client.connect(req, '127.0.0.1', this.address().port); diff --git a/test/parallel/test-tcp-wrap-listen.js b/test/parallel/test-tcp-wrap-listen.js index 7502969c967f86..8203a4771b861f 100644 --- a/test/parallel/test-tcp-wrap-listen.js +++ b/test/parallel/test-tcp-wrap-listen.js @@ -2,10 +2,10 @@ const common = require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const WriteWrap = process.binding('stream_wrap').WriteWrap; -const server = new TCP(); +const server = new TCP(TCPConstants.SOCKET); const r = server.bind('0.0.0.0', 0); assert.strictEqual(0, r); diff --git a/test/parallel/test-tcp-wrap.js b/test/parallel/test-tcp-wrap.js index 96ddd5bfd31ffa..36a45d7606b125 100644 --- a/test/parallel/test-tcp-wrap.js +++ b/test/parallel/test-tcp-wrap.js @@ -23,10 +23,10 @@ require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const uv = process.binding('uv'); -const handle = new TCP(); +const handle = new TCP(TCPConstants.SOCKET); // Should be able to bind to the port let err = handle.bind('0.0.0.0', 0); diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index d6a7085d8907d2..bd2b3254f06594 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -138,19 +138,27 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check testInitialized(new Gzip()._handle, 'Zlib'); } - { const binding = process.binding('pipe_wrap'); - const handle = new binding.Pipe(); + const handle = new binding.Pipe(binding.constants.IPC); testInitialized(handle, 'Pipe'); - const req = new binding.PipeConnectWrap(); - testUninitialized(req, 'PipeConnectWrap'); - req.address = common.PIPE; - req.oncomplete = common.mustCall(() => handle.close()); - handle.connect(req, req.address, req.oncomplete); - testInitialized(req, 'PipeConnectWrap'); } +{ + const server = net.createServer(common.mustCall((socket) => { + server.close(); + })).listen(common.PIPE, common.mustCall(() => { + const binding = process.binding('pipe_wrap'); + const handle = new binding.Pipe(binding.constants.SOCKET); + testInitialized(handle, 'Pipe'); + const req = new binding.PipeConnectWrap(); + testUninitialized(req, 'PipeConnectWrap'); + req.address = common.PIPE; + req.oncomplete = common.mustCall(() => handle.close()); + handle.connect(req, req.address, req.oncomplete); + testInitialized(req, 'PipeConnectWrap'); + })); +} { const Process = process.binding('process_wrap').Process; @@ -179,7 +187,7 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check }); socket.resume(); })).listen(0, common.localhostIPv4, common.mustCall(() => { - const handle = new tcp_wrap.TCP(); + const handle = new tcp_wrap.TCP(tcp_wrap.constants.SOCKET); const req = new tcp_wrap.TCPConnectWrap(); const sreq = new stream_wrap.ShutdownWrap(); const wreq = new stream_wrap.WriteWrap(); @@ -221,8 +229,8 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check if (common.hasCrypto) { // eslint-disable-line crypto-check - const TCP = process.binding('tcp_wrap').TCP; - const tcp = new TCP(); + const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); + const tcp = new TCP(TCPConstants.SOCKET); const ca = fixtures.readSync('test_ca.pem', 'ascii'); const cert = fixtures.readSync('test_cert.pem', 'ascii'); From dcd87acb7b237a8957224ea9399e94cf740b4a7a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Nov 2017 10:10:37 -0800 Subject: [PATCH 223/379] doc: make error descriptions more concise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the practice of starting most error descriptions with "Used when" or wordier variations. Change errors of the form: > Used when the type of an asynchronous resource is invalid. ...to: > The type of an asynchronous resource was invalid. Change errors of the form: > The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on > a given stream is attempted to move to a specified row without a > specified column. ...to: > A cursor on a given stream cannot be moved to a specified row without > a specified column. Backport-PR-URL: https://github.com/nodejs/node/pull/17622 PR-URL: https://github.com/nodejs/node/pull/16954 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tobias Nießen Reviewed-By: Joyee Cheung --- doc/api/errors.md | 443 ++++++++++++++++++++++------------------------ 1 file changed, 209 insertions(+), 234 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 3455d03e68793e..eca54b337ce72a 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -582,88 +582,89 @@ found [here][online]. ### ERR_ARG_NOT_ITERABLE -Used generically to identify that an iterable argument (i.e. a value that works -with `for...of` loops) is required, but not provided to a Node.js API. +An iterable argument (i.e. a value that works with `for...of` loops) was +required, but not provided to a Node.js API. ### ERR_ASSERTION -Used as special type of error that can be triggered whenever Node.js detects an +A special type of error that can be triggered whenever Node.js detects an exceptional logic violation that should never occur. These are raised typically by the `assert` module. ### ERR_ASYNC_CALLBACK -Used with `AsyncHooks` to indicate an attempt of registering something that is -not a function as a callback. +An attempt was made to register something that is not a function as an +`AsyncHooks` callback. ### ERR_ASYNC_TYPE -Used when the type of an asynchronous resource is invalid. Note that users are -also able to define their own types when using the public embedder API. +The type of an asynchronous resource was invalid. Note that users are also able +to define their own types if using the public embedder API. ### ERR_BUFFER_OUT_OF_BOUNDS -Used when attempting to perform an operation outside the bounds of a `Buffer`. +An operation outside the bounds of a `Buffer` was attempted. ### ERR_BUFFER_TOO_LARGE -Used when an attempt has been made to create a `Buffer` larger than the -maximum allowed size. +An attempt has been made to create a `Buffer` larger than the maximum allowed +size. ### ERR_CHILD_CLOSED_BEFORE_REPLY -Used when a child process is closed before the parent received a reply. +A child process was closed before the parent received a reply. ### ERR_CONSOLE_WRITABLE_STREAM -Used when `Console` is instantiated without `stdout` stream or when `stdout` or -`stderr` streams are not writable. +`Console` was instantiated without `stdout` stream, or `Console` has a +non-writable `stdout` or `stderr` stream. ### ERR_CPU_USAGE -Used when the native call from `process.cpuUsage` cannot be processed properly. +The native call from `process.cpuUsage` could not be processed. ### ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED -Used when a client certificate engine is requested that is not supported by the -version of OpenSSL being used. +A client certificate engine was requested that is not supported by the version +of OpenSSL being used. ### ERR_CRYPTO_ECDH_INVALID_FORMAT -Used when an invalid value for the `format` argument has been passed to the -`crypto.ECDH()` class `getPublicKey()` method. +An invalid value for the `format` argument was passed to the `crypto.ECDH()` +class `getPublicKey()` method. ### ERR_CRYPTO_ENGINE_UNKNOWN -Used when an invalid crypto engine identifier is passed to +An invalid crypto engine identifier was passed to [`require('crypto').setEngine()`][]. ### ERR_CRYPTO_FIPS_FORCED -Used when trying to enable or disable FIPS mode in the crypto module and -the [`--force-fips`][] command-line argument is used. +The [`--force-fips`][] command-line argument was used but there was an attempt +to enable or disable FIPS mode in the `crypto` module. ### ERR_CRYPTO_FIPS_UNAVAILABLE -Used when trying to enable or disable FIPS mode when FIPS is not available. +An attempt was made to enable or disable FIPS mode, but FIPS mode was not +available. ### ERR_CRYPTO_HASH_DIGEST_NO_UTF16 -Used when the UTF-16 encoding is used with [`hash.digest()`][]. While the +The UTF-16 encoding was used with [`hash.digest()`][]. While the `hash.digest()` method does allow an `encoding` argument to be passed in, causing the method to return a string rather than a `Buffer`, the UTF-16 encoding (e.g. `ucs` or `utf16le`) is not supported. @@ -671,76 +672,74 @@ encoding (e.g. `ucs` or `utf16le`) is not supported. ### ERR_CRYPTO_HASH_FINALIZED -Used when [`hash.digest()`][] is called multiple times. The `hash.digest()` -method must be called no more than one time per instance of a `Hash` object. +[`hash.digest()`][] was called multiple times. The `hash.digest()` method must +be called no more than one time per instance of a `Hash` object. ### ERR_CRYPTO_HASH_UPDATE_FAILED -Used when [`hash.update()`][] fails for any reason. This should rarely, if -ever, happen. +[`hash.update()`][] failed for any reason. This should rarely, if ever, happen. ### ERR_CRYPTO_INVALID_DIGEST -Used when an invalid [crypto digest algorithm][] is specified. +An invalid [crypto digest algorithm][] was specified. ### ERR_CRYPTO_SIGN_KEY_REQUIRED -Used when a signing `key` is not provided to the [`sign.sign()`][] method. +A signing `key` was not provided to the [`sign.sign()`][] method. ### ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH -Used when calling [`crypto.timingSafeEqual()`][] with `Buffer`, `TypedArray`, -or `DataView` arguments of different lengths. +[`crypto.timingSafeEqual()`][] was called with `Buffer`, `TypedArray`, or +`DataView` arguments of different lengths. ### ERR_DNS_SET_SERVERS_FAILED -Used when `c-ares` failed to set the DNS server. +`c-ares` failed to set the DNS server. ### ERR_ENCODING_INVALID_ENCODED_DATA -Used by the `util.TextDecoder()` API when the data provided is invalid -according to the encoding provided. +Data provided to `util.TextDecoder()` API was invalid according to the encoding +provided. ### ERR_ENCODING_NOT_SUPPORTED -Used by the `util.TextDecoder()` API when the encoding provided is not one of -the [WHATWG Supported Encodings][]. +Encoding provided to `util.TextDecoder()` API was not one of the +[WHATWG Supported Encodings][]. ### ERR_FALSY_VALUE_REJECTION -Used by the `util.callbackify()` API when a callbackified `Promise` is rejected -with a falsy value (e.g. `null`). +A `Promise` that was callbackified via `util.callbackify()` was rejected with a +falsy value. ### ERR_HTTP_HEADERS_SENT -Used when headers have already been sent and another attempt is made to add -more headers. +An attempt was made to add more headers after the headers had already been sent. ### ERR_HTTP_INVALID_CHAR -Used when an invalid character is found in an HTTP response status message -(reason phrase). +An invalid character was found in an HTTP response status message (reason +phrase). ### ERR_HTTP_INVALID_STATUS_CODE -Used for status codes outside the regular status code ranges (100-999). +Status code was outside the regular status code range (100-999). ### ERR_HTTP_TRAILER_INVALID -Used when the `Trailer` header is set even though the transfer encoding does not -support that. +The `Trailer` header was set even though the transfer encoding does not support +that. ### ERR_HTTP2_CONNECT_AUTHORITY @@ -763,35 +762,33 @@ forbidden. ### ERR_HTTP2_FRAME_ERROR -Used when a failure occurs sending an individual frame on the HTTP/2 -session. +A failure occurred sending an individual frame on the HTTP/2 session. ### ERR_HTTP2_HEADER_REQUIRED -Used when a required header is missing in an HTTP/2 message. +A required header was missing in an HTTP/2 message. ### ERR_HTTP2_HEADER_SINGLE_VALUE -Used when multiple values have been provided for an HTTP header field that -required to have only a single value. +Multiple values were provided for an HTTP/2 header field that was required to +have only a single value. ### ERR_HTTP2_HEADERS_AFTER_RESPOND -Used when trying to specify additional headers after an HTTP/2 response -initiated. +An additional headers was specified after an HTTP/2 response was initiated. ### ERR_HTTP2_HEADERS_OBJECT -Used when an HTTP/2 Headers Object is expected. +An HTTP/2 Headers Object was expected. ### ERR_HTTP2_HEADERS_SENT -Used when an attempt is made to send multiple response headers. +An attempt was made to send multiple response headers. ### ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND @@ -814,7 +811,7 @@ requests and responses. ### ERR_HTTP2_INVALID_HEADER_VALUE -Used to indicate that an invalid HTTP2 header value has been specified. +An invalid HTTP/2 header value was specified. ### ERR_HTTP2_INVALID_INFO_STATUS @@ -838,8 +835,8 @@ and `:method`) may be used. ### ERR_HTTP2_INVALID_SESSION -Used when any action is performed on an `Http2Session` object that has already -been destroyed. +An action was performed on an `Http2Session` object that had already been +destroyed. ### ERR_HTTP2_INVALID_SETTING_VALUE @@ -849,35 +846,34 @@ An invalid value has been specified for an HTTP/2 setting. ### ERR_HTTP2_INVALID_STREAM -Used when an operation has been performed on a stream that has already been -destroyed. +An operation was performed on a stream that had already been destroyed. ### ERR_HTTP2_MAX_PENDING_SETTINGS_ACK Whenever an HTTP/2 `SETTINGS` frame is sent to a connected peer, the peer is required to send an acknowledgement that it has received and applied the new -SETTINGS. By default, a maximum number of un-acknowledged `SETTINGS` frame may +`SETTINGS`. By default, a maximum number of unacknowledged `SETTINGS` frames may be sent at any given time. This error code is used when that limit has been reached. ### ERR_HTTP2_NO_SOCKET_MANIPULATION -Used when attempting to directly manipulate (e.g read, write, pause, resume, -etc.) a socket attached to an `Http2Session`. +An attempt was made to directly manipulate (read, write, pause, resume, etc.) a +socket attached to an `Http2Session`. ### ERR_HTTP2_OUT_OF_STREAMS -Used when the maximum number of streams on a single HTTP/2 session have been -created. +The number of streams created on a single HTTP/2 session reached the maximum +limit. ### ERR_HTTP2_PAYLOAD_FORBIDDEN -Used when a message payload is specified for an HTTP response code for which -a payload is forbidden. +A message payload was specified for an HTTP response code for which a payload is +forbidden. ### ERR_HTTP2_PING_CANCEL @@ -892,27 +888,26 @@ HTTP/2 ping payloads must be exactly 8 bytes in length. ### ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED -Used to indicate that an HTTP/2 pseudo-header has been used inappropriately. -Pseudo-headers are header key names that begin with the `:` prefix. +An HTTP/2 pseudo-header has been used inappropriately. Pseudo-headers are header +key names that begin with the `:` prefix. ### ERR_HTTP2_PUSH_DISABLED -Used when push streams have been disabled by the client but an attempt to -create a push stream is made. +An attempt was made to create a push stream, which had been disabled by the +client. ### ERR_HTTP2_SEND_FILE -Used when an attempt is made to use the -`Http2Stream.prototype.responseWithFile()` API to send a non-regular file. +An attempt was made to use the `Http2Stream.prototype.responseWithFile()` API to +send something other than a regular file. ### ERR_HTTP2_SOCKET_BOUND -Used when an attempt is made to connect a `Http2Session` object to a -`net.Socket` or `tls.TLSSocket` that has already been bound to another -`Http2Session` object. +An attempt was made to connect a `Http2Session` object to a `net.Socket` or +`tls.TLSSocket` that had already been bound to another `Http2Session` object. ### ERR_HTTP2_STATUS_101 @@ -928,13 +923,12 @@ between `100` and `599` (inclusive). ### ERR_HTTP2_STREAM_CLOSED -Used when an action has been performed on an HTTP/2 Stream that has already -been closed. +An action was performed on an HTTP/2 Stream that had already been closed. ### ERR_HTTP2_STREAM_ERROR -Used when a non-zero error code has been specified in an `RST_STREAM` frame. +A non-zero error code was been specified in an `RST_STREAM` frame. ### ERR_HTTP2_STREAM_SELF_DEPENDENCY @@ -946,172 +940,165 @@ made to mark a stream and dependent of itself. ### ERR_HTTP2_UNSUPPORTED_PROTOCOL -Used when `http2.connect()` is passed a URL that uses any protocol other than -`http:` or `https:`. +`http2.connect()` was passed a URL that uses any protocol other than `http:` or +`https:`. ### ERR_INDEX_OUT_OF_RANGE -Used when a given index is out of the accepted range (e.g. negative offsets). +A given index was out of the accepted range (e.g. negative offsets). ### ERR_INSPECTOR_ALREADY_CONNECTED -When using the `inspector` module, the `ERR_INSPECTOR_ALREADY_CONNECTED` error -code is used when an attempt is made to connect when the inspector is already -connected. +While using the `inspector` module, an attempt was made to connect when the +inspector was already connected. ### ERR_INSPECTOR_CLOSED -When using the `inspector` module, the `ERR_INSPECTOR_CLOSED` error code is -used when an attempt is made to use the inspector after the session has -already closed. +While using the `inspector` module, an attempt was made to use the inspector +after the session had already closed. ### ERR_INSPECTOR_NOT_AVAILABLE -Used to identify when the `inspector` module is not available for use. +The `inspector` module is not available for use. ### ERR_INSPECTOR_NOT_CONNECTED -When using the `inspector` module, the `ERR_INSPECTOR_NOT_CONNECTED` error code -is used when an attempt is made to use the inspector before it is connected. +While using the `inspector` module, an attempt was made to use the inspector +before it was connected. ### ERR_INVALID_ARG_TYPE -Used generically to identify that an argument of the wrong type has been passed -to a Node.js API. +An argument of the wrong type was passed to a Node.js API. ### ERR_INVALID_ARG_VALUE -Used generically to identify that an invalid or unsupported value has been -passed for a given argument. +An invalid or unsupported value was passed for a given argument. ### ERR_INVALID_ARRAY_LENGTH -Used when an Array is not of the expected length or in a valid range. +An Array was not of the expected length or in a valid range. ### ERR_INVALID_ASYNC_ID -Used with `AsyncHooks` when an invalid `asyncId` or `triggerAsyncId` is passed. -An id less than -1 should never happen. +An invalid `asyncId` or `triggerAsyncId` was passed using `AsyncHooks`. An id +less than -1 should never happen. ### ERR_INVALID_BUFFER_SIZE -Used when performing a swap on a `Buffer` but it's size is not compatible with the operation. +A swap was performed on a `Buffer` but its size was not compatible with the +operation. ### ERR_INVALID_CALLBACK -Used generically to identify that a callback function is required and has not -been provided to a Node.js API. +A callback function was required but was not been provided to a Node.js API. ### ERR_INVALID_CHAR -Used when invalid characters are detected in headers. +Invalid characters were detected in headers. ### ERR_INVALID_CURSOR_POS -The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on a given -stream is attempted to move to a specified row without a specified column. +A cursor on a given stream cannot be moved to a specified row without a +specified column. ### ERR_INVALID_DOMAIN_NAME -Used when `hostname` can not be parsed from a provided URL. +`hostname` can not be parsed from a provided URL. ### ERR_INVALID_FD -Used when a file descriptor ('fd') is not valid (e.g. it has a negative value). +A file descriptor ('fd') was not valid (e.g. it was a negative value). ### ERR_INVALID_FD_TYPE -Used when a file descriptor ('fd') type is not valid. +A file descriptor ('fd') type was not valid. ### ERR_INVALID_FILE_URL_HOST -Used when a Node.js API that consumes `file:` URLs (such as certain functions in -the [`fs`][] module) encounters a file URL with an incompatible host. Currently, -this situation can only occur on Unix-like systems, where only `localhost` or an -empty host is supported. +A Node.js API that consumes `file:` URLs (such as certain functions in the +[`fs`][] module) encountered a file URL with an incompatible host. This +situation can only occur on Unix-like systems where only `localhost` or an empty +host is supported. ### ERR_INVALID_FILE_URL_PATH -Used when a Node.js API that consumes `file:` URLs (such as certain -functions in the [`fs`][] module) encounters a file URL with an incompatible -path. The exact semantics for determining whether a path can be used is -platform-dependent. +A Node.js API that consumes `file:` URLs (such as certain functions in the +[`fs`][] module) encountered a file URL with an incompatible path. The exact +semantics for determining whether a path can be used is platform-dependent. ### ERR_INVALID_HANDLE_TYPE -Used when an attempt is made to send an unsupported "handle" over an IPC -communication channel to a child process. See [`subprocess.send()`] and -[`process.send()`] for more information. +An attempt was made to send an unsupported "handle" over an IPC communication +channel to a child process. See [`subprocess.send()`] and [`process.send()`] for +more information. ### ERR_INVALID_HTTP_TOKEN -Used when `options.method` received an invalid HTTP token. +An invalid HTTP token was supplied. ### ERR_INVALID_IP_ADDRESS -Used when an IP address is not valid. +An IP address is not valid. ### ERR_INVALID_OPT_VALUE -Used generically to identify when an invalid or unexpected value has been -passed in an options object. +An invalid or unexpected value was passed in an options object. ### ERR_INVALID_OPT_VALUE_ENCODING -Used when an invalid or unknown file encoding is passed. +An invalid or unknown file encoding was passed. ### ERR_INVALID_PERFORMANCE_MARK -Used by the Performance Timing API (`perf_hooks`) when a performance mark is +While using the Performance Timing API (`perf_hooks`), a performance mark is invalid. ### ERR_INVALID_PROTOCOL -Used when an invalid `options.protocol` is passed. +An invalid `options.protocol` was passed. ### ERR_INVALID_REPL_EVAL_CONFIG -Used when both `breakEvalOnSigint` and `eval` options are set -in the REPL config, which is not supported. +Both `breakEvalOnSigint` and `eval` options were set in the REPL config, which +is not supported. ### ERR_INVALID_SYNC_FORK_INPUT -Used when a `Buffer`, `Uint8Array` or `string` is provided as stdio input to a +A `Buffer`, `Uint8Array` or `string` was provided as stdio input to a synchronous fork. See the documentation for the [`child_process`](child_process.html) module for more information. ### ERR_INVALID_THIS -Used generically to identify that a Node.js API function is called with an -incompatible `this` value. +A Node.js API function was called with an incompatible `this` value. Example: @@ -1127,20 +1114,20 @@ urlSearchParams.has.call(buf, 'foo'); ### ERR_INVALID_TUPLE -Used when an element in the `iterable` provided to the [WHATWG][WHATWG URL -API] [`URLSearchParams` constructor][`new URLSearchParams(iterable)`] does not +An element in the `iterable` provided to the [WHATWG][WHATWG URL API] +[`URLSearchParams` constructor][`new URLSearchParams(iterable)`] did not represent a `[name, value]` tuple – that is, if an element is not iterable, or does not consist of exactly two elements. ### ERR_INVALID_URI -Used when an invalid URI is passed. +An invalid URI was passed. ### ERR_INVALID_URL -Used when an invalid URL is passed to the [WHATWG][WHATWG URL API] +An invalid URL was passed to the [WHATWG][WHATWG URL API] [`URL` constructor][`new URL(input)`] to be parsed. The thrown error object typically has an additional property `'input'` that contains the URL that failed to parse. @@ -1148,48 +1135,47 @@ to parse. ### ERR_INVALID_URL_SCHEME -Used generically to signify an attempt to use a URL of an incompatible scheme -(aka protocol) for a specific purpose. It is currently only used in the -[WHATWG URL API][] support in the [`fs`][] module (which only accepts URLs with -`'file'` scheme), but may be used in other Node.js APIs as well in the future. +An attempt was made to use a URL of an incompatible scheme (protocol) for a +specific purpose. It is only used in the [WHATWG URL API][] support in the +[`fs`][] module (which only accepts URLs with `'file'` scheme), but may be used +in other Node.js APIs as well in the future. ### ERR_IPC_CHANNEL_CLOSED -Used when an attempt is made to use an IPC communication channel that has -already been closed. +An attempt was made to use an IPC communication channel that was already closed. ### ERR_IPC_DISCONNECTED -Used when an attempt is made to disconnect an already disconnected IPC -communication channel between two Node.js processes. See the documentation for -the [`child_process`](child_process.html) module for more information. +An attempt was made to disconnect an IPC communication channel that was already +disconnected. See the documentation for the +[`child_process`](child_process.html) module for more information. ### ERR_IPC_ONE_PIPE -Used when an attempt is made to create a child Node.js process using more than -one IPC communication channel. See the documentation for the +An attempt was made to create a child Node.js process using more than one IPC +communication channel. See the documentation for the [`child_process`](child_process.html) module for more information. ### ERR_IPC_SYNC_FORK -Used when an attempt is made to open an IPC communication channel with a -synchronous forked Node.js process. See the documentation for the +An attempt was made to open an IPC communication channel with a synchronously +forked Node.js process. See the documentation for the [`child_process`](child_process.html) module for more information. ### ERR_METHOD_NOT_IMPLEMENTED -Used when a method is required but not implemented. +A method is required but not implemented. ### ERR_MISSING_ARGS -Used when a required argument of a Node.js API is not passed. This is only used -for strict compliance with the API specification (which in some cases may accept +A required argument of a Node.js API was not passed. This is only used for +strict compliance with the API specification (which in some cases may accept `func(undefined)` but not `func()`). In most native Node.js APIs, `func(undefined)` and `func()` are treated identically, and the [`ERR_INVALID_ARG_TYPE`][] error code may be used instead. @@ -1199,27 +1185,27 @@ for strict compliance with the API specification (which in some cases may accept > Stability: 1 - Experimental -Used when an [ES6 module][] loader hook specifies `format: 'dynamic` but does -not provide a `dynamicInstantiate` hook. +An [ES6 module][] loader hook specified `format: 'dynamic` but did not provide a +`dynamicInstantiate` hook. ### ERR_MISSING_MODULE > Stability: 1 - Experimental -Used when an [ES6 module][] cannot be resolved. +An [ES6 module][] could not be resolved. ### ERR_MODULE_RESOLUTION_LEGACY > Stability: 1 - Experimental -Used when a failure occurs resolving imports in an [ES6 module][]. +A failure occurred resolving imports in an [ES6 module][]. ### ERR_MULTIPLE_CALLBACK -Used when a callback is called more then once. +A callback was called more then once. *Note*: A callback is almost always meant to only be called once as the query can either be fulfilled or rejected but not both at the same time. The latter @@ -1228,154 +1214,149 @@ would be possible by calling a callback more then once. ### ERR_NAPI_CONS_FUNCTION -Used by the `N-API` when a constructor passed is not a function. +While using `N-API`, a constructor passed was not a function. ### ERR_NAPI_CONS_PROTOTYPE_OBJECT -Used by the `N-API` when `Constructor.prototype` is not an object. +While using `N-API`, `Constructor.prototype` was not an object. ### ERR_NO_CRYPTO -Used when an attempt is made to use crypto features while Node.js is not -compiled with OpenSSL crypto support. +An attempt was made to use crypto features while Node.js was not compiled with +OpenSSL crypto support. ### ERR_NO_ICU -Used when an attempt is made to use features that require [ICU][], while -Node.js is not compiled with ICU support. +An attempt was made to use features that require [ICU][], but Node.js was not +compiled with ICU support. ### ERR_NO_LONGER_SUPPORTED -Used when a Node.js API is called in an unsupported manner. +A Node.js API was called in an unsupported manner. For example: `Buffer.write(string, encoding, offset[, length])` ### ERR_OUTOFMEMORY -Used generically to identify that an operation caused an out of memory -condition. +An operation caused an out-of-memory condition. ### ERR_OUT_OF_RANGE -Used generically when an input argument value values outside an acceptable -range. +An input argument value was outside an acceptable range. ### ERR_PARSE_HISTORY_DATA -Used by the `REPL` module when it cannot parse data from the REPL history file. +The `REPL` module was unable parse data from the REPL history file. ### ERR_REQUIRE_ESM > Stability: 1 - Experimental -Used when an attempt is made to `require()` an [ES6 module][]. +An attempt was made to `require()` an [ES6 module][]. ### ERR_SERVER_ALREADY_LISTEN -Used when the [`server.listen()`][] method is called while a `net.Server` is -already listening. This applies to all instances of `net.Server`, including -HTTP, HTTPS, and HTTP/2 Server instances. +The [`server.listen()`][] method was called while a `net.Server` was already +listening. This applies to all instances of `net.Server`, including HTTP, HTTPS, +and HTTP/2 Server instances. ### ERR_SOCKET_ALREADY_BOUND -Used when an attempt is made to bind a socket that has already been bound. +An attempt was made to bind a socket that has already been bound. ### ERR_SOCKET_BAD_BUFFER_SIZE -Used when an invalid (negative) size is passed for either the `recvBufferSize` -or `sendBufferSize` options in [`dgram.createSocket()`][]. +An invalid (negative) size was passed for either the `recvBufferSize` or +`sendBufferSize` options in [`dgram.createSocket()`][]. ### ERR_SOCKET_BAD_PORT -Used when an API function expecting a port > 0 and < 65536 receives an invalid -value. +An API function expecting a port > 0 and < 65536 received an invalid value. ### ERR_SOCKET_BAD_TYPE -Used when an API function expecting a socket type (`udp4` or `udp6`) receives an -invalid value. +An API function expecting a socket type (`udp4` or `udp6`) received an invalid +value. ### ERR_SOCKET_BUFFER_SIZE -Used when using [`dgram.createSocket()`][] and the size of the receive or send -`Buffer` cannot be determined. +While using [`dgram.createSocket()`][], the size of the receive or send `Buffer` +could not be determined. ### ERR_SOCKET_CANNOT_SEND -Used when data cannot be sent on a socket. +Data could be sent on a socket. ### ERR_SOCKET_CLOSED -Used when an attempt is made to operate on an already closed socket. +An attempt was made to operate on an already closed socket. ### ERR_SOCKET_DGRAM_NOT_RUNNING -Used when a call is made and the UDP subsystem is not running. +A call was made and the UDP subsystem was not running. ### ERR_STDERR_CLOSE -Used when an attempt is made to close the `process.stderr` stream. By design, -Node.js does not allow `stdout` or `stderr` Streams to be closed by user code. +An attempt was made to close the `process.stderr` stream. By design, Node.js +does not allow `stdout` or `stderr` streams to be closed by user code. ### ERR_STDOUT_CLOSE -Used when an attempt is made to close the `process.stdout` stream. By design, -Node.js does not allow `stdout` or `stderr` Streams to be closed by user code. +An attempt was made to close the `process.stdout` stream. By design, Node.js +does not allow `stdout` or `stderr` streams to be closed by user code. ### ERR_STREAM_CANNOT_PIPE -Used when an attempt is made to call [`stream.pipe()`][] on a -[`Writable`][] stream. +An attempt was made to call [`stream.pipe()`][] on a [`Writable`][] stream. ### ERR_STREAM_NULL_VALUES -Used when an attempt is made to call [`stream.write()`][] with a `null` -chunk. +An attempt was made to call [`stream.write()`][] with a `null` chunk. ### ERR_STREAM_PUSH_AFTER_EOF -Used when an attempt is made to call [`stream.push()`][] after a `null`(EOF) -has been pushed to the stream. +An attempt was made to call [`stream.push()`][] after a `null`(EOF) had been +pushed to the stream. ### ERR_STREAM_READ_NOT_IMPLEMENTED -Used when an attempt is made to use a readable stream that has not implemented +An attempt was made to use a readable stream that did not implement [`readable._read()`][]. ### ERR_STREAM_UNSHIFT_AFTER_END_EVENT -Used when an attempt is made to call [`stream.unshift()`][] after the -`end` event has been emitted. +An attempt was made to call [`stream.unshift()`][] after the `end` event was +emitted. ### ERR_STREAM_WRAP -Used to prevent an abort if a string decoder was set on the Socket or if in -`objectMode`. +Prevents an abort if a string decoder was set on the Socket or if the decoder +is in `objectMode`. Example ```js @@ -1388,19 +1369,19 @@ instance.setEncoding('utf8'); ### ERR_STREAM_WRITE_AFTER_END -Used when an attempt is made to call [`stream.write()`][] after -`stream.end()` has been called. +An attempt was made to call [`stream.write()`][] after `stream.end()` has been +called. ### ERR_TLS_CERT_ALTNAME_INVALID -Used with TLS, when the hostname/IP of the peer does not match any of the +While using TLS, the hostname/IP of the peer did not match any of the subjectAltNames in its certificate. ### ERR_TLS_DH_PARAM_SIZE -Used with TLS when the parameter offered for the Diffie-Hellman (`DH`) +While using TLS, the parameter offered for the Diffie-Hellman (`DH`) key-agreement protocol is too small. By default, the key length must be greater than or equal to 1024 bits to avoid vulnerabilities, even though it is strongly recommended to use 2048 bits or larger for stronger security. @@ -1408,60 +1389,58 @@ recommended to use 2048 bits or larger for stronger security. ### ERR_TLS_HANDSHAKE_TIMEOUT -A TLS error emitted by the server whenever a TLS/SSL handshake times out. In -this case, the server must also abort the connection. +A TLS/SSL handshake timed out. In this case, the server must also abort the +connection. ### ERR_TLS_RENEGOTIATION_FAILED -Used when a TLS renegotiation request has failed in a non-specific way. +A TLS renegotiation request has failed in a non-specific way. ### ERR_TLS_REQUIRED_SERVER_NAME -Used with TLS, when calling the `server.addContext()` method without providing +While using TLS, the `server.addContext()` method was called without providing a hostname in the first parameter. ### ERR_TLS_SESSION_ATTACK -Used when an excessive amount of TLS renegotiations is detected, which is a -potential vector for denial-of-service attacks. +An excessive amount of TLS renegotiations is detected, which is a potential +vector for denial-of-service attacks. ### ERR_TRANSFORM_ALREADY_TRANSFORMING -Used in Transform streams when the stream finishes while it is still -transforming. +A Transform stream finished while it was still transforming. ### ERR_TRANSFORM_WITH_LENGTH_0 -Used in Transform streams when the stream finishes with data still in the write -buffer. +A Transform stream finished with data still in the write buffer. ### ERR_UNESCAPED_CHARACTERS -Used when a string that contains unescaped characters was received. +A string that contained unescaped characters was received. ### ERR_UNHANDLED_ERROR -Used when an unhandled "error" occurs (for instance, when an `'error'` event -is emitted by an [`EventEmitter`][] but an `'error'` handler is not registered). +An unhandled error occurred (for instance, when an `'error'` event is emitted +by an [`EventEmitter`][] but an `'error'` handler is not registered). ### ERR_UNKNOWN_ENCODING -Used when an invalid or unknown encoding option is passed to an API. +An invalid or unknown encoding option was passed to an API. ### ERR_UNKNOWN_FILE_EXTENSION > Stability: 1 - Experimental -Used when attempting to load a module with an unknown or unsupported file +An attempt was made to load a module with an unknown or unsupported file extension. @@ -1469,57 +1448,53 @@ extension. > Stability: 1 - Experimental -Used when attempting to load a module with an unknown or unsupported format. +An attempt was made to load a module with an unknown or unsupported format. ### ERR_UNKNOWN_SIGNAL -Used when an invalid or unknown process signal is passed to an API expecting a -valid signal (such as [`subprocess.kill()`][]). +An invalid or unknown process signal was passed to an API expecting a valid +signal (such as [`subprocess.kill()`][]). ### ERR_UNKNOWN_STDIN_TYPE -Used when an attempt is made to launch a Node.js process with an unknown `stdin` -file type. Errors of this kind cannot *typically* be caused by errors in user -code, although it is not impossible. Occurrences of this error are most likely -an indication of a bug within Node.js itself. +An attempt was made to launch a Node.js process with an unknown `stdin` file +type. This error is usually an indication of a bug within Node.js itself, +although it is possible for user code to trigger it. ### ERR_UNKNOWN_STREAM_TYPE -Used when an attempt is made to launch a Node.js process with an unknown -`stdout` or `stderr` file type. Errors of this kind cannot *typically* be caused -by errors in user code, although it is not impossible. Occurrences of this error -are most likely an indication of a bug within Node.js itself. +An attempt was made to launch a Node.js process with an unknown `stdout` or +`stderr` file type. This error is usually an indication of a bug within Node.js +itself, although it is possible for user code to trigger it. ### ERR_V8BREAKITERATOR -Used when the V8 BreakIterator API is used but the full ICU data set is not -installed. +The V8 BreakIterator API was used but the full ICU data set is not installed. ### ERR_VALID_PERFORMANCE_ENTRY_TYPE -Used by the Performance Timing API (`perf_hooks`) when no valid performance +While using the Performance Timing API (`perf_hooks`), no valid performance entry types were found. ### ERR_VALUE_OUT_OF_RANGE -Used when a given value is out of the accepted range. +A given value is out of the accepted range. ### ERR_ZLIB_BINDING_CLOSED -Used when an attempt is made to use a `zlib` object after it has already been -closed. +An attempt was made to use a `zlib` object after it has already been closed. ### ERR_ZLIB_INITIALIZATION_FAILED -Used when creation of a [`zlib`][] object fails due to incorrect configuration. +Creation of a [`zlib`][] object failed due to incorrect configuration. [`--force-fips`]: cli.html#cli_force_fips [`crypto.timingSafeEqual()`]: crypto.html#crypto_crypto_timingsafeequal_a_b From a333e713426ffe656cdcaa72b6a002d02e6bdd99 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Thu, 9 Nov 2017 10:18:12 -0500 Subject: [PATCH 224/379] errors: consistent format for error message Consistently use printf-style strings for error messages that do not need a custom argument order or processing of arguments. Backport-PR-URL: https://github.com/nodejs/node/pull/17624 PR-URL: https://github.com/nodejs/node/pull/16904 Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Anna Henningsen --- lib/internal/errors.js | 68 ++++++++----------- .../test-eslint-prefer-util-format-errors.js | 27 ++++++++ .../eslint-rules/prefer-util-format-errors.js | 39 +++++++++++ 3 files changed, 93 insertions(+), 41 deletions(-) create mode 100644 test/parallel/test-eslint-prefer-util-format-errors.js create mode 100644 tools/eslint-rules/prefer-util-format-errors.js diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 8da4e39f19dce6..535cd1937d6c33 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1,5 +1,6 @@ /* eslint documented-errors: "error" */ /* eslint alphabetize-errors: "error" */ +/* eslint prefer-util-format-errors: "error" */ 'use strict'; @@ -146,8 +147,8 @@ module.exports = exports = { // Note: Please try to keep these in alphabetical order E('ERR_ARG_NOT_ITERABLE', '%s must be iterable'); E('ERR_ASSERTION', '%s'); -E('ERR_ASYNC_CALLBACK', (name) => `${name} must be a function`); -E('ERR_ASYNC_TYPE', (s) => `Invalid name for async "type": ${s}`); +E('ERR_ASYNC_CALLBACK', '%s must be a function'); +E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s'); E('ERR_BUFFER_OUT_OF_BOUNDS', bufferOutOfBounds); E('ERR_BUFFER_TOO_LARGE', `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`); @@ -169,12 +170,10 @@ E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s'); E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign'); E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH', 'Input buffers must have the same length'); -E('ERR_DNS_SET_SERVERS_FAILED', (err, servers) => - `c-ares failed to set servers: "${err}" [${servers}]`); +E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]'); E('ERR_ENCODING_INVALID_ENCODED_DATA', - (enc) => `The encoded data was not valid for encoding ${enc}`); -E('ERR_ENCODING_NOT_SUPPORTED', - (enc) => `The "${enc}" encoding is not supported`); + 'The encoded data was not valid for encoding %s'); +E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported'); E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value'); E('ERR_HTTP2_CONNECT_AUTHORITY', ':authority header is required for CONNECT requests'); @@ -194,10 +193,9 @@ E('ERR_HTTP2_HEADERS_AFTER_RESPOND', 'Cannot specify additional headers after response initiated'); E('ERR_HTTP2_HEADERS_OBJECT', 'Headers must be an object'); E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.'); -E('ERR_HTTP2_HEADER_REQUIRED', - (name) => `The ${name} header is required`); +E('ERR_HTTP2_HEADER_REQUIRED', 'The %s header is required'); E('ERR_HTTP2_HEADER_SINGLE_VALUE', - (name) => `Header field "${name}" must have only a single value`); + 'Header field "%s" must have only a single value'); E('ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND', 'Cannot send informational headers after the HTTP message has been sent'); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', @@ -206,23 +204,23 @@ E('ERR_HTTP2_INVALID_CONNECTION_HEADERS', 'HTTP/1 Connection specific headers are forbidden: "%s"'); E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"'); E('ERR_HTTP2_INVALID_INFO_STATUS', - (code) => `Invalid informational status code: ${code}`); + 'Invalid informational status code: %s'); E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', 'Packed settings length must be a multiple of six'); E('ERR_HTTP2_INVALID_PSEUDOHEADER', - (name) => `"${name}" is an invalid pseudoheader or is used incorrectly`); + '"%s" is an invalid pseudoheader or is used incorrectly'); E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed'); E('ERR_HTTP2_INVALID_SETTING_VALUE', - (name, value) => `Invalid value for setting "${name}": ${value}`); + 'Invalid value for setting "%s": %s'); E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed'); E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', - (max) => `Maximum number of pending settings acknowledgements (${max})`); + 'Maximum number of pending settings acknowledgements (%s)'); E('ERR_HTTP2_NO_SOCKET_MANIPULATION', 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)'); E('ERR_HTTP2_OUT_OF_STREAMS', 'No stream ID is available because maximum stream ID has been reached'); E('ERR_HTTP2_PAYLOAD_FORBIDDEN', - (code) => `Responses with ${code} status must not have a payload`); + 'Responses with %s status must not have a payload'); E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled'); E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes'); E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', 'Cannot set HTTP/2 pseudo-headers'); @@ -232,19 +230,15 @@ E('ERR_HTTP2_SOCKET_BOUND', 'The socket is already bound to an Http2Session'); E('ERR_HTTP2_STATUS_101', 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2'); -E('ERR_HTTP2_STATUS_INVALID', - (code) => `Invalid status code: ${code}`); +E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s'); E('ERR_HTTP2_STREAM_CLOSED', 'The stream is already closed'); -E('ERR_HTTP2_STREAM_ERROR', - (code) => `Stream closed with error code ${code}`); +E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s'); E('ERR_HTTP2_STREAM_SELF_DEPENDENCY', 'A stream cannot depend on itself'); -E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', - (protocol) => `protocol "${protocol}" is unsupported.`); +E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.'); E('ERR_HTTP_HEADERS_SENT', 'Cannot %s headers after they are sent to the client'); E('ERR_HTTP_INVALID_CHAR', 'Invalid character in statusMessage.'); -E('ERR_HTTP_INVALID_STATUS_CODE', - (originalStatusCode) => `Invalid status code: ${originalStatusCode}`); +E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s'); E('ERR_HTTP_TRAILER_INVALID', 'Trailers are invalid with this transfer encoding'); E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range'); @@ -253,16 +247,14 @@ E('ERR_INSPECTOR_CLOSED', 'Session was closed'); E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available'); E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected'); E('ERR_INVALID_ARG_TYPE', invalidArgType); -E('ERR_INVALID_ARG_VALUE', - (name, value) => { - return `The value "${String(value)}" is invalid for argument "${name}"`; - }); +E('ERR_INVALID_ARG_VALUE', (name, value) => + `The value "${String(value)}" is invalid for argument "${name}"`); E('ERR_INVALID_ARRAY_LENGTH', (name, len, actual) => { internalAssert(typeof actual === 'number', 'actual must be a number'); return `The array "${name}" (length ${actual}) must be of length ${len}.`; }); -E('ERR_INVALID_ASYNC_ID', (type, id) => `Invalid ${type} value: ${id}`); +E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s'); E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s'); E('ERR_INVALID_CALLBACK', 'Callback must be a function'); E('ERR_INVALID_CHAR', invalidChar); @@ -277,15 +269,12 @@ E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s'); E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent'); E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]'); E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s'); -E('ERR_INVALID_OPT_VALUE', - (name, value) => { - return `The value "${String(value)}" is invalid for option "${name}"`; - }); +E('ERR_INVALID_OPT_VALUE', (name, value) => + `The value "${String(value)}" is invalid for option "${name}"`); E('ERR_INVALID_OPT_VALUE_ENCODING', - (value) => `The value "${String(value)}" is invalid for option "encoding"`); + 'The value "%s" is invalid for option "encoding"'); E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set'); -E('ERR_INVALID_PROTOCOL', (protocol, expectedProtocol) => - `Protocol "${protocol}" not supported. Expected "${expectedProtocol}"`); +E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"'); E('ERR_INVALID_REPL_EVAL_CONFIG', 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'); E('ERR_INVALID_SYNC_FORK_INPUT', @@ -325,8 +314,7 @@ E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer'); E('ERR_SOCKET_BAD_PORT', 'Port should be > 0 and < 65536. Received %s.'); E('ERR_SOCKET_BAD_TYPE', 'Bad socket type specified. Valid types are: udp4, udp6'); -E('ERR_SOCKET_BUFFER_SIZE', - (reason) => `Could not get or set buffer size: ${reason}`); +E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size: %s'); E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data'); E('ERR_SOCKET_CLOSED', 'Socket is closed'); E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running'); @@ -341,8 +329,7 @@ E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode'); E('ERR_STREAM_WRITE_AFTER_END', 'write after end'); E('ERR_TLS_CERT_ALTNAME_INVALID', 'Hostname/IP does not match certificate\'s altnames: %s'); -E('ERR_TLS_DH_PARAM_SIZE', (size) => - `DH parameter size ${size} is less than 2048`); +E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048'); E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout'); E('ERR_TLS_RENEGOTIATION_FAILED', 'Failed to renegotiate'); E('ERR_TLS_REQUIRED_SERVER_NAME', @@ -352,8 +339,7 @@ E('ERR_TRANSFORM_ALREADY_TRANSFORMING', 'Calling transform done when still transforming'); E('ERR_TRANSFORM_WITH_LENGTH_0', 'Calling transform done when writableState.length != 0'); -E('ERR_UNESCAPED_CHARACTERS', - (name) => `${name} contains unescaped characters`); +E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters'); E('ERR_UNHANDLED_ERROR', (err) => { const msg = 'Unhandled error.'; diff --git a/test/parallel/test-eslint-prefer-util-format-errors.js b/test/parallel/test-eslint-prefer-util-format-errors.js new file mode 100644 index 00000000000000..265a0752c50d43 --- /dev/null +++ b/test/parallel/test-eslint-prefer-util-format-errors.js @@ -0,0 +1,27 @@ +'use strict'; + +/* eslint-disable no-template-curly-in-string */ + +require('../common'); + +const RuleTester = require('../../tools/eslint').RuleTester; +const rule = require('../../tools/eslint-rules/prefer-util-format-errors'); + +new RuleTester({ parserOptions: { ecmaVersion: 6 } }) + .run('prefer-util-format-errors', rule, { + valid: [ + 'E(\'ABC\', \'abc\');', + 'E(\'ABC\', (arg1, arg2) => `${arg2}${arg1}`);', + 'E(\'ABC\', (arg1, arg2) => `${arg1}{arg2.something}`);', + 'E(\'ABC\', (arg1, arg2) => fn(arg1, arg2));' + ], + invalid: [ + { + code: 'E(\'ABC\', (arg1, arg2) => `${arg1}${arg2}`);', + errors: [{ + message: 'Please use a printf-like formatted string that ' + + 'util.format can consume.' + }] + } + ] + }); diff --git a/tools/eslint-rules/prefer-util-format-errors.js b/tools/eslint-rules/prefer-util-format-errors.js new file mode 100644 index 00000000000000..c3f4819e43b51c --- /dev/null +++ b/tools/eslint-rules/prefer-util-format-errors.js @@ -0,0 +1,39 @@ +'use strict'; + +const errMsg = 'Please use a printf-like formatted string that util.format' + + ' can consume.'; + +function isArrowFunctionWithTemplateLiteral(node) { + return node.type === 'ArrowFunctionExpression' && + node.body.type === 'TemplateLiteral'; +} + +function isDefiningError(node) { + return node.expression && + node.expression.type === 'CallExpression' && + node.expression.callee && + node.expression.callee.name === 'E'; +} + +module.exports = { + create: function(context) { + return { + ExpressionStatement: function(node) { + if (!isDefiningError(node)) + return; + + const msg = node.expression.arguments[1]; + if (!isArrowFunctionWithTemplateLiteral(msg)) + return; + + const { expressions } = msg.body; + const hasSequentialParams = msg.params.every((param, index) => { + const expr = expressions[index]; + return expr && expr.type === 'Identifier' && param.name === expr.name; + }); + if (hasSequentialParams) + context.report(msg, errMsg); + } + }; + } +}; From f5a1e6cbc4039f0727880f39f0349aa63a9573d3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 14:57:13 -0800 Subject: [PATCH 225/379] test: fix flaky async-hooks/test-graph.signal Make sure event loop remains open long enough for signal to be received. PR-URL: https://github.com/nodejs/node/pull/17509 Fixes: https://github.com/nodejs/node/issues/14568 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Evan Lucas --- test/async-hooks/test-graph.signal.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/async-hooks/test-graph.signal.js b/test/async-hooks/test-graph.signal.js index 92334b98268840..770fe00da4b4a6 100644 --- a/test/async-hooks/test-graph.signal.js +++ b/test/async-hooks/test-graph.signal.js @@ -3,16 +3,16 @@ const common = require('../common'); if (common.isWindows) { common.skip('no signals on Windows'); - return; } const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); -const exec = require('child_process').exec; +const { exec } = require('child_process'); const hooks = initHooks(); hooks.enable(); +const interval = setInterval(() => {}, 9999); // keep event loop open process.on('SIGUSR2', common.mustCall(onsigusr2, 2)); let count = 0; @@ -33,7 +33,9 @@ function onsigusr2() { } } -function onsigusr2Again() {} +function onsigusr2Again() { + clearInterval(interval); // let the event loop close +} process.on('exit', onexit); From 49d23a30213bfa627f5ed4c1a662e1087cb1786a Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 6 Dec 2017 15:43:09 -0800 Subject: [PATCH 226/379] deps: V8: backport 14ac02c from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [cpu-profiler] Clear code entries when no observers are present. Performed manual testing as well by making 20 CPU profile recordings of loading http://meduza.io page. Without the patch the page renderer memory size grows beyond 300MB. With the patch it remains below 200MB. BUG=v8:6623 Change-Id: Ifce541b84bb2aaaa5175520f8dd49dbc0cb5dd20 Reviewed-on: https://chromium-review.googlesource.com/798020 Commit-Queue: Alexei Filippov Reviewed-by: Yang Guo Cr-Commit-Position: refs/heads/master@{#49914} Ref: https://github.com/v8/v8/commit/14ac02c49c7a364059704537a10abae4feb15a88 PR-URL: https://github.com/nodejs/node/pull/17512 Reviewed-By: Timothy Gu Reviewed-By: Michaël Zasso Reviewed-By: Michael Dawson --- common.gypi | 2 +- deps/v8/src/profiler/profiler-listener.cc | 28 +++++++++++------------ deps/v8/src/profiler/profiler-listener.h | 3 ++- deps/v8/test/cctest/test-cpu-profiler.cc | 28 +++++++++++++++++++++++ 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/common.gypi b/common.gypi index b8e7ba833814c6..4b1f0377ba1745 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.11', + 'v8_embedder_string': '-node.12', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/profiler/profiler-listener.cc b/deps/v8/src/profiler/profiler-listener.cc index 169b12da0770c1..540d93002459fb 100644 --- a/deps/v8/src/profiler/profiler-listener.cc +++ b/deps/v8/src/profiler/profiler-listener.cc @@ -16,11 +16,7 @@ namespace internal { ProfilerListener::ProfilerListener(Isolate* isolate) : function_and_resource_names_(isolate->heap()) {} -ProfilerListener::~ProfilerListener() { - for (auto code_entry : code_entries_) { - delete code_entry; - } -} +ProfilerListener::~ProfilerListener() = default; void ProfilerListener::CallbackEvent(Name* name, Address entry_point) { CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); @@ -286,19 +282,23 @@ CodeEntry* ProfilerListener::NewCodeEntry( CodeEventListener::LogEventsAndTags tag, const char* name, const char* name_prefix, const char* resource_name, int line_number, int column_number, JITLineInfoTable* line_info, Address instruction_start) { - CodeEntry* code_entry = - new CodeEntry(tag, name, name_prefix, resource_name, line_number, - column_number, line_info, instruction_start); - code_entries_.push_back(code_entry); - return code_entry; + std::unique_ptr code_entry = base::make_unique( + tag, name, name_prefix, resource_name, line_number, column_number, + line_info, instruction_start); + CodeEntry* raw_code_entry = code_entry.get(); + code_entries_.push_back(std::move(code_entry)); + return raw_code_entry; } void ProfilerListener::AddObserver(CodeEventObserver* observer) { base::LockGuard guard(&mutex_); - if (std::find(observers_.begin(), observers_.end(), observer) != - observers_.end()) - return; - observers_.push_back(observer); + if (observers_.empty()) { + code_entries_.clear(); + } + if (std::find(observers_.begin(), observers_.end(), observer) == + observers_.end()) { + observers_.push_back(observer); + } } void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { diff --git a/deps/v8/src/profiler/profiler-listener.h b/deps/v8/src/profiler/profiler-listener.h index f4a9e24c7d00c5..440afd87a2e97f 100644 --- a/deps/v8/src/profiler/profiler-listener.h +++ b/deps/v8/src/profiler/profiler-listener.h @@ -74,6 +74,7 @@ class ProfilerListener : public CodeEventListener { const char* GetFunctionName(const char* name) { return function_and_resource_names_.GetFunctionName(name); } + size_t entries_count_for_test() const { return code_entries_.size(); } private: void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code); @@ -87,7 +88,7 @@ class ProfilerListener : public CodeEventListener { } StringsStorage function_and_resource_names_; - std::vector code_entries_; + std::vector> code_entries_; std::vector observers_; base::Mutex mutex_; diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 689305f30eabc6..f22a42a977d5be 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -2191,3 +2191,31 @@ TEST(TracingCpuProfiler) { i::V8::SetPlatformForTesting(old_platform); } + +TEST(CodeEntriesMemoryLeak) { + v8::HandleScope scope(CcTest::isolate()); + v8::Local env = CcTest::NewContext(PROFILER_EXTENSION); + v8::Context::Scope context_scope(env); + + std::string source = "function start() {}\n"; + for (int i = 0; i < 1000; ++i) { + source += "function foo" + std::to_string(i) + "() { return " + + std::to_string(i) + + "; }\n" + "foo" + + std::to_string(i) + "();\n"; + } + CompileRun(source.c_str()); + v8::Local function = GetFunction(env, "start"); + + ProfilerHelper helper(env); + + for (int j = 0; j < 100; ++j) { + v8::CpuProfile* profile = helper.Run(function, nullptr, 0); + profile->Delete(); + } + ProfilerListener* profiler_listener = + CcTest::i_isolate()->logger()->profiler_listener(); + + CHECK_GE(10000ul, profiler_listener->entries_count_for_test()); +} From 465a32a0874ac401fb6c30be4137b77e263a84ca Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 29 Nov 2017 11:02:49 +0900 Subject: [PATCH 227/379] Revert "deps: cherry-pick 3c8195d from V8 upstream" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e7f30db1a682208f2e5026ee299f07a3f23958e3. The original commit included tests for AsyncIterator that broke on 6.2 PR-URL: https://github.com/nodejs/node/pull/17383 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Refael Ackermann Reviewed-By: Yang Guo Reviewed-By: Michael Dawson --- common.gypi | 2 +- .../src/builtins/builtins-collections-gen.cc | 9 ++++---- .../caught-uncaught-exceptions-expected.txt | 8 ------- .../debugger/caught-uncaught-exceptions.js | 23 +------------------ 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/common.gypi b/common.gypi index 4b1f0377ba1745..1e6d9ac0b0fe0e 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.12', + 'v8_embedder_string': '-node.13', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/builtins/builtins-collections-gen.cc b/deps/v8/src/builtins/builtins-collections-gen.cc index acb4c949ae11a8..3cb20cd8df11a5 100644 --- a/deps/v8/src/builtins/builtins-collections-gen.cc +++ b/deps/v8/src/builtins/builtins-collections-gen.cc @@ -302,11 +302,10 @@ TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) { BIND(&if_notobject); { - Node* ret = CallRuntime( - Runtime::kThrowTypeError, context, - SmiConstant(MessageTemplate::kIteratorValueNotAnObject), next_value); - GotoIfException(ret, &if_exception, &var_exception); - Unreachable(); + Node* const exception = MakeTypeError( + MessageTemplate::kIteratorValueNotAnObject, context, next_value); + var_exception.Bind(exception); + Goto(&if_exception); } } diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt index 9c40b1c5561c94..b784fa549e3ba9 100644 --- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt +++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt @@ -3,11 +3,3 @@ paused in throwCaught uncaught: false paused in throwUncaught uncaught: true -paused in throwInPromiseCaught -uncaught: false -paused in promiseUncaught -uncaught: true -paused in throwInMapConstructor -uncaught: true -paused in throwInAsyncIterator -uncaught: true \ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js index b7c4bd4ab784ee..38b622d3dba0ff 100644 --- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js +++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js @@ -7,19 +7,6 @@ let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspecto contextGroup.addScript( `function throwCaught() { try { throw new Error(); } catch (_) {} } function throwUncaught() { throw new Error(); } - function throwInPromiseCaught() { - var reject; - new Promise(function(res, rej) { reject = rej; }).catch(() => {}); - reject(); - } - function throwInPromiseUncaught() { - new Promise(function promiseUncaught() { throw new Error(); }); - } - function throwInMapConstructor() { new Map('a'); } - function throwInAsyncIterator() { - let it = (async function*() {})(); - it.next.call({}); - } function schedule(f) { setTimeout(f, 0); } `); @@ -35,12 +22,4 @@ Protocol.Debugger.onPaused(message => { Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" }) .then(() => Protocol.Runtime.evaluate( { "expression": "schedule(throwUncaught);" })) - .then(() => Protocol.Runtime.evaluate( - { "expression": "schedule(throwInPromiseCaught);"})) - .then(() => Protocol.Runtime.evaluate( - { "expression": "schedule(throwInPromiseUncaught);"})) - .then(() => Protocol.Runtime.evaluate( - { "expression": "schedule(throwInMapConstructor);"})) - .then(() => Protocol.Runtime.evaluate( - { "expression": "schedule(throwInAsyncIterator);"})) - .then(() => InspectorTest.completeTest()); + .then(() => InspectorTest.completeTest()); From 47cd49a8cb3fcdeac5ac190e0bd0c45ed81f6d7b Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 8 Nov 2017 13:06:37 +0100 Subject: [PATCH 228/379] deps: backport 3c8195d from V8 upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: Fix map constructor to correctly throw. We need to throw before rethrowing, otherwise the exception does not trigger a debugger event and is not reported if uncaught. R=gsathya@chromium.org, jgruber@chromium.org Bug: v8:7047 Change-Id: I7ce0253883a21d6059e4e0ed0fc56dc55a0dcba6 Reviewed-on: https://chromium-review.googlesource.com/758372 Reviewed-by: Jakob Gruber Reviewed-by: Sathya Gunasekaran Commit-Queue: Yang Guo Cr-Commit-Position: refs/heads/master@{#49237} Fixes: https://github.com/nodejs/node/issues/17270 PR-URL: https://github.com/nodejs/node/pull/17383 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Refael Ackermann Reviewed-By: Yang Guo Reviewed-By: Michael Dawson --- common.gypi | 2 +- .../v8/src/builtins/builtins-collections-gen.cc | 9 +++++---- .../caught-uncaught-exceptions-expected.txt | 6 ++++++ .../debugger/caught-uncaught-exceptions.js | 17 ++++++++++++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/common.gypi b/common.gypi index 1e6d9ac0b0fe0e..3b53721cd493e0 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.13', + 'v8_embedder_string': '-node.14', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/builtins/builtins-collections-gen.cc b/deps/v8/src/builtins/builtins-collections-gen.cc index 3cb20cd8df11a5..acb4c949ae11a8 100644 --- a/deps/v8/src/builtins/builtins-collections-gen.cc +++ b/deps/v8/src/builtins/builtins-collections-gen.cc @@ -302,10 +302,11 @@ TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) { BIND(&if_notobject); { - Node* const exception = MakeTypeError( - MessageTemplate::kIteratorValueNotAnObject, context, next_value); - var_exception.Bind(exception); - Goto(&if_exception); + Node* ret = CallRuntime( + Runtime::kThrowTypeError, context, + SmiConstant(MessageTemplate::kIteratorValueNotAnObject), next_value); + GotoIfException(ret, &if_exception, &var_exception); + Unreachable(); } } diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt index b784fa549e3ba9..039b8bd9125f43 100644 --- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt +++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt @@ -3,3 +3,9 @@ paused in throwCaught uncaught: false paused in throwUncaught uncaught: true +paused in throwInPromiseCaught +uncaught: false +paused in promiseUncaught +uncaught: true +paused in throwInMapConstructor +uncaught: true \ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js index 38b622d3dba0ff..8789943a892572 100644 --- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js +++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js @@ -7,6 +7,15 @@ let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspecto contextGroup.addScript( `function throwCaught() { try { throw new Error(); } catch (_) {} } function throwUncaught() { throw new Error(); } + function throwInPromiseCaught() { + var reject; + new Promise(function(res, rej) { reject = rej; }).catch(() => {}); + reject(); + } + function throwInPromiseUncaught() { + new Promise(function promiseUncaught() { throw new Error(); }); + } + function throwInMapConstructor() { new Map('a'); } function schedule(f) { setTimeout(f, 0); } `); @@ -22,4 +31,10 @@ Protocol.Debugger.onPaused(message => { Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" }) .then(() => Protocol.Runtime.evaluate( { "expression": "schedule(throwUncaught);" })) - .then(() => InspectorTest.completeTest()); + .then(() => Protocol.Runtime.evaluate( + { "expression": "schedule(throwInPromiseCaught);"})) + .then(() => Protocol.Runtime.evaluate( + { "expression": "schedule(throwInPromiseUncaught);"})) + .then(() => Protocol.Runtime.evaluate( + { "expression": "schedule(throwInMapConstructor);"})) + .then(() => InspectorTest.completeTest()); From 9c7a42a2e48e6dbcda7ce15bcf3988f3c4f0b23f Mon Sep 17 00:00:00 2001 From: Yihong Wang Date: Sat, 21 Oct 2017 23:16:50 -0700 Subject: [PATCH 229/379] src: explicitly register built-in modules Previously, built-in modules are registered before main() via __attribute__((constructor)) mechanism in GCC and similiar mechanism in MSVC. This causes some issues when node is built as static library. Calling module registration function for built-in modules in node::Init() helps to avoid the issues. Signed-off-by: Yihong Wang Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206 Backport-PR-URL: https://github.com/nodejs/node/pull/17625 PR-URL: https://github.com/nodejs/node/pull/16565 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- node.gyp | 1 + src/async_wrap.cc | 2 +- src/cares_wrap.cc | 2 +- src/fs_event_wrap.cc | 2 +- src/inspector_js_api.cc | 2 +- src/js_stream.cc | 2 +- src/node.cc | 24 +++++++++- src/node_buffer.cc | 2 +- src/node_config.cc | 2 +- src/node_contextify.cc | 2 +- src/node_crypto.cc | 2 +- src/node_file.cc | 2 +- src/node_http2.cc | 2 +- src/node_http_parser.cc | 2 +- src/node_i18n.cc | 2 +- src/node_internals.h | 85 +++++++++++++++++++++++++++++++++- src/node_os.cc | 2 +- src/node_perf.cc | 2 +- src/node_serdes.cc | 2 +- src/node_url.cc | 2 +- src/node_util.cc | 2 +- src/node_v8.cc | 3 +- src/node_zlib.cc | 2 +- src/pipe_wrap.cc | 2 +- src/process_wrap.cc | 2 +- src/signal_wrap.cc | 2 +- src/spawn_sync.cc | 2 +- src/stream_wrap.cc | 2 +- src/tcp_wrap.cc | 2 +- src/timer_wrap.cc | 2 +- src/tls_wrap.cc | 2 +- src/tty_wrap.cc | 2 +- src/udp_wrap.cc | 2 +- src/uv.cc | 3 +- test/cctest/node_module_reg.cc | 28 +++++++++++ 35 files changed, 167 insertions(+), 35 deletions(-) create mode 100644 test/cctest/node_module_reg.cc diff --git a/node.gyp b/node.gyp index 3c2f0d332a1a49..70636e776592d3 100644 --- a/node.gyp +++ b/node.gyp @@ -815,6 +815,7 @@ 'defines': [ 'NODE_WANT_INTERNALS=1' ], 'sources': [ + 'test/cctest/node_module_reg.cc', 'test/cctest/node_test_fixture.cc', 'test/cctest/test_aliased_buffer.cc', 'test/cctest/test_base64.cc', diff --git a/src/async_wrap.cc b/src/async_wrap.cc index a58c59c212da4e..99d14fb2933cda 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -831,4 +831,4 @@ void EmitAsyncDestroy(Isolate* isolate, async_context asyncContext) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(async_wrap, node::AsyncWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(async_wrap, node::AsyncWrap::Initialize) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 71aefe7d479241..6d16cce2c87f10 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -2259,4 +2259,4 @@ void Initialize(Local target, } // namespace cares_wrap } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(cares_wrap, node::cares_wrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(cares_wrap, node::cares_wrap::Initialize) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index cb011bcc0143b9..934b9d545c6ba4 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -221,4 +221,4 @@ void FSEventWrap::Close(const FunctionCallbackInfo& args) { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs_event_wrap, node::FSEventWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(fs_event_wrap, node::FSEventWrap::Initialize) diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 50374b7e24377b..428d8391f2581a 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -348,5 +348,5 @@ void InitInspectorBindings(Local target, Local unused, } // namespace inspector } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, node::inspector::InitInspectorBindings); diff --git a/src/js_stream.cc b/src/js_stream.cc index 1b102451cd6d82..7d4ad7a4e978a6 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -251,4 +251,4 @@ void JSStream::Initialize(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(js_stream, node::JSStream::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(js_stream, node::JSStream::Initialize) diff --git a/src/node.cc b/src/node.cc index 7384215106e191..5d9024bf5dca9a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -123,6 +123,16 @@ typedef int mode_t; extern char **environ; #endif +// This is used to load built-in modules. Instead of using +// __attribute__((constructor)), we call the _register_ +// function for each built-in modules explicitly in +// node::RegisterBuiltinModules(). This is only forward declaration. +// The definitions are in each module's implementation when calling +// the NODE_BUILTIN_MODULE_CONTEXT_AWARE. +#define V(modname) void _register_##modname(); + NODE_BUILTIN_MODULES(V) +#undef V + namespace node { using v8::Array; @@ -4575,6 +4585,9 @@ void Init(int* argc, // Initialize prog_start_time to get relative uptime. prog_start_time = static_cast(uv_now(uv_default_loop())); + // Register built-in modules + node::RegisterBuiltinModules(); + // Make inherited handles noninheritable. uv_disable_stdio_inheritance(); @@ -4984,11 +4997,18 @@ int Start(int argc, char** argv) { return exit_code; } +// Call built-in modules' _register_ function to +// do module registration explicitly. +void RegisterBuiltinModules() { +#define V(modname) _register_##modname(); + NODE_BUILTIN_MODULES(V) +#undef V +} } // namespace node #if !HAVE_INSPECTOR -static void InitEmptyBindings() {} +void InitEmptyBindings() {} -NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, InitEmptyBindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, InitEmptyBindings) #endif // !HAVE_INSPECTOR diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 15194723c7557a..b8f0cdda34afb6 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1304,4 +1304,4 @@ void Initialize(Local target, } // namespace Buffer } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(buffer, node::Buffer::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(buffer, node::Buffer::Initialize) diff --git a/src/node_config.cc b/src/node_config.cc index b39dc20f870bf4..bf46444cabd107 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -132,4 +132,4 @@ static void InitConfig(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::InitConfig) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 7c705236a3d3d1..420cc77e927076 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -1171,4 +1171,4 @@ void InitContextify(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(contextify, node::InitContextify) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(contextify, node::InitContextify) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 56c25d0a0a6547..1f868afbed4d03 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -6286,4 +6286,4 @@ void InitCrypto(Local target, } // namespace crypto } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(crypto, node::crypto::InitCrypto) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(crypto, node::crypto::InitCrypto) diff --git a/src/node_file.cc b/src/node_file.cc index 3593971ddaf26c..9e7f7bb0e3566a 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1473,4 +1473,4 @@ void InitFs(Local target, } // end namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs, node::InitFs) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(fs, node::InitFs) diff --git a/src/node_http2.cc b/src/node_http2.cc index 1c9a007252bc5f..b439ae588a7756 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2250,4 +2250,4 @@ HTTP_STATUS_CODES(V) } // namespace http2 } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(http2, node::http2::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(http2, node::http2::Initialize) diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 06d6a488263a3d..c990b763be3f76 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -821,4 +821,4 @@ void InitHttpParser(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(http_parser, node::InitHttpParser) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(http_parser, node::InitHttpParser) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 7c769226062e5d..101ae4c79e42d2 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -874,6 +874,6 @@ void Init(Local target, } // namespace i18n } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(icu, node::i18n::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(icu, node::i18n::Init) #endif // NODE_HAVE_I18N_SUPPORT diff --git a/src/node_internals.h b/src/node_internals.h index 9c8a80854a9932..0d766a59bf01a1 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -73,6 +73,81 @@ struct sockaddr; constant_attributes).FromJust(); \ } while (0) + +#if HAVE_OPENSSL +#define NODE_BUILTIN_OPENSSL_MODULES(V) V(crypto) V(tls_wrap) +#else +#define NODE_BUILTIN_OPENSSL_MODULES(V) +#endif + +#if NODE_HAVE_I18N_SUPPORT +#define NODE_BUILTIN_ICU_MODULES(V) V(icu) +#else +#define NODE_BUILTIN_ICU_MODULES(V) +#endif + +// A list of built-in modules. In order to do module registration +// in node::Init(), need to add built-in modules in the following list. +// Then in node::RegisterBuiltinModules(), it calls modules' registration +// function. This helps the built-in modules are loaded properly when +// node is built as static library. No need to depends on the +// __attribute__((constructor)) like mechanism in GCC. +#define NODE_BUILTIN_STANDARD_MODULES(V) \ + V(async_wrap) \ + V(buffer) \ + V(cares_wrap) \ + V(config) \ + V(contextify) \ + V(fs) \ + V(fs_event_wrap) \ + V(http2) \ + V(http_parser) \ + V(inspector) \ + V(js_stream) \ + V(module_wrap) \ + V(os) \ + V(performance) \ + V(pipe_wrap) \ + V(process_wrap) \ + V(serdes) \ + V(signal_wrap) \ + V(spawn_sync) \ + V(stream_wrap) \ + V(tcp_wrap) \ + V(timer_wrap) \ + V(tty_wrap) \ + V(udp_wrap) \ + V(url) \ + V(util) \ + V(uv) \ + V(v8) \ + V(zlib) + +#define NODE_BUILTIN_MODULES(V) \ + NODE_BUILTIN_STANDARD_MODULES(V) \ + NODE_BUILTIN_OPENSSL_MODULES(V) \ + NODE_BUILTIN_ICU_MODULES(V) + +#define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags) \ + static node::node_module _module = { \ + NODE_MODULE_VERSION, \ + flags, \ + nullptr, \ + __FILE__, \ + nullptr, \ + (node::addon_context_register_func) (regfunc), \ + NODE_STRINGIFY(modname), \ + priv, \ + nullptr \ + }; \ + void _register_ ## modname() { \ + node_module_register(&_module); \ + } + + +#define NODE_BUILTIN_MODULE_CONTEXT_AWARE(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_BUILTIN) + namespace node { // Set in node.cc by ParseArgs with the value of --openssl-config. @@ -205,6 +280,12 @@ void SetupProcessObject(Environment* env, int exec_argc, const char* const* exec_argv); +// Call _register functions for all of +// the built-in modules. Because built-in modules don't +// use the __attribute__((constructor)). Need to +// explicitly call the _register* functions. +void RegisterBuiltinModules(); + enum Endianness { kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h. kBigEndian @@ -328,8 +409,8 @@ class InternalCallbackScope { bool closed_ = false; }; -#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_INTERNAL) \ +#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_INTERNAL) } // namespace node diff --git a/src/node_os.cc b/src/node_os.cc index f09cd6fa5a03ff..d66f8c72c7cb5c 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -414,4 +414,4 @@ void Initialize(Local target, } // namespace os } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(os, node::os::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(os, node::os::Initialize) diff --git a/src/node_perf.cc b/src/node_perf.cc index a3b428bac94fc4..94c3a0f8e0c047 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -390,4 +390,4 @@ void Init(Local target, } // namespace performance } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(performance, node::performance::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(performance, node::performance::Init) diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 449fe4a551a162..5eb4455a0eb807 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -483,4 +483,4 @@ void InitializeSerdesBindings(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(serdes, node::InitializeSerdesBindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(serdes, node::InitializeSerdesBindings) diff --git a/src/node_url.cc b/src/node_url.cc index 337eb55f4427c0..67c6986da876c8 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2220,4 +2220,4 @@ static void Init(Local target, } // namespace url } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(url, node::url::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(url, node::url::Init) diff --git a/src/node_util.cc b/src/node_util.cc index cf26eca692e6ed..864cb0f0e0b1b0 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -239,4 +239,4 @@ void Initialize(Local target, } // namespace util } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(util, node::util::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(util, node::util::Initialize) diff --git a/src/node_v8.cc b/src/node_v8.cc index 695a2bf3237314..e2ffedcea4b1b3 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -20,6 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node.h" +#include "node_internals.h" #include "env-inl.h" #include "util-inl.h" #include "v8.h" @@ -200,4 +201,4 @@ void InitializeV8Bindings(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(v8, node::InitializeV8Bindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(v8, node::InitializeV8Bindings) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index a614cdbe01da03..21145a0d5bdeb1 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -710,4 +710,4 @@ void InitZlib(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(zlib, node::InitZlib) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(zlib, node::InitZlib) diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 5e061165e29bf8..76280f0ce77e86 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -240,4 +240,4 @@ void PipeWrap::Connect(const FunctionCallbackInfo& args) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(pipe_wrap, node::PipeWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(pipe_wrap, node::PipeWrap::Initialize) diff --git a/src/process_wrap.cc b/src/process_wrap.cc index a73e4d9779ed46..3667b0449e4e2c 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -311,4 +311,4 @@ class ProcessWrap : public HandleWrap { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(process_wrap, node::ProcessWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(process_wrap, node::ProcessWrap::Initialize) diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 59aa45078b3ae6..5117d3ab1d1988 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -126,4 +126,4 @@ class SignalWrap : public HandleWrap { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(signal_wrap, node::SignalWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(signal_wrap, node::SignalWrap::Initialize) diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 296b860a2ca3a9..2a524153a29d13 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -1073,5 +1073,5 @@ void SyncProcessRunner::KillTimerCloseCallback(uv_handle_t* handle) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(spawn_sync, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(spawn_sync, node::SyncProcessRunner::Initialize) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 1bd1d1d6390442..a737ed67b02c57 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -398,5 +398,5 @@ void LibuvStreamWrap::OnAfterWriteImpl(WriteWrap* w, void* ctx) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(stream_wrap, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(stream_wrap, node::LibuvStreamWrap::Initialize) diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 7cb5d4735b9d40..8dd14e2e16c18b 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -387,4 +387,4 @@ Local AddressToJS(Environment* env, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tcp_wrap, node::TCPWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tcp_wrap, node::TCPWrap::Initialize) diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index eeaee70a02331c..874c80d8d7095b 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -136,4 +136,4 @@ class TimerWrap : public HandleWrap { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(timer_wrap, node::TimerWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(timer_wrap, node::TimerWrap::Initialize) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index d1cfcd9f17e81f..3b899ea12d501d 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -982,4 +982,4 @@ void TLSWrap::Initialize(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tls_wrap, node::TLSWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tls_wrap, node::TLSWrap::Initialize) diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 17462f6d21e49a..18f9feca57a4c2 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -175,4 +175,4 @@ TTYWrap::TTYWrap(Environment* env, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tty_wrap, node::TTYWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tty_wrap, node::TTYWrap::Initialize) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 6349b0bdc330e9..e1f478ac4f0b71 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -512,4 +512,4 @@ uv_udp_t* UDPWrap::UVHandle() { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(udp_wrap, node::UDPWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(udp_wrap, node::UDPWrap::Initialize) diff --git a/src/uv.cc b/src/uv.cc index a13a0430c14b92..f70da1baae5deb 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -21,6 +21,7 @@ #include "uv.h" #include "node.h" +#include "node_internals.h" #include "env-inl.h" namespace node { @@ -58,4 +59,4 @@ void InitializeUV(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(uv, node::InitializeUV) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(uv, node::InitializeUV) diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc new file mode 100644 index 00000000000000..f8d9d03c1cdb99 --- /dev/null +++ b/test/cctest/node_module_reg.cc @@ -0,0 +1,28 @@ +// Need to create empty definition for these modules' +// registration function for cctest. Because when +// building cctest, the definitions for the following +// registration functions are not included. +void _register_cares_wrap() {} +void _register_config() {} +void _register_contextify() {} +void _register_fs() {} +void _register_fs_event_wrap() {} +void _register_http2() {} +void _register_http_parser() {} +void _register_js_stream() {} +void _register_module_wrap() {} +void _register_os() {} +void _register_pipe_wrap() {} +void _register_process_wrap() {} +void _register_serdes() {} +void _register_signal_wrap() {} +void _register_spawn_sync() {} +void _register_stream_wrap() {} +void _register_tcp_wrap() {} +void _register_timer_wrap() {} +void _register_tty_wrap() {} +void _register_udp_wrap() {} +void _register_util() {} +void _register_uv() {} +void _register_v8() {} +void _register_zlib() {} From bd55a7942274313c791cae1d1c1eaaf8286692bb Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 26 Nov 2017 16:43:20 -0500 Subject: [PATCH 230/379] doc: clarify fast-track of reversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17332 Reviewed-By: James M Snell Reviewed-By: Jon Moss Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Gibson Fahnestock Reviewed-By: Tobias Nießen Reviewed-By: Alexey Orlenko Reviewed-By: Gireesh Punathil Reviewed-By: Michaël Zasso Reviewed-By: Daniel Bevenius Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen Reviewed-By: Michael Dawson --- COLLABORATOR_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index d8d0651ff53ca4..c65317dd570dcf 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -127,7 +127,7 @@ can be fast-tracked and may be landed after a shorter delay: * Focused changes that affect only documentation and/or the test suite. `code-and-learn` and `good-first-issue` pull requests typically fall into this category. -* Changes that revert commit(s) and/or fix regressions. +* Changes that fix regressions. When a pull request is deemed suitable to be fast-tracked, label it with `fast-track`. The pull request can be landed once 2 or more collaborators From 87c885bd44e5c6c54ebe50324d3da76bfd9e094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Fri, 17 Nov 2017 17:54:06 +0000 Subject: [PATCH 231/379] build,win,msi: support WiX with VS2017 PR-URL: https://github.com/nodejs/node/pull/17101 Reviewed-By: Nikolai Vavilov --- BUILDING.md | 2 ++ vcbuild.bat | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index cd819b4b4779c7..e6d575f82737d5 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -209,6 +209,8 @@ Prerequisites: * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. +* **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) + and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). If the path to your build directory contains a space, the build will likely fail. diff --git a/vcbuild.bat b/vcbuild.bat index a765bcb439b3c5..a15620e726680a 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -192,12 +192,24 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64 :vs-set-2017 if defined target_env if "%target_env%" NEQ "vs2017" goto vs-set-2015 echo Looking for Visual Studio 2017 +call tools\msvs\vswhere_usability_wrapper.cmd +if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015 +if defined msi ( + echo Looking for WiX installation for Visual Studio 2017... + if not exist "%WIX%\SDK\VS2017" ( + echo Failed to find WiX install for Visual Studio 2017 + echo VS2017 support for WiX is only present starting at version 3.11 + goto vs-set-2015 + ) + if not exist "%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" ( + echo Failed to find the Wix Toolset Visual Studio 2017 Extension + goto vs-set-2015 + ) +) @rem check if VS2017 is already setup, and for the requested arch if "_%VisualStudioVersion%_" == "_15.0_" if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2017 @rem need to clear VSINSTALLDIR for vcvarsall to work as expected set "VSINSTALLDIR=" -call tools\msvs\vswhere_usability_wrapper.cmd -if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015 @rem prevent VsDevCmd.bat from changing the current working directory set "VSCMD_START_DIR=%CD%" set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg% @@ -354,7 +366,9 @@ if not defined msi goto run :msibuild echo Building node-v%FULLVERSION%-%target_arch%.msi -msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +set "msbsdk=" +if defined WindowsSDKVersion set "msbsdk=/p:WindowsTargetPlatformVersion=%WindowsSDKVersion:~0,-1%" +msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build %msbsdk% /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit if not defined sign goto upload From 742a4566ee66f93ecf08c3943a96f0aa37278df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 23 Nov 2017 08:47:20 +0100 Subject: [PATCH 232/379] build: fix test-v8 target Clean the deps/v8 directory before rebuilding node for the hash seed test. It is necessary to avoid the script added in [1] to use ignored files while generating `node-debug-support.cc`. [1]: https://github.com/nodejs/node/pull/14901 PR-URL: https://github.com/nodejs/node/pull/17269 Fixes: https://github.com/nodejs/node-v8/issues/26 Reviewed-By: Richard Lau Reviewed-By: Gibson Fahnestock Reviewed-By: Refael Ackermann --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index d1f3f661835d5f..50fabae087dfaa 100644 --- a/Makefile +++ b/Makefile @@ -501,6 +501,7 @@ test-v8: v8 --no-presubmit \ --shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \ $(TAP_V8) + git clean -fdxq -- deps/v8 @echo Testing hash seed $(MAKE) test-hash-seed From b719b77215bea946c60b5369f95fccba0879ab0e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 24 Nov 2017 01:50:28 +0100 Subject: [PATCH 233/379] module: print better message on esm syntax error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include the offending line in the output and underline the bad token. Before this commit, it printed "SyntaxError: Unexpected reserved word" without indicating where the syntax error is. Now it prints the line and underlines the offending token, like it does for syntax errors in CJS scripts. Minor changes are made to the test runner in order to support `*.mjs` files in test/message. Fixes: https://github.com/nodejs/node/issues/17277 PR-URL: https://github.com/nodejs/node/pull/17281 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Michaël Zasso --- .eslintignore | 1 + lib/module.js | 2 ++ src/module_wrap.cc | 10 +++++++++- src/node_internals.h | 2 +- test/fixtures/es-module-loaders/syntax-error.mjs | 2 ++ test/message/esm_display_syntax_error.mjs | 3 +++ test/message/esm_display_syntax_error.out | 7 +++++++ test/message/esm_display_syntax_error_module.mjs | 3 +++ test/message/esm_display_syntax_error_module.out | 7 +++++++ test/message/testcfg.py | 10 +++++----- 10 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/es-module-loaders/syntax-error.mjs create mode 100644 test/message/esm_display_syntax_error.mjs create mode 100644 test/message/esm_display_syntax_error.out create mode 100644 test/message/esm_display_syntax_error_module.mjs create mode 100644 test/message/esm_display_syntax_error_module.out diff --git a/.eslintignore b/.eslintignore index 4b6e6b5e0fa94a..b9b743fb536cf5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,6 +2,7 @@ lib/internal/v8_prof_polyfill.js lib/punycode.js test/addons/??_* test/fixtures +test/message/esm_display_syntax_error.mjs tools/eslint tools/icu tools/remark-* diff --git a/lib/module.js b/lib/module.js index 69e6feb6c9109d..6f767c86b9428a 100644 --- a/lib/module.js +++ b/lib/module.js @@ -23,6 +23,7 @@ const NativeModule = require('native_module'); const util = require('util'); +const { decorateErrorStack } = require('internal/util'); const internalModule = require('internal/module'); const { getURLFromFilePath } = require('internal/url'); const vm = require('vm'); @@ -471,6 +472,7 @@ Module._load = function(request, parent, isMain) { await ESMLoader.import(getURLFromFilePath(request).pathname); })() .catch((e) => { + decorateErrorStack(e); console.error(e); process.exit(1); }); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index dfba4d5b300f66..0e1f7c9eaf8685 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -103,9 +103,17 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { False(isolate), // is opaque (?) False(isolate), // is WASM True(isolate)); // is ES6 module + TryCatch try_catch(isolate); ScriptCompiler::Source source(source_text, origin); - if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) + if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { + CHECK(try_catch.HasCaught()); + CHECK(!try_catch.Message().IsEmpty()); + CHECK(!try_catch.Exception().IsEmpty()); + AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), + ErrorHandlingMode::MODULE_ERROR); + try_catch.ReThrow(); return; + } } Local that = args.This(); diff --git a/src/node_internals.h b/src/node_internals.h index 0d766a59bf01a1..d7fbcc992f6a0f 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -262,7 +262,7 @@ constexpr size_t arraysize(const T(&)[N]) { return N; } bool IsExceptionDecorated(Environment* env, v8::Local er); -enum ErrorHandlingMode { FATAL_ERROR, CONTEXTIFY_ERROR }; +enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR }; void AppendExceptionLine(Environment* env, v8::Local er, v8::Local message, diff --git a/test/fixtures/es-module-loaders/syntax-error.mjs b/test/fixtures/es-module-loaders/syntax-error.mjs new file mode 100644 index 00000000000000..bda4a7e6ebe3a3 --- /dev/null +++ b/test/fixtures/es-module-loaders/syntax-error.mjs @@ -0,0 +1,2 @@ +'use strict'; +await async () => 0; diff --git a/test/message/esm_display_syntax_error.mjs b/test/message/esm_display_syntax_error.mjs new file mode 100644 index 00000000000000..829186725554bf --- /dev/null +++ b/test/message/esm_display_syntax_error.mjs @@ -0,0 +1,3 @@ +// Flags: --experimental-modules +'use strict'; +await async () => 0; diff --git a/test/message/esm_display_syntax_error.out b/test/message/esm_display_syntax_error.out new file mode 100644 index 00000000000000..0ca2bba5494470 --- /dev/null +++ b/test/message/esm_display_syntax_error.out @@ -0,0 +1,7 @@ +(node:*) ExperimentalWarning: The ESM module loader is experimental. +file:///*/test/message/esm_display_syntax_error.mjs:3 +await async () => 0; +^^^^^ +SyntaxError: Unexpected reserved word + at loaders.set (internal/loader/ModuleRequest.js:*:*) + at diff --git a/test/message/esm_display_syntax_error_module.mjs b/test/message/esm_display_syntax_error_module.mjs new file mode 100644 index 00000000000000..e74b70bec8cc28 --- /dev/null +++ b/test/message/esm_display_syntax_error_module.mjs @@ -0,0 +1,3 @@ +// Flags: --experimental-modules +import '../common'; +import '../fixtures/es-module-loaders/syntax-error'; diff --git a/test/message/esm_display_syntax_error_module.out b/test/message/esm_display_syntax_error_module.out new file mode 100644 index 00000000000000..a76b72bdb69b63 --- /dev/null +++ b/test/message/esm_display_syntax_error_module.out @@ -0,0 +1,7 @@ +(node:*) ExperimentalWarning: The ESM module loader is experimental. +file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2 +await async () => 0; +^^^^^ +SyntaxError: Unexpected reserved word + at loaders.set (internal/loader/ModuleRequest.js:*:*) + at diff --git a/test/message/testcfg.py b/test/message/testcfg.py index 3c668459079f0a..819dfa12c5b631 100644 --- a/test/message/testcfg.py +++ b/test/message/testcfg.py @@ -114,18 +114,18 @@ def __init__(self, context, root): def Ls(self, path): if isdir(path): - return [f[:-3] for f in os.listdir(path) if f.endswith('.js')] + return [f for f in os.listdir(path) + if f.endswith('.js') or f.endswith('.mjs')] else: - return [] + return [] def ListTests(self, current_path, path, arch, mode): all_tests = [current_path + [t] for t in self.Ls(self.root)] result = [] for test in all_tests: if self.Contains(path, test): - file_prefix = join(self.root, reduce(join, test[1:], "")) - file_path = file_prefix + ".js" - output_path = file_prefix + ".out" + file_path = join(self.root, reduce(join, test[1:], '')) + output_path = file_path[:file_path.rfind('.')] + '.out' if not exists(output_path): raise Exception("Could not find %s" % output_path) result.append(MessageTestCase(test, file_path, output_path, From 6e3a8be43ae661aed6161842897edce3f8923c9e Mon Sep 17 00:00:00 2001 From: Leko Date: Mon, 27 Nov 2017 17:53:12 +0900 Subject: [PATCH 234/379] test: replace function with arrow function 1. Among the list of Code and Learn, I solved the unfinished task of replacing function with arrow function: https://github.com/nodejs/code-and-learn/issues/72#issuecomment-345667395 2. Replace arrow function with shorter property syntax Arrow function makes `this` lexical scope. But toString expects evaluate `this` in runtime. 3. Replace this with null makeBlock does not need `this`. update `this` with `null` to clarify the intent. PR-URL: https://github.com/nodejs/node/pull/17345 Reviewed-By: Anna Henningsen Reviewed-By: Jon Moss Reviewed-By: Yosuke Furukawa --- test/parallel/test-assert.js | 18 +++++++------- ...in-top-level-error-handler-clears-stack.js | 6 ++--- test/parallel/test-querystring.js | 24 +++++++++---------- test/parallel/test-writeint.js | 24 +++++++++---------- test/parallel/test-zerolengthbufferbug.js | 8 +++---- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index eda477163cd9b5..87422e5ca0665b 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -26,8 +26,8 @@ const a = assert; function makeBlock(f) { const args = Array.prototype.slice.call(arguments, 1); - return function() { - return f.apply(this, args); + return () => { + return f.apply(null, args); }; } @@ -183,7 +183,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, a1, a2)); // having an identical prototype property const nbRoot = { - toString: function() { return `${this.first} ${this.last}`; } + toString() { return `${this.first} ${this.last}`; } }; function nameBuilder(first, last) { @@ -458,10 +458,10 @@ assert.throws(makeBlock(thrower, TypeError)); 'a.doesNotThrow is not catching type matching errors'); } -assert.throws(function() { assert.ifError(new Error('test error')); }, +assert.throws(() => { assert.ifError(new Error('test error')); }, /^Error: test error$/); -assert.doesNotThrow(function() { assert.ifError(null); }); -assert.doesNotThrow(function() { assert.ifError(); }); +assert.doesNotThrow(() => { assert.ifError(null); }); +assert.doesNotThrow(() => { assert.ifError(); }); assert.throws(() => { assert.doesNotThrow(makeBlock(thrower, Error), 'user message'); @@ -501,7 +501,7 @@ assert.throws(() => { let threw = false; try { assert.throws( - function() { + () => { throw ({}); // eslint-disable-line no-throw-literal }, Array @@ -516,7 +516,7 @@ assert.throws(() => { a.throws(makeBlock(thrower, TypeError), /\[object Object\]/); // use a fn to validate error object -a.throws(makeBlock(thrower, TypeError), function(err) { +a.throws(makeBlock(thrower, TypeError), (err) => { if ((err instanceof TypeError) && /\[object Object\]/.test(err)) { return true; } @@ -619,7 +619,7 @@ testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity }, let threw = false; try { // eslint-disable-next-line no-restricted-syntax - assert.throws(function() { + assert.throws(() => { assert.ifError(null); }); } catch (e) { diff --git a/test/parallel/test-domain-top-level-error-handler-clears-stack.js b/test/parallel/test-domain-top-level-error-handler-clears-stack.js index f2095f09b7836c..05d5fca4671826 100644 --- a/test/parallel/test-domain-top-level-error-handler-clears-stack.js +++ b/test/parallel/test-domain-top-level-error-handler-clears-stack.js @@ -9,8 +9,8 @@ const domain = require('domain'); */ const d = domain.create(); -d.on('error', common.mustCall(function() { - process.nextTick(function() { +d.on('error', common.mustCall(() => { + process.nextTick(() => { // Scheduling a callback with process.nextTick will enter a _new_ domain, // and the callback will be called after the domain that handled the error // was exited. So there should be only one domain on the domains stack if @@ -29,6 +29,6 @@ d.on('error', common.mustCall(function() { }); })); -d.run(function() { +d.run(() => { throw new Error('Error from domain'); }); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 400431fd2cb132..76049584dbe458 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -129,7 +129,7 @@ const qsWeirdObjects = [ [{ regexp: /./g }, 'regexp=', { 'regexp': '' }], // eslint-disable-next-line no-unescaped-regexp-dot [{ regexp: new RegExp('.', 'g') }, 'regexp=', { 'regexp': '' }], - [{ fn: function() {} }, 'fn=', { 'fn': '' }], + [{ fn: () => {} }, 'fn=', { 'fn': '' }], [{ fn: new Function('') }, 'fn=', { 'fn': '' }], [{ math: Math }, 'math=', { 'math': '' }], [{ e: extendedFunction }, 'e=', { 'e': '' }], @@ -192,7 +192,7 @@ function check(actual, expected, input) { `Expected keys: ${inspect(expectedKeys)}`; } assert.deepStrictEqual(actualKeys, expectedKeys, msg); - expectedKeys.forEach(function(key) { + expectedKeys.forEach((key) => { if (typeof input === 'string') { msg = `Input: ${inspect(input)}\n` + `Key: ${inspect(key)}\n` + @@ -206,21 +206,21 @@ function check(actual, expected, input) { } // test that the canonical qs is parsed properly. -qsTestCases.forEach(function(testCase) { +qsTestCases.forEach((testCase) => { check(qs.parse(testCase[0]), testCase[2], testCase[0]); }); // test that the colon test cases can do the same -qsColonTestCases.forEach(function(testCase) { +qsColonTestCases.forEach((testCase) => { check(qs.parse(testCase[0], ';', ':'), testCase[2], testCase[0]); }); // test the weird objects, that they get parsed properly -qsWeirdObjects.forEach(function(testCase) { +qsWeirdObjects.forEach((testCase) => { check(qs.parse(testCase[1]), testCase[2], testCase[1]); }); -qsNoMungeTestCases.forEach(function(testCase) { +qsNoMungeTestCases.forEach((testCase) => { assert.deepStrictEqual(testCase[0], qs.stringify(testCase[1], '&', '=')); }); @@ -258,15 +258,15 @@ qsNoMungeTestCases.forEach(function(testCase) { // now test stringifying // basic -qsTestCases.forEach(function(testCase) { +qsTestCases.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[2])); }); -qsColonTestCases.forEach(function(testCase) { +qsColonTestCases.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[2], ';', ':')); }); -qsWeirdObjects.forEach(function(testCase) { +qsWeirdObjects.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[0])); }); @@ -300,7 +300,7 @@ assert.strictEqual('foo=', qs.stringify({ foo: Infinity })); assert.strictEqual(f, 'a=b&q=x%3Dy%26y%3Dz'); } -assert.doesNotThrow(function() { +assert.doesNotThrow(() => { qs.parse(undefined); }); @@ -432,7 +432,7 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); } // Test QueryString.unescapeBuffer -qsUnescapeTestCases.forEach(function(testCase) { +qsUnescapeTestCases.forEach((testCase) => { assert.strictEqual(qs.unescape(testCase[0]), testCase[1]); assert.strictEqual(qs.unescapeBuffer(testCase[0]).toString(), testCase[1]); }); @@ -440,7 +440,7 @@ qsUnescapeTestCases.forEach(function(testCase) { // test overriding .unescape { const prevUnescape = qs.unescape; - qs.unescape = function(str) { + qs.unescape = (str) => { return str.replace(/o/g, '_'); }; check( diff --git a/test/parallel/test-writeint.js b/test/parallel/test-writeint.js index 66dc13997e2785..1e0a8e8812ecb2 100644 --- a/test/parallel/test-writeint.js +++ b/test/parallel/test-writeint.js @@ -41,10 +41,10 @@ function test8(clazz) { assert.strictEqual(0xfb, buffer[1]); /* Make sure we handle truncation correctly */ - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0xabc, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0xabc, 0); }, errorOutOfBounds); @@ -54,10 +54,10 @@ function test8(clazz) { assert.strictEqual(0x7f, buffer[0]); assert.strictEqual(0x80, buffer[1]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0x7f + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(-0x80 - 1, 0); }, errorOutOfBounds); } @@ -94,10 +94,10 @@ function test16(clazz) { assert.strictEqual(0xff, buffer[1]); assert.strictEqual(0x80, buffer[2]); assert.strictEqual(0x00, buffer[3]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16BE(0x7fff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16BE(-0x8000 - 1, 0); }, errorOutOfBounds); @@ -107,10 +107,10 @@ function test16(clazz) { assert.strictEqual(0x7f, buffer[1]); assert.strictEqual(0x00, buffer[2]); assert.strictEqual(0x80, buffer[3]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16LE(0x7fff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16LE(-0x8000 - 1, 0); }, errorOutOfBounds); } @@ -163,10 +163,10 @@ function test32(clazz) { assert.strictEqual(0x00, buffer[5]); assert.strictEqual(0x00, buffer[6]); assert.strictEqual(0x00, buffer[7]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32BE(0x7fffffff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32BE(-0x80000000 - 1, 0); }, errorOutOfBounds); @@ -180,10 +180,10 @@ function test32(clazz) { assert.strictEqual(0x00, buffer[5]); assert.strictEqual(0x00, buffer[6]); assert.strictEqual(0x80, buffer[7]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32LE(0x7fffffff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32LE(-0x80000000 - 1, 0); }, errorOutOfBounds); } diff --git a/test/parallel/test-zerolengthbufferbug.js b/test/parallel/test-zerolengthbufferbug.js index 75aaa2f48dd8f3..0e1e976e568818 100644 --- a/test/parallel/test-zerolengthbufferbug.js +++ b/test/parallel/test-zerolengthbufferbug.js @@ -4,7 +4,7 @@ const common = require('../common'); const http = require('http'); -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { const buffer = Buffer.alloc(0); // FIXME: WTF gjslint want this? res.writeHead(200, { 'Content-Type': 'text/html', @@ -12,12 +12,12 @@ const server = http.createServer(function(req, res) { res.end(buffer); }); -server.listen(0, common.mustCall(function() { - http.get({ port: this.address().port }, common.mustCall(function(res) { +server.listen(0, common.mustCall(() => { + http.get({ port: server.address().port }, common.mustCall((res) => { res.on('data', common.mustNotCall()); - res.on('end', function(d) { + res.on('end', (d) => { server.close(); }); })); From 6a7a59a8c1bd6c2f96b21c84b3149ce193ceb706 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 27 Nov 2017 01:31:24 +0100 Subject: [PATCH 235/379] src: remove `ClearFatalExceptionHandlers()` At its call sites, `ClearFatalExceptionHandlers()` was used to make the process crash as soon as possible once an exception occurred, without giving JS land a chance to interfere. `ClearFatalExceptionHandlers()` awkwardly removed the current domain and any `uncaughtException` handlers, whereas a clearer way is to execute the relevant reporting (and `exit()`) code directly. PR-URL: https://github.com/nodejs/node/pull/17333 Refs: https://github.com/nodejs/node/pull/17159 Refs: https://github.com/nodejs/node/pull/17324 Reviewed-By: Anatoli Papirovski Reviewed-By: Timothy Gu Reviewed-By: Daniel Bevenius Reviewed-By: Andreas Madsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/async_wrap.cc | 53 +++++++++++++------------------------------- src/node.cc | 37 +++++++++++++------------------ src/node_internals.h | 16 ++++++++----- src/node_url.cc | 23 +++++++++---------- 4 files changed, 51 insertions(+), 78 deletions(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 99d14fb2933cda..b355841c3419d0 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -144,7 +144,7 @@ static void DestroyAsyncIdsCallback(uv_timer_t* handle) { Context::Scope context_scope(env->context()); Local fn = env->async_hooks_destroy_function(); - TryCatch try_catch(env->isolate()); + FatalTryCatch try_catch(env); do { std::vector destroy_async_id_list; @@ -157,11 +157,8 @@ static void DestroyAsyncIdsCallback(uv_timer_t* handle) { MaybeLocal ret = fn->Call( env->context(), Undefined(env->isolate()), 1, &async_id_value); - if (ret.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(env->isolate(), try_catch); - UNREACHABLE(); - } + if (ret.IsEmpty()) + return; } } while (!env->destroy_async_id_list()->empty()); } @@ -175,14 +172,9 @@ void AsyncWrap::EmitPromiseResolve(Environment* env, double async_id) { Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_promise_resolve_function(); - TryCatch try_catch(env->isolate()); - MaybeLocal ar = fn->Call( - env->context(), Undefined(env->isolate()), 1, &async_id_value); - if (ar.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(env->isolate(), try_catch); - UNREACHABLE(); - } + FatalTryCatch try_catch(env); + fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) + .FromMaybe(Local()); } @@ -209,14 +201,9 @@ void AsyncWrap::EmitBefore(Environment* env, double async_id) { Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_before_function(); - TryCatch try_catch(env->isolate()); - MaybeLocal ar = fn->Call( - env->context(), Undefined(env->isolate()), 1, &async_id_value); - if (ar.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(env->isolate(), try_catch); - UNREACHABLE(); - } + FatalTryCatch try_catch(env); + fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) + .FromMaybe(Local()); } @@ -245,14 +232,9 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) { // end of _fatalException(). Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_after_function(); - TryCatch try_catch(env->isolate()); - MaybeLocal ar = fn->Call( - env->context(), Undefined(env->isolate()), 1, &async_id_value); - if (ar.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(env->isolate(), try_catch); - UNREACHABLE(); - } + FatalTryCatch try_catch(env); + fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) + .FromMaybe(Local()); } class PromiseWrap : public AsyncWrap { @@ -753,14 +735,9 @@ void AsyncWrap::EmitAsyncInit(Environment* env, object, }; - TryCatch try_catch(env->isolate()); - MaybeLocal ret = init_fn->Call( - env->context(), object, arraysize(argv), argv); - - if (ret.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(env->isolate(), try_catch); - } + FatalTryCatch try_catch(env); + init_fn->Call(env->context(), object, arraysize(argv), argv) + .FromMaybe(Local()); } diff --git a/src/node.cc b/src/node.cc index 5d9024bf5dca9a..d5631a5b061011 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1818,6 +1818,8 @@ void AppendExceptionLine(Environment* env, static void ReportException(Environment* env, Local er, Local message) { + CHECK(!er.IsEmpty()); + CHECK(!message.IsEmpty()); HandleScope scope(env->isolate()); AppendExceptionLine(env, er, message, FATAL_ERROR); @@ -1887,6 +1889,10 @@ static void ReportException(Environment* env, } fflush(stderr); + +#if HAVE_INSPECTOR + env->inspector_agent()->FatalException(er, message); +#endif } @@ -2746,6 +2752,15 @@ NO_RETURN void FatalError(const char* location, const char* message) { } +FatalTryCatch::~FatalTryCatch() { + if (HasCaught()) { + HandleScope scope(env_->isolate()); + ReportException(env_, *this); + exit(7); + } +} + + void FatalException(Isolate* isolate, Local error, Local message) { @@ -2788,9 +2803,6 @@ void FatalException(Isolate* isolate, } if (exit_code) { -#if HAVE_INSPECTOR - env->inspector_agent()->FatalException(error, message); -#endif exit(exit_code); } } @@ -2810,25 +2822,6 @@ static void OnMessage(Local message, Local error) { FatalException(Isolate::GetCurrent(), error, message); } - -void ClearFatalExceptionHandlers(Environment* env) { - Local process = env->process_object(); - Local events = - process->Get(env->context(), env->events_string()).ToLocalChecked(); - - if (events->IsObject()) { - events.As()->Set( - env->context(), - OneByteString(env->isolate(), "uncaughtException"), - Undefined(env->isolate())).FromJust(); - } - - process->Set( - env->context(), - env->domain_string(), - Undefined(env->isolate())).FromJust(); -} - // Call process.emitWarning(str), fmt is a snprintf() format string void ProcessEmitWarning(Environment* env, const char* fmt, ...) { char warning[1024]; diff --git a/src/node_internals.h b/src/node_internals.h index d7fbcc992f6a0f..ed64b0fdbe183f 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -270,6 +270,17 @@ void AppendExceptionLine(Environment* env, NO_RETURN void FatalError(const char* location, const char* message); +// Like a `TryCatch` but exits the process if an exception was caught. +class FatalTryCatch : public v8::TryCatch { + public: + explicit FatalTryCatch(Environment* env) + : TryCatch(env->isolate()), env_(env) {} + ~FatalTryCatch(); + + private: + Environment* env_; +}; + void ProcessEmitWarning(Environment* env, const char* fmt, ...); void FillStatsArray(double* fields, const uv_stat_t* s); @@ -323,11 +334,6 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land. }; -// Clear any domain and/or uncaughtException handlers to force the error's -// propagation and shutdown the process. Use this to force the process to exit -// by clearing all callbacks that could handle the error. -void ClearFatalExceptionHandlers(Environment* env); - namespace Buffer { v8::MaybeLocal Copy(Environment* env, const char* data, size_t len); v8::MaybeLocal New(Environment* env, size_t size); diff --git a/src/node_url.cc b/src/node_url.cc index 67c6986da876c8..c9c8ccd579744e 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2172,19 +2172,16 @@ const Local URL::ToObject(Environment* env) const { }; SetArgs(env, argv, &context_); - TryCatch try_catch(isolate); - - // The SetURLConstructor method must have been called already to - // set the constructor function used below. SetURLConstructor is - // called automatically when the internal/url.js module is loaded - // during the internal/bootstrap_node.js processing. - MaybeLocal ret = - env->url_constructor_function() - ->Call(env->context(), undef, 9, argv); - - if (ret.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(isolate, try_catch); + MaybeLocal ret; + { + FatalTryCatch try_catch(env); + + // The SetURLConstructor method must have been called already to + // set the constructor function used below. SetURLConstructor is + // called automatically when the internal/url.js module is loaded + // during the internal/bootstrap_node.js processing. + ret = env->url_constructor_function() + ->Call(env->context(), undef, arraysize(argv), argv); } return ret.ToLocalChecked(); From 9f282ddaf7f0f2b6ad7d98ce87079ce974ef538c Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sun, 26 Nov 2017 23:33:17 -0800 Subject: [PATCH 236/379] deps: cherry-pick 1420e44db0 from upstream V8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [coverage] Correctly free DebugInfo in the absence of breakpoints It's quite possible for DebugInfos to exist without the presence of a bytecode array, since DebugInfos are created for all functions for which we have a CoverageInfo. Free such objects properly. Also move the corresponding deletion of CoverageInfos on unload up before the early exit. Bug: v8:6000 Change-Id: Idde45b222290aa8b6828b61ff2251918b8ed2aed Reviewed-on: https://chromium-review.googlesource.com/664811 Reviewed-by: Yang Guo Commit-Queue: Jakob Gruber Cr-Commit-Position: refs/heads/master@{#48024} Fixes crash when passing Profiler.startPreciseCoverage before Debug.paused is received. PR-URL: https://github.com/nodejs/node/pull/17344 Refs: https://github.com/v8/v8/commit/1420e44db0ac3631687deb9fc6816ac97b9f499c Refs: https://github.com/bcoe/c8/pull/6#discussion_r153121287 Reviewed-By: Ben Noordhuis Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig --- common.gypi | 2 +- deps/v8/src/debug/debug.cc | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common.gypi b/common.gypi index 3b53721cd493e0..93d9e3ceee7247 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.14', + 'v8_embedder_string': '-node.15', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/debug/debug.cc b/deps/v8/src/debug/debug.cc index e2beaed6abc549..966be62e63617f 100644 --- a/deps/v8/src/debug/debug.cc +++ b/deps/v8/src/debug/debug.cc @@ -338,13 +338,12 @@ bool Debug::Load() { void Debug::Unload() { ClearAllBreakPoints(); ClearStepping(); + if (FLAG_block_coverage) RemoveAllCoverageInfos(); RemoveDebugDelegate(); // Return debugger is not loaded. if (!is_loaded()) return; - if (FLAG_block_coverage) RemoveAllCoverageInfos(); - // Clear debugger context global handle. GlobalHandles::Destroy(Handle::cast(debug_context_).location()); debug_context_ = Handle(); @@ -643,8 +642,11 @@ void Debug::ApplyBreakPoints(Handle debug_info) { } void Debug::ClearBreakPoints(Handle debug_info) { + // If we attempt to clear breakpoints but none exist, simply return. This can + // happen e.g. CoverageInfos exit but no breakpoints are set. + if (!debug_info->HasDebugBytecodeArray()) return; + DisallowHeapAllocation no_gc; - DCHECK(debug_info->HasDebugBytecodeArray()); for (BreakIterator it(debug_info); !it.Done(); it.Next()) { it.ClearDebugBreak(); } From fd501b31c6ece11c26d522a6249f853668ee629f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 16 Nov 2017 00:43:12 +0100 Subject: [PATCH 237/379] timers: cross JS/C++ border less frequently This removes the `process._needImmediateCallback` property and its semantics of having a 1/0 switch that tells C++ whether immediates are currently scheduled. Instead, a counter keeping track of all immediates is created, that can be increased on `setImmediate()` or decreased when an immediate is run or cleared. This is faster, because rather than reading/writing a C++ getter, this operation can be performed as a direct memory read/write via a typed array. The only C++ call that is left to make is activating the native handles upon creation of the first `Immediate` after the queue is empty. One other (good!) side-effect is that `immediate._destroyed` now reliably tells whether an `immediate` is still scheduled to run or not. Also, as a nice extra, this should make it easier to implement an internal variant of `setImmediate` for C++ that piggybacks off the same mechanism, which should be useful at least for async hooks and HTTP/2. Benchmark results: $ ./node benchmark/compare.js --new ./node --old ./node-master-1b093cb93df0 --runs 10 --filter immediate timers | Rscript benchmark/compare.R [00:08:53|% 100| 4/4 files | 20/20 runs | 1/1 configs]: Done improvement confidence p.value timers/immediate.js type="breadth" thousands=2000 25.61 % ** 1.432301e-03 timers/immediate.js type="breadth1" thousands=2000 7.66 % 1.320233e-01 timers/immediate.js type="breadth4" thousands=2000 4.61 % 5.669053e-01 timers/immediate.js type="clear" thousands=2000 311.40 % *** 3.896291e-07 timers/immediate.js type="depth" thousands=2000 17.54 % ** 9.755389e-03 timers/immediate.js type="depth1" thousands=2000 17.09 % *** 7.176229e-04 timers/set-immediate-breadth-args.js millions=5 10.63 % * 4.250034e-02 timers/set-immediate-breadth.js millions=10 20.62 % *** 9.150439e-07 timers/set-immediate-depth-args.js millions=10 17.97 % *** 6.819135e-10 PR-URL: https://github.com/nodejs/node/pull/17064 Reviewed-By: Refael Ackermann Reviewed-By: Minwoo Jung Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- lib/timers.js | 46 ++++++++++++++------------- src/env-inl.h | 6 ++++ src/env.h | 4 +++ src/node.cc | 86 +++++++++++++++++++++------------------------------ 4 files changed, 69 insertions(+), 73 deletions(-) diff --git a/lib/timers.js b/lib/timers.js index ce27be69450249..56f02fe1ea644c 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -47,6 +47,13 @@ const { kInit, kDestroy, kAsyncIdCounter } = async_wrap.constants; const async_id_symbol = Symbol('asyncId'); const trigger_async_id_symbol = Symbol('triggerAsyncId'); +/* This is an Uint32Array for easier sharing with C++ land. */ +const scheduledImmediateCount = process._scheduledImmediateCount; +delete process._scheduledImmediateCount; +/* Kick off setImmediate processing */ +const activateImmediateCheck = process._activateImmediateCheck; +delete process._activateImmediateCheck; + // Timeout values > TIMEOUT_MAX are set to 1. const TIMEOUT_MAX = 2147483647; // 2^31-1 @@ -742,15 +749,9 @@ function processImmediate() { else immediate = next; } - - // Only round-trip to C++ land if we have to. Calling clearImmediate() on an - // immediate that's in |queue| is okay. Worst case is we make a superfluous - // call to NeedImmediateCallbackSetter(). - if (!immediateQueue.head) { - process._needImmediateCallback = false; - } } +process._immediateCallback = processImmediate; // An optimization so that the try/finally only de-optimizes (since at least v8 // 4.7) what is in this smaller function. @@ -762,13 +763,17 @@ function tryOnImmediate(immediate, oldTail) { runCallback(immediate); threw = false; } finally { - // clearImmediate checks _onImmediate === null for kDestroy hooks. immediate._onImmediate = null; if (!threw) emitAfter(immediate[async_id_symbol]); - if (async_hook_fields[kDestroy] > 0 && !immediate._destroyed) { - emitDestroy(immediate[async_id_symbol]); + + if (!immediate._destroyed) { immediate._destroyed = true; + scheduledImmediateCount[0]--; + + if (async_hook_fields[kDestroy] > 0) { + emitDestroy(immediate[async_id_symbol]); + } } if (threw && immediate._idleNext) { @@ -870,10 +875,9 @@ function createImmediate(args, callback) { immediate._argv = args; immediate._onImmediate = callback; - if (!process._needImmediateCallback) { - process._needImmediateCallback = true; - process._immediateCallback = processImmediate; - } + if (scheduledImmediateCount[0] === 0) + activateImmediateCheck(); + scheduledImmediateCount[0]++; immediateQueue.append(immediate); @@ -884,18 +888,16 @@ function createImmediate(args, callback) { exports.clearImmediate = function(immediate) { if (!immediate) return; - if (async_hook_fields[kDestroy] > 0 && - immediate._onImmediate !== null && - !immediate._destroyed) { - emitDestroy(immediate[async_id_symbol]); + if (!immediate._destroyed) { + scheduledImmediateCount[0]--; immediate._destroyed = true; + + if (async_hook_fields[kDestroy] > 0) { + emitDestroy(immediate[async_id_symbol]); + } } immediate._onImmediate = null; immediateQueue.remove(immediate); - - if (!immediateQueue.head) { - process._needImmediateCallback = false; - } }; diff --git a/src/env-inl.h b/src/env-inl.h index 0ce13537995fd0..b4ec89c0a0d135 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -267,6 +267,7 @@ inline Environment::Environment(IsolateData* isolate_data, abort_on_uncaught_exception_(false), emit_napi_warning_(true), makecallback_cntr_(0), + scheduled_immediate_count_(isolate_, 1), #if HAVE_INSPECTOR inspector_agent_(new inspector::Agent(this)), #endif @@ -486,6 +487,11 @@ inline void Environment::set_fs_stats_field_array(double* fields) { fs_stats_field_array_ = fields; } +inline AliasedBuffer& +Environment::scheduled_immediate_count() { + return scheduled_immediate_count_; +} + inline performance::performance_state* Environment::performance_state() { return performance_state_; } diff --git a/src/env.h b/src/env.h index 248db2d9b93974..f0444b24d4fa86 100644 --- a/src/env.h +++ b/src/env.h @@ -601,6 +601,8 @@ class Environment { inline double* fs_stats_field_array() const; inline void set_fs_stats_field_array(double* fields); + inline AliasedBuffer& scheduled_immediate_count(); + inline performance::performance_state* performance_state(); inline std::map* performance_marks(); @@ -696,6 +698,8 @@ class Environment { size_t makecallback_cntr_; std::vector destroy_async_id_list_; + AliasedBuffer scheduled_immediate_count_; + performance::performance_state* performance_state_ = nullptr; std::map performance_marks_; diff --git a/src/node.cc b/src/node.cc index d5631a5b061011..5d175df3560032 100644 --- a/src/node.cc +++ b/src/node.cc @@ -399,25 +399,6 @@ static void PrintErrorString(const char* format, ...) { } -static void CheckImmediate(uv_check_t* handle) { - Environment* env = Environment::from_immediate_check_handle(handle); - HandleScope scope(env->isolate()); - Context::Scope context_scope(env->context()); - MakeCallback(env->isolate(), - env->process_object(), - env->immediate_callback_string(), - 0, - nullptr, - {0, 0}).ToLocalChecked(); -} - - -static void IdleImmediateDummy(uv_idle_t* handle) { - // Do nothing. Only for maintaining event loop. - // TODO(bnoordhuis) Maybe make libuv accept nullptr idle callbacks. -} - - static inline const char *errno_string(int errorno) { #define ERRNO_CASE(e) case e: return #e; switch (errorno) { @@ -3274,39 +3255,40 @@ static void DebugEnd(const FunctionCallbackInfo& args); namespace { -void NeedImmediateCallbackGetter(Local property, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - const uv_check_t* immediate_check_handle = env->immediate_check_handle(); - bool active = uv_is_active( - reinterpret_cast(immediate_check_handle)); - info.GetReturnValue().Set(active); +bool MaybeStopImmediate(Environment* env) { + if (env->scheduled_immediate_count()[0] == 0) { + uv_check_stop(env->immediate_check_handle()); + uv_idle_stop(env->immediate_idle_handle()); + return true; + } + return false; } +void CheckImmediate(uv_check_t* handle) { + Environment* env = Environment::from_immediate_check_handle(handle); + HandleScope scope(env->isolate()); + Context::Scope context_scope(env->context()); -void NeedImmediateCallbackSetter( - Local property, - Local value, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); + if (MaybeStopImmediate(env)) + return; - uv_check_t* immediate_check_handle = env->immediate_check_handle(); - bool active = uv_is_active( - reinterpret_cast(immediate_check_handle)); + MakeCallback(env->isolate(), + env->process_object(), + env->immediate_callback_string(), + 0, + nullptr, + {0, 0}).ToLocalChecked(); - if (active == value->BooleanValue()) - return; + MaybeStopImmediate(env); +} - uv_idle_t* immediate_idle_handle = env->immediate_idle_handle(); - if (active) { - uv_check_stop(immediate_check_handle); - uv_idle_stop(immediate_idle_handle); - } else { - uv_check_start(immediate_check_handle, CheckImmediate); - // Idle handle is needed only to stop the event loop from blocking in poll. - uv_idle_start(immediate_idle_handle, IdleImmediateDummy); - } +void ActivateImmediateCheck(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + uv_check_start(env->immediate_check_handle(), CheckImmediate); + // Idle handle is needed only to stop the event loop from blocking in poll. + uv_idle_start(env->immediate_idle_handle(), + [](uv_idle_t*){ /* do nothing, just keep the loop running */ }); } @@ -3533,12 +3515,11 @@ void SetupProcessObject(Environment* env, FIXED_ONE_BYTE_STRING(env->isolate(), "ppid"), GetParentProcessId).FromJust()); - auto need_immediate_callback_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "_needImmediateCallback"); - CHECK(process->SetAccessor(env->context(), need_immediate_callback_string, - NeedImmediateCallbackGetter, - NeedImmediateCallbackSetter, - env->as_external()).FromJust()); + auto scheduled_immediate_count = + FIXED_ONE_BYTE_STRING(env->isolate(), "_scheduledImmediateCount"); + CHECK(process->Set(env->context(), + scheduled_immediate_count, + env->scheduled_immediate_count().GetJSArray()).FromJust()); // -e, --eval if (eval_string) { @@ -3664,6 +3645,9 @@ void SetupProcessObject(Environment* env, env->as_external()).FromJust()); // define various internal methods + env->SetMethod(process, + "_activateImmediateCheck", + ActivateImmediateCheck); env->SetMethod(process, "_startProfilerIdleNotifier", StartProfilerIdleNotifier); From 347164a703c1e519f6fd1cb2c0f0f5c366766e8b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 20 Nov 2017 19:57:20 +0100 Subject: [PATCH 238/379] process: add flag for uncaught exception abort Introduce `process.shouldAbortOnUncaughtException` to control `--abort-on-uncaught-exception` behaviour, and implement some of the domains functionality on top of it. PR-URL: https://github.com/nodejs/node/pull/17159 Refs: https://github.com/nodejs/node/issues/17143 Reviewed-By: James M Snell Reviewed-By: Andreas Madsen --- doc/api/cli.md | 5 ++ doc/api/errors.md | 27 ++++++ doc/api/process.md | 37 ++++++++ lib/domain.js | 84 ++++++++++++++++--- lib/internal/bootstrap_node.js | 8 +- lib/internal/errors.js | 10 +++ lib/internal/process.js | 31 ++++++- src/env-inl.h | 9 ++ src/env.h | 10 ++- src/node.cc | 67 ++------------- ...ad-after-set-uncaught-exception-capture.js | 18 ++++ ...t-uncaught-exception-capture-after-load.js | 28 +++++++ .../test-process-exception-capture-errors.js | 22 +++++ ...ld-abort-on-uncaught-setflagsfromstring.js | 13 +++ ...eption-capture-should-abort-on-uncaught.js | 12 +++ .../test-process-exception-capture.js | 13 +++ 16 files changed, 320 insertions(+), 74 deletions(-) create mode 100644 test/parallel/test-domain-load-after-set-uncaught-exception-capture.js create mode 100644 test/parallel/test-domain-set-uncaught-exception-capture-after-load.js create mode 100644 test/parallel/test-process-exception-capture-errors.js create mode 100644 test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js create mode 100644 test/parallel/test-process-exception-capture-should-abort-on-uncaught.js create mode 100644 test/parallel/test-process-exception-capture.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 2d8cccb8a46382..b8ea4826dec2fe 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -183,6 +183,10 @@ added: v0.10 Aborting instead of exiting causes a core file to be generated for post-mortem analysis using a debugger (such as `lldb`, `gdb`, and `mdb`). +*Note*: If this flag is passed, the behavior can still be set to not abort +through [`process.setUncaughtExceptionCaptureCallback()`][] (and through usage +of the `domain` module that uses it). + ### `--trace-warnings` + +* Returns: {boolean} + +Indicates whether a callback has been set using +[`process.setUncaughtExceptionCaptureCallback()`][]. + ## process.hrtime([time]) + +* `fn` {Function|null} + +The `process.setUncaughtExceptionCapture` function sets a function that will +be invoked when an uncaught exception occurs, which will receive the exception +value itself as its first argument. + +If such a function is set, the [`process.on('uncaughtException')`][] event will +not be emitted. If `--abort-on-uncaught-exception` was passed from the +command line or set through [`v8.setFlagsFromString()`][], the process will +not abort. + +To unset the capture function, `process.setUncaughtExceptionCapture(null)` +may be used. Calling this method with a non-`null` argument while another +capture function is set will throw an error. + +*Note*: Using this function is mutually exclusive with using the +deprecated [`domain`][] built-in module. + ## process.stderr * {Stream} @@ -1921,6 +1954,7 @@ cases: [`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args +[`domain`]: domain.html [`end()`]: stream.html#stream_writable_end_chunk_encoding_callback [`net.Server`]: net.html#net_class_net_server [`net.Socket`]: net.html#net_class_net_socket @@ -1930,11 +1964,14 @@ cases: [`process.exit()`]: #process_process_exit_code [`process.exitCode`]: #process_process_exitcode [`process.kill()`]: #process_process_kill_pid_signal +[`process.on('uncaughtException')`]: process.html#process_event_uncaughtexception +[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch [`require()`]: globals.html#globals_require [`require.main`]: modules.html#modules_accessing_the_main_module [`require.resolve()`]: modules.html#modules_require_resolve_request_options [`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args +[`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags [Child Process]: child_process.html [Cluster]: cluster.html [Duplex]: stream.html#stream_duplex_and_transform_streams diff --git a/lib/domain.js b/lib/domain.js index dc3c550866c924..6c85ca2b17277b 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -28,6 +28,7 @@ const util = require('util'); const EventEmitter = require('events'); +const errors = require('internal/errors'); const { createHook } = require('async_hooks'); // communicate with events module, but don't require that @@ -81,19 +82,77 @@ const asyncHook = createHook({ } }); +// When domains are in use, they claim full ownership of the +// uncaught exception capture callback. +if (process.hasUncaughtExceptionCaptureCallback()) { + throw new errors.Error('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE'); +} + +// Get the stack trace at the point where `domain` was required. +const domainRequireStack = new Error('require(`domain`) at this point').stack; + +const { setUncaughtExceptionCaptureCallback } = process; +process.setUncaughtExceptionCaptureCallback = function(fn) { + const err = + new errors.Error('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE'); + err.stack = err.stack + '\n' + '-'.repeat(40) + '\n' + domainRequireStack; + throw err; +}; + // It's possible to enter one domain while already inside // another one. The stack is each entered domain. const stack = []; exports._stack = stack; -process._setupDomainUse(stack); +process._setupDomainUse(); -class Domain extends EventEmitter { +function updateExceptionCapture() { + if (stack.every((domain) => domain.listenerCount('error') === 0)) { + setUncaughtExceptionCaptureCallback(null); + } else { + setUncaughtExceptionCaptureCallback(null); + setUncaughtExceptionCaptureCallback((er) => { + return process.domain._errorHandler(er); + }); + } +} + + +process.on('newListener', (name, listener) => { + if (name === 'uncaughtException' && + listener !== domainUncaughtExceptionClear) { + // Make sure the first listener for `uncaughtException` always clears + // the domain stack. + process.removeListener(name, domainUncaughtExceptionClear); + process.prependListener(name, domainUncaughtExceptionClear); + } +}); + +process.on('removeListener', (name, listener) => { + if (name === 'uncaughtException' && + listener !== domainUncaughtExceptionClear) { + // If the domain listener would be the only remaining one, remove it. + const listeners = process.listeners('uncaughtException'); + if (listeners.length === 1 && listeners[0] === domainUncaughtExceptionClear) + process.removeListener(name, domainUncaughtExceptionClear); + } +}); +function domainUncaughtExceptionClear() { + stack.length = 0; + exports.active = process.domain = null; + updateExceptionCapture(); +} + + +class Domain extends EventEmitter { constructor() { super(); this.members = []; asyncHook.enable(); + + this.on('removeListener', updateExceptionCapture); + this.on('newListener', updateExceptionCapture); } } @@ -131,14 +190,14 @@ Domain.prototype._errorHandler = function _errorHandler(er) { // prevent the process 'uncaughtException' event from being emitted // if a listener is set. if (EventEmitter.listenerCount(this, 'error') > 0) { + // Clear the uncaughtExceptionCaptureCallback so that we know that, even + // if technically the top-level domain is still active, it would + // be ok to abort on an uncaught exception at this point + setUncaughtExceptionCaptureCallback(null); try { - // Set the _emittingTopLevelDomainError so that we know that, even - // if technically the top-level domain is still active, it would - // be ok to abort on an uncaught exception at this point - process._emittingTopLevelDomainError = true; caught = this.emit('error', er); } finally { - process._emittingTopLevelDomainError = false; + updateExceptionCapture(); } } } else { @@ -161,11 +220,13 @@ Domain.prototype._errorHandler = function _errorHandler(er) { if (this === exports.active) { stack.pop(); } + updateExceptionCapture(); if (stack.length) { exports.active = process.domain = stack[stack.length - 1]; - caught = process._fatalException(er2); + caught = process.domain._errorHandler(er2); } else { - caught = false; + // Pass on to the next exception handler. + throw er2; } } } @@ -173,8 +234,7 @@ Domain.prototype._errorHandler = function _errorHandler(er) { // Exit all domains on the stack. Uncaught exceptions end the // current tick and no domains should be left on the stack // between ticks. - stack.length = 0; - exports.active = process.domain = null; + domainUncaughtExceptionClear(); return caught; }; @@ -185,6 +245,7 @@ Domain.prototype.enter = function() { // to push it onto the stack so that we can pop it later. exports.active = process.domain = this; stack.push(this); + updateExceptionCapture(); }; @@ -198,6 +259,7 @@ Domain.prototype.exit = function() { exports.active = stack[stack.length - 1]; process.domain = exports.active; + updateExceptionCapture(); }; diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index dfb8b88ee440bb..2bb18741472c1f 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -9,6 +9,7 @@ (function(process) { let internalBinding; + const exceptionHandlerState = { captureFn: null }; function startup() { const EventEmitter = NativeModule.require('events'); @@ -34,6 +35,7 @@ const _process = NativeModule.require('internal/process'); _process.setupConfig(NativeModule._source); _process.setupSignalHandlers(); + _process.setupUncaughtExceptionCapture(exceptionHandlerState); NativeModule.require('internal/process/warning').setup(); NativeModule.require('internal/process/next_tick').setup(); NativeModule.require('internal/process/stdio').setup(); @@ -376,8 +378,10 @@ // that threw and was never cleared. So clear it now. async_id_fields[kInitTriggerAsyncId] = 0; - if (process.domain && process.domain._errorHandler) - caught = process.domain._errorHandler(er); + if (exceptionHandlerState.captureFn !== null) { + exceptionHandlerState.captureFn(er); + caught = true; + } if (!caught) caught = process.emit('uncaughtException', er); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 535cd1937d6c33..aadb0684d0d778 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -171,6 +171,13 @@ E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign'); E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH', 'Input buffers must have the same length'); E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]'); +E('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE', + 'A callback was registered through ' + + 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' + + 'exclusive with using the `domain` module'); +E('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE', + 'The `domain` module is in use, which is mutually exclusive with calling ' + + 'process.setUncaughtExceptionCaptureCallback()'); E('ERR_ENCODING_INVALID_ENCODED_DATA', 'The encoded data was not valid for encoding %s'); E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported'); @@ -339,6 +346,9 @@ E('ERR_TRANSFORM_ALREADY_TRANSFORMING', 'Calling transform done when still transforming'); E('ERR_TRANSFORM_WITH_LENGTH_0', 'Calling transform done when writableState.length != 0'); +E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', + '`process.setupUncaughtExceptionCapture()` was called while a capture ' + + 'callback was already active'); E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters'); E('ERR_UNHANDLED_ERROR', (err) => { diff --git a/lib/internal/process.js b/lib/internal/process.js index 56ff1f66397628..e58b83d21631ff 100644 --- a/lib/internal/process.js +++ b/lib/internal/process.js @@ -247,6 +247,34 @@ function setupRawDebug() { }; } + +function setupUncaughtExceptionCapture(exceptionHandlerState) { + // This is a typed array for faster communication with JS. + const shouldAbortOnUncaughtToggle = process._shouldAbortOnUncaughtToggle; + delete process._shouldAbortOnUncaughtToggle; + + process.setUncaughtExceptionCaptureCallback = function(fn) { + if (fn === null) { + exceptionHandlerState.captureFn = fn; + shouldAbortOnUncaughtToggle[0] = 1; + return; + } + if (typeof fn !== 'function') { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'fn', + ['Function', 'null']); + } + if (exceptionHandlerState.captureFn !== null) { + throw new errors.Error('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET'); + } + exceptionHandlerState.captureFn = fn; + shouldAbortOnUncaughtToggle[0] = 0; + }; + + process.hasUncaughtExceptionCaptureCallback = function() { + return exceptionHandlerState.captureFn !== null; + }; +} + module.exports = { setup_performance, setup_cpuUsage, @@ -256,5 +284,6 @@ module.exports = { setupKillAndExit, setupSignalHandlers, setupChannel, - setupRawDebug + setupRawDebug, + setupUncaughtExceptionCapture }; diff --git a/src/env-inl.h b/src/env-inl.h index b4ec89c0a0d135..bc2d68c1ce41f4 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -268,6 +268,7 @@ inline Environment::Environment(IsolateData* isolate_data, emit_napi_warning_(true), makecallback_cntr_(0), scheduled_immediate_count_(isolate_, 1), + should_abort_on_uncaught_toggle_(isolate_, 1), #if HAVE_INSPECTOR inspector_agent_(new inspector::Agent(this)), #endif @@ -305,6 +306,9 @@ inline Environment::Environment(IsolateData* isolate_data, performance_state_->milestones[ performance::NODE_PERFORMANCE_MILESTONE_V8_START] = performance::performance_v8_start; + + // By default, always abort when --abort-on-uncaught-exception was passed. + should_abort_on_uncaught_toggle_[0] = 1; } inline Environment::~Environment() { @@ -408,6 +412,11 @@ inline void Environment::set_abort_on_uncaught_exception(bool value) { abort_on_uncaught_exception_ = value; } +inline AliasedBuffer& +Environment::should_abort_on_uncaught_toggle() { + return should_abort_on_uncaught_toggle_; +} + inline std::vector* Environment::destroy_async_id_list() { return &destroy_async_id_list_; } diff --git a/src/env.h b/src/env.h index f0444b24d4fa86..c2e87c1dac9415 100644 --- a/src/env.h +++ b/src/env.h @@ -134,7 +134,6 @@ class ModuleWrap; V(dns_txt_string, "TXT") \ V(domain_string, "domain") \ V(emit_string, "emit") \ - V(emitting_top_level_domain_error_string, "_emittingTopLevelDomainError") \ V(exchange_string, "exchange") \ V(enumerable_string, "enumerable") \ V(idle_string, "idle") \ @@ -309,7 +308,6 @@ class ModuleWrap; V(internal_binding_cache_object, v8::Object) \ V(buffer_prototype_object, v8::Object) \ V(context, v8::Context) \ - V(domains_stack_array, v8::Array) \ V(http2ping_constructor_template, v8::ObjectTemplate) \ V(http2stream_constructor_template, v8::ObjectTemplate) \ V(inspector_console_api_object, v8::Object) \ @@ -571,8 +569,15 @@ class Environment { void PrintSyncTrace() const; inline void set_trace_sync_io(bool value); + // This stores whether the --abort-on-uncaught-exception flag was passed + // to Node. inline bool abort_on_uncaught_exception() const; inline void set_abort_on_uncaught_exception(bool value); + // This is a pseudo-boolean that keeps track of whether an uncaught exception + // should abort the process or not if --abort-on-uncaught-exception was + // passed to Node. If the flag was not passed, it is ignored. + inline AliasedBuffer& + should_abort_on_uncaught_toggle(); // The necessary API for async_hooks. inline double new_async_id(); @@ -699,6 +704,7 @@ class Environment { std::vector destroy_async_id_list_; AliasedBuffer scheduled_immediate_count_; + AliasedBuffer should_abort_on_uncaught_toggle_; performance::performance_state* performance_state_ = nullptr; std::map performance_marks_; diff --git a/src/node.cc b/src/node.cc index 5d175df3560032..33101dcd79c6e4 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1107,66 +1107,13 @@ void* ArrayBufferAllocator::Allocate(size_t size) { namespace { -bool DomainHasErrorHandler(const Environment* env, - const Local& domain) { - HandleScope scope(env->isolate()); - - Local domain_event_listeners_v = domain->Get(env->events_string()); - if (!domain_event_listeners_v->IsObject()) - return false; - - Local domain_event_listeners_o = - domain_event_listeners_v.As(); - - Local domain_error_listeners_v = - domain_event_listeners_o->Get(env->error_string()); - - if (domain_error_listeners_v->IsFunction() || - (domain_error_listeners_v->IsArray() && - domain_error_listeners_v.As()->Length() > 0)) - return true; - - return false; -} - -bool DomainsStackHasErrorHandler(const Environment* env) { - HandleScope scope(env->isolate()); - - if (!env->using_domains()) - return false; - - Local domains_stack_array = env->domains_stack_array().As(); - if (domains_stack_array->Length() == 0) - return false; - - uint32_t domains_stack_length = domains_stack_array->Length(); - for (uint32_t i = domains_stack_length; i > 0; --i) { - Local domain_v = domains_stack_array->Get(i - 1); - if (!domain_v->IsObject()) - return false; - - Local domain = domain_v.As(); - if (DomainHasErrorHandler(env, domain)) - return true; - } - - return false; -} - - bool ShouldAbortOnUncaughtException(Isolate* isolate) { HandleScope scope(isolate); - Environment* env = Environment::GetCurrent(isolate); - Local process_object = env->process_object(); - Local emitting_top_level_domain_error_key = - env->emitting_top_level_domain_error_string(); - bool isEmittingTopLevelDomainError = - process_object->Get(emitting_top_level_domain_error_key)->BooleanValue(); - - return isEmittingTopLevelDomainError || !DomainsStackHasErrorHandler(env); + return env->should_abort_on_uncaught_toggle()[0]; } + Local GetDomainProperty(Environment* env, Local object) { Local domain_v = object->GetPrivate(env->context(), env->domain_private_symbol()) @@ -1216,9 +1163,6 @@ void SetupDomainUse(const FunctionCallbackInfo& args) { HandleScope scope(env->isolate()); - CHECK(args[0]->IsArray()); - env->set_domains_stack_array(args[0].As()); - // Do a little housekeeping. env->process_object()->Delete( env->context(), @@ -3521,6 +3465,13 @@ void SetupProcessObject(Environment* env, scheduled_immediate_count, env->scheduled_immediate_count().GetJSArray()).FromJust()); + auto should_abort_on_uncaught_toggle = + FIXED_ONE_BYTE_STRING(env->isolate(), "_shouldAbortOnUncaughtToggle"); + CHECK(process->Set(env->context(), + should_abort_on_uncaught_toggle, + env->should_abort_on_uncaught_toggle().GetJSArray()) + .FromJust()); + // -e, --eval if (eval_string) { READONLY_PROPERTY(process, diff --git a/test/parallel/test-domain-load-after-set-uncaught-exception-capture.js b/test/parallel/test-domain-load-after-set-uncaught-exception-capture.js new file mode 100644 index 00000000000000..9e438368d63207 --- /dev/null +++ b/test/parallel/test-domain-load-after-set-uncaught-exception-capture.js @@ -0,0 +1,18 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +process.setUncaughtExceptionCaptureCallback(common.mustNotCall()); + +common.expectsError( + () => require('domain'), + { + code: 'ERR_DOMAIN_CALLBACK_NOT_AVAILABLE', + type: Error, + message: /^A callback was registered.*with using the `domain` module/ + } +); + +process.setUncaughtExceptionCaptureCallback(null); + +assert.doesNotThrow(() => require('domain')); diff --git a/test/parallel/test-domain-set-uncaught-exception-capture-after-load.js b/test/parallel/test-domain-set-uncaught-exception-capture-after-load.js new file mode 100644 index 00000000000000..e7cbffd00758e2 --- /dev/null +++ b/test/parallel/test-domain-set-uncaught-exception-capture-after-load.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +(function foobar() { + require('domain'); +})(); + +assert.throws( + () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()), + (err) => { + common.expectsError( + { + code: 'ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE', + type: Error, + message: /^The `domain` module is in use, which is mutually/ + } + )(err); + + assert(err.stack.includes('-'.repeat(40)), + `expected ${err.stack} to contain dashes`); + + const location = `at foobar (${__filename}:`; + assert(err.stack.includes(location), + `expected ${err.stack} to contain ${location}`); + return true; + } +); diff --git a/test/parallel/test-process-exception-capture-errors.js b/test/parallel/test-process-exception-capture-errors.js new file mode 100644 index 00000000000000..7053497adaf873 --- /dev/null +++ b/test/parallel/test-process-exception-capture-errors.js @@ -0,0 +1,22 @@ +'use strict'; +const common = require('../common'); + +common.expectsError( + () => process.setUncaughtExceptionCaptureCallback(42), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fn" argument must be one of type Function or null' + } +); + +process.setUncaughtExceptionCaptureCallback(common.mustNotCall()); + +common.expectsError( + () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()), + { + code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', + type: Error, + message: /setupUncaughtExceptionCapture.*called while a capture callback/ + } +); diff --git a/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js b/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js new file mode 100644 index 00000000000000..de14177b45a609 --- /dev/null +++ b/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js @@ -0,0 +1,13 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const v8 = require('v8'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +v8.setFlagsFromString('--abort-on-uncaught-exception'); +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +throw new Error('foo'); diff --git a/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js new file mode 100644 index 00000000000000..f9e685a86ea2e6 --- /dev/null +++ b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js @@ -0,0 +1,12 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +throw new Error('foo'); diff --git a/test/parallel/test-process-exception-capture.js b/test/parallel/test-process-exception-capture.js new file mode 100644 index 00000000000000..c84d3459e2318f --- /dev/null +++ b/test/parallel/test-process-exception-capture.js @@ -0,0 +1,13 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +process.on('uncaughtException', common.mustNotCall()); +throw new Error('foo'); From 0db1f8782518bced6ef23110bac5d25a3adfe5be Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 16 Nov 2017 15:15:05 +0100 Subject: [PATCH 239/379] src: use NODE_BUILTIN_MODULE_CONTEXT_AWARE() macro Commit d217b2850e ("async_hooks: add trace events to async_hooks") used `NODE_MODULE_CONTEXT_AWARE_BUILTIN()` instead. After commit 8680bb9f1a ("src: explicitly register built-in modules") it no longer works for static library builds so remove it. PR-URL: https://github.com/nodejs/node/pull/17071 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Timothy Gu --- src/node.h | 7 ------- src/node_internals.h | 7 +++++++ src/node_trace_events.cc | 2 +- test/cctest/node_module_reg.cc | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/node.h b/src/node.h index 8ef97bbffa83ff..583e58cea47383 100644 --- a/src/node.h +++ b/src/node.h @@ -456,10 +456,6 @@ typedef void (*addon_context_register_func)( v8::Local context, void* priv); -#define NM_F_BUILTIN 0x01 -#define NM_F_LINKED 0x02 -#define NM_F_INTERNAL 0x04 - struct node_module { int nm_version; unsigned int nm_flags; @@ -543,9 +539,6 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); #define NODE_MODULE_CONTEXT_AWARE(modname, regfunc) \ NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) -#define NODE_MODULE_CONTEXT_AWARE_BUILTIN(modname, regfunc) \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_BUILTIN) \ - /* * For backward compatibility in add-on modules. */ diff --git a/src/node_internals.h b/src/node_internals.h index ed64b0fdbe183f..edab3858f1b411 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -55,6 +55,12 @@ #define Z_MAX_LEVEL 9 #define Z_DEFAULT_LEVEL Z_DEFAULT_COMPRESSION +enum { + NM_F_BUILTIN = 1 << 0, + NM_F_LINKED = 1 << 1, + NM_F_INTERNAL = 1 << 2, +}; + struct sockaddr; // Variation on NODE_DEFINE_CONSTANT that sets a String value. @@ -115,6 +121,7 @@ struct sockaddr; V(stream_wrap) \ V(tcp_wrap) \ V(timer_wrap) \ + V(trace_events) \ V(tty_wrap) \ V(udp_wrap) \ V(url) \ diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 74308d82687985..f269b32fbef869 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -144,4 +144,4 @@ void InitializeTraceEvents(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(trace_events, node::InitializeTraceEvents) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(trace_events, node::InitializeTraceEvents) diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc index f8d9d03c1cdb99..a0736d2cc3e692 100644 --- a/test/cctest/node_module_reg.cc +++ b/test/cctest/node_module_reg.cc @@ -20,6 +20,7 @@ void _register_spawn_sync() {} void _register_stream_wrap() {} void _register_tcp_wrap() {} void _register_timer_wrap() {} +void _register_trace_events() {} void _register_tty_wrap() {} void _register_udp_wrap() {} void _register_util() {} From bd79c3788b3afcdb15bd3b726a2012665c7402f6 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 25 Nov 2017 08:07:26 -0500 Subject: [PATCH 240/379] timers: clean up for readability Remove micro-optimizations that no longer yield any benefits, restructure timers & immediates to be a bit more straightforward. Adjust timers benchmarks to run long enough to offer meaningful data. PR-URL: https://github.com/nodejs/node/pull/17279 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Timothy Gu --- benchmark/timers/immediate.js | 4 +- .../timers/set-immediate-breadth-args.js | 4 +- benchmark/timers/set-immediate-depth-args.js | 14 +- benchmark/timers/timers-breadth.js | 2 +- benchmark/timers/timers-cancel-pooled.js | 6 +- benchmark/timers/timers-cancel-unpooled.js | 6 +- benchmark/timers/timers-insert-pooled.js | 6 +- benchmark/timers/timers-insert-unpooled.js | 6 +- benchmark/timers/timers-timeout-pooled.js | 30 ++- lib/timers.js | 244 ++++++++---------- 10 files changed, 148 insertions(+), 174 deletions(-) diff --git a/benchmark/timers/immediate.js b/benchmark/timers/immediate.js index 3ba4429260fb65..bbe81555cacc97 100644 --- a/benchmark/timers/immediate.js +++ b/benchmark/timers/immediate.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [2000], + thousands: [5000], type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear'] }); @@ -88,6 +88,7 @@ function breadth1(N) { // concurrent setImmediate, 4 arguments function breadth4(N) { + N /= 2; var n = 0; bench.start(); function cb(a1, a2, a3, a4) { @@ -101,6 +102,7 @@ function breadth4(N) { } function clear(N) { + N *= 4; bench.start(); function cb(a1) { if (a1 === 2) diff --git a/benchmark/timers/set-immediate-breadth-args.js b/benchmark/timers/set-immediate-breadth-args.js index 6a904e2675d110..348cb62fb2cc1a 100644 --- a/benchmark/timers/set-immediate-breadth-args.js +++ b/benchmark/timers/set-immediate-breadth-args.js @@ -19,9 +19,9 @@ function main(conf) { bench.start(); for (let i = 0; i < N; i++) { if (i % 3 === 0) - setImmediate(cb3, 512, true, null); + setImmediate(cb3, 512, true, null, 512, true, null); else if (i % 2 === 0) - setImmediate(cb2, false, 5.1); + setImmediate(cb2, false, 5.1, 512); else setImmediate(cb1, 0); } diff --git a/benchmark/timers/set-immediate-depth-args.js b/benchmark/timers/set-immediate-depth-args.js index 1f12ae6ec73fc0..704b1814514a93 100644 --- a/benchmark/timers/set-immediate-depth-args.js +++ b/benchmark/timers/set-immediate-depth-args.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [10] + millions: [5] }); function main(conf) { @@ -15,9 +15,9 @@ function main(conf) { function cb3(n, arg2, arg3) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } @@ -25,9 +25,9 @@ function main(conf) { function cb2(n, arg2) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } @@ -35,9 +35,9 @@ function main(conf) { function cb1(n) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } diff --git a/benchmark/timers/timers-breadth.js b/benchmark/timers/timers-breadth.js index 036c878191422c..02ebd5bb0d082b 100644 --- a/benchmark/timers/timers-breadth.js +++ b/benchmark/timers/timers-breadth.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [500], + thousands: [5000], }); function main(conf) { diff --git a/benchmark/timers/timers-cancel-pooled.js b/benchmark/timers/timers-cancel-pooled.js index 2e834cc4db53fe..23cef153876f20 100644 --- a/benchmark/timers/timers-cancel-pooled.js +++ b/benchmark/timers/timers-cancel-pooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [500], + millions: [5], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; var timer = setTimeout(() => {}, 1); for (var i = 0; i < iterations; i++) { @@ -24,7 +24,7 @@ function main(conf) { clearTimeout(timer); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } function cb() { diff --git a/benchmark/timers/timers-cancel-unpooled.js b/benchmark/timers/timers-cancel-unpooled.js index ca3c0dbcd92c12..50931e35124724 100644 --- a/benchmark/timers/timers-cancel-unpooled.js +++ b/benchmark/timers/timers-cancel-unpooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [100], + millions: [1], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; const timersList = []; for (var i = 0; i < iterations; i++) { @@ -18,7 +18,7 @@ function main(conf) { for (var j = 0; j < iterations + 1; j++) { clearTimeout(timersList[j]); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } function cb() { diff --git a/benchmark/timers/timers-insert-pooled.js b/benchmark/timers/timers-insert-pooled.js index 80335a150a2a23..8bbc84290ad9b7 100644 --- a/benchmark/timers/timers-insert-pooled.js +++ b/benchmark/timers/timers-insert-pooled.js @@ -2,11 +2,11 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [500], + millions: [5], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; bench.start(); @@ -14,5 +14,5 @@ function main(conf) { setTimeout(() => {}, 1); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } diff --git a/benchmark/timers/timers-insert-unpooled.js b/benchmark/timers/timers-insert-unpooled.js index 98415625862075..efe8e9aaa579c2 100644 --- a/benchmark/timers/timers-insert-unpooled.js +++ b/benchmark/timers/timers-insert-unpooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [100], + millions: [1], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; const timersList = []; @@ -15,7 +15,7 @@ function main(conf) { for (var i = 0; i < iterations; i++) { timersList.push(setTimeout(cb, i + 1)); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); for (var j = 0; j < iterations + 1; j++) { clearTimeout(timersList[j]); diff --git a/benchmark/timers/timers-timeout-pooled.js b/benchmark/timers/timers-timeout-pooled.js index 2e8753a0c3cda8..d39c8cf969a49b 100644 --- a/benchmark/timers/timers-timeout-pooled.js +++ b/benchmark/timers/timers-timeout-pooled.js @@ -1,23 +1,35 @@ 'use strict'; const common = require('../common.js'); +// The following benchmark measures setting up n * 1e6 timeouts, +// which then get executed on the next uv tick + const bench = common.createBenchmark(main, { - thousands: [500], + millions: [10], }); function main(conf) { - const iterations = +conf.thousands * 1e3; - var count = 0; + const iterations = +conf.millions * 1e6; + let count = 0; - for (var i = 0; i < iterations; i++) { - setTimeout(cb, 1); - } - - bench.start(); + // Function tracking on the hidden class in V8 can cause misleading + // results in this benchmark if only a single function is used — + // alternate between two functions for a fairer benchmark function cb() { count++; if (count === iterations) - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } + function cb2() { + count++; + if (count === iterations) + bench.end(iterations / 1e6); + } + + for (var i = 0; i < iterations; i++) { + setTimeout(i % 2 ? cb : cb2, 1); + } + + bench.start(); } diff --git a/lib/timers.js b/lib/timers.js index 56f02fe1ea644c..ced8664c0ee330 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -182,10 +182,12 @@ function insert(item, unrefed) { item._destroyed = false; item[async_id_symbol] = ++async_id_fields[kAsyncIdCounter]; item[trigger_async_id_symbol] = initTriggerId(); - if (async_hook_fields[kInit] > 0) - emitInit( - item[async_id_symbol], 'Timeout', item[trigger_async_id_symbol], item - ); + if (async_hook_fields[kInit] > 0) { + emitInit(item[async_id_symbol], + 'Timeout', + item[trigger_async_id_symbol], + item); + } } L.append(list, item); @@ -430,74 +432,47 @@ function setTimeout(callback, after, arg1, arg2, arg3) { throw new errors.TypeError('ERR_INVALID_CALLBACK'); } - var len = arguments.length; - var args; - if (len === 3) { - args = [arg1]; - } else if (len === 4) { - args = [arg1, arg2]; - } else if (len > 4) { - args = [arg1, arg2, arg3]; - for (var i = 5; i < len; i++) - // extend array dynamically, makes .apply run much faster in v6.0.0 - args[i - 2] = arguments[i]; + var i, args; + switch (arguments.length) { + // fast cases + case 1: + case 2: + break; + case 3: + args = [arg1]; + break; + case 4: + args = [arg1, arg2]; + break; + default: + args = [arg1, arg2, arg3]; + for (i = 5; i < arguments.length; i++) { + // extend array dynamically, makes .apply run much faster in v6.0.0 + args[i - 2] = arguments[i]; + } + break; } - return createSingleTimeout(callback, after, args); + return new Timeout(callback, after, args, false); } setTimeout[internalUtil.promisify.custom] = function(after, value) { const promise = createPromise(); - createSingleTimeout(promise, after, [value]); + new Timeout(promise, after, [value], false); return promise; }; exports.setTimeout = setTimeout; -function createSingleTimeout(callback, after, args) { - after *= 1; // coalesce to number or NaN - if (!(after >= 1 && after <= TIMEOUT_MAX)) { - if (after > TIMEOUT_MAX) { - process.emitWarning(`${after} does not fit into` + - ' a 32-bit signed integer.' + - '\nTimeout duration was set to 1.', - 'TimeoutOverflowWarning'); - } - after = 1; // schedule on next tick, follows browser behavior - } - - var timer = new Timeout(after, callback, args); - if (process.domain) - timer.domain = process.domain; - - active(timer); - - return timer; -} - function ontimeout(timer) { var args = timer._timerArgs; - var callback = timer._onTimeout; - if (typeof callback !== 'function') - return promiseResolve(callback, args[0]); + if (typeof timer._onTimeout !== 'function') + return promiseResolve(timer._onTimeout, args[0]); if (!args) timer._onTimeout(); - else { - switch (args.length) { - case 1: - timer._onTimeout(args[0]); - break; - case 2: - timer._onTimeout(args[0], args[1]); - break; - case 3: - timer._onTimeout(args[0], args[1], args[2]); - break; - default: - Function.prototype.apply.call(callback, timer, args); - } - } + else + Reflect.apply(timer._onTimeout, timer, args); if (timer._repeat) rearm(timer); } @@ -534,44 +509,30 @@ exports.setInterval = function(callback, repeat, arg1, arg2, arg3) { throw new errors.TypeError('ERR_INVALID_CALLBACK'); } - var len = arguments.length; - var args; - if (len === 3) { - args = [arg1]; - } else if (len === 4) { - args = [arg1, arg2]; - } else if (len > 4) { - args = [arg1, arg2, arg3]; - for (var i = 5; i < len; i++) - // extend array dynamically, makes .apply run much faster in v6.0.0 - args[i - 2] = arguments[i]; + var i, args; + switch (arguments.length) { + // fast cases + case 1: + case 2: + break; + case 3: + args = [arg1]; + break; + case 4: + args = [arg1, arg2]; + break; + default: + args = [arg1, arg2, arg3]; + for (i = 5; i < arguments.length; i++) { + // extend array dynamically, makes .apply run much faster in v6.0.0 + args[i - 2] = arguments[i]; + } + break; } - return createRepeatTimeout(callback, repeat, args); + return new Timeout(callback, repeat, args, true); }; -function createRepeatTimeout(callback, repeat, args) { - repeat *= 1; // coalesce to number or NaN - if (!(repeat >= 1 && repeat <= TIMEOUT_MAX)) { - if (repeat > TIMEOUT_MAX) { - process.emitWarning(`${repeat} does not fit into` + - ' a 32-bit signed integer.' + - '\nInterval duration was set to 1.', - 'TimeoutOverflowWarning'); - } - repeat = 1; // schedule on next tick, follows browser behavior - } - - var timer = new Timeout(repeat, callback, args); - timer._repeat = repeat; - if (process.domain) - timer.domain = process.domain; - - active(timer); - - return timer; -} - exports.clearInterval = function(timer) { if (timer && timer._repeat) { timer._repeat = null; @@ -580,22 +541,41 @@ exports.clearInterval = function(timer) { }; -function Timeout(after, callback, args) { +function Timeout(callback, after, args, isRepeat) { + after *= 1; // coalesce to number or NaN + if (!(after >= 1 && after <= TIMEOUT_MAX)) { + if (after > TIMEOUT_MAX) { + process.emitWarning(`${after} does not fit into` + + ' a 32-bit signed integer.' + + '\nTimeout duration was set to 1.', + 'TimeoutOverflowWarning'); + } + after = 1; // schedule on next tick, follows browser behavior + } + this._called = false; this._idleTimeout = after; this._idlePrev = this; this._idleNext = this; this._idleStart = null; + // this must be set to null first to avoid function tracking + // on the hidden class, revisit in V8 versions after 6.2 + this._onTimeout = null; this._onTimeout = callback; this._timerArgs = args; - this._repeat = null; + this._repeat = isRepeat ? after : null; this._destroyed = false; + this[async_id_symbol] = ++async_id_fields[kAsyncIdCounter]; this[trigger_async_id_symbol] = initTriggerId(); - if (async_hook_fields[kInit] > 0) - emitInit( - this[async_id_symbol], 'Timeout', this[trigger_async_id_symbol], this - ); + if (async_hook_fields[kInit] > 0) { + emitInit(this[async_id_symbol], + 'Timeout', + this[trigger_async_id_symbol], + this); + } + + active(this); } @@ -653,9 +633,7 @@ Timeout.prototype.ref = function() { Timeout.prototype.close = function() { this._onTimeout = null; if (this._handle) { - // Fewer checks may be possible, but these cover everything. if (async_hook_fields[kDestroy] > 0 && - this && typeof this[async_id_symbol] === 'number' && !this._destroyed) { emitDestroy(this[async_id_symbol]); @@ -796,42 +774,38 @@ function tryOnImmediate(immediate, oldTail) { function runCallback(timer) { const argv = timer._argv; - const argc = argv ? argv.length : 0; if (typeof timer._onImmediate !== 'function') return promiseResolve(timer._onImmediate, argv[0]); - switch (argc) { - // fast-path callbacks with 0-3 arguments - case 0: - return timer._onImmediate(); - case 1: - return timer._onImmediate(argv[0]); - case 2: - return timer._onImmediate(argv[0], argv[1]); - case 3: - return timer._onImmediate(argv[0], argv[1], argv[2]); - // more than 3 arguments run slower with .apply - default: - return Function.prototype.apply.call(timer._onImmediate, timer, argv); - } + if (!argv) + return timer._onImmediate(); + Reflect.apply(timer._onImmediate, timer, argv); } -function Immediate() { - // assigning the callback here can cause optimize/deoptimize thrashing - // so have caller annotate the object (node v6.0.0, v8 5.0.71.35) +function Immediate(callback, args) { this._idleNext = null; this._idlePrev = null; + // this must be set to null first to avoid function tracking + // on the hidden class, revisit in V8 versions after 6.2 this._onImmediate = null; - this._argv = null; - this._onImmediate = null; + this._onImmediate = callback; + this._argv = args; this._destroyed = false; - this.domain = process.domain; + this[async_id_symbol] = ++async_id_fields[kAsyncIdCounter]; this[trigger_async_id_symbol] = initTriggerId(); - if (async_hook_fields[kInit] > 0) - emitInit( - this[async_id_symbol], 'Immediate', this[trigger_async_id_symbol], this - ); + if (async_hook_fields[kInit] > 0) { + emitInit(this[async_id_symbol], + 'Immediate', + this[trigger_async_id_symbol], + this); + } + + if (scheduledImmediateCount[0] === 0) + activateImmediateCheck(); + scheduledImmediateCount[0]++; + + immediateQueue.append(this); } function setImmediate(callback, arg1, arg2, arg3) { @@ -840,7 +814,6 @@ function setImmediate(callback, arg1, arg2, arg3) { } var i, args; - switch (arguments.length) { // fast cases case 1: @@ -853,37 +826,24 @@ function setImmediate(callback, arg1, arg2, arg3) { break; default: args = [arg1, arg2, arg3]; - for (i = 4; i < arguments.length; i++) + for (i = 4; i < arguments.length; i++) { // extend array dynamically, makes .apply run much faster in v6.0.0 args[i - 1] = arguments[i]; + } break; } - return createImmediate(args, callback); + + return new Immediate(callback, args); } setImmediate[internalUtil.promisify.custom] = function(value) { const promise = createPromise(); - createImmediate([value], promise); + new Immediate(promise, [value]); return promise; }; exports.setImmediate = setImmediate; -function createImmediate(args, callback) { - // declaring it `const immediate` causes v6.0.0 to deoptimize this function - var immediate = new Immediate(); - immediate._argv = args; - immediate._onImmediate = callback; - - if (scheduledImmediateCount[0] === 0) - activateImmediateCheck(); - scheduledImmediateCount[0]++; - - immediateQueue.append(immediate); - - return immediate; -} - exports.clearImmediate = function(immediate) { if (!immediate) return; From 9b27bc85aedd2e0943d038aef74e8a4e13cd7865 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 27 Nov 2017 18:10:23 +0100 Subject: [PATCH 241/379] src: introduce USE() for silencing compiler warnings PR-URL: https://github.com/nodejs/node/pull/17333 Reviewed-By: Timothy Gu Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/async_wrap.cc | 12 ++++-------- src/node_crypto.cc | 18 +++++++++--------- src/util.h | 3 +++ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index b355841c3419d0..607d4792192d18 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -173,8 +173,7 @@ void AsyncWrap::EmitPromiseResolve(Environment* env, double async_id) { Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_promise_resolve_function(); FatalTryCatch try_catch(env); - fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) - .FromMaybe(Local()); + USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value)); } @@ -202,8 +201,7 @@ void AsyncWrap::EmitBefore(Environment* env, double async_id) { Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_before_function(); FatalTryCatch try_catch(env); - fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) - .FromMaybe(Local()); + USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value)); } @@ -233,8 +231,7 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) { Local async_id_value = Number::New(env->isolate(), async_id); Local fn = env->async_hooks_after_function(); FatalTryCatch try_catch(env); - fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value) - .FromMaybe(Local()); + USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value)); } class PromiseWrap : public AsyncWrap { @@ -736,8 +733,7 @@ void AsyncWrap::EmitAsyncInit(Environment* env, }; FatalTryCatch try_catch(env); - init_fn->Call(env->context(), object, arraysize(argv), argv) - .FromMaybe(Local()); + USE(init_fn->Call(env->context(), object, arraysize(argv), argv)); } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 1f868afbed4d03..5db3db3ed51d20 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1827,7 +1827,7 @@ static Local X509ToObject(Environment* env, X509* cert) { String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); } - (void) BIO_reset(bio); + USE(BIO_reset(bio)); X509_NAME* issuer_name = X509_get_issuer_name(cert); if (X509_NAME_print_ex(bio, issuer_name, 0, X509_NAME_FLAGS) > 0) { @@ -1836,7 +1836,7 @@ static Local X509ToObject(Environment* env, X509* cert) { String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); } - (void) BIO_reset(bio); + USE(BIO_reset(bio)); int nids[] = { NID_subject_alt_name, NID_info_access }; Local keys[] = { env->subjectaltname_string(), @@ -1863,7 +1863,7 @@ static Local X509ToObject(Environment* env, X509* cert) { String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); - (void) BIO_reset(bio); + USE(BIO_reset(bio)); } EVP_PKEY* pkey = X509_get_pubkey(cert); @@ -1880,7 +1880,7 @@ static Local X509ToObject(Environment* env, X509* cert) { info->Set(env->modulus_string(), String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); - (void) BIO_reset(bio); + USE(BIO_reset(bio)); uint64_t exponent_word = static_cast(BN_get_word(e)); uint32_t lo = static_cast(exponent_word); @@ -1894,7 +1894,7 @@ static Local X509ToObject(Environment* env, X509* cert) { info->Set(env->exponent_string(), String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); - (void) BIO_reset(bio); + USE(BIO_reset(bio)); } if (pkey != nullptr) { @@ -1911,7 +1911,7 @@ static Local X509ToObject(Environment* env, X509* cert) { info->Set(env->valid_from_string(), String::NewFromUtf8(env->isolate(), mem->data, String::kNormalString, mem->length)); - (void) BIO_reset(bio); + USE(BIO_reset(bio)); ASN1_TIME_print(bio, X509_get_notAfter(cert)); BIO_get_mem_ptr(bio, &mem); @@ -2889,7 +2889,7 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) { return rv; int retry = BIO_should_retry(bio); - (void) retry; // unused if !defined(SSL_PRINT_DEBUG) + USE(retry); // unused if !defined(SSL_PRINT_DEBUG) if (BIO_should_write(bio)) { DEBUG_PRINT("[%p] BIO: %s want write. should retry %d\n", @@ -5389,7 +5389,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo& args) { EC_KEY_set_public_key(ecdh->key_, nullptr); MarkPopErrorOnReturn mark_pop_error_on_return; - (void) &mark_pop_error_on_return; // Silence compiler warning. + USE(&mark_pop_error_on_return); const BIGNUM* priv_key = EC_KEY_get0_private_key(ecdh->key_); CHECK_NE(priv_key, nullptr); @@ -5452,7 +5452,7 @@ bool ECDH::IsKeyValidForCurve(const BIGNUM* private_key) { bool ECDH::IsKeyPairValid() { MarkPopErrorOnReturn mark_pop_error_on_return; - (void) &mark_pop_error_on_return; // Silence compiler warning. + USE(&mark_pop_error_on_return); return 1 == EC_KEY_check_key(key_); } diff --git a/src/util.h b/src/util.h index 08308d837fbf8b..eb060a57b8801b 100644 --- a/src/util.h +++ b/src/util.h @@ -428,6 +428,9 @@ class BufferValue : public MaybeStackBuffer { if (name##_length > 0) \ CHECK_NE(name##_data, nullptr); +// Use this when a variable or parameter is unused in order to explicitly +// silence a compiler warning about that. +template inline void USE(T&&) {} } // namespace node From 3807c6887a8f7f69394dedcff5d65551c3b8c48a Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Mon, 27 Nov 2017 17:27:23 -0200 Subject: [PATCH 242/379] doc: fix doc example for cctest cctest guide example wasn't working because of a few typos. PR-URL: https://github.com/nodejs/node/pull/17355 Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Jon Moss Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Alexey Orlenko --- doc/guides/writing-tests.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 7dc86facfd00c5..3ea221901195dc 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -312,8 +312,8 @@ TEST_F(EnvTest, RunAtExit) { v8::Local context = v8::Context::New(isolate_); node::IsolateData* isolateData = node::CreateIsolateData(isolate_, uv_default_loop()); Argv argv{"node", "-e", ";"}; - auto env = Environment:CreateEnvironment(isolateData, context, 1, *argv, 2, *argv); - node::AtExit(at_exit_callback); + auto env = node::CreateEnvironment(isolateData, context, 1, *argv, 2, *argv); + node::AtExit(env, at_exit_callback); node::RunAtExit(env); EXPECT_TRUE(called_cb); } From 2a4f4f8125751cc7528898a84e25a4ba740a9516 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Thu, 26 Oct 2017 23:26:41 -0400 Subject: [PATCH 243/379] doc: add guide to maintaining npm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is based on the guide found on their wiki refs: https://github.com/npm/npm/wiki/CLI-Team-Process#submitting-the-new-latest-x-to-nodejs PR-URL: https://github.com/nodejs/node/pull/16541 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaël Zasso Reviewed-By: Yuta Hiroto Reviewed-By: Ruben Bridgewater Reviewed-By: Michael Dawson Reviewed-By: Gibson Fahnestock --- doc/guides/maintaining-npm.md | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/guides/maintaining-npm.md diff --git a/doc/guides/maintaining-npm.md b/doc/guides/maintaining-npm.md new file mode 100644 index 00000000000000..af9d3af04f2360 --- /dev/null +++ b/doc/guides/maintaining-npm.md @@ -0,0 +1,68 @@ +# Maintaining npm in Node.js + +## Step 1: Clone npm + +```console +$ git clone https://github.com/npm/npm.git +$ cd npm +``` + +or if you already have npm cloned make sure the repo is up to date + +```console +$ git remote update -p +$ git reset --hard origin latest +``` + +## Step 2: Build release + +```console +$ git checkout vX.Y.Z +$ make release +``` + +Note: please run `npm dist-tag ls npm` and make sure this is the `latest` **dist-tag**. `latest` on git is usually released as `next` when it's time to downstream + +## Step 3: Remove old npm + +```console +$ cd /path/to/node +$ git remote update -p +$ git checkout -b npm-x.y.z origin/master +$ cd deps +$ rm -rf npm +``` + +## Step 4: Extract and commit new npm + +```console +$ tar zxf /path/to/npm/release/npm-x.y.z.tgz +$ git add -A npm +$ git commit -m "deps: upgrade npm to x.y.z" +$ cd .. +``` + +## Step 5: Update licenses + +```console +$ ./configure +$ make -j4 +$ ./tools/license-builder.sh +# The following commands are only necessary if there are changes +$ git add . +$ git commit -m "doc: update npm LICENSE using license-builder.sh" +``` + +Note: please ensure you are only making the updates that are changed by npm. + +## Step 6: Apply Whitespace fix + +```console +$ git rebase --whitespace=fix master +``` + +## Step 7: Test the build + +```console +$ make test-npm +``` From 8bd74c406195eb768baab82f097ceeef52d7bf64 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Tue, 28 Nov 2017 19:35:58 -0500 Subject: [PATCH 244/379] tools,test: use Execute instead of check_output subprocess.check_output is a python2.7 only feature. Using Execute allows keeping python2.6 compatibility PR-URL: https://github.com/nodejs/node/pull/17381 Reviewed-By: Rich Trott Reviewed-By: Myles Borins Reviewed-By: Ben Noordhuis Reviewed-By: Gibson Fahnestock --- tools/test.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/test.py b/tools/test.py index efb7c0e5b8e475..ccc25f2a883c15 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1562,18 +1562,15 @@ def ArgsToTestPaths(test_root, args, suites): return paths -def get_env_type(vm, options_type): +def get_env_type(vm, options_type, context): if options_type is not None: env_type = options_type else: - if "fips" in subprocess.check_output([vm, "-p", - "process.versions.openssl"]): - env_type = "fips" - # NOTE(nikhil): "simple" is the default value for var 'env_type' and should - # be set last if no if/elif matches. If you plan to add more values, use - # 'elif' above. - else: - env_type = "simple" + # 'simple' is the default value for 'env_type'. + env_type = 'simple' + ssl_ver = Execute([vm, '-p', 'process.versions.openssl'], context).stdout + if 'fips' in ssl_ver: + env_type = 'fips' return env_type @@ -1659,7 +1656,7 @@ def Main(): 'mode': mode, 'system': utils.GuessOS(), 'arch': vmArch, - 'type': get_env_type(vm, options.type), + 'type': get_env_type(vm, options.type, context), } test_list = root.ListTests([], path, context, arch, mode) unclassified_tests += test_list From 1cc6df29a72f6f1af70c4c38ce423ce63df91a06 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Tue, 14 Nov 2017 15:57:11 +0100 Subject: [PATCH 245/379] tools: add Boxstarter script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a Boxstarter script for easy Node.js building prerequisites installation PR-URL: https://github.com/nodejs/node/pull/17046 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Refael Ackermann Reviewed-By: João Reis Reviewed-By: Gibson Fahnestock --- BUILDING.md | 3 ++ tools/bootstrap/README.md | 55 ++++++++++++++++++++++++++++++ tools/bootstrap/windows_boxstarter | 21 ++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 tools/bootstrap/README.md create mode 100644 tools/bootstrap/windows_boxstarter diff --git a/BUILDING.md b/BUILDING.md index e6d575f82737d5..a1e7afc8c68e60 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -89,6 +89,9 @@ Depending on host platform, the selection of toolchains may vary. ## Building Node.js on supported platforms +*Note:* All prerequisites can be easily installed by following +[this bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md). + ### Unix / macOS Prerequisites: diff --git a/tools/bootstrap/README.md b/tools/bootstrap/README.md new file mode 100644 index 00000000000000..a61e947a2af0b4 --- /dev/null +++ b/tools/bootstrap/README.md @@ -0,0 +1,55 @@ +# Node.js Bootstrapping Guide + +## Windows + +A [Boxstarter][] script can be used for easy setup of Windows systems with all +the required prerequisites for Node.js development. This script will install +the following [Chocolatey] packages: + * [Git for Windows][] with the `git` and Unix tools added to the `PATH` + * [Python 2.x][] + * [Visual Studio 2017 Build Tools][] with [Visual C++ workload][] + +To install Node.js prerequisites using [Boxstarter WebLauncher][], just open +[this link](http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter) +with Internet Explorer or Edge browser on the target machine. + +Alternatively, you can use PowerShell. Run those commands from an elevated +PowerShell terminal: +```console +Set-ExecutionPolicy Unrestricted -Force +iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')) +get-boxstarter -Force +Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots +``` + +Entire installation will take up about 8 GB of disk space. + +## Linux + +For building Node.js on Linux, following packages are required (note, that this +can vary from distribution to distribution): + * `git` + * `python` + * `gcc-c++` or `g++` + * `make` + +To bootstrap Node.js on Linux, run in terminal: + * OpenSUSE: `sudo zypper install git python gcc-c++ make` + * Fedora: `sudo dnf install git python gcc-c++ make` + * Ubuntu, Debian: `sudo apt-get install git python g++ make` + +## macOS + +To install required tools on macOS, run in terminal: +```console +xcode-select --install +``` + +[Boxstarter]: http://boxstarter.org/ +[Boxstarter WebLauncher]: http://boxstarter.org/WebLauncher +[Chocolatey]: https://chocolatey.org/ +[Git for Windows]: https://chocolatey.org/packages/git +[Python 2.x]: https://chocolatey.org/packages/python2 +[Visual Studio 2017 Build Tools]: https://chocolatey.org/packages/visualstudio2017buildtools +[Visual C++ workload]: https://chocolatey.org/packages/visualstudio2017-workload-vctools + diff --git a/tools/bootstrap/windows_boxstarter b/tools/bootstrap/windows_boxstarter new file mode 100644 index 00000000000000..144c309ae11ad0 --- /dev/null +++ b/tools/bootstrap/windows_boxstarter @@ -0,0 +1,21 @@ +# Boxstarter (http://boxstarter.org/) script for Node.js prerequisites +# +# To install either open this link in IE or Edge: +# http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter +# +# Or run those commands in an elevated Powershell terminal: +# iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')) +# get-boxstarter -Force +# Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots +# +# For more detail see +# https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md +# + +# Git and Unix tools will be added to the PATH +choco install git -params /GitAndUnixToolsOnPath -y +choco install python2 -y + +# Installs VS 2017 Build Tools +choco install visualstudio2017buildtools -y +choco install visualstudio2017-workload-vctools -y From 7f55f98a84e80a56bc4369c71217399b97ff6876 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 28 Nov 2017 05:46:35 -0600 Subject: [PATCH 246/379] src: fix typo in NODE_OPTIONS whitelist The whitelist of allowed cli flags that can be passed in the NODE_OPTIONS environment variable had --trace-events-categories, but the cli flag is actually --trace-event-categories. PR-URL: https://github.com/nodejs/node/pull/17369 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Jon Moss Reviewed-By: Gibson Fahnestock Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig --- src/node.cc | 2 +- test/parallel/test-cli-node-options.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 33101dcd79c6e4..7b4b112897b7e8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3939,7 +3939,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env, "--trace-sync-io", "--no-force-async-hooks-checks", "--trace-events-enabled", - "--trace-events-categories", + "--trace-event-categories", "--track-heap-objects", "--zero-fill-buffers", "--v8-pool-size", diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 4febf1ca1bdd1c..85c35508566ff1 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -23,6 +23,7 @@ expect('--track-heap-objects', 'B\n'); expect('--throw-deprecation', 'B\n'); expect('--zero-fill-buffers', 'B\n'); expect('--v8-pool-size=10', 'B\n'); +expect('--trace-event-categories node', 'B\n'); if (common.hasCrypto) { expect('--use-openssl-ca', 'B\n'); From e41344f1b801bda6fccd0a08ad2558685abc656c Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Tue, 28 Nov 2017 16:56:45 -0500 Subject: [PATCH 247/379] tools: add docs for prefer-util-format-errors rule I had a little trouble understanding what the rule was trying to say, so am documenting what would pass/fail. PR-URL: https://github.com/nodejs/node/pull/17376 Reviewed-By: Anatoli Papirovski Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Gibson Fahnestock Reviewed-By: Michael Dawson --- tools/eslint-rules/prefer-util-format-errors.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/eslint-rules/prefer-util-format-errors.js b/tools/eslint-rules/prefer-util-format-errors.js index c3f4819e43b51c..f6993e627782dd 100644 --- a/tools/eslint-rules/prefer-util-format-errors.js +++ b/tools/eslint-rules/prefer-util-format-errors.js @@ -26,6 +26,11 @@ module.exports = { if (!isArrowFunctionWithTemplateLiteral(msg)) return; + // Checks to see if order of arguments to function is the same as the + // order of them being concatenated in the template string. The idea is + // that if both match, then you can use `util.format`-style args. + // Would pass rule: (a, b) => `${b}${a}`. + // Would fail rule: (a, b) => `${a}${b}`, and needs to be rewritten. const { expressions } = msg.body; const hasSequentialParams = msg.params.every((param, index) => { const expr = expressions[index]; From ceda8c57aadffcd45785182a06429ca6a55e5ab3 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 27 Nov 2017 09:19:11 +0100 Subject: [PATCH 248/379] src: use nullptr instead of NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17373 Reviewed-By: Jon Moss Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Tobias Nießen --- src/cares_wrap.cc | 4 +-- src/inspector_socket.cc | 2 +- src/inspector_socket_server.cc | 6 ++-- src/node.h | 32 ++++++++++----------- src/node_buffer.cc | 2 +- src/node_crypto.cc | 12 ++++---- src/node_http2.cc | 2 +- src/node_i18n.cc | 14 ++++----- src/node_os.cc | 2 +- src/node_url.cc | 2 +- src/tracing/node_trace_buffer.cc | 6 ++-- src/tracing/node_trace_writer.cc | 2 +- src/tracing/trace_event.h | 2 +- test/addons/repl-domain-abort/binding.cc | 2 +- test/cctest/test_inspector_socket_server.cc | 4 +-- 15 files changed, 48 insertions(+), 46 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 6d16cce2c87f10..3fb98c293c23d7 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -798,7 +798,7 @@ int ParseGeneralReply(Environment* env, status = ares_parse_ns_reply(buf, len, &host); break; case ns_t_ptr: - status = ares_parse_ptr_reply(buf, len, NULL, 0, AF_INET, &host); + status = ares_parse_ptr_reply(buf, len, nullptr, 0, AF_INET, &host); break; default: CHECK(0 && "Bad NS type"); @@ -830,7 +830,7 @@ int ParseGeneralReply(Environment* env, HostentToNames(env, host, ret); } else if (*type == ns_t_ptr) { uint32_t offset = ret->Length(); - for (uint32_t i = 0; host->h_aliases[i] != NULL; i++) { + for (uint32_t i = 0; host->h_aliases[i] != nullptr; i++) { ret->Set(context, i + offset, OneByteString(env->isolate(), host->h_aliases[i])).FromJust(); diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index 265b37616138dc..49d337b70b1198 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -577,7 +577,7 @@ int inspector_accept(uv_stream_t* server, InspectorSocket* socket, data_received_cb); } if (err != 0) { - uv_close(reinterpret_cast(tcp), NULL); + uv_close(reinterpret_cast(tcp), nullptr); } return err; } diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index cdc907ee9b263b..958c41a654adff 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -94,7 +94,7 @@ void PrintDebuggerReadyMessage(const std::string& host, int port, const std::vector& ids, FILE* out) { - if (out == NULL) { + if (out == nullptr) { return; } for (const std::string& id : ids) { @@ -398,7 +398,7 @@ bool InspectorSocketServer::Start() { int err = uv_getaddrinfo(loop_, &req, nullptr, host_.c_str(), port_string.c_str(), &hints); if (err < 0) { - if (out_ != NULL) { + if (out_ != nullptr) { fprintf(out_, "Unable to resolve \"%s\": %s\n", host_.c_str(), uv_strerror(err)); } @@ -416,7 +416,7 @@ bool InspectorSocketServer::Start() { // We only show error if we failed to start server on all addresses. We only // show one error, for the last address. if (server_sockets_.empty()) { - if (out_ != NULL) { + if (out_ != nullptr) { fprintf(out_, "Starting inspector on %s:%d failed: %s\n", host_.c_str(), port_, uv_strerror(err)); fflush(out_); diff --git a/src/node.h b/src/node.h index 583e58cea47383..9ce8664c98e998 100644 --- a/src/node.h +++ b/src/node.h @@ -108,14 +108,14 @@ namespace node { NODE_EXTERN v8::Local ErrnoException(v8::Isolate* isolate, int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); + const char* syscall = nullptr, + const char* message = nullptr, + const char* path = nullptr); NODE_EXTERN v8::Local UVException(v8::Isolate* isolate, int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); + const char* syscall = nullptr, + const char* message = nullptr, + const char* path = nullptr); NODE_EXTERN v8::Local UVException(v8::Isolate* isolate, int errorno, const char* syscall, @@ -126,9 +126,9 @@ NODE_EXTERN v8::Local UVException(v8::Isolate* isolate, NODE_DEPRECATED("Use ErrnoException(isolate, ...)", inline v8::Local ErrnoException( int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL) { + const char* syscall = nullptr, + const char* message = nullptr, + const char* path = nullptr) { return ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, @@ -137,9 +137,9 @@ NODE_DEPRECATED("Use ErrnoException(isolate, ...)", }) inline v8::Local UVException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL) { + const char* syscall = nullptr, + const char* message = nullptr, + const char* path = nullptr) { return UVException(v8::Isolate::GetCurrent(), errorno, syscall, @@ -426,14 +426,14 @@ NODE_DEPRECATED("Use DecodeWrite(isolate, ...)", NODE_EXTERN v8::Local WinapiErrnoException( v8::Isolate* isolate, int errorno, - const char *syscall = NULL, + const char *syscall = nullptr, const char *msg = "", - const char *path = NULL); + const char *path = nullptr); NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)", inline v8::Local WinapiErrnoException(int errorno, - const char *syscall = NULL, const char *msg = "", - const char *path = NULL) { + const char *syscall = nullptr, const char *msg = "", + const char *path = nullptr) { return WinapiErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, diff --git a/src/node_buffer.cc b/src/node_buffer.cc index b8f0cdda34afb6..45597c72e5ee08 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1214,7 +1214,7 @@ static void EncodeUtf8String(const FunctionCallbackInfo& args) { char* data = node::UncheckedMalloc(length); str->WriteUtf8(data, -1, // We are certain that `data` is sufficiently large - NULL, + nullptr, String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8); auto array_buf = ArrayBuffer::New(env->isolate(), data, length, ArrayBufferCreationMode::kInternalized); diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 5db3db3ed51d20..5937c8d2ebd71d 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1782,7 +1782,7 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) { return false; GENERAL_NAMES* names = static_cast(X509V3_EXT_d2i(ext)); - if (names == NULL) + if (names == nullptr) return false; for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { @@ -1798,8 +1798,8 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) { BIO_write(out, name->data, name->length); } else { STACK_OF(CONF_VALUE)* nval = i2v_GENERAL_NAME( - const_cast(method), gen, NULL); - if (nval == NULL) + const_cast(method), gen, nullptr); + if (nval == nullptr) return false; X509V3_EXT_val_prn(out, nval, 0, 0); sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); @@ -6125,7 +6125,7 @@ void InitCryptoOnce() { if (0 != err) { fprintf(stderr, "openssl config failed: %s\n", - ERR_error_string(err, NULL)); + ERR_error_string(err, nullptr)); CHECK_NE(err, 0); } } @@ -6148,7 +6148,9 @@ void InitCryptoOnce() { } } if (0 != err) { - fprintf(stderr, "openssl fips failed: %s\n", ERR_error_string(err, NULL)); + fprintf(stderr, + "openssl fips failed: %s\n", + ERR_error_string(err, nullptr)); UNREACHABLE(); } #endif // NODE_FIPS_MODE diff --git a/src/node_http2.cc b/src/node_http2.cc index b439ae588a7756..89d68de88f8cfe 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1768,7 +1768,7 @@ void Http2Session::Goaway(const FunctionCallbackInfo& args) { int32_t lastStreamID = args[1]->Int32Value(context).ToChecked(); Local opaqueData = args[2]; - uint8_t* data = NULL; + uint8_t* data = nullptr; size_t length = 0; if (opaqueData->BooleanValue(context).ToChecked()) { diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 101ae4c79e42d2..041eda94f3bdd5 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -114,21 +114,21 @@ MaybeLocal ToBufferEndian(Environment* env, MaybeStackBuffer* buf) { } struct Converter { - explicit Converter(const char* name, const char* sub = NULL) + explicit Converter(const char* name, const char* sub = nullptr) : conv(nullptr) { UErrorCode status = U_ZERO_ERROR; conv = ucnv_open(name, &status); CHECK(U_SUCCESS(status)); - if (sub != NULL) { + if (sub != nullptr) { ucnv_setSubstChars(conv, sub, strlen(sub), &status); } } explicit Converter(UConverter* converter, - const char* sub = NULL) : conv(converter) { + const char* sub = nullptr) : conv(converter) { CHECK_NE(conv, nullptr); UErrorCode status = U_ZERO_ERROR; - if (sub != NULL) { + if (sub != nullptr) { ucnv_setSubstChars(conv, sub, strlen(sub), &status); } } @@ -229,7 +229,7 @@ class ConverterObject : public BaseObject, Converter { ucnv_toUnicode(converter->conv, &target, target + (limit * sizeof(UChar)), &source, source + source_length, - NULL, flush, &status); + nullptr, flush, &status); if (U_SUCCESS(status)) { if (limit > 0) @@ -254,7 +254,7 @@ class ConverterObject : public BaseObject, Converter { v8::Local wrap, UConverter* converter, bool ignoreBOM, - const char* sub = NULL) : + const char* sub = nullptr) : BaseObject(env, wrap), Converter(converter, sub), ignoreBOM_(ignoreBOM) { @@ -427,7 +427,7 @@ const char* EncodingName(const enum encoding encoding) { case LATIN1: return "iso8859-1"; case UCS2: return "utf16le"; case UTF8: return "utf-8"; - default: return NULL; + default: return nullptr; } } diff --git a/src/node_os.cc b/src/node_os.cc index d66f8c72c7cb5c..f4832b60077c9e 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -368,7 +368,7 @@ static void GetUserInfo(const FunctionCallbackInfo& args) { &error); MaybeLocal shell; - if (pwd.shell == NULL) + if (pwd.shell == nullptr) shell = Null(env->isolate()); else shell = StringBytes::Encode(env->isolate(), pwd.shell, encoding, &error); diff --git a/src/node_url.cc b/src/node_url.cc index c9c8ccd579744e..e1ef9273ae927e 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -752,7 +752,7 @@ static inline int64_t ParseNumber(const char* start, const char* end) { } p++; } - return strtoll(start, NULL, R); + return strtoll(start, nullptr, R); } static url_host_type ParseIPv4Host(url_host* host, diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc index c8d71b762ef1de..4c9f7c658fd945 100644 --- a/src/tracing/node_trace_buffer.cc +++ b/src/tracing/node_trace_buffer.cc @@ -32,7 +32,7 @@ TraceObject* InternalTraceBuffer::GetEventByHandle(uint64_t handle) { Mutex::ScopedLock scoped_lock(mutex_); if (handle == 0) { // A handle value of zero never has a trace event associated with it. - return NULL; + return nullptr; } size_t chunk_index, event_index; uint32_t buffer_id, chunk_seq; @@ -41,12 +41,12 @@ TraceObject* InternalTraceBuffer::GetEventByHandle(uint64_t handle) { // Either the chunk belongs to the other buffer, or is outside the current // range of chunks loaded in memory (the latter being true suggests that // the chunk has already been flushed and is no longer in memory.) - return NULL; + return nullptr; } auto& chunk = chunks_[chunk_index]; if (chunk->seq() != chunk_seq) { // Chunk is no longer in memory. - return NULL; + return nullptr; } return chunk->GetEventAt(event_index); } diff --git a/src/tracing/node_trace_writer.cc b/src/tracing/node_trace_writer.cc index ff3c981d103d09..9293e9cb8f7b4a 100644 --- a/src/tracing/node_trace_writer.cc +++ b/src/tracing/node_trace_writer.cc @@ -60,7 +60,7 @@ void NodeTraceWriter::OpenNewFileForStreaming() { std::ostringstream log_file; log_file << "node_trace." << file_num_ << ".log"; fd_ = uv_fs_open(tracing_loop_, &req, log_file.str().c_str(), - O_CREAT | O_WRONLY | O_TRUNC, 0644, NULL); + O_CREAT | O_WRONLY | O_TRUNC, 0644, nullptr); CHECK_NE(fd_, -1); uv_fs_req_cleanup(&req); } diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h index 2b4c1e36cf9156..44a30f38e59394 100644 --- a/src/tracing/trace_event.h +++ b/src/tracing/trace_event.h @@ -518,7 +518,7 @@ static inline uint64_t AddTraceEvent( class ScopedTracer { public: // Note: members of data_ intentionally left uninitialized. See Initialize. - ScopedTracer() : p_data_(NULL) {} + ScopedTracer() : p_data_(nullptr) {} ~ScopedTracer() { if (p_data_ && *data_.category_group_enabled) diff --git a/test/addons/repl-domain-abort/binding.cc b/test/addons/repl-domain-abort/binding.cc index d6a825dfdd5dd8..1b4dbfa84e5054 100644 --- a/test/addons/repl-domain-abort/binding.cc +++ b/test/addons/repl-domain-abort/binding.cc @@ -35,7 +35,7 @@ void Method(const FunctionCallbackInfo& args) { isolate->GetCurrentContext()->Global(), args[0].As(), 0, - NULL); + nullptr); } void init(Local exports) { diff --git a/test/cctest/test_inspector_socket_server.cc b/test/cctest/test_inspector_socket_server.cc index 5eff9d706b2a3a..ab74917234eefb 100644 --- a/test/cctest/test_inspector_socket_server.cc +++ b/test/cctest/test_inspector_socket_server.cc @@ -313,7 +313,7 @@ class ServerHolder { public: template ServerHolder(Delegate* delegate, uv_loop_t* loop, int port) - : ServerHolder(delegate, loop, HOST, port, NULL) { } + : ServerHolder(delegate, loop, HOST, port, nullptr) { } template ServerHolder(Delegate* delegate, uv_loop_t* loop, const std::string host, @@ -617,7 +617,7 @@ TEST_F(InspectorSocketServerTest, BindsToIpV6) { return; } TestInspectorServerDelegate delegate; - ServerHolder server(&delegate, &loop, "::", 0, NULL); + ServerHolder server(&delegate, &loop, "::", 0, nullptr); ASSERT_TRUE(server->Start()); SocketWrapper socket1(&loop); From 1e34a0e9a8a2034159e93043f6257979b267f36f Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 28 Nov 2017 18:04:49 +0100 Subject: [PATCH 249/379] tools: add cpplint rule for NULL usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: https://github.com/nodejs/node/pull/17373 Reviewed-By: Jon Moss Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Tobias Nießen --- src/node.h | 15 +++++------ src/node_api.h | 2 +- src/node_win32_etw_provider-inl.h | 2 +- test/addons-napi/7_factory_wrap/binding.cc | 1 + .../addons-napi/test_make_callback/binding.cc | 2 ++ .../test_make_callback_recurse/binding.cc | 2 ++ tools/cpplint.py | 25 ++++++++++++++++++- tools/icu/iculslocs.cc | 19 +++++++------- 8 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/node.h b/src/node.h index 9ce8664c98e998..e6f47aa30075c4 100644 --- a/src/node.h +++ b/src/node.h @@ -501,13 +501,13 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); { \ NODE_MODULE_VERSION, \ flags, \ - NULL, \ + NULL, /* NOLINT (readability/null_usage) */ \ __FILE__, \ (node::addon_register_func) (regfunc), \ - NULL, \ + NULL, /* NOLINT (readability/null_usage) */ \ NODE_STRINGIFY(modname), \ priv, \ - NULL \ + NULL /* NOLINT (readability/null_usage) */ \ }; \ NODE_C_CTOR(_register_ ## modname) { \ node_module_register(&_module); \ @@ -520,13 +520,13 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); { \ NODE_MODULE_VERSION, \ flags, \ - NULL, \ + NULL, /* NOLINT (readability/null_usage) */ \ __FILE__, \ - NULL, \ + NULL, /* NOLINT (readability/null_usage) */ \ (node::addon_context_register_func) (regfunc), \ NODE_STRINGIFY(modname), \ priv, \ - NULL \ + NULL /* NOLINT (readability/null_usage) */ \ }; \ NODE_C_CTOR(_register_ ## modname) { \ node_module_register(&_module); \ @@ -534,9 +534,10 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); } #define NODE_MODULE(modname, regfunc) \ - NODE_MODULE_X(modname, regfunc, NULL, 0) + NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) #define NODE_MODULE_CONTEXT_AWARE(modname, regfunc) \ + /* NOLINTNEXTLINE (readability/null_usage) */ \ NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) /* diff --git a/src/node_api.h b/src/node_api.h index 8e5eef8a47728f..ee0ad3518e13aa 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -100,7 +100,7 @@ typedef struct { EXTERN_C_END #define NAPI_MODULE(modname, regfunc) \ - NAPI_MODULE_X(modname, regfunc, NULL, 0) + NAPI_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) #define NAPI_AUTO_LENGTH SIZE_MAX diff --git a/src/node_win32_etw_provider-inl.h b/src/node_win32_etw_provider-inl.h index 3c90bee67d26f3..98a28f14f45a15 100644 --- a/src/node_win32_etw_provider-inl.h +++ b/src/node_win32_etw_provider-inl.h @@ -115,7 +115,7 @@ extern int events_enabled; DWORD status = event_write(node_provider, \ &eventDescriptor, \ 0, \ - NULL); \ + NULL); // NOLINT (readability/null_usage) \ CHECK_EQ(status, ERROR_SUCCESS); diff --git a/test/addons-napi/7_factory_wrap/binding.cc b/test/addons-napi/7_factory_wrap/binding.cc index c8fca4d536e74c..d98132457875a1 100644 --- a/test/addons-napi/7_factory_wrap/binding.cc +++ b/test/addons-napi/7_factory_wrap/binding.cc @@ -16,6 +16,7 @@ napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, MyObject::Init(env)); NAPI_CALL(env, + // NOLINTNEXTLINE (readability/null_usage) napi_create_function(env, "exports", -1, CreateObject, NULL, &exports)); return exports; } diff --git a/test/addons-napi/test_make_callback/binding.cc b/test/addons-napi/test_make_callback/binding.cc index 4b0537ca07cf17..952dfcc1cb5bec 100644 --- a/test/addons-napi/test_make_callback/binding.cc +++ b/test/addons-napi/test_make_callback/binding.cc @@ -8,6 +8,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) { const int kMaxArgs = 10; size_t argc = kMaxArgs; napi_value args[kMaxArgs]; + // NOLINTNEXTLINE (readability/null_usage) NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); NAPI_ASSERT(env, argc > 0, "Wrong number of arguments"); @@ -47,6 +48,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { napi_value fn; NAPI_CALL(env, napi_create_function( + // NOLINTNEXTLINE (readability/null_usage) env, NULL, NAPI_AUTO_LENGTH, MakeCallback, NULL, &fn)); NAPI_CALL(env, napi_set_named_property(env, exports, "makeCallback", fn)); return exports; diff --git a/test/addons-napi/test_make_callback_recurse/binding.cc b/test/addons-napi/test_make_callback_recurse/binding.cc index 714e44773de623..b99c583d31d9f9 100644 --- a/test/addons-napi/test_make_callback_recurse/binding.cc +++ b/test/addons-napi/test_make_callback_recurse/binding.cc @@ -7,6 +7,7 @@ namespace { napi_value MakeCallback(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; + // NOLINTNEXTLINE (readability/null_usage) NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); napi_value recv = args[0]; @@ -21,6 +22,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { napi_value fn; NAPI_CALL(env, napi_create_function( + // NOLINTNEXTLINE (readability/null_usage) env, NULL, NAPI_AUTO_LENGTH, MakeCallback, NULL, &fn)); NAPI_CALL(env, napi_set_named_property(env, exports, "makeCallback", fn)); return exports; diff --git a/tools/cpplint.py b/tools/cpplint.py index ca42ddeb7bc477..460c1ecbfeb02f 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -499,7 +499,6 @@ _ALT_TOKEN_REPLACEMENT_PATTERN = re.compile( r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)') - # These constants define types of headers for use with # _IncludeState.CheckNextIncludeOrder(). _C_SYS_HEADER = 1 @@ -526,6 +525,8 @@ # Match string that indicates we're working on a Linux Kernel file. _SEARCH_KERNEL_FILE = re.compile(r'\b(?:LINT_KERNEL_FILE)') +_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') + _regexp_compile_cache = {} # {str, set(int)}: a map from error categories to sets of linenumbers @@ -4156,6 +4157,27 @@ def CheckAltTokens(filename, clean_lines, linenum, error): 'Use operator %s instead of %s' % ( _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1))) +def CheckNullTokens(filename, clean_lines, linenum, error): + """Check NULL usage. + + Args: + filename: The name of the current file. + clean_lines: A CleansedLines instance containing the file. + linenum: The number of the line to check. + error: The function to call with any errors found. + """ + line = clean_lines.elided[linenum] + + # Avoid preprocessor lines + if Match(r'^\s*#', line): + return + + if line.find('/*') >= 0 or line.find('*/') >= 0: + return + + for match in _NULL_TOKEN_PATTERN.finditer(line): + error(filename, linenum, 'readability/null_usage', 2, + 'Use nullptr instead of NULL') def GetLineWidth(line): """Determines the width of the line in column positions. @@ -4294,6 +4316,7 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, CheckSpacingForFunctionCall(filename, clean_lines, linenum, error) CheckCheck(filename, clean_lines, linenum, error) CheckAltTokens(filename, clean_lines, linenum, error) + CheckNullTokens(filename, clean_lines, linenum, error) classinfo = nesting_state.InnermostClass() if classinfo: CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error) diff --git a/tools/icu/iculslocs.cc b/tools/icu/iculslocs.cc index 485a179deb2e04..ca312b783565c4 100644 --- a/tools/icu/iculslocs.cc +++ b/tools/icu/iculslocs.cc @@ -231,14 +231,14 @@ int dumpAllButInstalledLocales(int lev, int list(const char* toBundle) { UErrorCode status = U_ZERO_ERROR; - FILE* bf = NULL; + FILE* bf = NULL; // NOLINT (readability/null_usage) - if (toBundle != NULL) { + if (toBundle != NULL) { // NOLINT (readability/null_usage) if (VERBOSE) { printf("writing to bundle %s\n", toBundle); } bf = fopen(toBundle, "wb"); - if (bf == NULL) { + if (bf == NULL) { // NOLINT (readability/null_usage) printf("ERROR: Could not open '%s' for writing.\n", toBundle); return 1; } @@ -258,6 +258,7 @@ int list(const char* toBundle) { ures_openDirect(packageName.data(), locale, &status)); ASSERT_SUCCESS(&status, "while opening the bundle"); LocalUResourceBundlePointer installedLocales( + // NOLINTNEXTLINE (readability/null_usage) ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, NULL, &status)); ASSERT_SUCCESS(&status, "while fetching installed locales"); @@ -266,7 +267,7 @@ int list(const char* toBundle) { printf("Locales: %d\n", count); } - if (bf != NULL) { + if (bf != NULL) { // NOLINT (readability/null_usage) // write the HEADER fprintf(bf, "// Warning this file is automatically generated\n" @@ -310,17 +311,17 @@ int list(const char* toBundle) { UBool exists; if (localeExists(key, &exists)) { - if (bf != NULL) fclose(bf); + if (bf != NULL) fclose(bf); // NOLINT (readability/null_usage) return 1; // get out. } if (exists) { validCount++; printf("%s\n", key); - if (bf != NULL) { + if (bf != NULL) { // NOLINT (readability/null_usage) fprintf(bf, " %s {\"\"}\n", key); } } else { - if (bf != NULL) { + if (bf != NULL) { // NOLINT (readability/null_usage) fprintf(bf, "// %s {\"\"}\n", key); } if (VERBOSE) { @@ -329,7 +330,7 @@ int list(const char* toBundle) { } } - if (bf != NULL) { + if (bf != NULL) { // NOLINT (readability/null_usage) fprintf(bf, " } // %d/%d valid\n", validCount, count); // write the HEADER fprintf(bf, "}\n"); @@ -371,7 +372,7 @@ int main(int argc, const char* argv[]) { usage(); return 0; } else if (!strcmp(arg, "-l")) { - if (list(NULL)) { + if (list(NULL)) { // NOLINT (readability/null_usage) return 1; } } else if (!strcmp(arg, "-b") && (argsLeft >= 1)) { From ca81d4bb3f4b45f869258a4fd499e979e50ec3b7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 28 Nov 2017 08:45:35 +0100 Subject: [PATCH 250/379] test: use v8 Default Allocator in cctest fixture This commit updates the node_test_fixture to use v8::ArrayBuffer::Allocator::NewDefaultAllocator() and removes the custom allocator. PR-URL: https://github.com/nodejs/node/pull/17366 Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis --- test/cctest/node_test_fixture.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index 890fe9049994e9..bbc46986ebe922 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -9,21 +9,6 @@ #include "v8.h" #include "libplatform/libplatform.h" -class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - public: - virtual void* Allocate(size_t length) { - return AllocateUninitialized(length); - } - - virtual void* AllocateUninitialized(size_t length) { - return calloc(length, 1); - } - - virtual void Free(void* data, size_t) { - free(data); - } -}; - struct Argv { public: Argv() : Argv({"node", "-p", "process.version"}) {} @@ -77,7 +62,6 @@ class NodeTestFixture : public ::testing::Test { protected: v8::Isolate::CreateParams params_; - ArrayBufferAllocator allocator_; v8::Isolate* isolate_; ~NodeTestFixture() { @@ -89,7 +73,7 @@ class NodeTestFixture : public ::testing::Test { platform_ = new node::NodePlatform(8, nullptr); v8::V8::InitializePlatform(platform_); v8::V8::Initialize(); - params_.array_buffer_allocator = &allocator_; + params_.array_buffer_allocator = allocator_.get(); isolate_ = v8::Isolate::New(params_); } @@ -107,6 +91,8 @@ class NodeTestFixture : public ::testing::Test { private: node::NodePlatform* platform_ = nullptr; + std::unique_ptr allocator_{ + v8::ArrayBuffer::Allocator::NewDefaultAllocator()}; }; #endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_ From 78592a34c6aef85b9a84afe529835a8d931907cf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 30 Nov 2017 07:46:03 +0100 Subject: [PATCH 251/379] test: make CreateParams stack-allocated PR-URL: https://github.com/nodejs/node/pull/17366 Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis --- test/cctest/node_test_fixture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index bbc46986ebe922..d5be613c0bd105 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -61,7 +61,6 @@ class NodeTestFixture : public ::testing::Test { node::MultiIsolatePlatform* Platform() const { return platform_; } protected: - v8::Isolate::CreateParams params_; v8::Isolate* isolate_; ~NodeTestFixture() { @@ -73,6 +72,7 @@ class NodeTestFixture : public ::testing::Test { platform_ = new node::NodePlatform(8, nullptr); v8::V8::InitializePlatform(platform_); v8::V8::Initialize(); + v8::Isolate::CreateParams params_; params_.array_buffer_allocator = allocator_.get(); isolate_ = v8::Isolate::New(params_); } From a256482318907007db138dd1c71c98f512570d2f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 22 Nov 2017 12:47:50 -0800 Subject: [PATCH 252/379] doc,test: remove unnecessary await with return instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary `await` in combination with `return` in preparation for enabling lint rule. PR-URL: https://github.com/nodejs/node/pull/17265 Reviewed-By: Timothy Gu Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- doc/api/util.md | 2 +- test/common/inspector-helper.js | 2 +- test/parallel/test-util-callbackify.js | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index ba570749888c88..10474b6f836f5c 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -31,7 +31,7 @@ For example: const util = require('util'); async function fn() { - return await Promise.resolve('hello world'); + return 'hello world'; } const callbackFunction = util.callbackify(fn); diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 81aa046bf3d94d..454eef4c5e26da 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -390,7 +390,7 @@ class NodeInstance { console.log('[test]', 'Connecting to a child Node process'); const response = await this.httpGet(null, '/json/list'); const url = response[0]['webSocketDebuggerUrl']; - return await this.wsHandshake(url); + return this.wsHandshake(url); } expectShutdown() { diff --git a/test/parallel/test-util-callbackify.js b/test/parallel/test-util-callbackify.js index 0999fc4fd39f07..84b439e43f0702 100644 --- a/test/parallel/test-util-callbackify.js +++ b/test/parallel/test-util-callbackify.js @@ -28,7 +28,7 @@ const values = [ for (const value of values) { // Test and `async function` async function asyncFn() { - return await Promise.resolve(value); + return value; } const cbAsyncFn = callbackify(asyncFn); @@ -70,7 +70,7 @@ const values = [ for (const value of values) { // Test an `async function` async function asyncFn() { - return await Promise.reject(value); + return Promise.reject(value); } const cbAsyncFn = callbackify(asyncFn); @@ -142,7 +142,7 @@ const values = [ for (const value of values) { async function asyncFn(arg) { assert.strictEqual(arg, value); - return await Promise.resolve(arg); + return arg; } const cbAsyncFn = callbackify(asyncFn); @@ -183,7 +183,7 @@ const values = [ const iAmThat = { async fn(arg) { assert.strictEqual(this, iAmThat); - return await Promise.resolve(arg); + return arg; }, }; iAmThat.cbFn = callbackify(iAmThat.fn); @@ -241,7 +241,7 @@ const values = [ { async function asyncFn() { - return await Promise.resolve(42); + return 42; } const cb = callbackify(asyncFn); From 6c65e042315a889af2035391fb0bd4a6188fe134 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 22 Nov 2017 12:49:05 -0800 Subject: [PATCH 253/379] tools: enable no-return-await lint rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable lint rule that prohibits unnecessary use of `await` with `return`. PR-URL: https://github.com/nodejs/node/pull/17265 Reviewed-By: Timothy Gu Reviewed-By: Vse Mozhet Byt Reviewed-By: Michaël Zasso Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- .eslintrc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 0f46a7fbfa77c7..da49eb8b4f7c82 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -69,6 +69,7 @@ rules: message: __defineGetter__ is deprecated. - property: __defineSetter__ message: __defineSetter__ is deprecated. + no-return-await: error no-self-assign: error no-throw-literal: error no-unused-labels: error From e3df569d1ce62abc3c26c2fdb850b7a6dcf4bc0d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 30 Nov 2017 21:41:16 -0500 Subject: [PATCH 254/379] deps: upgrade libuv to 1.18.0 PR-URL: https://github.com/nodejs/node/pull/17282 Reviewed-By: Ben Noordhuis --- deps/uv/AUTHORS | 3 + deps/uv/CONTRIBUTING.md | 2 +- deps/uv/ChangeLog | 52 +++++ deps/uv/Makefile.am | 2 +- deps/uv/appveyor.yml | 2 +- deps/uv/checksparse.sh | 10 + deps/uv/configure.ac | 2 +- deps/uv/docs/src/fs.rst | 4 +- deps/uv/docs/src/loop.rst | 3 +- deps/uv/docs/src/misc.rst | 6 + deps/uv/docs/src/signal.rst | 8 +- deps/uv/include/uv-unix.h | 2 + deps/uv/include/uv-version.h | 4 +- deps/uv/include/uv-win.h | 8 +- deps/uv/include/uv.h | 1 + deps/uv/src/unix/aix-common.c | 292 ++++++++++++++++++++++++++++ deps/uv/src/unix/aix.c | 237 +--------------------- deps/uv/src/unix/core.c | 5 + deps/uv/src/unix/ibmi.c | 112 +++++++++++ deps/uv/src/unix/os390-syscalls.c | 9 + deps/uv/src/unix/os390-syscalls.h | 1 + deps/uv/src/unix/process.c | 14 +- deps/uv/src/unix/stream.c | 5 +- deps/uv/src/unix/tcp.c | 101 +++++++--- deps/uv/src/win/fs.c | 9 +- deps/uv/src/win/pipe.c | 4 +- deps/uv/src/win/thread.c | 1 + deps/uv/src/win/util.c | 5 + deps/uv/test/run-tests.c | 5 + deps/uv/test/test-fs.c | 62 +++++- deps/uv/test/test-list.h | 8 + deps/uv/test/test-platform-output.c | 4 + deps/uv/test/test-spawn.c | 79 ++++++++ deps/uv/test/test-thread.c | 32 ++- deps/uv/uv.gyp | 38 +++- 35 files changed, 817 insertions(+), 315 deletions(-) create mode 100644 deps/uv/src/unix/aix-common.c create mode 100644 deps/uv/src/unix/ibmi.c diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 03255534fa1de3..b227123e4ac35c 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -318,3 +318,6 @@ Scott Parker Wade Brainerd rayrase Pekka Nikander +Ed Schouten +Xu Meng +Matt Harrison diff --git a/deps/uv/CONTRIBUTING.md b/deps/uv/CONTRIBUTING.md index aa97506dbc6923..d9bf0472fb1fc3 100644 --- a/deps/uv/CONTRIBUTING.md +++ b/deps/uv/CONTRIBUTING.md @@ -164,6 +164,6 @@ not send out notifications when you add commits. [issue tracker]: https://github.com/libuv/libuv/issues [libuv mailing list]: http://groups.google.com/group/libuv -[IRC]: http://webchat.freelibuv.net/?channels=libuv +[IRC]: http://webchat.freenode.net/?channels=libuv [Google C/C++ style guide]: https://google.github.io/styleguide/cppguide.html [project maintainers]: https://github.com/libuv/libuv/blob/master/MAINTAINERS.md diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 595b3871278898..113c28aed136a7 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,55 @@ +2017.12.02, Version 1.18.0 (Stable), 1489c98b7fc17f1702821a269eb0c5e730c5c813 + +Changes since version 1.17.0: + +* aix: fix -Wmaybe-uninitialized warning (cjihrig) + +* doc: remove note about SIGWINCH on Windows (Bartosz Sosnowski) + +* Revert "unix,win: wait for threads to start" (Ben Noordhuis) + +* unix,win: add uv_os_getpid() (Bartosz Sosnowski) + +* unix: remove incorrect assertion in uv_shutdown() (Jameson Nash) + +* doc: fix IRC URL in CONTRIBUTING.md (Matt Harrison) + + +2017.11.25, Version 1.17.0 (Stable), 1344d2bb82e195d0eafc0b40ba103f18dfd04cc5 + +Changes since version 1.16.1: + +* unix: avoid malloc() call in uv_spawn() (Ben Noordhuis) + +* doc: clarify the description of uv_loop_alive() (Ed Schouten) + +* win: map UV_FS_O_EXLOCK to a share mode of 0 (Joran Dirk Greef) + +* win: fix build on case-sensitive file systems (Ben Noordhuis) + +* win: fix test runner build with mingw64 (Ben Noordhuis) + +* win: remove unused variable in test/test-fs.c (Ben Noordhuis) + +* zos: add strnlen() implementation (jBarz) + +* unix: keep track of bound sockets sent via spawn (jBarz) + +* unix,win: wait for threads to start (Ben Noordhuis) + +* test: add threadpool init/teardown test (Bartosz Sosnowski) + +* test: avoid malloc() in threadpool test (Ben Noordhuis) + +* test: lower number of tasks in threadpool test (Ben Noordhuis) + +* win: issue memory barrier in uv_thread_join() (Ben Noordhuis) + +* ibmi: add support for new platform (Xu Meng) + +* test: fix test-spawn compilation (Bartosz Sosnowski) + + 2017.11.11, Version 1.16.1 (Stable), 4056fbe46493ef87237e307e0025e551db875e13 Changes since version 1.16.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 6e548a69c374e6..e01cf416638bfe 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -329,7 +329,7 @@ libuv_la_CFLAGS += -D_ALL_SOURCE \ -D_THREAD_SAFE \ -DHAVE_SYS_AHAFS_EVPRODS_H include_HEADERS += include/uv-aix.h -libuv_la_SOURCES += src/unix/aix.c +libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c endif if ANDROID diff --git a/deps/uv/appveyor.yml b/deps/uv/appveyor.yml index 8ad69718b6e619..f77e640eb10f09 100644 --- a/deps/uv/appveyor.yml +++ b/deps/uv/appveyor.yml @@ -1,4 +1,4 @@ -version: v1.16.1.build{build} +version: v1.18.0.build{build} init: - git config --global core.autocrlf true diff --git a/deps/uv/checksparse.sh b/deps/uv/checksparse.sh index ae0e5374f5efba..d4a983d02618b5 100755 --- a/deps/uv/checksparse.sh +++ b/deps/uv/checksparse.sh @@ -177,8 +177,18 @@ case `uname -s` in AIX) SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1" SOURCES="$SOURCES + src/unix/aix-common.c src/unix/aix.c" ;; +OS400) + SPARSE_FLAGS="$SPARSE_FLAGS -D_PASE=1" + SOURCES="$SOURCES + src/unix/aix-common.c + src/unix/ibmi.c + src/unix/posix-poll.c + src/unix/no-fsevents.c + src/unix/no-proctitle.c" + ;; Darwin) SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1" SOURCES="$SOURCES diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index 5fc0f72434d92e..7eb1674dbaa7fb 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.16.1], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.18.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index f46c4e761a5d2f..16d5e05c7834cf 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -409,7 +409,9 @@ File open constants Atomically obtain an exclusive lock. .. note:: - `UV_FS_O_EXLOCK` is only supported on macOS. + `UV_FS_O_EXLOCK` is only supported on macOS and Windows. + + .. versionchanged:: 1.17.0 support is added for Windows. .. c:macro:: UV_FS_O_NOATIME diff --git a/deps/uv/docs/src/loop.rst b/deps/uv/docs/src/loop.rst index c63f813993ff4b..18dd135cd63834 100644 --- a/deps/uv/docs/src/loop.rst +++ b/deps/uv/docs/src/loop.rst @@ -109,7 +109,8 @@ API .. c:function:: int uv_loop_alive(const uv_loop_t* loop) - Returns non-zero if there are active handles or request in the loop. + Returns non-zero if there are referenced active handles, active + requests or closing handles in the loop. .. c:function:: void uv_stop(uv_loop_t* loop) diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst index 2968d1cea1cc2b..a653413e0927bd 100644 --- a/deps/uv/docs/src/misc.rst +++ b/deps/uv/docs/src/misc.rst @@ -227,6 +227,12 @@ API On Windows not all fields are set, the unsupported fields are filled with zeroes. See :c:type:`uv_rusage_t` for more details. +.. c:function:: uv_pid_t uv_os_getpid(void) + + Returns the current process ID. + + .. versionadded:: 1.18.0 + .. c:function:: uv_pid_t uv_os_getppid(void) Returns the parent process ID. diff --git a/deps/uv/docs/src/signal.rst b/deps/uv/docs/src/signal.rst index 5b3b352bdd257d..24354e4f7c1329 100644 --- a/deps/uv/docs/src/signal.rst +++ b/deps/uv/docs/src/signal.rst @@ -17,13 +17,6 @@ Reception of some signals is emulated on Windows: program is given approximately 10 seconds to perform cleanup. After that Windows will unconditionally terminate it. -* SIGWINCH is raised whenever libuv detects that the console has been - resized. SIGWINCH is emulated by libuv when the program uses a :c:type:`uv_tty_t` - handle to write to the console. SIGWINCH may not always be delivered in a - timely manner; libuv will only detect size changes when the cursor is - being moved. When a readable :c:type:`uv_tty_t` handle is used in raw mode, - resizing the console buffer will also trigger a SIGWINCH signal. - Watchers for other signals can be successfully created, but these signals are never received. These signals are: `SIGILL`, `SIGABRT`, `SIGFPE`, `SIGSEGV`, `SIGTERM` and `SIGKILL.` @@ -36,6 +29,7 @@ not detected by libuv; these will not trigger a signal watcher. manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them. +.. versionchanged:: 1.15.0 SIGWINCH support on Windows was improved. Data types ---------- diff --git a/deps/uv/include/uv-unix.h b/deps/uv/include/uv-unix.h index 6565ff441ef292..da32f86e8476fa 100644 --- a/deps/uv/include/uv-unix.h +++ b/deps/uv/include/uv-unix.h @@ -48,6 +48,8 @@ # include "uv-linux.h" #elif defined (__MVS__) # include "uv-os390.h" +#elif defined(_PASE) +# include "uv-posix.h" #elif defined(_AIX) # include "uv-aix.h" #elif defined(__sun) diff --git a/deps/uv/include/uv-version.h b/deps/uv/include/uv-version.h index 1c9113cdc9f7ee..831ee54de4486e 100644 --- a/deps/uv/include/uv-version.h +++ b/deps/uv/include/uv-version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 16 -#define UV_VERSION_PATCH 1 +#define UV_VERSION_MINOR 18 +#define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/include/uv-win.h b/deps/uv/include/uv-win.h index be150fc482f92e..b96bed22ace759 100644 --- a/deps/uv/include/uv-win.h +++ b/deps/uv/include/uv-win.h @@ -664,13 +664,13 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); #define UV_FS_O_WRONLY _O_WRONLY /* fs open() flags supported on other platforms (or mapped on this platform): */ -#define UV_FS_O_DIRECT 0x2000000 /* FILE_FLAG_NO_BUFFERING */ +#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ #define UV_FS_O_DIRECTORY 0 -#define UV_FS_O_DSYNC 0x4000000 /* FILE_FLAG_WRITE_THROUGH */ -#define UV_FS_O_EXLOCK 0 +#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ #define UV_FS_O_NOATIME 0 #define UV_FS_O_NOCTTY 0 #define UV_FS_O_NOFOLLOW 0 #define UV_FS_O_NONBLOCK 0 #define UV_FS_O_SYMLINK 0 -#define UV_FS_O_SYNC 0x8000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 3f61812081da5e..b11666e2e65806 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -1070,6 +1070,7 @@ UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); +UV_EXTERN uv_pid_t uv_os_getpid(void); UV_EXTERN uv_pid_t uv_os_getppid(void); UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); diff --git a/deps/uv/src/unix/aix-common.c b/deps/uv/src/unix/aix-common.c new file mode 100644 index 00000000000000..2cfe8be6f11830 --- /dev/null +++ b/deps/uv/src/unix/aix-common.c @@ -0,0 +1,292 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +uint64_t uv__hrtime(uv_clocktype_t type) { + uint64_t G = 1000000000; + timebasestruct_t t; + read_wall_time(&t, TIMEBASE_SZ); + time_base_to_time(&t, TIMEBASE_SZ); + return (uint64_t) t.tb_high * G + t.tb_low; +} + + +/* + * We could use a static buffer for the path manipulations that we need outside + * of the function, but this function could be called by multiple consumers and + * we don't want to potentially create a race condition in the use of snprintf. + * There is no direct way of getting the exe path in AIX - either through /procfs + * or through some libc APIs. The below approach is to parse the argv[0]'s pattern + * and use it in conjunction with PATH environment variable to craft one. + */ +int uv_exepath(char* buffer, size_t* size) { + int res; + char args[PATH_MAX]; + char abspath[PATH_MAX]; + size_t abspath_size; + struct procsinfo pi; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + pi.pi_pid = getpid(); + res = getargs(&pi, sizeof(pi), args, sizeof(args)); + if (res < 0) + return -EINVAL; + + /* + * Possibilities for args: + * i) an absolute path such as: /home/user/myprojects/nodejs/node + * ii) a relative path such as: ./node or ../myprojects/nodejs/node + * iii) a bare filename such as "node", after exporting PATH variable + * to its location. + */ + + /* Case i) and ii) absolute or relative paths */ + if (strchr(args, '/') != NULL) { + if (realpath(args, abspath) != abspath) + return -errno; + + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; + } else { + /* Case iii). Search PATH environment variable */ + char trypath[PATH_MAX]; + char *clonedpath = NULL; + char *token = NULL; + char *path = getenv("PATH"); + + if (path == NULL) + return -EINVAL; + + clonedpath = uv__strdup(path); + if (clonedpath == NULL) + return -ENOMEM; + + token = strtok(clonedpath, ":"); + while (token != NULL) { + snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); + if (realpath(trypath, abspath) == abspath) { + /* Check the match is executable */ + if (access(abspath, X_OK) == 0) { + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + uv__free(clonedpath); + return 0; + } + } + token = strtok(NULL, ":"); + } + uv__free(clonedpath); + + /* Out of tokens (path entries), and no match found */ + return -EINVAL; + } +} + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, + int* count) { + uv_interface_address_t* address; + int sockfd, inet6, size = 1; + struct ifconf ifc; + struct ifreq *ifr, *p, flg; + struct sockaddr_dl* sa_addr; + + *count = 0; + + if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { + return -errno; + } + + if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) { + uv__close(sockfd); + return -errno; + } + + ifc.ifc_req = (struct ifreq*)uv__malloc(size); + ifc.ifc_len = size; + if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) { + uv__close(sockfd); + return -errno; + } + +#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p)) + + /* Count all up and running ipv4/ipv6 addresses */ + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + uv__close(sockfd); + return -errno; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + (*count)++; + } + + /* Alloc the return interface structs */ + *addresses = uv__malloc(*count * sizeof(uv_interface_address_t)); + if (!(*addresses)) { + uv__close(sockfd); + return -ENOMEM; + } + address = *addresses; + + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + inet6 = (p->ifr_addr.sa_family == AF_INET6); + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + uv__close(sockfd); + return -ENOSYS; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + /* All conditions above must match count loop */ + + address->name = uv__strdup(p->ifr_name); + + if (inet6) + address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); + else + address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); + + sa_addr = (struct sockaddr_dl*) &p->ifr_addr; + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + + if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) { + uv__close(sockfd); + return -ENOSYS; + } + + if (inet6) + address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr); + else + address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr); + + address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; + + address++; + } + +#undef ADDR_SIZE + + uv__close(sockfd); + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} \ No newline at end of file diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c index 56a8f4ffe753e8..06f19a4fc9fc54 100644 --- a/deps/uv/src/unix/aix.c +++ b/deps/uv/src/unix/aix.c @@ -1,4 +1,5 @@ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -316,104 +317,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { } -uint64_t uv__hrtime(uv_clocktype_t type) { - uint64_t G = 1000000000; - timebasestruct_t t; - read_wall_time(&t, TIMEBASE_SZ); - time_base_to_time(&t, TIMEBASE_SZ); - return (uint64_t) t.tb_high * G + t.tb_low; -} - - -/* - * We could use a static buffer for the path manipulations that we need outside - * of the function, but this function could be called by multiple consumers and - * we don't want to potentially create a race condition in the use of snprintf. - * There is no direct way of getting the exe path in AIX - either through /procfs - * or through some libc APIs. The below approach is to parse the argv[0]'s pattern - * and use it in conjunction with PATH environment variable to craft one. - */ -int uv_exepath(char* buffer, size_t* size) { - int res; - char args[PATH_MAX]; - char abspath[PATH_MAX]; - size_t abspath_size; - struct procsinfo pi; - - if (buffer == NULL || size == NULL || *size == 0) - return -EINVAL; - - pi.pi_pid = getpid(); - res = getargs(&pi, sizeof(pi), args, sizeof(args)); - if (res < 0) - return -EINVAL; - - /* - * Possibilities for args: - * i) an absolute path such as: /home/user/myprojects/nodejs/node - * ii) a relative path such as: ./node or ../myprojects/nodejs/node - * iii) a bare filename such as "node", after exporting PATH variable - * to its location. - */ - - /* Case i) and ii) absolute or relative paths */ - if (strchr(args, '/') != NULL) { - if (realpath(args, abspath) != abspath) - return -errno; - - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - return 0; - } else { - /* Case iii). Search PATH environment variable */ - char trypath[PATH_MAX]; - char *clonedpath = NULL; - char *token = NULL; - char *path = getenv("PATH"); - - if (path == NULL) - return -EINVAL; - - clonedpath = uv__strdup(path); - if (clonedpath == NULL) - return -ENOMEM; - - token = strtok(clonedpath, ":"); - while (token != NULL) { - snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); - if (realpath(trypath, abspath) == abspath) { - /* Check the match is executable */ - if (access(abspath, X_OK) == 0) { - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - uv__free(clonedpath); - return 0; - } - } - token = strtok(NULL, ":"); - } - uv__free(clonedpath); - - /* Out of tokens (path entries), and no match found */ - return -EINVAL; - } -} - - uint64_t uv_get_free_memory(void) { perfstat_memory_total_t mem_total; int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1); @@ -1018,6 +921,7 @@ int uv_uptime(double* uptime) { size_t entries = 0; time_t boot_time; + boot_time = 0; utmpname(UTMP_FILE); setutent(); @@ -1094,143 +998,6 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { } -void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { - int i; - - for (i = 0; i < count; ++i) { - uv__free(cpu_infos[i].model); - } - - uv__free(cpu_infos); -} - - -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { - uv_interface_address_t* address; - int sockfd, inet6, size = 1; - struct ifconf ifc; - struct ifreq *ifr, *p, flg; - struct sockaddr_dl* sa_addr; - - *count = 0; - - if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { - return -errno; - } - - if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) { - uv__close(sockfd); - return -errno; - } - - ifc.ifc_req = (struct ifreq*)uv__malloc(size); - ifc.ifc_len = size; - if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) { - uv__close(sockfd); - return -errno; - } - -#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p)) - - /* Count all up and running ipv4/ipv6 addresses */ - ifr = ifc.ifc_req; - while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { - p = ifr; - ifr = (struct ifreq*) - ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); - - if (!(p->ifr_addr.sa_family == AF_INET6 || - p->ifr_addr.sa_family == AF_INET)) - continue; - - memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); - if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { - uv__close(sockfd); - return -errno; - } - - if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) - continue; - - (*count)++; - } - - /* Alloc the return interface structs */ - *addresses = (uv_interface_address_t*) - uv__malloc(*count * sizeof(uv_interface_address_t)); - if (!(*addresses)) { - uv__close(sockfd); - return -ENOMEM; - } - address = *addresses; - - ifr = ifc.ifc_req; - while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { - p = ifr; - ifr = (struct ifreq*) - ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); - - if (!(p->ifr_addr.sa_family == AF_INET6 || - p->ifr_addr.sa_family == AF_INET)) - continue; - - inet6 = (p->ifr_addr.sa_family == AF_INET6); - - memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); - if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { - uv__close(sockfd); - return -ENOSYS; - } - - if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) - continue; - - /* All conditions above must match count loop */ - - address->name = uv__strdup(p->ifr_name); - - if (inet6) - address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); - else - address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); - - sa_addr = (struct sockaddr_dl*) &p->ifr_addr; - memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); - - if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) { - uv__close(sockfd); - return -ENOSYS; - } - - if (inet6) - address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr); - else - address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr); - - address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; - - address++; - } - -#undef ADDR_SIZE - - uv__close(sockfd); - return 0; -} - - -void uv_free_interface_addresses(uv_interface_address_t* addresses, - int count) { - int i; - - for (i = 0; i < count; ++i) { - uv__free(addresses[i].name); - } - - uv__free(addresses); -} - void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { struct pollfd* events; uintptr_t i; diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index d64593a3134729..c7e431e5295d1b 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -1345,6 +1345,11 @@ uv_os_fd_t uv_get_osfhandle(int fd) { } +uv_pid_t uv_os_getpid(void) { + return getpid(); +} + + uv_pid_t uv_os_getppid(void) { return getppid(); } diff --git a/deps/uv/src/unix/ibmi.c b/deps/uv/src/unix/ibmi.c new file mode 100644 index 00000000000000..8380d02db7616d --- /dev/null +++ b/deps/uv/src/unix/ibmi.c @@ -0,0 +1,112 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +uint64_t uv_get_free_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES); +} + + +uint64_t uv_get_total_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES); +} + + +void uv_loadavg(double avg[3]) { + avg[0] = avg[1] = avg[2] = 0; + return; +} + + +int uv_resident_set_memory(size_t* rss) { + return UV_ENOSYS; +} + + +int uv_uptime(double* uptime) { + return UV_ENOSYS; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int numcpus, idx = 0; + uv_cpu_info_t* cpu_info; + + *cpu_infos = NULL; + *count = 0; + + numcpus = sysconf(_SC_NPROCESSORS_ONLN); + + *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t)); + if (!*cpu_infos) { + return -ENOMEM; + } + + cpu_info = *cpu_infos; + for (idx = 0; idx < numcpus; idx++) { + cpu_info->speed = 0; + cpu_info->model = uv__strdup("unknown"); + cpu_info->cpu_times.user = 0; + cpu_info->cpu_times.sys = 0; + cpu_info->cpu_times.idle = 0; + cpu_info->cpu_times.irq = 0; + cpu_info->cpu_times.nice = 0; + cpu_info++; + } + *count = numcpus; + + return 0; +} \ No newline at end of file diff --git a/deps/uv/src/unix/os390-syscalls.c b/deps/uv/src/unix/os390-syscalls.c index 86c6852b4b608c..5bc489387ef3c5 100644 --- a/deps/uv/src/unix/os390-syscalls.c +++ b/deps/uv/src/unix/os390-syscalls.c @@ -427,3 +427,12 @@ ssize_t os390_readlink(const char* path, char* buf, size_t len) { return rlen; } + + +size_t strnlen(const char* str, size_t maxlen) { + void* p = memchr(str, 0, maxlen); + if (p == NULL) + return maxlen; + else + return p - str; +} diff --git a/deps/uv/src/unix/os390-syscalls.h b/deps/uv/src/unix/os390-syscalls.h index 7aba3d27da7f9b..5ce6a681bf1cb3 100644 --- a/deps/uv/src/unix/os390-syscalls.h +++ b/deps/uv/src/unix/os390-syscalls.h @@ -66,5 +66,6 @@ int scandir(const char* maindir, struct dirent*** namelist, const struct dirent **)); char *mkdtemp(char* path); ssize_t os390_readlink(const char* path, char* buf, size_t len); +size_t strnlen(const char* str, size_t maxlen); #endif /* UV_OS390_SYSCALL_H_ */ diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c index 80b9686ec828f4..9842710d0ea159 100644 --- a/deps/uv/src/unix/process.c +++ b/deps/uv/src/unix/process.c @@ -419,6 +419,7 @@ int uv_spawn(uv_loop_t* loop, return -ENOSYS; #else int signal_pipe[2] = { -1, -1 }; + int pipes_storage[8][2]; int (*pipes)[2]; int stdio_count; ssize_t r; @@ -443,7 +444,10 @@ int uv_spawn(uv_loop_t* loop, stdio_count = 3; err = -ENOMEM; - pipes = uv__malloc(stdio_count * sizeof(*pipes)); + pipes = pipes_storage; + if (stdio_count > (int) ARRAY_SIZE(pipes_storage)) + pipes = uv__malloc(stdio_count * sizeof(*pipes)); + if (pipes == NULL) goto error; @@ -548,7 +552,9 @@ int uv_spawn(uv_loop_t* loop, process->pid = pid; process->exit_cb = options->exit_cb; - uv__free(pipes); + if (pipes != pipes_storage) + uv__free(pipes); + return exec_errorno; error: @@ -562,7 +568,9 @@ int uv_spawn(uv_loop_t* loop, if (pipes[i][1] != -1) uv__close_nocheckstdio(pipes[i][1]); } - uv__free(pipes); + + if (pipes != pipes_storage) + uv__free(pipes); } return err; diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index 672a7e2d6c65f6..6fc0a01f5a51a6 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -1261,8 +1261,9 @@ static void uv__read(uv_stream_t* stream) { int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { - assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE) && - "uv_shutdown (unix) only supports uv_handle_t right now"); + assert(stream->type == UV_TCP || + stream->type == UV_TTY || + stream->type == UV_NAMED_PIPE); if (!(stream->flags & UV_STREAM_WRITABLE) || stream->flags & UV_STREAM_SHUT || diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c index c423dcb15fe11d..c7c8d21c668080 100644 --- a/deps/uv/src/unix/tcp.c +++ b/deps/uv/src/unix/tcp.c @@ -28,15 +28,12 @@ #include -static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) { +static int new_socket(uv_tcp_t* handle, int domain, unsigned long flags) { + struct sockaddr_storage saddr; + socklen_t slen; int sockfd; int err; - if (domain == AF_UNSPEC || uv__stream_fd(handle) != -1) { - handle->flags |= flags; - return 0; - } - err = uv__socket(domain, SOCK_STREAM, 0); if (err < 0) return err; @@ -48,10 +45,74 @@ static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) { return err; } + if (flags & UV_HANDLE_BOUND) { + /* Bind this new socket to an arbitrary port */ + slen = sizeof(saddr); + memset(&saddr, 0, sizeof(saddr)); + err = getsockname(uv__stream_fd(handle), (struct sockaddr*) &saddr, &slen); + if (err) { + uv__close(sockfd); + return err; + } + + err = bind(uv__stream_fd(handle), (struct sockaddr*) &saddr, slen); + if (err) { + uv__close(sockfd); + return err; + } + } + return 0; } +static int maybe_new_socket(uv_tcp_t* handle, int domain, unsigned long flags) { + struct sockaddr_storage saddr; + socklen_t slen; + + if (domain == AF_UNSPEC) { + handle->flags |= flags; + return 0; + } + + if (uv__stream_fd(handle) != -1) { + + if (flags & UV_HANDLE_BOUND) { + + if (handle->flags & UV_HANDLE_BOUND) { + /* It is already bound to a port. */ + handle->flags |= flags; + return 0; + } + + /* Query to see if tcp socket is bound. */ + slen = sizeof(saddr); + memset(&saddr, 0, sizeof(saddr)); + if (getsockname(uv__stream_fd(handle), (struct sockaddr*) &saddr, &slen)) + return -errno; + + if ((saddr.ss_family == AF_INET6 && + ((struct sockaddr_in6*) &saddr)->sin6_port != 0) || + (saddr.ss_family == AF_INET && + ((struct sockaddr_in*) &saddr)->sin_port != 0)) { + /* Handle is already bound to a port. */ + handle->flags |= flags; + return 0; + } + + /* Bind to arbitrary port */ + if (bind(uv__stream_fd(handle), (struct sockaddr*) &saddr, slen)) + return -errno; + } + + handle->flags |= flags; + return 0; + } + + return new_socket(handle, domain, flags); +} + + int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* tcp, unsigned int flags) { int domain; @@ -260,6 +321,7 @@ int uv_tcp_getpeername(const uv_tcp_t* handle, int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { static int single_accept = -1; + unsigned long flags; int err; if (tcp->delayed_error) @@ -273,30 +335,17 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { if (single_accept) tcp->flags |= UV_TCP_SINGLE_ACCEPT; - err = maybe_new_socket(tcp, AF_INET, UV_STREAM_READABLE); - if (err) - return err; - -#ifdef __MVS__ + flags = UV_STREAM_READABLE; +#if defined(__MVS__) /* on zOS the listen call does not bind automatically if the socket is unbound. Hence the manual binding to an arbitrary port is required to be done manually */ - - if (!(tcp->flags & UV_HANDLE_BOUND)) { - struct sockaddr_storage saddr; - socklen_t slen = sizeof(saddr); - memset(&saddr, 0, sizeof(saddr)); - - if (getsockname(tcp->io_watcher.fd, (struct sockaddr*) &saddr, &slen)) - return -errno; - - if (bind(tcp->io_watcher.fd, (struct sockaddr*) &saddr, slen)) - return -errno; - - tcp->flags |= UV_HANDLE_BOUND; - } -#endif + flags |= UV_HANDLE_BOUND; +#endif + err = maybe_new_socket(tcp, AF_INET, flags); + if (err) + return err; if (listen(tcp->io_watcher.fd, backlog)) return -errno; diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index b90eaa7548969a..11c7c13edd04d6 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -439,8 +439,15 @@ void fs__open(uv_fs_t* req) { * does. We indiscriminately use all the sharing modes, to match * UNIX semantics. In particular, this ensures that the file can * be deleted even whilst it's open, fixing issue #1449. + * We still support exclusive sharing mode, since it is necessary + * for opening raw block devices, otherwise Windows will prevent + * any attempt to write past the master boot record. */ - share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + if (flags & UV_FS_O_EXLOCK) { + share = 0; + } else { + share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + } switch (flags & (UV_FS_O_CREAT | UV_FS_O_EXCL | UV_FS_O_TRUNC)) { case 0: diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index 642213bc8886c2..1a7c4dc15e0b30 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -31,8 +31,8 @@ #include "stream-inl.h" #include "req-inl.h" -#include -#include +#include +#include typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t; diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c index 30b2d7793cf906..9eaad77cd02c97 100644 --- a/deps/uv/src/win/thread.c +++ b/deps/uv/src/win/thread.c @@ -182,6 +182,7 @@ int uv_thread_join(uv_thread_t *tid) { else { CloseHandle(*tid); *tid = 0; + MemoryBarrier(); /* For feature parity with pthread_join(). */ return 0; } } diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index 2aec9f8dfe3e2b..3100bc23ad3e09 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -331,6 +331,11 @@ uint64_t uv_get_total_memory(void) { } +uv_pid_t uv_os_getpid(void) { + return GetCurrentProcessId(); +} + + uv_pid_t uv_os_getppid(void) { int parent_pid = -1; HANDLE handle; diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c index 4e10b68f3b42f7..da4ac82e431124 100644 --- a/deps/uv/test/run-tests.c +++ b/deps/uv/test/run-tests.c @@ -43,6 +43,7 @@ int ipc_send_recv_helper(void); int ipc_helper_bind_twice(void); int stdio_over_pipes_helper(void); int spawn_stdin_stdout(void); +int spawn_tcp_server_helper(void); static int maybe_run_test(int argc, char **argv); @@ -111,6 +112,10 @@ static int maybe_run_test(int argc, char **argv) { return 1; } + if (strcmp(argv[1], "spawn_tcp_server_helper") == 0) { + return spawn_tcp_server_helper(); + } + if (strcmp(argv[1], "spawn_helper3") == 0) { char buffer[256]; ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 6afa650793e670..cae02dd1fddec8 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -32,8 +32,12 @@ defined(__APPLE__) || defined(_AIX) || defined(__MVS__) #include /* unlink, rmdir, etc. */ #else +# include # include # include +# ifndef ERROR_SYMLINK_NOT_SUPPORTED +# define ERROR_SYMLINK_NOT_SUPPORTED 1464 +# endif # define unlink _unlink # define rmdir _rmdir # define open _open @@ -2167,7 +2171,6 @@ TEST_IMPL(fs_utime) { #ifdef _WIN32 TEST_IMPL(fs_stat_root) { int r; - uv_loop_t* loop = uv_default_loop(); r = uv_fs_stat(NULL, &stat_req, "\\", NULL); ASSERT(r == 0); @@ -3061,3 +3064,60 @@ TEST_IMPL(fs_null_req) { return 0; } + +#ifdef _WIN32 +TEST_IMPL(fs_exclusive_sharing_mode) { + int r; + + /* Setup. */ + unlink("test_file"); + + ASSERT(UV_FS_O_EXLOCK > 0); + + r = uv_fs_open(NULL, + &open_req1, + "test_file", + O_RDWR | O_CREAT | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + r = uv_fs_open(NULL, + &open_req2, + "test_file", + O_RDONLY | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r < 0); + ASSERT(open_req2.result < 0); + uv_fs_req_cleanup(&open_req2); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, + &open_req2, + "test_file", + O_RDONLY | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req2.result >= 0); + uv_fs_req_cleanup(&open_req2); + + r = uv_fs_close(NULL, &close_req, open_req2.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 3e88e6c928d096..2adbe6a017cfc3 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -260,6 +260,7 @@ TEST_DECLARE (spawn_closed_process_io) TEST_DECLARE (spawn_reads_child_path) TEST_DECLARE (spawn_inherit_streams) TEST_DECLARE (spawn_quoted_path) +TEST_DECLARE (spawn_tcp_server) TEST_DECLARE (fs_poll) TEST_DECLARE (fs_poll_getpath) TEST_DECLARE (kill) @@ -321,6 +322,9 @@ TEST_DECLARE (fs_write_alotof_bufs) TEST_DECLARE (fs_write_alotof_bufs_with_offset) TEST_DECLARE (fs_file_pos_after_op_with_offset) TEST_DECLARE (fs_null_req) +#ifdef _WIN32 +TEST_DECLARE (fs_exclusive_sharing_mode) +#endif TEST_DECLARE (threadpool_queue_work_simple) TEST_DECLARE (threadpool_queue_work_einval) TEST_DECLARE (threadpool_multiple_event_loops) @@ -740,6 +744,7 @@ TASK_LIST_START TEST_ENTRY (spawn_reads_child_path) TEST_ENTRY (spawn_inherit_streams) TEST_ENTRY (spawn_quoted_path) + TEST_ENTRY (spawn_tcp_server) TEST_ENTRY (fs_poll) TEST_ENTRY (fs_poll_getpath) TEST_ENTRY (kill) @@ -832,6 +837,9 @@ TASK_LIST_START TEST_ENTRY (fs_read_write_null_arguments) TEST_ENTRY (fs_file_pos_after_op_with_offset) TEST_ENTRY (fs_null_req) +#ifdef _WIN32 + TEST_ENTRY (fs_exclusive_sharing_mode) +#endif TEST_ENTRY (get_osfhandle_valid_handle) TEST_ENTRY (threadpool_queue_work_simple) TEST_ENTRY (threadpool_queue_work_einval) diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c index 50ed59a6d23a02..4025fba540e61e 100644 --- a/deps/uv/test/test-platform-output.c +++ b/deps/uv/test/test-platform-output.c @@ -29,6 +29,7 @@ TEST_IMPL(platform_output) { size_t rss; size_t size; double uptime; + uv_pid_t pid; uv_pid_t ppid; uv_rusage_t rusage; uv_cpu_info_t* cpus; @@ -145,6 +146,9 @@ TEST_IMPL(platform_output) { printf(" shell: %s\n", pwd.shell); printf(" home directory: %s\n", pwd.homedir); + pid = uv_os_getpid(); + ASSERT(pid > 0); + printf("uv_os_getpid: %d\n", (int) pid); ppid = uv_os_getppid(); ASSERT(ppid > 0); printf("uv_os_getppid: %d\n", (int) ppid); diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index d3958fe216f983..4b138265a5bc51 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -50,6 +50,7 @@ static size_t exepath_size = 1024; static char* args[5]; static int no_term_signal; static int timer_counter; +static uv_tcp_t tcp_server; #define OUTPUT_SIZE 1024 static char output[OUTPUT_SIZE]; @@ -622,6 +623,84 @@ TEST_IMPL(spawn_stdio_greater_than_3) { } +int spawn_tcp_server_helper(void) { + uv_tcp_t tcp; + uv_os_sock_t handle; + int r; + + r = uv_tcp_init(uv_default_loop(), &tcp); + ASSERT(r == 0); + +#ifdef _WIN32 + handle = _get_osfhandle(3); +#else + handle = 3; +#endif + r = uv_tcp_open(&tcp, handle); + ASSERT(r == 0); + + /* Make sure that we can listen on a socket that was + * passed down from the parent process + */ + r = uv_listen((uv_stream_t*)&tcp, SOMAXCONN, NULL); + ASSERT(r == 0); + + return 1; +} + + +TEST_IMPL(spawn_tcp_server) { + uv_stdio_container_t stdio[4]; + struct sockaddr_in addr; + int fd; + int r; +#ifdef _WIN32 + uv_os_fd_t handle; +#endif + + init_process_options("spawn_tcp_server_helper", exit_cb); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + fd = -1; + r = uv_tcp_init_ex(uv_default_loop(), &tcp_server, AF_INET); + ASSERT(r == 0); + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); +#ifdef _WIN32 + r = uv_fileno((uv_handle_t*)&tcp_server, &handle); + fd = _open_osfhandle((intptr_t) handle, 0); +#else + r = uv_fileno((uv_handle_t*)&tcp_server, &fd); + #endif + ASSERT(r == 0); + ASSERT(fd > 0); + + options.stdio = stdio; + options.stdio[0].flags = UV_INHERIT_FD; + options.stdio[0].data.fd = 0; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = 1; + options.stdio[2].flags = UV_INHERIT_FD; + options.stdio[2].data.fd = 2; + options.stdio[3].flags = UV_INHERIT_FD; + options.stdio[3].data.fd = fd; + options.stdio_count = 4; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + TEST_IMPL(spawn_ignored_stdio) { int r; diff --git a/deps/uv/test/test-thread.c b/deps/uv/test/test-thread.c index b0e87e208155ea..955c9f2f1be149 100644 --- a/deps/uv/test/test-thread.c +++ b/deps/uv/test/test-thread.c @@ -44,7 +44,7 @@ struct fs_req { struct test_thread { uv_thread_t thread_id; - volatile int thread_called; + int thread_called; }; static void getaddrinfo_do(struct getaddrinfo_req* req); @@ -54,7 +54,7 @@ static void getaddrinfo_cb(uv_getaddrinfo_t* handle, static void fs_do(struct fs_req* req); static void fs_cb(uv_fs_t* handle); -static volatile int thread_called; +static int thread_called; static uv_key_t tls_key; @@ -105,36 +105,30 @@ static void fs_cb(uv_fs_t* handle) { static void do_work(void* arg) { - struct getaddrinfo_req getaddrinfo_reqs[16]; - struct fs_req fs_reqs[16]; - uv_loop_t* loop; + struct getaddrinfo_req getaddrinfo_reqs[4]; + struct fs_req fs_reqs[4]; + uv_loop_t loop; size_t i; - int r; struct test_thread* thread = arg; - loop = malloc(sizeof *loop); - ASSERT(loop != NULL); - ASSERT(0 == uv_loop_init(loop)); + ASSERT(0 == uv_loop_init(&loop)); for (i = 0; i < ARRAY_SIZE(getaddrinfo_reqs); i++) { struct getaddrinfo_req* req = getaddrinfo_reqs + i; - req->counter = 16; - req->loop = loop; + req->counter = 4; + req->loop = &loop; getaddrinfo_do(req); } for (i = 0; i < ARRAY_SIZE(fs_reqs); i++) { struct fs_req* req = fs_reqs + i; - req->counter = 16; - req->loop = loop; + req->counter = 4; + req->loop = &loop; fs_do(req); } - r = uv_run(loop, UV_RUN_DEFAULT); - ASSERT(r == 0); - - ASSERT(0 == uv_loop_close(loop)); - free(loop); + ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); + ASSERT(0 == uv_loop_close(&loop)); thread->thread_called = 1; } @@ -179,7 +173,7 @@ TEST_IMPL(threadpool_multiple_event_loops) { for (i = 0; i < ARRAY_SIZE(threads); i++) { r = uv_thread_join(&threads[i].thread_id); ASSERT(r == 0); - ASSERT(threads[i].thread_called); + ASSERT(threads[i].thread_called == 1); } return 0; diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 9d9bb4b735a310..96fb801a77b034 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -274,19 +274,43 @@ }, }], [ 'OS=="aix"', { - 'sources': [ 'src/unix/aix.c' ], + 'variables': { + 'os_name': ' Date: Wed, 29 Nov 2017 15:44:35 +0000 Subject: [PATCH 255/379] errors: fix typo in TLS_SESSION_ATTACK message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17388 Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tobias Nießen --- lib/internal/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index aadb0684d0d778..aca7c66e6d3bd2 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -341,7 +341,7 @@ E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout'); E('ERR_TLS_RENEGOTIATION_FAILED', 'Failed to renegotiate'); E('ERR_TLS_REQUIRED_SERVER_NAME', '"servername" is required parameter for Server.addContext'); -E('ERR_TLS_SESSION_ATTACK', 'TSL session renegotiation attack detected'); +E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected'); E('ERR_TRANSFORM_ALREADY_TRANSFORMING', 'Calling transform done when still transforming'); E('ERR_TRANSFORM_WITH_LENGTH_0', From 419cde79b1fd2adc5c215e0b3ffe47c0bd916b59 Mon Sep 17 00:00:00 2001 From: Leko Date: Mon, 27 Nov 2017 16:16:32 +0900 Subject: [PATCH 256/379] src: use non-deprecated versions of `->To*()` utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed from multiple commits: - src: replace ->To*(isolate) with ->To*(context).ToLocalChecked() - test: use .As on Exception::Error > Exception::Error always returns an object, so e.As() should also work fine See https://github.com/nodejs/node/pull/17343#discussion_r153232027 - test: use .As instead of ->ToObject we already checked that its a buffer - src: use FromMaybe instead of ToLocalChecked It fixed this test case: 19a1b2e414 - src: pass context to Get() Dont pass Local is deprecated soon. So we migrate to maybe version. - src: return if Get or ToObject return an empty before call ToLocalChecked Refs: https://github.com/nodejs/node/issues/17244 PR-URL: https://github.com/nodejs/node/pull/17343 Reviewed-By: Ben Noordhuis Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Yuta Hiroto Reviewed-By: Anna Henningsen Reviewed-By: Daijiro Wachi --- src/node.cc | 27 ++++++++++++++++++++------- src/node_buffer.cc | 4 ++-- src/node_contextify.cc | 3 ++- src/node_file.cc | 2 +- src/node_http_parser.cc | 2 +- src/node_zlib.cc | 4 ++-- src/process_wrap.cc | 3 ++- src/stream_base.cc | 4 ++-- 8 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/node.cc b/src/node.cc index 7b4b112897b7e8..13d93796e4e64c 100644 --- a/src/node.cc +++ b/src/node.cc @@ -917,7 +917,7 @@ Local ErrnoException(Isolate* isolate, } e = Exception::Error(cons); - Local obj = e->ToObject(env->isolate()); + Local obj = e.As(); obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno)); obj->Set(env->code_string(), estring); @@ -1079,7 +1079,7 @@ Local WinapiErrnoException(Isolate* isolate, e = Exception::Error(message); } - Local obj = e->ToObject(env->isolate()); + Local obj = e.As(); obj->Set(env->errno_string(), Integer::New(isolate, errorno)); if (path != nullptr) { @@ -1756,7 +1756,7 @@ static void ReportException(Environment* env, if (er->IsUndefined() || er->IsNull()) { trace_value = Undefined(env->isolate()); } else { - Local err_obj = er->ToObject(env->isolate()); + Local err_obj = er->ToObject(env->context()).ToLocalChecked(); trace_value = err_obj->Get(env->stack_string()); arrow = @@ -2579,7 +2579,8 @@ static void DLOpen(const FunctionCallbackInfo& args) { return env->ThrowTypeError("flag argument must be an integer."); } - Local module = args[0]->ToObject(env->isolate()); // Cast + Local module = + args[0]->ToObject(env->context()).ToLocalChecked(); // Cast node::Utf8Value filename(env->isolate(), args[1]); // Cast DLib dlib; dlib.filename_ = *filename; @@ -2597,7 +2598,8 @@ static void DLOpen(const FunctionCallbackInfo& args) { dlib.Close(); #ifdef _WIN32 // Windows needs to add the filename into the error message - errmsg = String::Concat(errmsg, args[1]->ToString(env->isolate())); + errmsg = String::Concat(errmsg, + args[1]->ToString(env->context()).ToLocalChecked()); #endif // _WIN32 env->isolate()->ThrowException(Exception::Error(errmsg)); return; @@ -2642,7 +2644,18 @@ static void DLOpen(const FunctionCallbackInfo& args) { modlist_addon = mp; Local exports_string = env->exports_string(); - Local exports = module->Get(exports_string)->ToObject(env->isolate()); + MaybeLocal maybe_exports = + module->Get(env->context(), exports_string); + + if (maybe_exports.IsEmpty() || + maybe_exports.ToLocalChecked()->ToObject(env->context()).IsEmpty()) { + dlib.Close(); + return; + } + + Local exports = + maybe_exports.ToLocalChecked()->ToObject(env->context()) + .FromMaybe(Local()); if (mp->nm_context_register_func != nullptr) { mp->nm_context_register_func(exports, module, env->context(), mp->nm_priv); @@ -4641,7 +4654,7 @@ void EmitBeforeExit(Environment* env) { Local exit_code = FIXED_ONE_BYTE_STRING(env->isolate(), "exitCode"); Local args[] = { FIXED_ONE_BYTE_STRING(env->isolate(), "beforeExit"), - process_object->Get(exit_code)->ToInteger(env->isolate()) + process_object->Get(exit_code)->ToInteger(env->context()).ToLocalChecked() }; MakeCallback(env->isolate(), process_object, "emit", arraysize(args), args, diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 45597c72e5ee08..ca2c6a89cb012a 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -608,7 +608,7 @@ void Fill(const FunctionCallbackInfo& args) { return; } - str_obj = args[1]->ToString(env->isolate()); + str_obj = args[1]->ToString(env->context()).ToLocalChecked(); enc = ParseEncoding(env->isolate(), args[4], UTF8); str_length = enc == UTF8 ? str_obj->Utf8Length() : @@ -681,7 +681,7 @@ void StringWrite(const FunctionCallbackInfo& args) { if (!args[0]->IsString()) return env->ThrowTypeError("Argument must be a string"); - Local str = args[0]->ToString(env->isolate()); + Local str = args[0]->ToString(env->context()).ToLocalChecked(); size_t offset; size_t max_length; diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 420cc77e927076..ec97e821db1636 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -654,7 +654,8 @@ class ContextifyScript : public BaseObject { new ContextifyScript(env, args.This()); TryCatch try_catch(env->isolate()); - Local code = args[0]->ToString(env->isolate()); + Local code = + args[0]->ToString(env->context()).FromMaybe(Local()); Local options = args[1]; MaybeLocal filename = GetFilenameArg(env, options); diff --git a/src/node_file.cc b/src/node_file.cc index 9e7f7bb0e3566a..bef62ae766c7e0 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1169,7 +1169,7 @@ static void Read(const FunctionCallbackInfo& args) { char * buf = nullptr; - Local buffer_obj = args[1]->ToObject(env->isolate()); + Local buffer_obj = args[1].As(); char *buffer_data = Buffer::Data(buffer_obj); size_t buffer_length = Buffer::Length(buffer_obj); diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index c990b763be3f76..f378a0475a65c0 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -466,7 +466,7 @@ class Parser : public AsyncWrap { enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_); Local e = Exception::Error(env->parse_error_string()); - Local obj = e->ToObject(env->isolate()); + Local obj = e.As(); obj->Set(env->bytes_parsed_string(), Integer::New(env->isolate(), 0)); obj->Set(env->code_string(), OneByteString(env->isolate(), http_errno_name(err))); diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 21145a0d5bdeb1..8ef4383e0355de 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -178,7 +178,7 @@ class ZCtx : public AsyncWrap { } else { CHECK(Buffer::HasInstance(args[1])); Local in_buf; - in_buf = args[1]->ToObject(env->isolate()); + in_buf = args[1]->ToObject(env->context()).ToLocalChecked(); in_off = args[2]->Uint32Value(); in_len = args[3]->Uint32Value(); @@ -187,7 +187,7 @@ class ZCtx : public AsyncWrap { } CHECK(Buffer::HasInstance(args[4])); - Local out_buf = args[4]->ToObject(env->isolate()); + Local out_buf = args[4]->ToObject(env->context()).ToLocalChecked(); out_off = args[5]->Uint32Value(); out_len = args[6]->Uint32Value(); CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf))); diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 3667b0449e4e2c..b01ef56270767e 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -143,7 +143,8 @@ class ProcessWrap : public HandleWrap { ProcessWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); - Local js_options = args[0]->ToObject(env->isolate()); + Local js_options = + args[0]->ToObject(env->context()).ToLocalChecked(); uv_process_options_t options; memset(&options, 0, sizeof(uv_process_options_t)); diff --git a/src/stream_base.cc b/src/stream_base.cc index c6aca1694f9568..922b277c583017 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -127,7 +127,7 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { // Buffer chunk, no additional storage required // String chunk - Local string = chunk->ToString(env->isolate()); + Local string = chunk->ToString(env->context()).ToLocalChecked(); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); size_t chunk_size; @@ -179,7 +179,7 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { char* str_storage = req_wrap->Extra(offset); size_t str_size = storage_size - offset; - Local string = chunk->ToString(env->isolate()); + Local string = chunk->ToString(env->context()).ToLocalChecked(); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); str_size = StringBytes::Write(env->isolate(), From f0608814af4b48fa094515e9a38c6ed72e781296 Mon Sep 17 00:00:00 2001 From: Leko Date: Tue, 28 Nov 2017 23:13:38 +0900 Subject: [PATCH 257/379] test: add test case for throwing an exception with vm.Script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It failed with `FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal`. PR-URL: https://github.com/nodejs/node/pull/17343 Reviewed-By: Ben Noordhuis Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Yuta Hiroto Reviewed-By: Anna Henningsen Reviewed-By: Daijiro Wachi --- test/parallel/test-vm-script-throw-in-tostring.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/parallel/test-vm-script-throw-in-tostring.js diff --git a/test/parallel/test-vm-script-throw-in-tostring.js b/test/parallel/test-vm-script-throw-in-tostring.js new file mode 100644 index 00000000000000..20e7a75079b33c --- /dev/null +++ b/test/parallel/test-vm-script-throw-in-tostring.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const vm = require('vm'); + +assert.throws(() => { + new vm.Script({ + toString() { + throw new Error(); + } + }); +}, Error); From 8336e4f88ea5e904fbd669988e2a9557d72f156e Mon Sep 17 00:00:00 2001 From: Leko Date: Thu, 30 Nov 2017 21:27:47 +0900 Subject: [PATCH 258/379] test: add test case for process.dlopen with undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17343 Reviewed-By: Ben Noordhuis Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Yuta Hiroto Reviewed-By: Anna Henningsen Reviewed-By: Daijiro Wachi --- test/parallel/test-process-dlopen-undefined-exports.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/parallel/test-process-dlopen-undefined-exports.js diff --git a/test/parallel/test-process-dlopen-undefined-exports.js b/test/parallel/test-process-dlopen-undefined-exports.js new file mode 100644 index 00000000000000..3766a73a45ab7b --- /dev/null +++ b/test/parallel/test-process-dlopen-undefined-exports.js @@ -0,0 +1,10 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const someBindingPath = './test/addons/hello-world/build/Release/binding.node'; + +assert.throws(() => { + process.dlopen({ exports: undefined }, someBindingPath); +}, Error); From 9b41c0b0213d509e3aa3df6b8e04545679e9f3ab Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Thu, 30 Nov 2017 19:00:45 -0500 Subject: [PATCH 259/379] src: node_http2_state.h should not be executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17408 Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen --- src/node_http2_state.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/node_http2_state.h diff --git a/src/node_http2_state.h b/src/node_http2_state.h old mode 100755 new mode 100644 From a596577a31a6d4f2187c2f3a0c312f2ce2ba67e4 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Tue, 21 Nov 2017 13:36:08 -0800 Subject: [PATCH 260/379] doc: improve checkServerIdentity docs PR-URL: https://github.com/nodejs/node/pull/17203 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/tls.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 4274c36d20d0e0..9a0215bd673728 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -792,8 +792,9 @@ changes: * `servername`: {string} Server name for the SNI (Server Name Indication) TLS extension. * `checkServerIdentity(servername, cert)` {Function} A callback function - to be used when checking the server's hostname against the certificate. - This should throw an error if verification fails. The method should return +    to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname against the certificate. + This should return an {Error} if verification fails. The method should return `undefined` if the `servername` and `cert` are verified. * `session` {Buffer} A `Buffer` instance, containing TLS session. * `minDHSize` {number} Minimum size of the DH parameter in bits to accept a From 7849d531581d46ad8cb1f424c64ea1b3f38bc4f2 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Wed, 22 Nov 2017 12:28:59 -0800 Subject: [PATCH 261/379] doc: document tls.checkServerIdentity The funciton was added in eb2ca104628e415fc73c330cdd76fca77bf5ba97 PR-URL: https://github.com/nodejs/node/pull/17203 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/tls.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++--- lib/tls.js | 1 - 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 9a0215bd673728..4f31812dbb6838 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -742,6 +742,55 @@ and their processing can be delayed due to packet loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, which may decrease overall server throughput. +## tls.checkServerIdentity(host, cert) + + +* `host` {string} The hostname to verify the certificate against +* `cert` {Object} An object representing the peer's certificate. The returned + object has some properties corresponding to the fields of the certificate. + +Verifies the certificate `cert` is issued to host `host`. + +Returns {Error} object, populating it with the reason, host and cert on failure. +On success, returns {undefined}. + +*Note*: This function can be overwritten by providing alternative function +as part of the `options.checkServerIdentity` option passed to `tls.connect()`. +The overwriting function can call `tls.checkServerIdentity()` of course, to augment +the checks done with additional verification. + +*Note*: This function is only called if the certificate passed all other checks, such as +being issued by trusted CA (`options.ca`). + +The cert object contains the parsed certificate and will have a structure similar to: + +```text +{ subject: + { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' }, + issuer: + { C: 'GB', + ST: 'Greater Manchester', + L: 'Salford', + O: 'COMODO CA Limited', + CN: 'COMODO RSA Domain Validation Secure Server CA' }, + subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org', + infoAccess: + { 'CA Issuers - URI': + [ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ], + 'OCSP - URI': [ 'http://ocsp.comodoca.com' ] }, + modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1', + exponent: '0x10001', + valid_from: 'Aug 14 00:00:00 2017 GMT', + valid_to: 'Nov 20 23:59:59 2019 GMT', + fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', + ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], + serialNumber: '66593D57F20CBC573E433381B5FEC280', + raw: } +``` + ## tls.connect(options[, callback]) `Buffer` instances are commonly used to represent sequences of encoded characters -such as UTF-8, UCS2, Base64 or even Hex-encoded data. It is possible to +such as UTF-8, UCS2, Base64, or even Hex-encoded data. It is possible to convert back and forth between `Buffer` instances and ordinary JavaScript strings by using an explicit character encoding. diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 8be21a1d07d908..801c4251942e66 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -628,7 +628,7 @@ pipes between the parent and child. The value is one of the following: 5. Positive integer - The integer value is interpreted as a file descriptor that is is currently open in the parent process. It is shared with the child process, similar to how {Stream} objects can be shared. -6. `null`, `undefined` - Use default value. For stdio fds 0, 1 and 2 (in other +6. `null`, `undefined` - Use default value. For stdio fds 0, 1, and 2 (in other words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the default is `'ignore'`. diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 9d6e344667520e..c490ee71ddb7e0 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -5,7 +5,7 @@ > Stability: 2 - Stable The `crypto` module provides cryptographic functionality that includes a set of -wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. Use `require('crypto')` to access this module. @@ -1254,7 +1254,7 @@ In line with OpenSSL's recommendation to use pbkdf2 instead of [`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] to create the `Cipher` object. Users should not use ciphers with counter mode -(e.g. CTR, GCM or CCM) in `crypto.createCipher()`. A warning is emitted when +(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when they are used in order to avoid the risk of IV reuse that causes vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries][] for details. @@ -2034,7 +2034,7 @@ Based on the recommendations of [NIST SP 800-131A][]: - MD5 and SHA-1 are no longer acceptable where collision resistance is required such as digital signatures. -- The key used with RSA, DSA and DH algorithms is recommended to have +- The key used with RSA, DSA, and DH algorithms is recommended to have at least 2048 bits and that of the curve of ECDSA and ECDH at least 224 bits, to be safe to use for several years. - The DH groups of `modp1`, `modp2` and `modp5` have a key size diff --git a/doc/api/fs.md b/doc/api/fs.md index 600f6db59bef4e..0bbfd41d80818c 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1881,7 +1881,7 @@ Linux, and Windows, an error will be returned. On FreeBSD, a representation of the directory's contents will be returned. ```js -// macOS, Linux and Windows +// macOS, Linux, and Windows fs.readFile('', (err, data) => { // => [Error: EISDIR: illegal operation on a directory, read ] }); @@ -1929,7 +1929,7 @@ string. Otherwise it returns a buffer. behavior of `fs.readFileSync()` is platform-specific. ```js -// macOS, Linux and Windows +// macOS, Linux, and Windows fs.readFileSync(''); // => [Error: EISDIR: illegal operation on a directory, read ] @@ -3043,7 +3043,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
- + @@ -3059,7 +3059,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's - + @@ -3075,7 +3075,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's - + diff --git a/doc/api/http2.md b/doc/api/http2.md index d7bbbc1d132ceb..c1f2ecde11b661 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1264,7 +1264,7 @@ added: v8.4.0 In `Http2Server`, there is no `'clientError'` event as there is in HTTP1. However, there are `'socketError'`, `'sessionError'`, and -`'streamError'`, for error happened on the socket, session or stream +`'streamError'`, for error happened on the socket, session, or stream respectively. #### Event: 'socketError' @@ -1857,7 +1857,7 @@ performance. There are several types of error conditions that may arise when using the `http2` module: -Validation Errors occur when an incorrect argument, option or setting value is +Validation Errors occur when an incorrect argument, option, or setting value is passed in. These will always be reported by a synchronous `throw`. State Errors occur when an action is attempted at an incorrect time (for @@ -2229,7 +2229,7 @@ added: v8.4.0 * {net.Socket|tls.TLSSocket} Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but -applies getters, setters and methods based on HTTP/2 logic. +applies getters, setters, and methods based on HTTP/2 logic. `destroyed`, `readable`, and `writable` properties will be retrieved from and set on `request.stream`. @@ -2601,7 +2601,7 @@ added: v8.4.0 * {net.Socket|tls.TLSSocket} Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but -applies getters, setters and methods based on HTTP/2 logic. +applies getters, setters, and methods based on HTTP/2 logic. `destroyed`, `readable`, and `writable` properties will be retrieved from and set on `response.stream`. diff --git a/doc/api/n-api.md b/doc/api/n-api.md index f1587f4848b807..c91927a4ee8304 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2257,7 +2257,7 @@ following forms: - Named: a simple UTF8-encoded string - Integer-Indexed: an index value represented by `uint32_t` - JavaScript value: these are represented in N-API by `napi_value`. This can -be a `napi_value` representing a String, Number or Symbol. +be a `napi_value` representing a String, Number, or Symbol. N-API values are represented by the type `napi_value`. Any N-API call that requires a JavaScript value takes in a `napi_value`. @@ -3471,8 +3471,8 @@ napi_status napi_get_node_version(napi_env env, Returns `napi_ok` if the API succeeded. -This function fills the `version` struct with the major, minor and patch version -of Node that is currently running, and the `release` field with the +This function fills the `version` struct with the major, minor, and patch +version of Node.js that is currently running, and the `release` field with the value of [`process.release.name`][`process.release`]. The returned buffer is statically allocated and does not need to be freed. diff --git a/doc/api/os.md b/doc/api/os.md index dca9b266f7806d..e77238021c6085 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -453,7 +453,7 @@ The following signal constants are exported by `os.constants.signals`: + malformed, unknown, or privileged instruction. diff --git a/doc/api/process.md b/doc/api/process.md index 733abe4c65afaa..675f3fba927e73 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -275,7 +275,7 @@ A process warning is similar to an error in that it describes exceptional conditions that are being brought to the user's attention. However, warnings are not part of the normal Node.js and JavaScript error handling flow. Node.js can emit warnings whenever it detects bad coding practices that could -lead to sub-optimal application performance, bugs or security vulnerabilities. +lead to sub-optimal application performance, bugs, or security vulnerabilities. The listener function is called with a single `warning` argument whose value is an `Error` object. There are three key properties that describe the warning: @@ -1307,7 +1307,7 @@ objects managed by V8. `rss`, Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the process, which includes the _heap_, _code segment_ and _stack_. -The _heap_ is where objects, strings and closures are stored. Variables are +The _heap_ is where objects, strings, and closures are stored. Variables are stored in the _stack_ and the actual JavaScript code resides in the _code segment_. diff --git a/doc/api/tls.md b/doc/api/tls.md index 4f31812dbb6838..806e8fa492b2a7 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -104,7 +104,7 @@ not required and a default ECDHE curve will be used. The `ecdhCurve` property can be used when creating a TLS Server to specify the list of names of supported curves to use, see [`tls.createServer()`] for more info. -### ALPN, NPN and SNI +### ALPN, NPN, and SNI diff --git a/doc/releases.md b/doc/releases.md index c3d21407acf298..be3d3bcdb7af30 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -214,7 +214,7 @@ If you have an error on Windows and need to start again, be aware that you'll ge ARMv7 takes the longest to compile. Unfortunately ccache isn't as effective on release builds, I think it's because of the additional macro settings that go in to a release build that nullify previous builds. Also most of the release build machines are separate to the test build machines so they don't get any benefit from ongoing compiles between releases. You can expect 1.5 hours for the ARMv7 builder to complete and you should normally wait for this to finish. It is possible to rush a release out if you want and add additional builds later but we normally provide ARMv7 from initial promotion. -You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers and docs (both produced currently by an macOS worker). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. +You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers, and docs (both produced currently by an macOS worker). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. ### 9. Test the Build From 0093840044bbc015a540ccfac3cdc569b97c19ec Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 22 Nov 2017 14:12:11 -0800 Subject: [PATCH 268/379] test,doc: do not indicate that non-functions "return" values Update documentation for test `common` module so that properties that are not functions do not specify a return type and functions that do return values specify the type. PR-URL: https://github.com/nodejs/node/pull/17267 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig --- test/common/README.md | 97 ++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index e6371265d8b971..30dd9a2f04d46b 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -43,12 +43,14 @@ A stream to push an array into a REPL Blocks for `time` amount of time. -### canCreateSymLink -API to indicate whether the current running process can create -symlinks. On Windows, this returns false if the process running -doesn't have privileges to create symlinks (specifically -[SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx)). -On non-Windows platforms, this currently returns true. +### canCreateSymLink() +* return [<Boolean>] + +Checks whether the current running process can create symlinks. On Windows, this +returns `false` if the process running doesn't have privileges to create +symlinks +([SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx)). +On non-Windows platforms, this always returns `true`. ### crashOnUnhandledRejection() @@ -63,9 +65,9 @@ failures. Platform normalizes the `dd` command ### enoughTestMem -* return [<Boolean>] +* [<Boolean>] -Check if there is more than 1gb of total memory. +Indicates if there is more than 1gb of total memory. ### expectsError([fn, ]settings[, exact]) * `fn` [<Function>] a function that should throw. @@ -126,7 +128,7 @@ that happens within the `timeoutMs` timespan, or rejects with `error` as a reason otherwise. ### fixturesDir -* return [<String>] +* [<String>] Path to the 'fixtures' directory. @@ -137,39 +139,39 @@ Path to the 'fixtures' directory. Returns an instance of all possible `ArrayBufferView`s of the provided Buffer. ### globalCheck -* return [<Boolean>] +* [<Boolean>] -Turn this off if the test should not check for global leaks. +Set to `false` if the test should not check for global leaks. ### hasCrypto -* return [<Boolean>] +* [<Boolean>] -Checks for 'openssl'. +Indicates whether OpenSSL is available. ### hasFipsCrypto -* return [<Boolean>] +* [<Boolean>] -Checks `hasCrypto` and `crypto` with fips. +Indicates `hasCrypto` and `crypto` with fips. ### hasIntl -* return [<Boolean>] +* [<Boolean>] -Checks if [internationalization] is supported. +Indicates if [internationalization] is supported. ### hasSmallICU -* return [<Boolean>] +* [<Boolean>] -Checks `hasIntl` and `small-icu` is supported. +Indicates `hasIntl` and `small-icu` are supported. ### hasIPv6 -* return [<Boolean>] +* [<Boolean>] -Checks whether `IPv6` is supported on this platform. +Indicates whether `IPv6` is supported on this platform. ### hasMultiLocalhost -* return [<Boolean>] +* [<Boolean>] -Checks if there are multiple localhosts available. +Indicates if there are multiple localhosts available. ### hijackStderr(listener) * `listener` [<Function>]: a listener with a single parameter @@ -190,12 +192,12 @@ be passed to `listener`. What's more, `process.stdout.writeTimes` is a count of the number of calls. ### inFreeBSDJail -* return [<Boolean>] +* [<Boolean>] Checks whether free BSD Jail is true or false. ### isAIX -* return [<Boolean>] +* [<Boolean>] Platform check for Advanced Interactive eXecutive (AIX). @@ -206,54 +208,54 @@ Platform check for Advanced Interactive eXecutive (AIX). Attempts to 'kill' `pid` ### isFreeBSD -* return [<Boolean>] +* [<Boolean>] Platform check for Free BSD. ### isLinux -* return [<Boolean>] +* [<Boolean>] Platform check for Linux. ### isLinuxPPCBE -* return [<Boolean>] +* [<Boolean>] Platform check for Linux on PowerPC. ### isOSX -* return [<Boolean>] +* [<Boolean>] Platform check for macOS. ### isSunOS -* return [<Boolean>] +* [<Boolean>] Platform check for SunOS. ### isWindows -* return [<Boolean>] +* [<Boolean>] Platform check for Windows. ### isWOW64 -* return [<Boolean>] +* [<Boolean>] Platform check for Windows 32-bit on Windows 64-bit. -### leakedGlobals +### leakedGlobals() * return [<Array>] -Checks whether any globals are not on the `knownGlobals` list. +Indicates whether any globals are not on the `knownGlobals` list. ### localhostIPv4 -* return [<String>] +* [<String>] -Gets IP of localhost +IP of `localhost`. ### localIPv6Hosts -* return [<Array>] +* [<Array>] -Array of IPV6 hosts. +Array of IPV6 representations for `localhost`. ### mustCall([fn][, exact]) * `fn` [<Function>] default = () => {} @@ -294,9 +296,9 @@ the exit code and/or signal name of a node process that aborted, `false` otherwise. ### opensslCli -* return [<Boolean>] +* [<Boolean>] -Checks whether 'opensslCli' is supported. +Indicates whether 'opensslCli' is supported. ### platformTimeout(ms) * `ms` [<Number>] @@ -305,14 +307,14 @@ Checks whether 'opensslCli' is supported. Platform normalizes timeout. ### PIPE -* return [<String>] +* [<String>] -Path to the test sock. +Path to the test socket. ### PORT -* return [<Number>] default = `12346` +* [<Number>] -Port tests are running on. +A port number for tests to use if one is needed. ### printSkipMessage(msg) * `msg` [<String>] @@ -335,12 +337,12 @@ Restore the original `process.stdout.write`. Used to restore `stdout` to its original state after calling [`common.hijackStdOut()`][]. ### rootDir -* return [<String>] +* [<String>] Path to the 'root' directory. either `/` or `c:\\` (windows) ### projectDir -* return [<String>] +* [<String>] Path to the project directory. @@ -372,7 +374,7 @@ Platform normalizes the `pwd` command. Synchronous version of `spawnPwd`. ### tmpDir -* return [<String>] +* [<String>] The realpath of the 'tmp' directory. @@ -422,7 +424,6 @@ The `DNS` module provides utilities related to the `dns` built-in module. * `syscall` [<String>] Defaults to `dns.mockedSysCall`. * return [<Function>] - A mock for the `lookup` option of `net.connect()` that would result in an error with the `code` and the `syscall` specified. Returns a function that has the same signature as `dns.lookup()`. From 0e5dc8f9254d5baca8f556c489d1e4be3e889abf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 28 Nov 2017 21:19:13 -0500 Subject: [PATCH 269/379] tools: update markdown lint presets Update remark-preset-lint-node to version at commit hash 859eab541e0f63839b33196f26e2bed4dfe2b194. This is the most recent version at this time (although not yet published to npm). It includes linting for "v8" where "V8" is intended and "Javascript" Where "JavaScript" is intended. By installing those lint rules now rather than waiting for a published version, we avoid the possibility that new markdown text with those prohibited strings will be introduced. PR-URL: https://github.com/nodejs/node/pull/17382 Reviewed-By: Jon Moss --- tools/remark-preset-lint-node/index.js | 7 ++ .../remark-preset-lint-node/package-lock.json | 80 +++++++++++-------- tools/remark-preset-lint-node/package.json | 49 ++++++++++-- 3 files changed, 98 insertions(+), 38 deletions(-) diff --git a/tools/remark-preset-lint-node/index.js b/tools/remark-preset-lint-node/index.js index 132bc7eae24210..c5aef12d539542 100644 --- a/tools/remark-preset-lint-node/index.js +++ b/tools/remark-preset-lint-node/index.js @@ -39,6 +39,13 @@ module.exports.plugins = [ [require('remark-lint-file-extension'), 'md'], [require('remark-lint-first-heading-level'), 1], [require('remark-lint-heading-style'), 'atx'], + [ + require('remark-lint-prohibited-strings'), + [ + { no: 'v8', yes: 'V8' }, + { no: 'Javascript', yes: 'JavaScript' } + ] + ], [require('remark-lint-strong-marker'), '*'], [require('remark-lint-table-cell-padding'), 'padded'] ]; diff --git a/tools/remark-preset-lint-node/package-lock.json b/tools/remark-preset-lint-node/package-lock.json index 30008212f5520e..8c84d7f782b61d 100644 --- a/tools/remark-preset-lint-node/package-lock.json +++ b/tools/remark-preset-lint-node/package-lock.json @@ -1,8 +1,7 @@ { "name": "remark-preset-lint-node", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 1, - "preserveSymlinks": "1", "requires": true, "dependencies": { "co": { @@ -56,7 +55,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-checkbox-character-style": { @@ -67,7 +66,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3", + "unist-util-visit": "1.2.0", "vfile-location": "2.0.2" } }, @@ -79,7 +78,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3", + "unist-util-visit": "1.2.0", "vfile-location": "2.0.2" } }, @@ -91,7 +90,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-definition-spacing": { @@ -102,7 +101,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-fenced-code-flag": { @@ -113,7 +112,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-fenced-code-marker": { @@ -124,7 +123,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-file-extension": { @@ -143,7 +142,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-final-newline": { @@ -161,7 +160,7 @@ "requires": { "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-hard-break-spaces": { @@ -172,7 +171,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-heading-style": { @@ -183,7 +182,7 @@ "mdast-util-heading-style": "1.0.3", "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-auto-link-without-protocol": { @@ -195,7 +194,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-blockquote-without-caret": { @@ -206,7 +205,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3", + "unist-util-visit": "1.2.0", "vfile-location": "2.0.2" } }, @@ -218,7 +217,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-file-name-articles": { @@ -255,7 +254,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-heading-indent": { @@ -267,7 +266,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-inline-padding": { @@ -278,7 +277,7 @@ "mdast-util-to-string": "1.0.4", "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-multiple-toplevel-headings": { @@ -289,7 +288,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-shell-dollars": { @@ -299,7 +298,7 @@ "requires": { "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-shortcut-reference-image": { @@ -309,7 +308,7 @@ "requires": { "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-table-indentation": { @@ -320,7 +319,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-no-tabs": { @@ -339,7 +338,16 @@ "requires": { "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" + } + }, + "remark-lint-prohibited-strings": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-1.0.0.tgz", + "integrity": "sha512-FXqOBjU36+67l3y3RwtACrXdMUusANgyj+kDx6vlXYP8OfaRRjYNse51AcCiNQKR3XHgbGKxEklUHMJFKWfe7A==", + "requires": { + "unified-lint-rule": "1.0.2", + "unist-util-visit": "1.2.0" } }, "remark-lint-rule-style": { @@ -350,7 +358,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-strong-marker": { @@ -361,7 +369,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-table-cell-padding": { @@ -372,7 +380,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-lint-table-pipes": { @@ -383,7 +391,7 @@ "unified-lint-rule": "1.0.2", "unist-util-generated": "1.1.1", "unist-util-position": "3.0.0", - "unist-util-visit": "1.1.3" + "unist-util-visit": "1.2.0" } }, "remark-message-control": { @@ -393,7 +401,7 @@ "requires": { "mdast-comment-marker": "1.0.2", "trim": "0.0.1", - "unist-util-visit": "1.1.3", + "unist-util-visit": "1.2.0", "vfile-location": "2.0.2" } }, @@ -420,15 +428,23 @@ "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.1.tgz", "integrity": "sha1-mfFseJWayFTe58YVwpGSTIv03n8=" }, + "unist-util-is": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.1.tgz", + "integrity": "sha1-DDEmKeP5YMZukx6BLT2A53AQlHs=" + }, "unist-util-position": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.0.tgz", "integrity": "sha1-5uHgPu64HF4a/lU+jUrfvXwNj4I=" }, "unist-util-visit": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", - "integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.2.0.tgz", + "integrity": "sha512-lI+jyPlDztHZ2CJhUchcRMQ7MNc0yASgYFxwRTxs0EZ+9HbYFBLVGDJ2FchTBy+pra0O1LVEn0Wkgf19mDVDzw==", + "requires": { + "unist-util-is": "2.1.1" + } }, "vfile-location": { "version": "2.0.2", diff --git a/tools/remark-preset-lint-node/package.json b/tools/remark-preset-lint-node/package.json index 000a5a2901d4e7..26e25a4d31e64f 100644 --- a/tools/remark-preset-lint-node/package.json +++ b/tools/remark-preset-lint-node/package.json @@ -1,9 +1,30 @@ { - "private": true, - "name": "remark-preset-lint-node", - "version": "1.0.0", - "description": "remark preset to configure remark-lint with settings for nodejs/node", - "main": "index.js", + "_from": "github:watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "_id": "remark-preset-lint-node@1.0.2", + "_inBundle": false, + "_integrity": "sha1-UxsozHvbtJwHgKk6AYCqVPvpz8w=", + "_location": "/remark-preset-lint-node", + "_phantomChildren": {}, + "_requested": { + "type": "git", + "raw": "watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "rawSpec": "watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "saveSpec": "github:watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "fetchSpec": null, + "gitCommittish": "859eab541e0f63839b33196f26e2bed4dfe2b194" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "github:watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "_spec": "watilde/remark-preset-lint-node#859eab541e0f63839b33196f26e2bed4dfe2b194", + "_where": "/Users/trott/io.js/tools", + "author": "", + "bugs": { + "url": "https://github.com/watilde/remark-preset-lint-node/issues" + }, + "bundleDependencies": false, "dependencies": { "remark-lint": "^6.0.0", "remark-lint-blockquote-indentation": "^1.0.0", @@ -34,9 +55,25 @@ "remark-lint-no-table-indentation": "^1.0.0", "remark-lint-no-tabs": "^1.0.0", "remark-lint-no-unused-definitions": "^1.0.0", + "remark-lint-prohibited-strings": "^1.0.0", "remark-lint-rule-style": "^1.0.0", "remark-lint-strong-marker": "^1.0.0", "remark-lint-table-cell-padding": "^1.0.0", "remark-lint-table-pipes": "^1.0.0" - } + }, + "deprecated": false, + "description": "remark preset to configure remark-lint with settings for nodejs/node", + "homepage": "https://github.com/watilde/remark-preset-lint-node#readme", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "remark-preset-lint-node", + "repository": { + "type": "git", + "url": "git+https://github.com/watilde/remark-preset-lint-node.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "1.0.2" } From 90a5e9f19bcbf04f9af067735276ed160edc8127 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 25 Nov 2017 14:17:23 -0500 Subject: [PATCH 270/379] build,win: vcbuild refactoring call configure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17299 Reviewed-By: Tobias Nießen --- vcbuild.bat | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index a15620e726680a..843c0ec99ceaed 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -105,7 +105,7 @@ if /i "%1"=="upload" set upload=1&goto arg-ok if /i "%1"=="small-icu" set i18n_arg=%1&goto arg-ok if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok -if /i "%1"=="without-intl" set i18n_arg=%1&goto arg-ok +if /i "%1"=="without-intl" set i18n_arg=intl-none&goto arg-ok if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok if /i "%1"=="enable-vtune" set enable_vtune_arg=1&goto arg-ok @@ -146,26 +146,21 @@ set "node_gyp_exe="%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp" if "%target_env%"=="vs2015" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2015" if "%target_env%"=="vs2017" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2017" -if "%config%"=="Debug" set configure_flags=%configure_flags% --debug -if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot -if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1 -if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1 -if defined release_urlbase set configure_flags=%configure_flags% --release-urlbase=%release_urlbase% -if defined download_arg set configure_flags=%configure_flags% %download_arg% +if "%config%"=="Debug" set configure_flags=%configure_flags% --debug +if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot +if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1 +if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1 +if defined release_urlbase set configure_flags=%configure_flags% --release-urlbase=%release_urlbase% +if defined download_arg set configure_flags=%configure_flags% %download_arg% if defined enable_vtune_arg set configure_flags=%configure_flags% --enable-vtune-profiling -if defined dll set configure_flags=%configure_flags% --shared -if defined enable_static set configure_flags=%configure_flags% --enable-static -if defined no_NODE_OPTIONS set configure_flags=%configure_flags% --without-node-options - -REM if defined debug_http2 set configure_flags=%configure_flags% --debug-http2 -REM if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp2 - -if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu -if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu -if "%i18n_arg%"=="intl-none" set configure_flags=%configure_flags% --with-intl=none -if "%i18n_arg%"=="without-intl" set configure_flags=%configure_flags% --without-intl - -if defined config_flags set configure_flags=%configure_flags% %config_flags% +if defined dll set configure_flags=%configure_flags% --shared +if defined enable_static set configure_flags=%configure_flags% --enable-static +if defined no_NODE_OPTIONS set configure_flags=%configure_flags% --without-node-options +if defined link_module set configure_flags=%configure_flags% %link_module% +if defined i18n_arg set configure_flags=%configure_flags% --with-intl=%i18n_arg% +if defined config_flags set configure_flags=%configure_flags% %config_flags% +if defined target_arch set configure_flags=%configure_flags% --dest-cpu=%target_arch% +if defined TAG set configure_flags=%configure_flags% --tag=%TAG% if not exist "%~dp0deps\icu" goto no-depsicu if "%target%"=="Clean" echo deleting %~dp0deps\icu @@ -266,7 +261,7 @@ goto run if defined noprojgen goto msbuild @rem Generate the VS project. -call :run-python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% %link_module% +call :run-python configure %configure_flags% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed echo Project files generated. @@ -295,7 +290,7 @@ if errorlevel 1 echo Failed to sign exe&goto exit @rem Skip license.rtf generation if not requested. if not defined licensertf goto package -%config%\node tools\license2rtf.js < LICENSE > %config%\license.rtf +%config%\node.exe tools\license2rtf.js < LICENSE > %config%\license.rtf if errorlevel 1 echo Failed to generate license.rtf&goto exit :package From d3e76e78ff767af9c039f4b67dd7b35eb68950a9 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Fri, 17 Nov 2017 11:00:31 +0100 Subject: [PATCH 271/379] doc: introduce categories to Cpp style guide Ref: https://github.com/nodejs/node/pull/17052#discussion_r151228700 PR-URL: https://github.com/nodejs/node/pull/17095 Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig --- CPP_STYLE_GUIDE.md | 102 ++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 47 deletions(-) diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index d3afd3c1abb7da..7f8e5a3de42e35 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -2,21 +2,24 @@ ## Table of Contents -* [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations) -* [2 spaces of indentation for blocks or bodies of conditionals](#2-spaces-of-indentation-for-blocks-or-bodies-of-conditionals) -* [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations) -* [Align function arguments vertically](#align-function-arguments-vertically) -* [Initialization lists](#initialization-lists) -* [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes) -* [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters) -* [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields) -* [Space after `template`](#space-after-template) -* [Type casting](#type-casting) -* [Memory allocation](#memory-allocation) -* [`nullptr` instead of `NULL` or `0`](#nullptr-instead-of-null-or-0) -* [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included) -* [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods) -* [Ownership and Smart Pointers](#ownership-and-smart-pointers) +* [Formatting](#formatting) + * [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations) + * [2 spaces of indentation for blocks or bodies of conditionals](#2-spaces-of-indentation-for-blocks-or-bodies-of-conditionals) + * [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations) + * [Align function arguments vertically](#align-function-arguments-vertically) + * [Initialization lists](#initialization-lists) + * [CamelCase for methods, functions and classes](#camelcase-for-methods-functions-and-classes) + * [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters) + * [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields) + * [Space after `template`](#space-after-template) +* [Memory Management](#memory-management) + * [Memory allocation](#memory-allocation) + * [Use `nullptr` instead of `NULL` or `0`](#use-nullptr-instead-of-null-or-0) + * [Ownership and Smart Pointers](#ownership-and-smart-pointers) +* [Others](#others) + * [Type casting](#type-casting) + * [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included) + * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods) Unfortunately, the C++ linter (based on [Google’s `cpplint`](https://github.com/google/styleguide)), which can be run @@ -24,6 +27,8 @@ explicitly via `make lint-cpp`, does not currently catch a lot of rules that are specific to the Node.js C++ code base. This document explains the most common of these rules: +## Formatting + ## Left-leaning (C++ style) asterisks for pointer declarations `char* buffer;` instead of `char *buffer;` @@ -128,23 +133,50 @@ class FancyContainer { ... } ``` - -## Type casting - -- Always avoid C-style casts (`(type)value`) -- `dynamic_cast` does not work because RTTI is not enabled -- Use `static_cast` for casting whenever it works -- `reinterpret_cast` is okay if `static_cast` is not appropriate +## Memory Management ## Memory allocation - `Malloc()`, `Calloc()`, etc. from `util.h` abort in Out-of-Memory situations - `UncheckedMalloc()`, etc. return `nullptr` in OOM situations -## `nullptr` instead of `NULL` or `0` +## Use `nullptr` instead of `NULL` or `0` What it says in the title. +## Ownership and Smart Pointers + +"Smart" pointers are classes that act like pointers, e.g. +by overloading the `*` and `->` operators. Some smart pointer types can be +used to automate ownership bookkeeping, to ensure these responsibilities are +met. `std::unique_ptr` is a smart pointer type introduced in C++11, which +expresses exclusive ownership of a dynamically allocated object; the object +is deleted when the `std::unique_ptr` goes out of scope. It cannot be +copied, but can be moved to represent ownership transfer. +`std::shared_ptr` is a smart pointer type that expresses shared ownership of a +dynamically allocated object. `std::shared_ptr`s can be copied; ownership +of the object is shared among all copies, and the object +is deleted when the last `std::shared_ptr` is destroyed. + +Prefer to use `std::unique_ptr` to make ownership +transfer explicit. For example: + +```cpp +std::unique_ptr FooFactory(); +void FooConsumer(std::unique_ptr ptr); +``` + +Never use `std::auto_ptr`. Instead, use `std::unique_ptr`. + +## Others + +## Type casting + +- Always avoid C-style casts (`(type)value`) +- `dynamic_cast` does not work because RTTI is not enabled +- Use `static_cast` for casting whenever it works +- `reinterpret_cast` is okay if `static_cast` is not appropriate + ## Do not include `*.h` if `*-inl.h` has already been included Do @@ -169,27 +201,3 @@ A lot of code inside Node.js is written so that typechecking etc. is performed in JavaScript. Using C++ `throw` is not allowed. - -## Ownership and Smart Pointers - -"Smart" pointers are classes that act like pointers, e.g. -by overloading the `*` and `->` operators. Some smart pointer types can be -used to automate ownership bookkeeping, to ensure these responsibilities are -met. `std::unique_ptr` is a smart pointer type introduced in C++11, which -expresses exclusive ownership of a dynamically allocated object; the object -is deleted when the `std::unique_ptr` goes out of scope. It cannot be -copied, but can be moved to represent ownership transfer. -`std::shared_ptr` is a smart pointer type that expresses shared ownership of a -dynamically allocated object. `std::shared_ptr`s can be copied; ownership -of the object is shared among all copies, and the object -is deleted when the last `std::shared_ptr` is destroyed. - -Prefer to use `std::unique_ptr` to make ownership -transfer explicit. For example: - -```cpp -std::unique_ptr FooFactory(); -void FooConsumer(std::unique_ptr ptr); -``` - -Never use `std::auto_ptr`. Instead, use `std::unique_ptr`. From 91d541627e7f9b2c56c5a61869575042bd1602a4 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Mon, 27 Nov 2017 11:43:20 +0530 Subject: [PATCH 272/379] test: update test-http-status-reason-invalid-chars to use countdown PR-URL: https://github.com/nodejs/node/pull/17342 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-status-reason-invalid-chars.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http-status-reason-invalid-chars.js b/test/parallel/test-http-status-reason-invalid-chars.js index 75ccb2c2430c53..ce08ff84a09b42 100644 --- a/test/parallel/test-http-status-reason-invalid-chars.js +++ b/test/parallel/test-http-status-reason-invalid-chars.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); function explicit(req, res) { assert.throws(() => { @@ -34,13 +35,12 @@ const server = http.createServer((req, res) => { } }).listen(0, common.mustCall(() => { const hostname = 'localhost'; + const countdown = new Countdown(2, () => server.close()); const url = `http://${hostname}:${server.address().port}`; - let left = 2; const check = common.mustCall((res) => { - left--; assert.notStrictEqual(res.headers['content-type'], 'text/html'); assert.notStrictEqual(res.headers['content-type'], 'gotcha'); - if (left === 0) server.close(); + countdown.dec(); }, 2); http.get(`${url}/explicit`, check).end(); http.get(`${url}/implicit`, check).end(); From c9a4f4f8f16c30b62b4a1b11ef9a5efc095c3beb Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Mon, 27 Nov 2017 12:44:12 +0530 Subject: [PATCH 273/379] test: update test-http-upgrade-client to use countdown PR-URL: https://github.com/nodejs/node/pull/17339 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-upgrade-client.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http-upgrade-client.js b/test/parallel/test-http-upgrade-client.js index 3c56e5959fbd93..c637324a53d801 100644 --- a/test/parallel/test-http-upgrade-client.js +++ b/test/parallel/test-http-upgrade-client.js @@ -29,6 +29,7 @@ const assert = require('assert'); const http = require('http'); const net = require('net'); +const Countdown = require('../common/countdown'); // Create a TCP server const srv = net.createServer(function(c) { @@ -60,7 +61,8 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { ['Origin', 'http://www.websocket.org'] ] ]; - let left = headers.length; + const countdown = new Countdown(headers.length, () => srv.close()); + headers.forEach(function(h) { const req = http.get({ port: port, @@ -87,8 +89,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { assert.deepStrictEqual(expectedHeaders, res.headers); socket.end(); - if (--left === 0) - srv.close(); + countdown.dec(); })); req.on('close', common.mustCall(function() { assert.strictEqual(sawUpgrade, true); From 0afcea280e9705b66adb620705a6d45b2bd476de Mon Sep 17 00:00:00 2001 From: Leko Date: Sat, 2 Dec 2017 03:10:26 +0900 Subject: [PATCH 274/379] test: add test case for missing branch - The case of id is string, flags is number - The case of flags is not 0 PR-URL: https://github.com/nodejs/node/pull/17418 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss --- test/parallel/test-crypto-engine.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js index b731ec2f0372fa..43f8b8084c7fe9 100644 --- a/test/parallel/test-crypto-engine.js +++ b/test/parallel/test-crypto-engine.js @@ -5,6 +5,7 @@ if (!common.hasCrypto) common.skip('missing crypto'); const crypto = require('crypto'); +const invalidEngineName = 'xxx'; common.expectsError( () => crypto.setEngine(true), @@ -21,3 +22,19 @@ common.expectsError( type: TypeError, message: 'The "flags" argument must be of type number' }); + +common.expectsError( + () => crypto.setEngine(invalidEngineName), + { + code: 'ERR_CRYPTO_ENGINE_UNKNOWN', + type: Error, + message: `Engine "${invalidEngineName}" was not found` + }); + +common.expectsError( + () => crypto.setEngine(invalidEngineName, crypto.constants.ENGINE_METHOD_RSA), + { + code: 'ERR_CRYPTO_ENGINE_UNKNOWN', + type: Error, + message: `Engine "${invalidEngineName}" was not found` + }); From 23967b2713eb77f9b31e804800370bf9b8e1800e Mon Sep 17 00:00:00 2001 From: Benjamin Zaslavsky Date: Mon, 20 Nov 2017 17:12:20 +0100 Subject: [PATCH 275/379] console: make dirxml an alias for console.log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This method was previously exposed by V8 (since node 8.0.0) but not implemented in node. PR-URL: https://github.com/nodejs/node/pull/17152 Refs: https://github.com/nodejs/node/issues/17128 Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Anatoli Papirovski Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/console.md | 25 +++++++++++++------------ lib/console.js | 3 +++ test/parallel/test-console.js | 13 +++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index ba1505ec1d0f21..d9421043659cd4 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -277,6 +277,19 @@ Defaults to `2`. To make it recurse indefinitely, pass `null`. Defaults to `false`. Colors are customizable; see [customizing `util.inspect()` colors][]. +### console.dirxml(...data) + +* `...data` {any} + +This method calls `console.log()` passing it the arguments received. +Please note that this method does not produce any XML formatting. + ### console.error([data][, ...args]) -* `object` {string} - -This method does not display anything unless used in the inspector. The -`console.dirxml()` method displays in `stdout` an XML interactive tree -representation of the descendants of the specified `object` if possible, or the -JavaScript representation if not. Calling `console.dirxml()` on an HTML or XML -element is equivalent to calling `console.log()`. - ### console.markTimeline(label) -Node.js has a simple module loading system. In Node.js, files and modules -are in one-to-one correspondence (each file is treated as a separate module). - -As an example, consider a file named `foo.js`: +In the Node.js module system, each file is treated as a separate module. For +example, consider a file named `foo.js`: ```js const circle = require('./circle.js'); From 20dcbfce89b41ffa1a23f26a469756f2623a5ede Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 4 Dec 2017 19:56:43 -0800 Subject: [PATCH 297/379] doc: add serial comma in CPP_STYLE_GUIDE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17464 Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- CPP_STYLE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 7f8e5a3de42e35..62c96a8fd12e35 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -8,7 +8,7 @@ * [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations) * [Align function arguments vertically](#align-function-arguments-vertically) * [Initialization lists](#initialization-lists) - * [CamelCase for methods, functions and classes](#camelcase-for-methods-functions-and-classes) + * [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes) * [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters) * [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields) * [Space after `template`](#space-after-template) From 5e0f39323f3f782dcd283ea0c6cde80de9233d73 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 4 Dec 2017 19:57:00 -0800 Subject: [PATCH 298/379] build: add serial commas to messages in configure script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17464 Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 13dcb601d09e32..98a96ac0cbc64d 100755 --- a/configure +++ b/configure @@ -146,7 +146,7 @@ parser.add_option("--enable-vtune-profiling", dest="enable_vtune_profiling", help="Enable profiling support for Intel VTune profiler to profile " "JavaScript code executed in nodejs. This feature is only available " - "for x32, x86 and x64 architectures.") + "for x32, x86, and x64 architectures.") parser.add_option("--link-module", @@ -883,7 +883,7 @@ def configure_node(o): o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) elif options.enable_vtune_profiling: raise Exception( - 'The VTune profiler for JavaScript is only supported on x32, x86 and x64 ' + 'The VTune profiler for JavaScript is only supported on x32, x86, and x64 ' 'architectures.') else: o['variables']['node_enable_v8_vtunejit'] = 'false' From f7b0054b2bac2c63c4844fd2dfe4c0f95fbe3970 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 4 Dec 2017 23:49:38 -0800 Subject: [PATCH 299/379] doc: use serial comma in tls.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17464 Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/tls.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 806e8fa492b2a7..2898c28cd323ca 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -753,8 +753,8 @@ added: v0.8.4 Verifies the certificate `cert` is issued to host `host`. -Returns {Error} object, populating it with the reason, host and cert on failure. -On success, returns {undefined}. +Returns {Error} object, populating it with the reason, host, and cert on +failure. On success, returns {undefined}. *Note*: This function can be overwritten by providing alternative function as part of the `options.checkServerIdentity` option passed to `tls.connect()`. From fe9d9f732b30060eba7e52f883d45e137dd6218d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 5 Dec 2017 00:31:20 -0800 Subject: [PATCH 300/379] test: remove hidden use of common.PORT in parallel tests common.hasMultiLocalhost() uses common.PORT under the hood. This is problematic in parallel tests because another test using port 0 to get an arbitrary open port may end up getting common.PORT before the test using common.PORT gets it. Therefore, change common.PORT to port 0 in common.hasMultiLocalhost(). PR-URL: https://github.com/nodejs/node/pull/17466 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Ruben Bridgewater --- test/common/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common/index.js b/test/common/index.js index 8ba6c15aa49b40..90df0a4e698cb7 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -526,7 +526,7 @@ function _mustCallInner(fn, criteria = 1, field) { exports.hasMultiLocalhost = function hasMultiLocalhost() { const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const t = new TCP(TCPConstants.SOCKET); - const ret = t.bind('127.0.0.2', exports.PORT); + const ret = t.bind('127.0.0.2', 0); t.close(); return ret === 0; }; From 53ed05582ae4575f81259d0e232801dc9f31fdfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 4 Dec 2017 11:24:52 +0100 Subject: [PATCH 301/379] doc: update AUTHORS list PR-URL: https://github.com/nodejs/node/pull/17452 Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Evan Lucas Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Timothy Gu --- .mailmap | 2 ++ AUTHORS | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index e5790b736e88de..fd6816a5dce7d3 100644 --- a/.mailmap +++ b/.mailmap @@ -198,6 +198,7 @@ Lydia Kats Lydia Katsamberis Maciej Małecki Malte-Thorben Bruns Malte-Thorben Bruns skenqbx +Mandeep Singh Manil Chowdhurian Chowdhurian Marcelo Gobelli decareano Marcin Cieślak @@ -206,6 +207,7 @@ Marcin Zielinski marzelin Marti Martz Martial James Jefferson Martijn Schrage Oblosys +Matheus Marchini Matt Lang matt-in-a-hat Matt Reed matthewreed26 Matthias Bastian piepmatz diff --git a/AUTHORS b/AUTHORS index 7e48fe0aba2fa3..8d8e74493aff0a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1616,7 +1616,7 @@ Guy Margalit Azard nishijayaraj Nick Stanish -Mandeep Singh +Mandeep Singh Prakash Palaniappan Keita Akutsu Michael Albert @@ -1971,5 +1971,70 @@ Steve Kinney Sebastian Mayr Vijayalakshmi Kannan Benjamin Zaslavsky +Sebastian Silbermann +pimlie +buji +Witthawat Piwawatthanapanit +sgreylyn +Xavier Balloy +François Descamps +Guillaume Flandre +Pierre-Loic Doulcet +Fran Herrero +Francois KY +suman-mitra +Matheus Marchini +neta +Whien +Chiahao Lin +esbb48 +Roth Peng +jimliu7434 +YuLun Shih +Kyle Yu +Ivan Wei +john +Jamie Davis +Scya597 +Zack Yang +aryung chen +Larry Lu +Robert Rossmann +薛定谔的猫 +danielLin +jackyen +Kurt Hsu +sorarize@gmail.com +Jason Chung +Thomas den Hollander +Ronald Eddy Jr +Richard Littauer +pkovacs +zhengyuanjie +Andy Chen +Kcin1993 +yozian +jimmy +Leko +Aqui Tsuchida +koooge +kou-hin +Hiroaki KARASAWA +narirou +Antonio V +spring_raining +Hiromu Yoshiwara +yuza yuko +smatsu-hl +Bamieh +WhoMeNope +Junichi Kajiwara +Matthew Leon +Hativ +Tom Hallam +Hannes Magnusson +ChungNgoops +Jose M. Palacios Diaz +hmammedzadeh # Generated by tools/update-authors.sh From 8c32b4a37ae5d1724d6a412db6ceca9381c0a6b6 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Mon, 4 Dec 2017 09:07:07 +0530 Subject: [PATCH 302/379] test: refactor code to use common.mustCall PR-URL: https://github.com/nodejs/node/pull/17437 Reviewed-By: Anatoli Papirovski Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- ...test-http-res-write-end-dont-take-array.js | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index fcf9da8c12b0e3..94b105cb18177c 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -20,44 +20,39 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); -let test = 1; +const server = http.createServer(); -const server = http.createServer(function(req, res) { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - if (test === 1) { - // write should accept string - res.write('string'); - // write should accept buffer - res.write(Buffer.from('asdf')); +server.once('request', common.mustCall((req, res) => { + server.on('request', common.mustCall((req, res) => { + res.end(Buffer.from('asdf')); + })); + // write should accept string + res.write('string'); + // write should accept buffer + res.write(Buffer.from('asdf')); - // write should not accept an Array - assert.throws(function() { - res.write(['array']); - }, TypeError, 'first argument must be a string or Buffer'); + // write should not accept an Array + assert.throws(function() { + res.write(['array']); + }, TypeError, 'first argument must be a string or Buffer'); - // end should not accept an Array - assert.throws(function() { - res.end(['moo']); - }, TypeError, 'first argument must be a string or Buffer'); + // end should not accept an Array + assert.throws(function() { + res.end(['moo']); + }, TypeError, 'first argument must be a string or Buffer'); - // end should accept string - res.end('string'); - } else if (test === 2) { - // end should accept Buffer - res.end(Buffer.from('asdf')); - } -}); + // end should accept string + res.end('string'); +})); server.listen(0, function() { // just make a request, other tests handle responses http.get({ port: this.address().port }, function(res) { res.resume(); - // lazy serial test, because we can only call end once per request - test += 1; // do it again to test .end(Buffer); http.get({ port: server.address().port }, function(res) { res.resume(); From 7e38821df2c856dee3e1894d940c11b79db101f6 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 21:29:34 +0530 Subject: [PATCH 303/379] doc: use arrow functions in util.md sample code PR-URL: https://github.com/nodejs/node/pull/17459 Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/util.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 10474b6f836f5c..510b8c92ac9e5f 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -119,11 +119,9 @@ it is marked as deprecated. ```js const util = require('util'); -exports.puts = util.deprecate(function() { - for (let i = 0, len = arguments.length; i < len; ++i) { - process.stdout.write(arguments[i] + '\n'); - } -}, 'util.puts: Use console.log instead'); +exports.obsoleteFunction = util.deprecate(() => { + // Do something here. +}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); ``` When called, `util.deprecate()` will return a function that will emit a @@ -1023,7 +1021,7 @@ util.isObject(null); // Returns: false util.isObject({}); // Returns: true -util.isObject(function() {}); +util.isObject(() => {}); // Returns: false ``` @@ -1055,7 +1053,7 @@ util.isPrimitive(undefined); // Returns: true util.isPrimitive({}); // Returns: false -util.isPrimitive(function() {}); +util.isPrimitive(() => {}); // Returns: false util.isPrimitive(/^$/); // Returns: false From a159a2c6accb895655212b0b263000f752c92d22 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Thu, 30 Nov 2017 13:36:06 -0600 Subject: [PATCH 304/379] process: slight refinements to nextTick Remove length prop on NextTickQueue class. We technically don't need to keep track of the length of the queue in two places as we already have tickInfo doing that work (between the index & the length we have enough data for everything). Store asyncId in a const within the _tickCallback function. Accessing Symbol properties seems to be quite a bit more expensive than string keys so this actually has a decent performance impact. PR-URL: https://github.com/nodejs/node/pull/17421 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- lib/internal/process/next_tick.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/internal/process/next_tick.js b/lib/internal/process/next_tick.js index 4c8b5f7d2d4181..225ef7fe8f2eab 100644 --- a/lib/internal/process/next_tick.js +++ b/lib/internal/process/next_tick.js @@ -14,35 +14,31 @@ class NextTickQueue { constructor() { this.head = null; this.tail = null; - this.length = 0; } push(v) { const entry = { data: v, next: null }; - if (this.length > 0) + if (this.tail !== null) this.tail.next = entry; else this.head = entry; this.tail = entry; - ++this.length; } shift() { - if (this.length === 0) + if (this.head === null) return; const ret = this.head.data; - if (this.length === 1) + if (this.head === this.tail) this.head = this.tail = null; else this.head = this.head.next; - --this.length; return ret; } clear() { this.head = null; this.tail = null; - this.length = 0; } } @@ -90,7 +86,7 @@ function setupNextTick() { nextTickQueue.clear(); tickInfo[kLength] = 0; } else { - tickInfo[kLength] = nextTickQueue.length; + tickInfo[kLength] -= tickInfo[kIndex]; } } tickInfo[kIndex] = 0; @@ -124,8 +120,6 @@ function setupNextTick() { } } - // Run callbacks that have no domain. - // Using domains will cause this to be overridden. function _tickCallback() { do { while (tickInfo[kIndex] < tickInfo[kLength]) { @@ -137,7 +131,8 @@ function setupNextTick() { // CHECK(Number.isSafeInteger(tock[trigger_async_id_symbol])) // CHECK(tock[trigger_async_id_symbol] > 0) - emitBefore(tock[async_id_symbol], tock[trigger_async_id_symbol]); + const asyncId = tock[async_id_symbol]; + emitBefore(asyncId, tock[trigger_async_id_symbol]); // emitDestroy() places the async_id_symbol into an asynchronous queue // that calls the destroy callback in the future. It's called before // calling tock.callback so destroy will be called even if the callback @@ -148,7 +143,7 @@ function setupNextTick() { // any async hooks are enabled during the callback's execution then // this tock's after hook will be called, but not its destroy hook. if (async_hook_fields[kDestroy] > 0) - emitDestroy(tock[async_id_symbol]); + emitDestroy(asyncId); const callback = tock.callback; if (tock.args === undefined) @@ -156,7 +151,7 @@ function setupNextTick() { else Reflect.apply(callback, undefined, tock.args); - emitAfter(tock[async_id_symbol]); + emitAfter(asyncId); if (kMaxCallbacksPerLoop < tickInfo[kIndex]) tickDone(); From 07547346a80b2d606ec3a3533eb8e13b027a53e0 Mon Sep 17 00:00:00 2001 From: IHsuan Date: Wed, 22 Nov 2017 16:39:05 +0800 Subject: [PATCH 305/379] test: add common.crashOnUnhandledRejection() PR-URL: https://github.com/nodejs/node/pull/17247 Reviewed-By: James M Snell Reviewed-By: Jon Moss Reviewed-By: Anna Henningsen --- test/addons/make-callback-recurse/test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index 77815e052ab1f9..222a81b06b87eb 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -9,6 +9,7 @@ const makeCallback = binding.makeCallback; // Make sure this is run in the future. const mustCallCheckDomains = common.mustCall(checkDomains); +common.crashOnUnhandledRejection(); // Make sure that using MakeCallback allows the error to propagate. assert.throws(function() { From e9ee168a3d7aec32a2648f2934c371cef15c7e40 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Mon, 4 Dec 2017 18:12:59 +0100 Subject: [PATCH 306/379] doc: remove IPC channel implementation details IPC messages are more complicated than a simple pipe passing JSON objects separated by new line. This removes inaccurate notes about implementation from the documentation. PR-URL: https://github.com/nodejs/node/pull/17460 Fixes: https://github.com/nodejs/node/issues/16491 Fixes: https://github.com/nodejs/node/issues/17405 Reviewed-By: Jon Moss Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/api/child_process.md | 18 ++++++------------ doc/api/process.md | 11 ++++------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 801c4251942e66..6394fb693475f5 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -366,8 +366,7 @@ By default, `child_process.fork()` will spawn new Node.js instances using the Node.js processes launched with a custom `execPath` will communicate with the parent process using the file descriptor (fd) identified using the -environment variable `NODE_CHANNEL_FD` on the child process. The input and -output on this fd is expected to be line delimited JSON objects. +environment variable `NODE_CHANNEL_FD` on the child process. *Note*: Unlike the fork(2) POSIX system call, `child_process.fork()` does not clone the current process. @@ -609,9 +608,7 @@ pipes between the parent and child. The value is one of the following: 2. `'ipc'` - Create an IPC channel for passing messages/file descriptors between parent and child. A [`ChildProcess`][] may have at most *one* IPC stdio file descriptor. Setting this option enables the [`subprocess.send()`][] - method. If the child writes JSON messages to this file descriptor, the - [`subprocess.on('message')`][`'message'`] event handler will be triggered in - the parent. If the child is a Node.js process, the presence of an IPC channel + method. If the child is a Node.js process, the presence of an IPC channel will enable [`process.send()`][], [`process.disconnect()`][], [`process.on('disconnect')`][], and [`process.on('message')`] within the child. @@ -933,9 +930,8 @@ added: v0.5.9 The `'message'` event is triggered when a child process uses [`process.send()`][] to send messages. -*Note*: The message goes through JSON serialization and parsing. The resulting -message might not be the same as what is originally sent. See notes in -[the `JSON.stringify()` specification][`JSON.stringify` spec]. +*Note*: The message goes through serialization and parsing. The resulting +message might not be the same as what is originally sent. ### subprocess.channel ```js From 232a486c0cabf61a7783a1a12b7efafd9767b291 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 10:15:58 -0800 Subject: [PATCH 314/379] doc: fix common typo involving one-time listeners Our docs use both "one time listener" and "one-time listener". The second is more correct. Standardize on that. PR-URL: https://github.com/nodejs/node/pull/17502 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: Minwoo Jung Reviewed-By: Luigi Pinca --- doc/api/events.md | 4 ++-- doc/api/http.md | 2 +- doc/api/net.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 443137f1705e26..8eaa8cae102b75 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -409,7 +409,7 @@ added: v0.3.0 * `eventName` {any} The name of the event. * `listener` {Function} The callback function -Adds a **one time** `listener` function for the event named `eventName`. The +Adds a **one-time** `listener` function for the event named `eventName`. The next time `eventName` is triggered, this listener is removed and then invoked. ```js @@ -464,7 +464,7 @@ added: v6.0.0 * `eventName` {any} The name of the event. * `listener` {Function} The callback function -Adds a **one time** `listener` function for the event named `eventName` to the +Adds a **one-time** `listener` function for the event named `eventName` to the *beginning* of the listeners array. The next time `eventName` is triggered, this listener is removed, and then invoked. diff --git a/doc/api/http.md b/doc/api/http.md index cb4eff07325d2d..9f06296e6e2584 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1785,7 +1785,7 @@ This function allows one to transparently issue requests. string, it is automatically parsed with [`url.parse()`][]. If it is a [`URL`][] object, it will be automatically converted to an ordinary `options` object. -The optional `callback` parameter will be added as a one time listener for +The optional `callback` parameter will be added as a one-time listener for the [`'response'`][] event. `http.request()` returns an instance of the [`http.ClientRequest`][] diff --git a/doc/api/net.md b/doc/api/net.md index 04821ad2e90ea7..03ed3d5cbc3955 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -802,7 +802,7 @@ socket.on('timeout', () => { If `timeout` is 0, then the existing idle timeout is disabled. -The optional `callback` parameter will be added as a one time listener for the +The optional `callback` parameter will be added as a one-time listener for the [`'timeout'`][] event. ### socket.unref() From b8141a42d041154744c9bd8ef046763a58423f89 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 10:18:05 -0800 Subject: [PATCH 315/379] doc: fix typo in repl.md PR-URL: https://github.com/nodejs/node/pull/17502 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: Minwoo Jung Reviewed-By: Luigi Pinca --- doc/api/repl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/repl.md b/doc/api/repl.md index 1be90347ac57e1..56661d86d9fb79 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -418,7 +418,7 @@ changes: * `output` {Writable} The Writable stream to which REPL output will be written. Defaults to `process.stdout`. * `terminal` {boolean} If `true`, specifies that the `output` should be - treated as a a TTY terminal, and have ANSI/VT100 escape codes written to it. + treated as a TTY terminal, and have ANSI/VT100 escape codes written to it. Defaults to checking the value of the `isTTY` property on the `output` stream upon instantiation. * `eval` {Function} The function to be used when evaluating each given line From 89d31ee04865b9db9a9171c18f28bbcc5630a18e Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Wed, 29 Nov 2017 12:46:13 -0500 Subject: [PATCH 316/379] timers: improvements to TimersList management Move all the TimersList instantiation code into the constructor. Compare values to undefined & null as appropriate instead of truthy or falsy. PR-URL: https://github.com/nodejs/node/pull/17429 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- lib/timers.js | 55 ++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/lib/timers.js b/lib/timers.js index ced8664c0ee330..baed84f8f7b851 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -55,7 +55,7 @@ const activateImmediateCheck = process._activateImmediateCheck; delete process._activateImmediateCheck; // Timeout values > TIMEOUT_MAX are set to 1. -const TIMEOUT_MAX = 2147483647; // 2^31-1 +const TIMEOUT_MAX = 2 ** 31 - 1; // HOW and WHY the timers implementation works the way it does. @@ -173,9 +173,9 @@ function insert(item, unrefed) { // Use an existing list if there is one, otherwise we need to make a new one. var list = lists[msecs]; - if (!list) { + if (list === undefined) { debug('no %d list was found in insert, creating a new one', msecs); - lists[msecs] = list = createTimersList(msecs, unrefed); + lists[msecs] = list = new TimersList(msecs, unrefed); } if (!item[async_id_symbol] || item._destroyed) { @@ -194,28 +194,21 @@ function insert(item, unrefed) { assert(!L.isEmpty(list)); // list is not empty } -function createTimersList(msecs, unrefed) { - // Make a new linked list of timers, and create a TimerWrap to schedule - // processing for the list. - const list = new TimersList(msecs, unrefed); - L.init(list); - list._timer._list = list; - - if (unrefed === true) list._timer.unref(); - list._timer.start(msecs); - - list._timer[kOnTimeout] = listOnTimeout; - - return list; -} - function TimersList(msecs, unrefed) { - this._idleNext = null; // Create the list with the linkedlist properties to - this._idlePrev = null; // prevent any unnecessary hidden class changes. - this._timer = new TimerWrap(); + this._idleNext = this; // Create the list with the linkedlist properties to + this._idlePrev = this; // prevent any unnecessary hidden class changes. this._unrefed = unrefed; this.msecs = msecs; this.nextTick = false; + + const timer = this._timer = new TimerWrap(); + timer._list = this; + + if (unrefed === true) + timer.unref(); + timer.start(msecs); + + timer[kOnTimeout] = listOnTimeout; } function listOnTimeout() { @@ -359,7 +352,7 @@ function reuse(item) { var list = refedLists[item._idleTimeout]; // if empty - reuse the watcher - if (list && L.isEmpty(list)) { + if (list !== undefined && L.isEmpty(list)) { debug('reuse hit'); list._timer.stop(); delete refedLists[item._idleTimeout]; @@ -382,7 +375,7 @@ const unenroll = exports.unenroll = function(item) { } var handle = reuse(item); - if (handle) { + if (handle !== null) { debug('unenroll: list empty'); handle.close(); } @@ -610,7 +603,7 @@ Timeout.prototype.unref = function() { } var handle = reuse(this); - if (handle) { + if (handle !== null) { handle._list = undefined; } @@ -659,7 +652,7 @@ function ImmediateList() { // Appends an item to the end of the linked list, adjusting the current tail's // previous and next pointers where applicable ImmediateList.prototype.append = function(item) { - if (this.tail) { + if (this.tail !== null) { this.tail._idleNext = item; item._idlePrev = this.tail; } else { @@ -671,11 +664,11 @@ ImmediateList.prototype.append = function(item) { // Removes an item from the linked list, adjusting the pointers of adjacent // items and the linked list's head or tail pointers as necessary ImmediateList.prototype.remove = function(item) { - if (item._idleNext) { + if (item._idleNext !== null) { item._idleNext._idlePrev = item._idlePrev; } - if (item._idlePrev) { + if (item._idlePrev !== null) { item._idlePrev._idleNext = item._idleNext; } @@ -701,7 +694,7 @@ function processImmediate() { // immediate callbacks are executed immediateQueue.head = immediateQueue.tail = null; - while (immediate) { + while (immediate !== null) { domain = immediate.domain; if (!immediate._onImmediate) { @@ -722,7 +715,7 @@ function processImmediate() { // If `clearImmediate(immediate)` wasn't called from the callback, use the // `immediate`'s next item - if (immediate._idleNext) + if (immediate._idleNext !== null) immediate = immediate._idleNext; else immediate = next; @@ -754,11 +747,11 @@ function tryOnImmediate(immediate, oldTail) { } } - if (threw && immediate._idleNext) { + if (threw && immediate._idleNext !== null) { // Handle any remaining on next tick, assuming we're still alive to do so. const curHead = immediateQueue.head; const next = immediate._idleNext; - if (curHead) { + if (curHead !== null) { curHead._idlePrev = oldTail; oldTail._idleNext = curHead; next._idlePrev = null; From 7d3a84388d5083eaab580288b6c7950c0c390099 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 19:39:07 -0800 Subject: [PATCH 317/379] test: fix flaky test-benchmark-querystring Allow zero iterations for short benchmark in test. PR-URL: https://github.com/nodejs/node/pull/17517 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Refael Ackermann --- test/parallel/test-benchmark-querystring.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-benchmark-querystring.js b/test/parallel/test-benchmark-querystring.js index 9daa165bf82a09..77d0ac99ff97d8 100644 --- a/test/parallel/test-benchmark-querystring.js +++ b/test/parallel/test-benchmark-querystring.js @@ -4,8 +4,9 @@ require('../common'); const runBenchmark = require('../common/benchmark'); -runBenchmark('querystring', [ - 'n=1', - 'input="there is nothing to unescape here"', - 'type=noencode' -]); +runBenchmark('querystring', + [ 'n=1', + 'input="there is nothing to unescape here"', + 'type=noencode' + ], + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); From 49402b12d01bca1dae8e05c0effd96476d779b29 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 6 Dec 2017 08:09:02 +0100 Subject: [PATCH 318/379] crypto: declare int return type for set_field This commit updates the set_field function pointer to return an int, and also updates the lambdas with a return statement. PR-URL: https://github.com/nodejs/node/pull/17468 Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 10 ++++++---- src/node_crypto.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 72fd05c2ecd5a5..b833b7415d51ff 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5115,7 +5115,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo& args) { } void DiffieHellman::SetKey(const v8::FunctionCallbackInfo& args, - void (*set_field)(DH*, BIGNUM*), const char* what) { + int (*set_field)(DH*, BIGNUM*), const char* what) { Environment* env = Environment::GetCurrent(args); DiffieHellman* dh; @@ -5138,12 +5138,13 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo& args, BN_bin2bn(reinterpret_cast(Buffer::Data(args[0])), Buffer::Length(args[0]), nullptr); CHECK_NE(num, nullptr); - set_field(dh->dh, num); + CHECK_EQ(1, set_field(dh->dh, num)); } void DiffieHellman::SetPublicKey(const FunctionCallbackInfo& args) { - SetKey(args, [](DH* dh, BIGNUM* num) { DH_set0_key(dh, num, nullptr); }, + SetKey(args, + [](DH* dh, BIGNUM* num) { return DH_set0_key(dh, num, nullptr); }, "Public key"); } @@ -5154,7 +5155,8 @@ void DiffieHellman::SetPrivateKey(const FunctionCallbackInfo& args) { // Node. See https://github.com/openssl/openssl/pull/4384. #error "OpenSSL 1.1.0 revisions before 1.1.0g are not supported" #endif - SetKey(args, [](DH* dh, BIGNUM* num) { DH_set0_key(dh, nullptr, num); }, + SetKey(args, + [](DH* dh, BIGNUM* num) { return DH_set0_key(dh, nullptr, num); }, "Private key"); } diff --git a/src/node_crypto.h b/src/node_crypto.h index 836144bf8be1a2..7d8c9032c65285 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -712,7 +712,7 @@ class DiffieHellman : public BaseObject { const BIGNUM* (*get_field)(const DH*), const char* err_if_null); static void SetKey(const v8::FunctionCallbackInfo& args, - void (*set_field)(DH*, BIGNUM*), const char* what); + int (*set_field)(DH*, BIGNUM*), const char* what); bool VerifyContext(); bool initialised_; From 928aecc92ca7e724eb11cfbfa18d5ea989cf4ecc Mon Sep 17 00:00:00 2001 From: Leko Date: Mon, 4 Dec 2017 16:21:18 +0900 Subject: [PATCH 319/379] test: replace fs.accessSync with fs.existsSync PR-URL: https://github.com/nodejs/node/pull/17446 Reviewed-By: Luigi Pinca Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-npm-install.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 34f48d50ccdb2b..d826eb09ed4756 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -57,7 +57,5 @@ function handleExit(error, stdout, stderr) { assert.strictEqual(code, 0, `npm install got error code ${code}`); assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`); - assert.doesNotThrow(function() { - fs.accessSync(`${installDir}/node_modules/package-name`); - }); + assert(fs.existsSync(`${installDir}/node_modules/package-name`)); } From fb553b5b59fe295f84f5ce69b53c08298d352ef5 Mon Sep 17 00:00:00 2001 From: Leko Date: Sat, 2 Dec 2017 22:03:04 +0900 Subject: [PATCH 320/379] test: improve crypto test coverage - Call Sign without new - Call Verify without new - Call Verify#verify with options.padding !== options.padding >> 0 - Call Verify#verify with options.saltLength !== options.saltLength >> 0 PR-URL: https://github.com/nodejs/node/pull/17426 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca --- test/parallel/test-crypto-sign-verify.js | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 5f0f8d8c7ebc04..abdbcd3a1e5350 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -15,6 +15,42 @@ const certPem = fixtures.readSync('test_cert.pem', 'ascii'); const keyPem = fixtures.readSync('test_key.pem', 'ascii'); const modSize = 1024; +{ + const Sign = crypto.Sign; + const instance = Sign('SHA256'); + assert(instance instanceof Sign, 'Sign is expected to return a new ' + + 'instance when called without `new`'); +} + +{ + const Verify = crypto.Verify; + const instance = Verify('SHA256'); + assert(instance instanceof Verify, 'Verify is expected to return a new ' + + 'instance when called without `new`'); +} + +common.expectsError( + () => crypto.createVerify('SHA256').verify({ + key: certPem, + padding: undefined, + }, ''), + { + code: 'ERR_INVALID_OPT_VALUE', + type: Error, + message: 'The value "undefined" is invalid for option "padding"' + }); + +common.expectsError( + () => crypto.createVerify('SHA256').verify({ + key: certPem, + saltLength: undefined, + }, ''), + { + code: 'ERR_INVALID_OPT_VALUE', + type: Error, + message: 'The value "undefined" is invalid for option "saltLength"' + }); + // Test signing and verifying { const s1 = crypto.createSign('SHA1') From c5d20b36e1935e3dc14ee7175a4513dab121bb8a Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 3 Dec 2017 01:31:27 -0600 Subject: [PATCH 321/379] util: remove check for global.process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit process is explicitly passed by NativeModule now. PR-URL: https://github.com/nodejs/node/pull/17435 Reviewed-By: Timothy Gu Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: Ruben Bridgewater Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- lib/internal/util.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index a9094577f44716..e3b2c7f9fac191 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -24,13 +24,6 @@ function objectToString(o) { // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. function deprecate(fn, msg, code) { - // Allow for deprecating things in the process of starting up. - if (global.process === undefined) { - return function(...args) { - return deprecate(fn, msg).apply(this, args); - }; - } - if (process.noDeprecation === true) { return fn; } From 6aa6d418e2027a76098f50e15b1c9692d1e4e93f Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Wed, 6 Dec 2017 19:26:40 -0500 Subject: [PATCH 322/379] doc: mention node-test-pull-request-lite job PR-URL: https://github.com/nodejs/node/pull/17513 Reviewed-By: Anatoli Papirovski Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- COLLABORATOR_GUIDE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 95d5dccb59afef..10a4803023d72e 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -153,6 +153,10 @@ which runs the `build-ci` and `test-ci` targets on all supported platforms. only runs the linter targets, which is useful for changes that only affect comments or documentation. +* [`node-test-pull-request-lite`](https://ci.nodejs.org/job/node-test-pull-request-lite/) +only runs the linter job, as well as the tests on LinuxONE. Should only be used for +trivial changes that do not require being tested on all platforms. + * [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/) uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run `npm install && npm test` on a large selection of common modules. This is useful to check whether a From 7b8622f94667253954f8d8455f2158cc40c7a72f Mon Sep 17 00:00:00 2001 From: Francisco Gerardo Neri Andriano Date: Tue, 5 Dec 2017 20:58:36 -0600 Subject: [PATCH 323/379] test: update http test to use Countdown PR-URL: https://github.com/nodejs/node/pull/17477 Refs: https://github.com/nodejs/node/issues/17169 Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss --- test/parallel/test-http-status-code.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index 802565f26bb697..246d22c131fe65 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -23,19 +23,19 @@ require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); // Simple test of Node's HTTP ServerResponse.statusCode // ServerResponse.prototype.statusCode -let testsComplete = 0; const tests = [200, 202, 300, 404, 451, 500]; -let testIdx = 0; +let test; +const countdown = new Countdown(tests.length, () => s.close()); const s = http.createServer(function(req, res) { - const t = tests[testIdx]; - res.writeHead(t, { 'Content-Type': 'text/plain' }); + res.writeHead(test, { 'Content-Type': 'text/plain' }); console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`); - assert.strictEqual(res.statusCode, t); + assert.strictEqual(res.statusCode, test); res.end('hello world\n'); }); @@ -43,25 +43,16 @@ s.listen(0, nextTest); function nextTest() { - if (testIdx + 1 === tests.length) { - return s.close(); - } - const test = tests[testIdx]; + test = tests.shift(); http.get({ port: s.address().port }, function(response) { console.log(`client: expected status: ${test}`); console.log(`client: statusCode: ${response.statusCode}`); assert.strictEqual(response.statusCode, test); response.on('end', function() { - testsComplete++; - testIdx += 1; - nextTest(); + if (countdown.dec()) + nextTest(); }); response.resume(); }); } - - -process.on('exit', function() { - assert.strictEqual(5, testsComplete); -}); From 7f2764debb39a9bc2b58ce3b3a4a60ed8d73fd69 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Mon, 4 Dec 2017 10:20:38 -0500 Subject: [PATCH 324/379] doc: add info on post-publishing ARM6 builds ARM6 takes longer, more often fails builds than other platforms. Add instructions for how to recover in this case. PR-URL: https://github.com/nodejs/node/pull/17455 Reviewed-By: Gibson Fahnestock Reviewed-By: Luigi Pinca --- doc/releases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases.md b/doc/releases.md index be3d3bcdb7af30..fd38e073d8b52d 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -214,7 +214,7 @@ If you have an error on Windows and need to start again, be aware that you'll ge ARMv7 takes the longest to compile. Unfortunately ccache isn't as effective on release builds, I think it's because of the additional macro settings that go in to a release build that nullify previous builds. Also most of the release build machines are separate to the test build machines so they don't get any benefit from ongoing compiles between releases. You can expect 1.5 hours for the ARMv7 builder to complete and you should normally wait for this to finish. It is possible to rush a release out if you want and add additional builds later but we normally provide ARMv7 from initial promotion. -You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers, and docs (both produced currently by an macOS worker). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. +You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer than the others. It is only necessary to have the main Linux (x64 and x86), macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers, and docs (both produced currently by an macOS worker). **If you promote builds _before_ ARM builds have finished, you must repeat the promotion step for the ARM builds when they are ready**. If the ARMv6 build failed for some reason you can use the [`iojs-release-arm6-only`](https://ci-release.nodejs.org/job/iojs+release-arm6-only/) build in the release CI to re-run the build only for ARMv6. When launching the build make sure to use the same commit hash as for the original release. ### 9. Test the Build From af8e27d10e1b8cce510f4520cdfe8bafbde3856c Mon Sep 17 00:00:00 2001 From: sreepurnajasti Date: Wed, 6 Dec 2017 17:02:41 +0530 Subject: [PATCH 325/379] test: Use common.mustCall in http test PR-URL: https://github.com/nodejs/node/pull/17487 Refs: https://github.com/nodejs/node/issues/17169 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-pipeline-regr-2639.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-http-pipeline-regr-2639.js b/test/parallel/test-http-pipeline-regr-2639.js index 133e4126683d9b..8eaf5588aaf2bd 100644 --- a/test/parallel/test-http-pipeline-regr-2639.js +++ b/test/parallel/test-http-pipeline-regr-2639.js @@ -1,25 +1,20 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); const http = require('http'); const net = require('net'); const COUNT = 10; -let received = 0; - -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { // Close the server, we have only one TCP connection anyway - if (received++ === 0) - server.close(); - + server.close(); res.writeHead(200); res.write('data'); setTimeout(function() { res.end(); }, (Math.random() * 100) | 0); -}).listen(0, function() { +}, COUNT)).listen(0, function() { const s = net.connect(this.address().port); const big = 'GET / HTTP/1.0\r\n\r\n'.repeat(COUNT); @@ -27,7 +22,3 @@ const server = http.createServer(function(req, res) { s.write(big); s.resume(); }); - -process.on('exit', function() { - assert.strictEqual(received, COUNT); -}); From c2ff36ed7f67170ee8736cc1c4dd6f3fdd754e95 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 20:02:42 +0530 Subject: [PATCH 326/379] test: replace assert.throws w/ common.expectsError PR-URL: https://github.com/nodejs/node/pull/17494 Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/parallel/test-dgram-createSocket-type.js | 6 ++-- test/parallel/test-dgram-custom-lookup.js | 7 ++--- test/parallel/test-dgram-membership.js | 24 +++++++------- test/parallel/test-dgram-multicast-setTTL.js | 6 ++-- .../parallel/test-dgram-send-address-types.js | 12 +++---- test/parallel/test-dgram-sendto.js | 31 +++++++++---------- test/parallel/test-dgram-setTTL.js | 6 ++-- .../parallel/test-dgram-socket-buffer-size.js | 28 ++++++++--------- test/parallel/test-dns-lookup.js | 30 +++++++++--------- test/parallel/test-dns-regress-7070.js | 23 +++++++------- 10 files changed, 85 insertions(+), 88 deletions(-) diff --git a/test/parallel/test-dgram-createSocket-type.js b/test/parallel/test-dgram-createSocket-type.js index 613e1c80308734..54f3aaa0603621 100644 --- a/test/parallel/test-dgram-createSocket-type.js +++ b/test/parallel/test-dgram-createSocket-type.js @@ -23,13 +23,13 @@ const errMessage = /^Bad socket type specified\. Valid types are: udp4, udp6$/; // Error must be thrown with invalid types invalidTypes.forEach((invalidType) => { - assert.throws(() => { + common.expectsError(() => { dgram.createSocket(invalidType); - }, common.expectsError({ + }, { code: 'ERR_SOCKET_BAD_TYPE', type: TypeError, message: errMessage - })); + }); }); // Error must not be thrown with valid types diff --git a/test/parallel/test-dgram-custom-lookup.js b/test/parallel/test-dgram-custom-lookup.js index a418116598c7c9..df715f81d63589 100644 --- a/test/parallel/test-dgram-custom-lookup.js +++ b/test/parallel/test-dgram-custom-lookup.js @@ -1,6 +1,5 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const dgram = require('dgram'); const dns = require('dns'); @@ -36,12 +35,12 @@ const dns = require('dns'); { // Verify that non-functions throw. [null, true, false, 0, 1, NaN, '', 'foo', {}, Symbol()].forEach((value) => { - assert.throws(() => { + common.expectsError(() => { dgram.createSocket({ type: 'udp4', lookup: value }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "lookup" argument must be of type Function' - })); + }); }); } diff --git a/test/parallel/test-dgram-membership.js b/test/parallel/test-dgram-membership.js index 8729b387bf3991..47704e90b7ce13 100644 --- a/test/parallel/test-dgram-membership.js +++ b/test/parallel/test-dgram-membership.js @@ -11,13 +11,13 @@ const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true }); { const socket = setup(); socket.close(common.mustCall(() => { - assert.throws(() => { + common.expectsError(() => { socket.addMembership(multicastAddress); - }, common.expectsError({ + }, { code: 'ERR_SOCKET_DGRAM_NOT_RUNNING', type: Error, message: /^Not running$/ - })); + }); })); } @@ -25,39 +25,39 @@ const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true }); { const socket = setup(); socket.close(common.mustCall(() => { - assert.throws(() => { + common.expectsError(() => { socket.dropMembership(multicastAddress); - }, common.expectsError({ + }, { code: 'ERR_SOCKET_DGRAM_NOT_RUNNING', type: Error, message: /^Not running$/ - })); + }); })); } // addMembership() with no argument should throw { const socket = setup(); - assert.throws(() => { + common.expectsError(() => { socket.addMembership(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: /^The "multicastAddress" argument must be specified$/ - })); + }); socket.close(); } // dropMembership() with no argument should throw { const socket = setup(); - assert.throws(() => { + common.expectsError(() => { socket.dropMembership(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: /^The "multicastAddress" argument must be specified$/ - })); + }); socket.close(); } diff --git a/test/parallel/test-dgram-multicast-setTTL.js b/test/parallel/test-dgram-multicast-setTTL.js index bd04ce4f32bde6..8cfa759ad9f382 100644 --- a/test/parallel/test-dgram-multicast-setTTL.js +++ b/test/parallel/test-dgram-multicast-setTTL.js @@ -35,13 +35,13 @@ socket.on('listening', common.mustCall(() => { socket.setMulticastTTL(1000); }, /^Error: setMulticastTTL EINVAL$/); - assert.throws(() => { + common.expectsError(() => { socket.setMulticastTTL('foo'); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "ttl" argument must be of type number. Received type string' - })); + }); //close the socket socket.close(); diff --git a/test/parallel/test-dgram-send-address-types.js b/test/parallel/test-dgram-send-address-types.js index 6b26c23a266558..b3f4f3fcea290d 100644 --- a/test/parallel/test-dgram-send-address-types.js +++ b/test/parallel/test-dgram-send-address-types.js @@ -38,19 +38,19 @@ const client = dgram.createSocket('udp4').bind(0, () => { client.send(buf, port, onMessage); // invalid address: object - assert.throws(() => { + common.expectsError(() => { client.send(buf, port, []); - }, common.expectsError(expectedError)); + }, expectedError); // invalid address: nonzero number - assert.throws(() => { + common.expectsError(() => { client.send(buf, port, 1); - }, common.expectsError(expectedError)); + }, expectedError); // invalid address: true - assert.throws(() => { + common.expectsError(() => { client.send(buf, port, true); - }, common.expectsError(expectedError)); + }, expectedError); }); client.unref(); diff --git a/test/parallel/test-dgram-sendto.js b/test/parallel/test-dgram-sendto.js index c922dc1039e732..782b2f692b290d 100644 --- a/test/parallel/test-dgram-sendto.js +++ b/test/parallel/test-dgram-sendto.js @@ -1,48 +1,47 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); const errorMessageOffset = /^The "offset" argument must be of type number$/; -assert.throws(() => { +common.expectsError(() => { socket.sendto(); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: errorMessageOffset -})); +}); -assert.throws(() => { +common.expectsError(() => { socket.sendto('buffer', 1, 'offset', 'port', 'address', 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "length" argument must be of type number$/ -})); +}); -assert.throws(() => { +common.expectsError(() => { socket.sendto('buffer', 'offset', 1, 'port', 'address', 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: errorMessageOffset -})); +}); -assert.throws(() => { +common.expectsError(() => { socket.sendto('buffer', 1, 1, 10, false, 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "address" argument must be of type string$/ -})); +}); -assert.throws(() => { +common.expectsError(() => { socket.sendto('buffer', 1, 1, false, 'address', 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "port" argument must be of type number$/ -})); +}); diff --git a/test/parallel/test-dgram-setTTL.js b/test/parallel/test-dgram-setTTL.js index 840a3f4d09f43a..c6e8cb3c66923c 100644 --- a/test/parallel/test-dgram-setTTL.js +++ b/test/parallel/test-dgram-setTTL.js @@ -9,13 +9,13 @@ socket.on('listening', common.mustCall(() => { const result = socket.setTTL(16); assert.strictEqual(result, 16); - assert.throws(() => { + common.expectsError(() => { socket.setTTL('foo'); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "ttl" argument must be of type number. Received type string' - })); + }); // TTL must be a number from > 0 to < 256 assert.throws(() => { diff --git a/test/parallel/test-dgram-socket-buffer-size.js b/test/parallel/test-dgram-socket-buffer-size.js index 7d6e2bfcc564ca..4b555284d4adb9 100644 --- a/test/parallel/test-dgram-socket-buffer-size.js +++ b/test/parallel/test-dgram-socket-buffer-size.js @@ -14,21 +14,21 @@ const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); - assert.throws(() => { + common.expectsError(() => { socket.setRecvBufferSize(8192); - }, common.expectsError(errorObj)); + }, errorObj); - assert.throws(() => { + common.expectsError(() => { socket.setSendBufferSize(8192); - }, common.expectsError(errorObj)); + }, errorObj); - assert.throws(() => { + common.expectsError(() => { socket.getRecvBufferSize(); - }, common.expectsError(errorObj)); + }, errorObj); - assert.throws(() => { + common.expectsError(() => { socket.getSendBufferSize(); - }, common.expectsError(errorObj)); + }, errorObj); } { @@ -45,13 +45,13 @@ const dgram = require('dgram'); socket.bind(common.mustCall(() => { badBufferSizes.forEach((badBufferSize) => { - assert.throws(() => { + common.expectsError(() => { socket.setRecvBufferSize(badBufferSize); - }, common.expectsError(errorObj)); + }, errorObj); - assert.throws(() => { + common.expectsError(() => { socket.setSendBufferSize(badBufferSize); - }, common.expectsError(errorObj)); + }, errorObj); }); socket.close(); })); @@ -84,9 +84,9 @@ function checkBufferSizeError(type, size) { 'BufferSize'; const socket = dgram.createSocket('udp4'); socket.bind(common.mustCall(() => { - assert.throws(() => { + common.expectsError(() => { socket[functionName](size); - }, common.expectsError(errorObj)); + }, errorObj); socket.close(); })); } diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 18ba8cddc73158..516f6ac0c145ec 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -7,51 +7,51 @@ const dns = require('dns'); // Stub `getaddrinfo` to *always* error. cares.getaddrinfo = () => process.binding('uv').UV_ENOENT; -assert.throws(() => { +common.expectsError(() => { dns.lookup(1, {}); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "hostname" argument must be one of type string or falsy/ -})); +}); -assert.throws(() => { +common.expectsError(() => { dns.lookup(false, 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_CALLBACK', type: TypeError -})); +}); -assert.throws(() => { +common.expectsError(() => { dns.lookup(false, 'options', 'cb'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_CALLBACK', type: TypeError -})); +}); -assert.throws(() => { +common.expectsError(() => { dns.lookup(false, { hints: 100, family: 0, all: false }, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: 'The value "100" is invalid for option "hints"' -})); +}); -assert.throws(() => { +common.expectsError(() => { dns.lookup(false, { hints: 0, family: 20, all: false }, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: 'The value "20" is invalid for option "family"' -})); +}); assert.doesNotThrow(() => { dns.lookup(false, { diff --git a/test/parallel/test-dns-regress-7070.js b/test/parallel/test-dns-regress-7070.js index f0e6554fdc7edf..c1f698c3a65035 100644 --- a/test/parallel/test-dns-regress-7070.js +++ b/test/parallel/test-dns-regress-7070.js @@ -21,18 +21,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const dns = require('dns'); // Should not raise assertion error. Issue #7070 -assert.throws(() => dns.resolveNs([]), // bad name - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: /^The "name" argument must be of type string/ - })); -assert.throws(() => dns.resolveNs(''), // bad callback - common.expectsError({ - code: 'ERR_INVALID_CALLBACK', - type: TypeError - })); +common.expectsError(() => dns.resolveNs([]), // bad name + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: /^The "name" argument must be of type string/ + }); +common.expectsError(() => dns.resolveNs(''), // bad callback + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError + }); From f399667784cdf2b4d5334db06c2ee1bdade8872a Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 21:08:06 +0530 Subject: [PATCH 327/379] test: replace assert.throws w/ common.expectsError PR-URL: https://github.com/nodejs/node/pull/17497 Reviewed-By: Ruben Bridgewater Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/parallel/test-dns.js | 28 +++++++++---------- test/parallel/test-fs-realpath.js | 4 +-- test/parallel/test-fs-watchfile.js | 4 +-- .../test-http-client-check-http-token.js | 7 ++--- ...est-http-client-reject-unexpected-agent.js | 6 ++-- .../test-http-client-unescaped-path.js | 7 ++--- .../test-http-hostname-typechecking.js | 12 ++++---- .../test-http-request-invalid-method-error.js | 7 ++--- .../parallel/test-http-response-statuscode.js | 12 ++++---- .../test-http-server-de-chunked-trailer.js | 4 +-- test/parallel/test-http-write-head.js | 7 ++--- 11 files changed, 47 insertions(+), 51 deletions(-) diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 08a26ab2184dd2..f0e4b29d7c9b7f 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -68,16 +68,16 @@ const goog = [ ]; assert.doesNotThrow(() => dns.setServers(goog)); assert.deepStrictEqual(dns.getServers(), goog); -assert.throws(() => dns.setServers(['foobar']), common.expectsError({ +common.expectsError(() => dns.setServers(['foobar']), { code: 'ERR_INVALID_IP_ADDRESS', type: Error, message: 'Invalid IP address: foobar' -})); -assert.throws(() => dns.setServers(['127.0.0.1:va']), common.expectsError({ +}); +common.expectsError(() => dns.setServers(['127.0.0.1:va']), { code: 'ERR_INVALID_IP_ADDRESS', type: Error, message: 'Invalid IP address: 127.0.0.1:va' -})); +}); assert.deepStrictEqual(dns.getServers(), goog); const goog6 = [ @@ -109,14 +109,14 @@ assert.deepStrictEqual(dns.getServers(), portsExpected); assert.doesNotThrow(() => dns.setServers([])); assert.deepStrictEqual(dns.getServers(), []); -assert.throws(() => { +common.expectsError(() => { dns.resolve('example.com', [], common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "rrtype" argument must be of type string. ' + 'Received type object' -})); +}); // dns.lookup should accept only falsey and string values { @@ -167,24 +167,24 @@ assert.throws(() => { * - it's an odd number different than 1, and thus is invalid, because * flags are either === 1 or even. */ -assert.throws(() => { +common.expectsError(() => { dns.lookup('nodejs.org', { hints: (dns.V4MAPPED | dns.ADDRCONFIG) + 1 }, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: /The value "\d+" is invalid for option "hints"/ -})); +}); -assert.throws(() => dns.lookup('nodejs.org'), common.expectsError({ +common.expectsError(() => dns.lookup('nodejs.org'), { code: 'ERR_INVALID_CALLBACK', type: TypeError -})); +}); -assert.throws(() => dns.lookup('nodejs.org', 4), common.expectsError({ +common.expectsError(() => dns.lookup('nodejs.org', 4), { code: 'ERR_INVALID_CALLBACK', type: TypeError -})); +}); assert.doesNotThrow(() => dns.lookup('', { family: 4, hints: 0 }, common.mustCall())); diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 4ea9bfdf48eb6f..cee45b2c899cdf 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -225,9 +225,9 @@ function test_cyclic_link_protection(realpath, realpathSync, callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(() => { + common.expectsError(() => { realpathSync(entry); - }, common.expectsError({ code: 'ELOOP', type: Error })); + }, { code: 'ELOOP', type: Error }); asynctest( realpath, [entry], callback, common.mustCall(function(err, result) { assert.strictEqual(err.path, entry); diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index f980d8f3fcc0c0..fe0d89c42e031f 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -24,9 +24,9 @@ common.expectsError( type: TypeError }); -assert.throws(function() { +common.expectsError(function() { fs.watchFile(new Object(), common.mustNotCall()); -}, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError }); const enoentFile = path.join(common.tmpDir, 'non-existent-file'); const expectedStatObject = new fs.Stats( diff --git a/test/parallel/test-http-client-check-http-token.js b/test/parallel/test-http-client-check-http-token.js index 7a0c894504b1b9..828d7fa79a503c 100644 --- a/test/parallel/test-http-client-check-http-token.js +++ b/test/parallel/test-http-client-check-http-token.js @@ -1,6 +1,5 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const http = require('http'); const Countdown = require('../common/countdown'); @@ -18,14 +17,14 @@ const server = http.createServer(common.mustCall((req, res) => { server.listen(0, common.mustCall(() => { expectedFails.forEach((method) => { - assert.throws(() => { + common.expectsError(() => { http.request({ method, path: '/' }, common.mustNotCall()); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "method" argument must be of type string. ' + `Received type ${typeof method}` - })); + }); }); expectedSuccesses.forEach((method) => { diff --git a/test/parallel/test-http-client-reject-unexpected-agent.js b/test/parallel/test-http-client-reject-unexpected-agent.js index 50d80fd32a2861..407084c030e67d 100644 --- a/test/parallel/test-http-client-reject-unexpected-agent.js +++ b/test/parallel/test-http-client-reject-unexpected-agent.js @@ -47,14 +47,14 @@ server.listen(0, baseOptions.host, common.mustCall(function() { baseOptions.port = this.address().port; failingAgentOptions.forEach((agent) => { - assert.throws( + common.expectsError( () => createRequest(agent), - common.expectsError({ + { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "Agent option" argument must be one of type ' + 'Agent-like Object, undefined, or false' - }) + } ); }); diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js index f3c680919df001..6d5a945dd5f893 100644 --- a/test/parallel/test-http-client-unescaped-path.js +++ b/test/parallel/test-http-client-unescaped-path.js @@ -21,17 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const http = require('http'); for (let i = 0; i <= 32; i += 1) { const path = `bad${String.fromCharCode(i)}path`; - assert.throws( + common.expectsError( () => http.get({ path }, common.mustNotCall()), - common.expectsError({ + { code: 'ERR_UNESCAPED_CHARACTERS', type: TypeError, message: 'Request path contains unescaped characters' - }) + } ); } diff --git a/test/parallel/test-http-hostname-typechecking.js b/test/parallel/test-http-hostname-typechecking.js index dbb98b7ae11c5e..12fe72005a41a6 100644 --- a/test/parallel/test-http-hostname-typechecking.js +++ b/test/parallel/test-http-hostname-typechecking.js @@ -9,26 +9,26 @@ const http = require('http'); const vals = [{}, [], NaN, Infinity, -Infinity, true, false, 1, 0, new Date()]; vals.forEach((v) => { - assert.throws( + common.expectsError( () => http.request({ hostname: v }), - common.expectsError({ + { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options.hostname" property must be one of ' + 'type string, undefined, or null. ' + `Received type ${typeof v}` - }) + } ); - assert.throws( + common.expectsError( () => http.request({ host: v }), - common.expectsError({ + { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options.host" property must be one of ' + 'type string, undefined, or null. ' + `Received type ${typeof v}` - }) + } ); }); diff --git a/test/parallel/test-http-request-invalid-method-error.js b/test/parallel/test-http-request-invalid-method-error.js index 59706e90c7ca12..ae11985e12ff87 100644 --- a/test/parallel/test-http-request-invalid-method-error.js +++ b/test/parallel/test-http-request-invalid-method-error.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const http = require('http'); -assert.throws( +common.expectsError( () => http.request({ method: '\0' }), - common.expectsError({ + { code: 'ERR_INVALID_HTTP_TOKEN', type: TypeError, message: 'Method must be a valid HTTP token ["\u0000"]' - }) + } ); diff --git a/test/parallel/test-http-response-statuscode.js b/test/parallel/test-http-response-statuscode.js index 17fce6c2d0f11e..28b091a3e8eddb 100644 --- a/test/parallel/test-http-response-statuscode.js +++ b/test/parallel/test-http-response-statuscode.js @@ -56,12 +56,12 @@ const server = http.Server(common.mustCall(function(req, res) { test(res, '404 this is not valid either', '404 this is not valid either'); break; case 12: - assert.throws(() => { res.writeHead(); }, - common.expectsError({ - code: 'ERR_HTTP_INVALID_STATUS_CODE', - type: RangeError, - message: 'Invalid status code: undefined' - })); + common.expectsError(() => { res.writeHead(); }, + { + code: 'ERR_HTTP_INVALID_STATUS_CODE', + type: RangeError, + message: 'Invalid status code: undefined' + }); this.close(); break; default: diff --git a/test/parallel/test-http-server-de-chunked-trailer.js b/test/parallel/test-http-server-de-chunked-trailer.js index 72c40ed5592690..dad744209ee419 100644 --- a/test/parallel/test-http-server-de-chunked-trailer.js +++ b/test/parallel/test-http-server-de-chunked-trailer.js @@ -14,8 +14,8 @@ const server = http.createServer(common.mustCall(function(req, res) { message: 'Trailers are invalid with this transfer encoding', type: Error }; - assert.throws(() => res.writeHead(200, { 'Content-Length': '2' }), - common.expectsError(trailerInvalidErr)); + common.expectsError(() => res.writeHead(200, { 'Content-Length': '2' }), + trailerInvalidErr); res.removeHeader('Trailer'); res.end('ok'); })); diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 70ad5935a92690..2d1b8ff5504df0 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -52,14 +52,13 @@ const s = http.createServer(common.mustCall((req, res) => { res.writeHead(200, { Test: '2' }); - assert.throws(() => { + common.expectsError(() => { res.writeHead(100, {}); - }, common.expectsError({ + }, { code: 'ERR_HTTP_HEADERS_SENT', type: Error, message: 'Cannot render headers after they are sent to the client' - }) - ); + }); res.end(); })); From 715baf82144792fdc0f40af74d7247689b317fb9 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 23:15:34 +0530 Subject: [PATCH 328/379] fs: use rest param & Reflect.apply in makeCallback PR-URL: https://github.com/nodejs/node/pull/17486 Reviewed-By: Anatoli Papirovski Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Benedikt Meurer Reviewed-By: Timothy Gu --- lib/fs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index a53290274c331e..eb781b0add8588 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -145,8 +145,8 @@ function makeCallback(cb) { throw new errors.TypeError('ERR_INVALID_CALLBACK'); } - return function() { - return cb.apply(undefined, arguments); + return function(...args) { + return Reflect.apply(cb, undefined, args); }; } From 919625bd6a9e8929d1bdf01cf528c313406bc5d9 Mon Sep 17 00:00:00 2001 From: Shilo Mangam Date: Wed, 6 Dec 2017 20:36:28 +0200 Subject: [PATCH 329/379] test: use Countdown in test-http-set-cookies PR-URL: https://github.com/nodejs/node/pull/17504 Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss --- test/parallel/test-http-set-cookies.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-http-set-cookies.js b/test/parallel/test-http-set-cookies.js index 44a5f47bbb3d03..c307bda73a3515 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -23,9 +23,9 @@ require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); -let nresponses = 0; - +const countdown = new Countdown(2, () => server.close()); const server = http.createServer(function(req, res) { if (req.url === '/one') { res.writeHead(200, [['set-cookie', 'A'], @@ -55,9 +55,7 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses === 2) { - server.close(); - } + countdown.dec(); }); }); @@ -72,14 +70,8 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses === 2) { - server.close(); - } + countdown.dec(); }); }); }); - -process.on('exit', function() { - assert.strictEqual(2, nresponses); -}); From 2a5da9c2c95692deeb46da9b827cd113ae122575 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Date: Sun, 26 Nov 2017 23:26:41 +0530 Subject: [PATCH 330/379] test: use Countdown in http-response-statuscode PR-URL: https://github.com/nodejs/node/pull/17327 Refs: https://github.com/nodejs/node/issues/17169 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-response-statuscode.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http-response-statuscode.js b/test/parallel/test-http-response-statuscode.js index 28b091a3e8eddb..79c3f6305449bb 100644 --- a/test/parallel/test-http-response-statuscode.js +++ b/test/parallel/test-http-response-statuscode.js @@ -2,6 +2,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const MAX_REQUESTS = 13; let reqNum = 0; @@ -72,13 +73,17 @@ const server = http.Server(common.mustCall(function(req, res) { }, MAX_REQUESTS)); server.listen(); +const countdown = new Countdown(MAX_REQUESTS, () => server.close()); + server.on('listening', function makeRequest() { http.get({ port: this.address().port }, (res) => { assert.strictEqual(res.statusCode, 200); res.on('end', () => { - if (++reqNum < MAX_REQUESTS) + countdown.dec(); + reqNum = MAX_REQUESTS - countdown.remaining; + if (countdown.remaining > 0) makeRequest.call(this); }); res.resume(); From 1aae28b7c9f95efa5a32c28955586d200cb8493b Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Thu, 7 Dec 2017 08:24:49 +0530 Subject: [PATCH 331/379] test: use Number.isNaN instead of global isNaN PR-URL: https://github.com/nodejs/node/pull/17515 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/parallel/test-os.js | 2 +- test/parallel/test-readdouble.js | 4 ++-- test/parallel/test-writefloat.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index b35faeb7cd7bbe..f8e383e497a154 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -28,7 +28,7 @@ const { inspect } = require('util'); const is = { number: (value, key) => { - assert(!isNaN(value), `${key} should not be NaN`); + assert(!Number.isNaN(value), `${key} should not be NaN`); assert.strictEqual(typeof value, 'number'); }, string: (value) => { assert.strictEqual(typeof value, 'string'); }, diff --git a/test/parallel/test-readdouble.js b/test/parallel/test-readdouble.js index 01ea010609e504..76b259ba498a6d 100644 --- a/test/parallel/test-readdouble.js +++ b/test/parallel/test-readdouble.js @@ -72,12 +72,12 @@ function test(clazz) { buffer[5] = 0xff; buffer[6] = 0x0f; buffer[7] = 0x00; - assert.ok(isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); assert.strictEqual(2.225073858507201e-308, buffer.readDoubleLE(0)); buffer[6] = 0xef; buffer[7] = 0x7f; - assert.ok(isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); assert.strictEqual(1.7976931348623157e+308, buffer.readDoubleLE(0)); buffer[0] = 0; diff --git a/test/parallel/test-writefloat.js b/test/parallel/test-writefloat.js index c175840f598087..b22b9e8c924899 100644 --- a/test/parallel/test-writefloat.js +++ b/test/parallel/test-writefloat.js @@ -127,8 +127,8 @@ function test(clazz) { // Darwin ia32 does the other kind of NaN. // Compiler bug. No one really cares. assert(0x7F === buffer[7] || 0xFF === buffer[7]); - assert.ok(isNaN(buffer.readFloatBE(0))); - assert.ok(isNaN(buffer.readFloatLE(4))); + assert.ok(Number.isNaN(buffer.readFloatBE(0))); + assert.ok(Number.isNaN(buffer.readFloatLE(4))); } From 0948238aa2b322f3d6d4055711539d96d42cd923 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 21:07:09 -0800 Subject: [PATCH 332/379] doc: improve readability of COLLABORATOR_GUIDE.md * convert run-on sentence to a bulleted list * standardize capitalization in "Collaborators" PR-URL: https://github.com/nodejs/node/pull/17519 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- COLLABORATOR_GUIDE.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 10a4803023d72e..9a4b5184b3a43e 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -130,7 +130,7 @@ can be fast-tracked and may be landed after a shorter delay: * Changes that fix regressions. When a pull request is deemed suitable to be fast-tracked, label it with -`fast-track`. The pull request can be landed once 2 or more collaborators +`fast-track`. The pull request can be landed once 2 or more Collaborators approve both the pull request and the fast-tracking request, and the necessary CI testing is done. @@ -225,15 +225,16 @@ on how to handle those types of changes. ### Breaking Changes Backwards-incompatible changes may land on the master branch at any time after -sufficient review by collaborators and approval of at least two TSC members. - -Examples of breaking changes include, but are not necessarily limited to, -removal or redefinition of existing API arguments, changing return values -(except when return values do not currently exist), removing or modifying -existing properties on an options argument, adding or removing errors, -changing error messages in any way, altering expected timing of an event (e.g. -moving from sync to async responses or vice versa), and changing the -non-internal side effects of using a particular API. +sufficient review by Collaborators and approval of at least two TSC members. + +Examples of breaking changes include: + +* removal or redefinition of existing API arguments +* changing return values +* removing or modifying existing properties on an options argument +* adding or removing errors +* altering expected timing of an event +* changing the side effects of using a particular API Purely additive changes (e.g. adding new events to `EventEmitter` implementations, adding new arguments to a method in a way that allows From cb09959e8fc2e601c8aaf2e0717878529a858b20 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 21:11:44 -0800 Subject: [PATCH 333/379] doc: improve readability of README.md Use consistent typography and other minor changes to Verifying Binaries section. PR-URL: https://github.com/nodejs/node/pull/17519 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f4332771ac3e23..e37a2b70d82b02 100644 --- a/README.md +++ b/README.md @@ -116,11 +116,11 @@ documentation of the latest stable version. ### Verifying Binaries -Current, LTS, and Nightly download directories all contain a _SHASUMS256.txt_ +Current, LTS, and Nightly download directories all contain a SHASUMS256.txt file that lists the SHA checksums for each file available for download. -The _SHASUMS256.txt_ can be downloaded using curl. +The SHASUMS256.txt can be downloaded using `curl`. ```console $ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt @@ -133,12 +133,9 @@ it through `sha256sum` with a command such as: $ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c - ``` -_(Where "node-vx.y.z.tar.gz" is the name of the file you have -downloaded)_ - -Additionally, Current and LTS releases (not Nightlies) have the GPG -detached signature of SHASUMS256.txt available as SHASUMS256.txt.sig. -You can use `gpg` to verify that SHASUMS256.txt has not been tampered with. +Current and LTS releases (but not Nightlies) also have the GPG detached +signature of SHASUMS256.txt available as SHASUMS256.txt.sig. You can use `gpg` +to verify that SHASUMS256.txt has not been tampered with. To verify SHASUMS256.txt has not been altered, you will first need to import all of the GPG keys of individuals authorized to create releases. They are @@ -149,8 +146,7 @@ Use a command such as this to import the keys: $ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D ``` -_(See the bottom of this README for a full script to import active -release keys)_ +See the bottom of this README for a full script to import active release keys. Next, download the SHASUMS256.txt.sig for the release: From 18d6dab19dac436f15dd0a23c83ffcea338a2393 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 21:15:39 -0800 Subject: [PATCH 334/379] doc: improve text for Console constructor Make text for Console constructor more precise. PR-URL: https://github.com/nodejs/node/pull/17519 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- doc/api/console.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index d9421043659cd4..6dac2a8a5e7c66 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -81,10 +81,9 @@ const { Console } = console; * `stdout` {Writable} * `stderr` {Writable} -Creates a new `Console` by passing one or two writable stream instances. -`stdout` is a writable stream to print log or info output. `stderr` -is used for warning or error output. If `stderr` is not passed, warning and error -output will be sent to `stdout`. +Creates a new `Console` with one or two writable stream instances. `stdout` is a +writable stream to print log or info output. `stderr` is used for warning or +error output. If `stderr` is not provided, `stdout` is used for `stderr`. ```js const output = fs.createWriteStream('./stdout.log'); From 865c4520b619d9047273bd0e2b52e41f70db6bb1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 21:48:11 -0800 Subject: [PATCH 335/379] doc: immprove inode text in fs.md Rewrite and edit somewhat confusing paragraph about inodes and AIX in fs.md. PR-URL: https://github.com/nodejs/node/pull/17519 Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- doc/api/fs.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 8bc585d3a7291a..fb8d246f03d845 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2568,12 +2568,9 @@ a new inode. The watch will emit an event for the delete but will continue watching the *original* inode. Events for the new inode will not be emitted. This is expected behavior. -On AIX, save and close of a file being watched causes two notifications - -one for adding new content, and one for truncation. Moreover, save and -close operations on some platforms cause inode changes that force watch -operations to become invalid and ineffective. AIX retains inode for the -lifetime of a file, that way though this is different from Linux / macOS, -this improves the usability of file watching. This is expected behavior. +AIX files retain the same inode for the lifetime of a file. Saving and closing a +watched file on AIX will result in two notifications (one for adding new +content, and one for truncation). #### Filename Argument From 0a0a56aa3477991fcf9378b4f7a2d50427a3bc2e Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Sat, 2 Dec 2017 12:44:09 +0100 Subject: [PATCH 336/379] doc: add "Hello world" example for N-API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our Addons documentation has a "Hello world" example that outlines all steps to build it. Adding the sources for this "Hello world" example for N-API. PR-URL: https://github.com/nodejs/node/pull/17425 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- doc/api/addons.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 9ccf07f777a5ba..e2df5f30e9a32a 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -221,7 +221,7 @@ illustration of how it can be used. > Stability: 1 - Experimental N-API is an API for building native Addons. It is independent from -the underlying JavaScript runtime (ex V8) and is maintained as part of +the underlying JavaScript runtime (e.g., V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across version of Node.js. It is intended to insulate Addons from changes in the underlying JavaScript engine and allow modules @@ -232,6 +232,41 @@ set of APIs that are used by the native code. Instead of using the V8 or [Native Abstractions for Node.js][] APIs, the functions available in the N-API are used. +To use N-API in the above "Hello world" example, replace the content of +`hello.cc` with the following. All other instructions remain the same. + +```cpp +// hello.cc using N-API +#include + +namespace demo { + +napi_value Method(napi_env env, napi_callback_info args) { + napi_value greeting; + napi_status status; + + status = napi_create_string_utf8(env, "hello", 6, &greeting); + if (status != napi_ok) return nullptr; + return greeting; +} + +napi_value init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) return nullptr; + + status = napi_set_named_property(env, exports, "hello", fn); + if (status != napi_ok) return nullptr; + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + The functions available and how to use them are documented in the section titled [C/C++ Addons - N-API](n-api.html). From 993b1cbc6d132e64b92747499bea4292ed5a3b06 Mon Sep 17 00:00:00 2001 From: idandagan1 Date: Wed, 6 Dec 2017 21:57:13 +0200 Subject: [PATCH 337/379] test: use Countdown in http test PR-URL: https://github.com/nodejs/node/pull/17506 Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- .../test-http-incoming-pipelined-socket-destroy.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 7c15339785137b..8e63bdb8a9bbd2 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -21,11 +21,13 @@ 'use strict'; const common = require('../common'); +const Countdown = require('../common/countdown'); const http = require('http'); const net = require('net'); const seeds = [ 3, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 ]; +const countdown = new Countdown(seeds.length, () => server.close()); // Set up some timing issues where sockets can be destroyed // via either the req or res. @@ -72,11 +74,8 @@ function generator(seeds) { server.listen(0, common.mustCall(function() { const client = net.connect({ port: this.address().port }); - let done = 0; server.on('requestDone', function() { - if (++done === seeds.length) { - server.close(); - } + countdown.dec(); }); // immediately write the pipelined requests. From d15cdc6fdbc79fdfdeb54ac53549bbe8a06a866e Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 22:16:44 +0530 Subject: [PATCH 338/379] test: replace assert.throws w/ common.expectsError PR-URL: https://github.com/nodejs/node/pull/17498 Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss --- ...est-http2-compat-serverresponse-headers.js | 18 +-- ...-http2-compat-serverresponse-statuscode.js | 18 +-- test/parallel/test-http2-getpackedsettings.js | 36 +++--- test/parallel/test-http2-info-headers.js | 38 +++--- .../test-http2-misused-pseudoheaders.js | 9 +- test/parallel/test-http2-too-many-settings.js | 10 +- test/parallel/test-http2-util-asserts.js | 20 +-- test/parallel/test-internal-errors.js | 120 +++++++++--------- test/parallel/test-module-loading-error.js | 12 +- .../test-net-better-error-messages-path.js | 5 +- .../parallel/test-net-connect-options-port.js | 4 +- test/parallel/test-net-options-lookup.js | 6 +- .../test-net-server-listen-options.js | 12 +- test/parallel/test-net-server-options.js | 21 ++- test/parallel/test-net-socket-write-error.js | 11 +- test/parallel/test-path-parse-format.js | 6 +- test/parallel/test-path.js | 4 +- test/parallel/test-performance-function.js | 12 +- test/parallel/test-process-assert.js | 12 +- test/parallel/test-process-hrtime.js | 24 ++-- test/parallel/test-process-next-tick.js | 13 +- test/parallel/test-readline-csi.js | 6 +- test/parallel/test-regress-GH-5727.js | 18 +-- test/parallel/test-require-invalid-package.js | 5 +- ...tream-readable-with-unimplemented-_read.js | 5 +- .../parallel/test-stream-unshift-read-race.js | 12 +- .../test-timers-enroll-invalid-msecs.js | 13 +- test/parallel/test-tls-basic-validations.js | 12 +- ...t-tls-clientcertengine-invalid-arg-type.js | 7 +- .../test-tls-clientcertengine-unsupported.js | 7 +- test/parallel/test-tls-no-cert-required.js | 12 +- .../test-tls-options-boolean-check.js | 18 +-- test/parallel/test-util-callbackify.js | 12 +- test/parallel/test-util-inherits.js | 12 +- test/parallel/test-util-inspect.js | 12 +- .../test-whatwg-encoding-textdecoder.js | 31 ++--- .../test-whatwg-encoding-textencoder.js | 12 +- .../test-whatwg-url-searchparams-append.js | 12 +- .../test-whatwg-url-searchparams-delete.js | 12 +- .../test-whatwg-url-searchparams-entries.js | 12 +- .../test-whatwg-url-searchparams-foreach.js | 7 +- .../test-whatwg-url-searchparams-get.js | 12 +- .../test-whatwg-url-searchparams-getall.js | 12 +- .../test-whatwg-url-searchparams-has.js | 12 +- .../test-whatwg-url-searchparams-keys.js | 12 +- .../test-whatwg-url-searchparams-set.js | 12 +- ...est-whatwg-url-searchparams-stringifier.js | 7 +- .../test-whatwg-url-searchparams-values.js | 12 +- 48 files changed, 358 insertions(+), 369 deletions(-) diff --git a/test/parallel/test-http2-compat-serverresponse-headers.js b/test/parallel/test-http2-compat-serverresponse-headers.js index ec1071bc34ffa1..6da74307e0d340 100644 --- a/test/parallel/test-http2-compat-serverresponse-headers.js +++ b/test/parallel/test-http2-compat-serverresponse-headers.js @@ -72,28 +72,28 @@ server.listen(0, common.mustCall(function() { ':path', ':authority', ':scheme' - ].forEach((header) => assert.throws( + ].forEach((header) => common.expectsError( () => response.setHeader(header, 'foobar'), - common.expectsError({ + { code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', type: Error, message: 'Cannot set HTTP/2 pseudo-headers' }) - )); - assert.throws(function() { + ); + common.expectsError(function() { response.setHeader(real, null); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_HEADER_VALUE', type: TypeError, message: 'Invalid value "null" for header "foo-bar"' - })); - assert.throws(function() { + }); + common.expectsError(function() { response.setHeader(real, undefined); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_HEADER_VALUE', type: TypeError, message: 'Invalid value "undefined" for header "foo-bar"' - })); + }); common.expectsError( () => response.setHeader(), // header name undefined { diff --git a/test/parallel/test-http2-compat-serverresponse-statuscode.js b/test/parallel/test-http2-compat-serverresponse-statuscode.js index 96b033328f2855..6a573da88f9858 100644 --- a/test/parallel/test-http2-compat-serverresponse-statuscode.js +++ b/test/parallel/test-http2-compat-serverresponse-statuscode.js @@ -34,24 +34,24 @@ server.listen(0, common.mustCall(function() { response.statusCode = realStatusCodes.internalServerError; }); - assert.throws(function() { + common.expectsError(function() { response.statusCode = realStatusCodes.continue; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', type: RangeError - })); - assert.throws(function() { + }); + common.expectsError(function() { response.statusCode = fakeStatusCodes.tooLow; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_STATUS_INVALID', type: RangeError - })); - assert.throws(function() { + }); + common.expectsError(function() { response.statusCode = fakeStatusCodes.tooHigh; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_STATUS_INVALID', type: RangeError - })); + }); response.on('finish', common.mustCall(function() { server.close(); diff --git a/test/parallel/test-http2-getpackedsettings.js b/test/parallel/test-http2-getpackedsettings.js index 16c84913893d0c..9ae2512b2cea06 100644 --- a/test/parallel/test-http2-getpackedsettings.js +++ b/test/parallel/test-http2-getpackedsettings.js @@ -44,25 +44,25 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); ['maxHeaderListSize', -1], ['maxHeaderListSize', 2 ** 32] ].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getPackedSettings({ [i[0]]: i[1] }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: `Invalid value for setting "${i[0]}": ${i[1]}` - })); + }); }); [ 1, null, '', Infinity, new Date(), {}, NaN, [false] ].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getPackedSettings({ enablePush: i }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: TypeError, message: `Invalid value for setting "enablePush": ${i}` - })); + }); }); { @@ -99,23 +99,23 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); 0x00, 0x02, 0x00, 0x00, 0x00, 0x01]); [1, true, '', [], {}, NaN].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(i); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "buf" argument must be one of type Buffer, TypedArray, or DataView' - })); + }); }); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed.slice(5)); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', type: RangeError, message: 'Packed settings length must be a multiple of six' - })); + }); const settings = http2.getUnpackedSettings(packed); @@ -160,24 +160,24 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); { const packed = Buffer.from([0x00, 0x05, 0x01, 0x00, 0x00, 0x00]); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: 'Invalid value for setting "maxFrameSize": 16777216' - })); + }); } // check for maxConcurrentStreams failing the max number { const packed = Buffer.from([0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF]); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: 'Invalid value for setting "maxConcurrentStreams": 4294967295' - })); + }); } diff --git a/test/parallel/test-http2-info-headers.js b/test/parallel/test-http2-info-headers.js index 609f56e8b8566c..332c688429c37e 100644 --- a/test/parallel/test-http2-info-headers.js +++ b/test/parallel/test-http2-info-headers.js @@ -18,19 +18,19 @@ const afterRespondregex = function onStream(stream, headers, flags) { - assert.throws(() => stream.additionalHeaders({ ':status': 201 }), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_INFO_STATUS', - type: RangeError, - message: /^Invalid informational status code: 201$/ - })); - - assert.throws(() => stream.additionalHeaders({ ':status': 101 }), - common.expectsError({ - code: 'ERR_HTTP2_STATUS_101', - type: Error, - message: status101regex - })); + common.expectsError(() => stream.additionalHeaders({ ':status': 201 }), + { + code: 'ERR_HTTP2_INVALID_INFO_STATUS', + type: RangeError, + message: /^Invalid informational status code: 201$/ + }); + + common.expectsError(() => stream.additionalHeaders({ ':status': 101 }), + { + code: 'ERR_HTTP2_STATUS_101', + type: Error, + message: status101regex + }); common.expectsError( () => stream.additionalHeaders({ ':method': 'POST' }), @@ -50,12 +50,12 @@ function onStream(stream, headers, flags) { ':status': 200 }); - assert.throws(() => stream.additionalHeaders({ abc: 123 }), - common.expectsError({ - code: 'ERR_HTTP2_HEADERS_AFTER_RESPOND', - type: Error, - message: afterRespondregex - })); + common.expectsError(() => stream.additionalHeaders({ abc: 123 }), + { + code: 'ERR_HTTP2_HEADERS_AFTER_RESPOND', + type: Error, + message: afterRespondregex + }); stream.end('hello world'); } diff --git a/test/parallel/test-http2-misused-pseudoheaders.js b/test/parallel/test-http2-misused-pseudoheaders.js index 2ccb676b2199e5..1f501598c1c421 100644 --- a/test/parallel/test-http2-misused-pseudoheaders.js +++ b/test/parallel/test-http2-misused-pseudoheaders.js @@ -3,7 +3,6 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const assert = require('assert'); const h2 = require('http2'); const server = h2.createServer(); @@ -19,10 +18,10 @@ function onStream(stream, headers, flags) { ':method', ':scheme' ].forEach((i) => { - assert.throws(() => stream.respond({ [i]: '/' }), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_PSEUDOHEADER' - })); + common.expectsError(() => stream.respond({ [i]: '/' }), + { + code: 'ERR_HTTP2_INVALID_PSEUDOHEADER' + }); }); stream.respond({ diff --git a/test/parallel/test-http2-too-many-settings.js b/test/parallel/test-http2-too-many-settings.js index 4feda98c05d522..9b685fa8ceb16f 100644 --- a/test/parallel/test-http2-too-many-settings.js +++ b/test/parallel/test-http2-too-many-settings.js @@ -17,11 +17,11 @@ let clients = 2; function doTest(session) { for (let n = 0; n < maxPendingAck; n++) assert.doesNotThrow(() => session.settings({ enablePush: false })); - assert.throws(() => session.settings({ enablePush: false }), - common.expectsError({ - code: 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', - type: Error - })); + common.expectsError(() => session.settings({ enablePush: false }), + { + code: 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', + type: Error + }); } server.on('stream', common.mustNotCall()); diff --git a/test/parallel/test-http2-util-asserts.js b/test/parallel/test-http2-util-asserts.js index ca25396a2c1d0c..1e7a0113f4a850 100644 --- a/test/parallel/test-http2-util-asserts.js +++ b/test/parallel/test-http2-util-asserts.js @@ -27,17 +27,17 @@ const { [], [{}] ].forEach((i) => { - assert.throws(() => assertIsObject(i, 'foo', 'Object'), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - message: /^The "foo" argument must be of type Object$/ - })); + common.expectsError(() => assertIsObject(i, 'foo', 'Object'), + { + code: 'ERR_INVALID_ARG_TYPE', + message: /^The "foo" argument must be of type Object$/ + }); }); assert.doesNotThrow(() => assertWithinRange('foo', 1, 0, 2)); -assert.throws(() => assertWithinRange('foo', 1, 2, 3), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - message: /^Invalid value for setting "foo": 1$/ - })); +common.expectsError(() => assertWithinRange('foo', 1, 2, 3), + { + code: 'ERR_HTTP2_INVALID_SETTING_VALUE', + message: /^Invalid value for setting "foo": 1$/ + }); diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index 80edc25df1902c..1b4abcf72c9ab3 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -52,91 +52,91 @@ errors.E('TEST_ERROR_2', (a, b) => `${a} ${b}`); assert.strictEqual(err.code, 'TEST_ERROR_1'); } -assert.throws( +common.expectsError( () => new errors.Error('TEST_FOO_KEY'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('TEST_FOO_KEY') - })); + }); // Calling it twice yields same result (using the key does not create it) -assert.throws( +common.expectsError( () => new errors.Error('TEST_FOO_KEY'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('TEST_FOO_KEY') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.Error({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); + }); // Tests for common.expectsError @@ -166,25 +166,25 @@ assert.doesNotThrow(() => { }, common.expectsError({ code: 'TEST_ERROR_1', type: Error })); }); -assert.throws(() => { - assert.throws(() => { +common.expectsError(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: RangeError })); -}, common.expectsError({ + }, { code: 'TEST_ERROR_1', type: RangeError }); +}, { code: 'ERR_ASSERTION', message: /^.+ is not instance of \S/ -})); +}); -assert.throws(() => { - assert.throws(() => { +common.expectsError(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', - type: TypeError, - message: /^Error for testing 2/ })); -}, common.expectsError({ + }, { code: 'TEST_ERROR_1', + type: TypeError, + message: /^Error for testing 2/ }); +}, { code: 'ERR_ASSERTION', message: /.+ does not match \S/ -})); +}); // // Test ERR_INVALID_ARG_TYPE assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']), @@ -229,12 +229,12 @@ assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['http', 'ftp']]), 'The URL must be one of scheme http or ftp'); assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['a', 'b', 'c']]), 'The URL must be one of scheme a, b, or c'); -assert.throws( +common.expectsError( () => errors.message('ERR_INVALID_URL_SCHEME', [[]]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^At least one expected value needs to be specified$/ - })); + }); // Test ERR_MISSING_ARGS assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name']), @@ -243,12 +243,12 @@ assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name', 'value']), 'The "name" and "value" arguments must be specified'); assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['a', 'b', 'c']), 'The "a", "b", and "c" arguments must be specified'); -assert.throws( +common.expectsError( () => errors.message('ERR_MISSING_ARGS'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^At least one arg needs to be specified$/ - })); + }); // Test ERR_SOCKET_BAD_PORT assert.strictEqual( diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 68f45d774e5ce0..f1c457af2b2c9e 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -59,16 +59,16 @@ assert.throws( } ); -assert.throws( +common.expectsError( require, - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^missing path$/ - })); + }); -assert.throws( +common.expectsError( () => { require({}); }, - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^path must be a string$/ - })); + }); diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js index bb2256637a0d30..0d16894ff83f6c 100644 --- a/test/parallel/test-net-better-error-messages-path.js +++ b/test/parallel/test-net-better-error-messages-path.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const net = require('net'); -const assert = require('assert'); { const fp = '/tmp/fadagagsdfgsdf'; @@ -15,8 +14,8 @@ const assert = require('assert'); } { - assert.throws( + common.expectsError( () => net.createConnection({ path: {} }), - common.expectsError({ code: 'ERR_INVALID_ARG_TYPE' }) + { code: 'ERR_INVALID_ARG_TYPE' } ); } diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index 975022be8aa88c..37dc1d58b4519f 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -63,11 +63,11 @@ const net = require('net'); const hintOptBlocks = doConnect([{ hints: hints }], () => common.mustNotCall()); for (const block of hintOptBlocks) { - assert.throws(block, common.expectsError({ + common.expectsError(block, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: /The value "\d+" is invalid for option "hints"/ - })); + }); } } diff --git a/test/parallel/test-net-options-lookup.js b/test/parallel/test-net-options-lookup.js index 337a071a19b80b..0551a241147e84 100644 --- a/test/parallel/test-net-options-lookup.js +++ b/test/parallel/test-net-options-lookup.js @@ -13,12 +13,12 @@ function connectThrows(input) { lookup: input }; - assert.throws(() => { + common.expectsError(() => { net.connect(opts); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - })); + }); } connectDoesNotThrow(() => {}); diff --git a/test/parallel/test-net-server-listen-options.js b/test/parallel/test-net-server-listen-options.js index bc28b57ac12854..f969fa9d43d2da 100644 --- a/test/parallel/test-net-server-listen-options.js +++ b/test/parallel/test-net-server-listen-options.js @@ -57,12 +57,12 @@ const listenOnPort = [ const block = () => { net.createServer().listen(options, common.mustNotCall()); }; - assert.throws(block, - common.expectsError({ - code: 'ERR_INVALID_OPT_VALUE', - type: Error, - message: /^The value "{.*}" is invalid for option "options"$/ - })); + common.expectsError(block, + { + code: 'ERR_INVALID_OPT_VALUE', + type: Error, + message: /^The value "{.*}" is invalid for option "options"$/ + }); } shouldFailToListen(false, { port: false }); diff --git a/test/parallel/test-net-server-options.js b/test/parallel/test-net-server-options.js index 6b120821b0d3ac..2275d9f859b409 100644 --- a/test/parallel/test-net-server-options.js +++ b/test/parallel/test-net-server-options.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const net = require('net'); -assert.throws(function() { net.createServer('path'); }, - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); +common.expectsError(function() { net.createServer('path'); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); -assert.throws(function() { net.createServer(0); }, - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); +common.expectsError(function() { net.createServer(0); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); diff --git a/test/parallel/test-net-socket-write-error.js b/test/parallel/test-net-socket-write-error.js index 0a2dd967df6a2a..800d6020da4cbe 100644 --- a/test/parallel/test-net-socket-write-error.js +++ b/test/parallel/test-net-socket-write-error.js @@ -1,18 +1,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const net = require('net'); const server = net.createServer().listen(0, connectToServer); function connectToServer() { const client = net.createConnection(this.address().port, () => { - assert.throws(() => client.write(1337), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); + common.expectsError(() => client.write(1337), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); client.end(); }) diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index 83ae328c1ac343..3586ebece1af16 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -225,13 +225,13 @@ function checkFormat(path, testCases) { } [null, undefined, 1, true, false, 'string'].forEach((pathObject) => { - assert.throws(() => { + common.expectsError(() => { path.format(pathObject); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "pathObject" argument must be of type Object. ' + `Received type ${typeName(pathObject)}` - })); + }); }); } diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 58dfc92855cba6..a3f10eccdf1d7e 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -30,9 +30,9 @@ const typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN]; function fail(fn) { const args = Array.from(arguments).slice(1); - assert.throws(() => { + common.expectsError(() => { fn.apply(null, args); - }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError }); } typeErrorTests.forEach((test) => { diff --git a/test/parallel/test-performance-function.js b/test/parallel/test-performance-function.js index 8dd4d3004baed1..0deaa0e057c302 100644 --- a/test/parallel/test-performance-function.js +++ b/test/parallel/test-performance-function.js @@ -71,12 +71,12 @@ const { { [1, {}, [], null, undefined, Infinity].forEach((i) => { - assert.throws(() => performance.timerify(i), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "fn" argument must be of type Function' - })); + common.expectsError(() => performance.timerify(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fn" argument must be of type Function' + }); }); } diff --git a/test/parallel/test-process-assert.js b/test/parallel/test-process-assert.js index 4baccb21fd01c3..f62cf1a5ced1c7 100644 --- a/test/parallel/test-process-assert.js +++ b/test/parallel/test-process-assert.js @@ -3,19 +3,19 @@ const common = require('../common'); const assert = require('assert'); assert.strictEqual(process.assert(1, 'error'), undefined); -assert.throws(() => { +common.expectsError(() => { process.assert(undefined, 'errorMessage'); -}, common.expectsError({ +}, { code: 'ERR_ASSERTION', type: Error, message: 'errorMessage' -}) +} ); -assert.throws(() => { +common.expectsError(() => { process.assert(false); -}, common.expectsError({ +}, { code: 'ERR_ASSERTION', type: Error, message: 'assertion error' -}) +} ); diff --git a/test/parallel/test-process-hrtime.js b/test/parallel/test-process-hrtime.js index 5ca9be72d14d63..1d2d2ecde9da2b 100644 --- a/test/parallel/test-process-hrtime.js +++ b/test/parallel/test-process-hrtime.js @@ -33,34 +33,34 @@ validateTuple(tuple); validateTuple(process.hrtime(tuple)); // test that only an Array may be passed to process.hrtime() -assert.throws(() => { +common.expectsError(() => { process.hrtime(1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "time" argument must be of type Array. Received type number' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 0) must be of length 2.' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([1]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 1) must be of length 2.' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([1, 2, 3]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 3) must be of length 2.' -})); +}); function validateTuple(tuple) { assert(Array.isArray(tuple)); diff --git a/test/parallel/test-process-next-tick.js b/test/parallel/test-process-next-tick.js index 5c078870806cc5..59de0da42d3962 100644 --- a/test/parallel/test-process-next-tick.js +++ b/test/parallel/test-process-next-tick.js @@ -21,7 +21,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const N = 2; function cb() { @@ -39,10 +38,10 @@ process.on('exit', function() { }); [null, 1, 'test', {}, [], Infinity, true].forEach((i) => { - assert.throws(() => process.nextTick(i), - common.expectsError({ - code: 'ERR_INVALID_CALLBACK', - type: TypeError, - message: 'Callback must be a function' - })); + common.expectsError(() => process.nextTick(i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: 'Callback must be a function' + }); }); diff --git a/test/parallel/test-readline-csi.js b/test/parallel/test-readline-csi.js index d83948764314de..a3316a8800e4e3 100644 --- a/test/parallel/test-readline-csi.js +++ b/test/parallel/test-readline-csi.js @@ -73,13 +73,13 @@ assert.doesNotThrow(() => readline.cursorTo(writable, 'a', 'b')); assert.strictEqual(writable.data, ''); writable.data = ''; -assert.throws( +common.expectsError( () => readline.cursorTo(writable, 'a', 1), - common.expectsError({ + { type: Error, code: 'ERR_INVALID_CURSOR_POS', message: 'Cannot set cursor row without setting its column' - })); + }); assert.strictEqual(writable.data, ''); writable.data = ''; diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js index 053719c6facf76..fab139ca7c305c 100644 --- a/test/parallel/test-regress-GH-5727.js +++ b/test/parallel/test-regress-GH-5727.js @@ -14,25 +14,25 @@ net.Server().listen(0, function() { }); // The first argument is a configuration object -assert.throws(() => { +common.expectsError(() => { net.Server().listen({ port: invalidPort }, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); // The first argument is the port, no IP given. -assert.throws(() => { +common.expectsError(() => { net.Server().listen(invalidPort, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); // The first argument is the port, the second an IP. -assert.throws(() => { +common.expectsError(() => { net.Server().listen(invalidPort, '0.0.0.0', common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); diff --git a/test/parallel/test-require-invalid-package.js b/test/parallel/test-require-invalid-package.js index 606fabd0e2f73d..669ea54e52b442 100644 --- a/test/parallel/test-require-invalid-package.js +++ b/test/parallel/test-require-invalid-package.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // Should be an invalid package path. -assert.throws(() => require('package.json'), - common.expectsError({ code: 'MODULE_NOT_FOUND' }) +common.expectsError(() => require('package.json'), + { code: 'MODULE_NOT_FOUND' } ); diff --git a/test/parallel/test-stream-readable-with-unimplemented-_read.js b/test/parallel/test-stream-readable-with-unimplemented-_read.js index b644bd40674367..e9619a31e2f298 100644 --- a/test/parallel/test-stream-readable-with-unimplemented-_read.js +++ b/test/parallel/test-stream-readable-with-unimplemented-_read.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); const stream = require('stream'); -const assert = require('assert'); const readable = new stream.Readable(); -assert.throws(() => readable.read(), common.expectsError({ +common.expectsError(() => readable.read(), { code: 'ERR_STREAM_READ_NOT_IMPLEMENTED', type: Error, message: '_read() is not implemented' -})); +}); diff --git a/test/parallel/test-stream-unshift-read-race.js b/test/parallel/test-stream-unshift-read-race.js index a67147506e48c3..cfa90c7f2bff1c 100644 --- a/test/parallel/test-stream-unshift-read-race.js +++ b/test/parallel/test-stream-unshift-read-race.js @@ -68,13 +68,13 @@ r._read = function(n) { }; function pushError() { - assert.throws(function() { + common.expectsError(function() { r.push(Buffer.allocUnsafe(1)); - }, common.expectsError({ + }, { code: 'ERR_STREAM_PUSH_AFTER_EOF', type: Error, message: 'stream.push() after EOF' - })); + }); } @@ -86,13 +86,13 @@ w._write = function(chunk, encoding, cb) { }; r.on('end', common.mustCall(function() { - assert.throws(function() { + common.expectsError(function() { r.unshift(Buffer.allocUnsafe(1)); - }, common.expectsError({ + }, { code: 'ERR_STREAM_UNSHIFT_AFTER_END_EVENT', type: Error, message: 'stream.unshift() after end event' - })); + }); w.end(); })); diff --git a/test/parallel/test-timers-enroll-invalid-msecs.js b/test/parallel/test-timers-enroll-invalid-msecs.js index 0ecad0bd2a3191..df6ad04069910f 100644 --- a/test/parallel/test-timers-enroll-invalid-msecs.js +++ b/test/parallel/test-timers-enroll-invalid-msecs.js @@ -2,7 +2,6 @@ const common = require('../common'); const timers = require('timers'); -const assert = require('assert'); [ {}, @@ -11,12 +10,12 @@ const assert = require('assert'); () => { }, Symbol('foo') ].forEach((val) => { - assert.throws( + common.expectsError( () => timers.enroll({}, val), - common.expectsError({ + { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - }) + } ); }); @@ -25,13 +24,13 @@ const assert = require('assert'); Infinity, NaN ].forEach((val) => { - assert.throws( + common.expectsError( () => timers.enroll({}, val), - common.expectsError({ + { code: 'ERR_VALUE_OUT_OF_RANGE', type: RangeError, message: 'The value of "msecs" must be a non-negative ' + `finite number. Received "${val}"` - }) + } ); }); diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index 2af42346b8381c..e747f5a5162db5 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -22,12 +22,12 @@ assert.throws(() => tls.createServer({ key: 'dummykey', passphrase: 1 }), assert.throws(() => tls.createServer({ ecdhCurve: 1 }), /TypeError: ECDH curve name must be a string/); -assert.throws(() => tls.createServer({ handshakeTimeout: 'abcd' }), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "timeout" argument must be of type number' - }) +common.expectsError(() => tls.createServer({ handshakeTimeout: 'abcd' }), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "timeout" argument must be of type number' + } ); assert.throws(() => tls.createServer({ sessionTimeout: 'abcd' }), diff --git a/test/parallel/test-tls-clientcertengine-invalid-arg-type.js b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js index 35915bbde3e98f..b91e0f35c4c384 100644 --- a/test/parallel/test-tls-clientcertengine-invalid-arg-type.js +++ b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js @@ -4,12 +4,11 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const assert = require('assert'); const tls = require('tls'); { - assert.throws( + common.expectsError( () => { tls.createSecureContext({ clientCertEngine: 0 }); }, - common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', - message: / Received type number$/ })); + { code: 'ERR_INVALID_ARG_TYPE', + message: / Received type number$/ }); } diff --git a/test/parallel/test-tls-clientcertengine-unsupported.js b/test/parallel/test-tls-clientcertengine-unsupported.js index aaa31b96303240..0209a51fc78d31 100644 --- a/test/parallel/test-tls-clientcertengine-unsupported.js +++ b/test/parallel/test-tls-clientcertengine-unsupported.js @@ -14,15 +14,14 @@ binding.SecureContext = function() { return rv; }; -const assert = require('assert'); const tls = require('tls'); { - assert.throws( + common.expectsError( () => { tls.createSecureContext({ clientCertEngine: 'Cannonmouth' }); }, - common.expectsError({ + { code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', message: 'Custom engines not supported by this OpenSSL' - }) + } ); } diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index e5461d2291cf57..c6ad117831e5a6 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -39,12 +39,12 @@ tls.createServer(assert.fail) tls.createServer({}) .listen(0, common.mustCall(close)); -assert.throws(() => tls.createServer('this is not valid'), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "options" argument must be of type Object' - }) +common.expectsError(() => tls.createServer('this is not valid'), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "options" argument must be of type Object' + } ); tls.createServer() diff --git a/test/parallel/test-tls-options-boolean-check.js b/test/parallel/test-tls-options-boolean-check.js index e866f5a0692d54..d77f66c6885c97 100644 --- a/test/parallel/test-tls-options-boolean-check.js +++ b/test/parallel/test-tls-options-boolean-check.js @@ -98,13 +98,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] ].map(([key, cert, message]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message - })); + }); }); // Checks to ensure tls.createServer works with the CA parameter @@ -132,13 +132,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map(([key, cert, ca]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert, ca }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); // Checks to ensure tls.createServer throws an error for CA assignment @@ -150,13 +150,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map(([key, cert, ca]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert, ca }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); // Checks to ensure tls.createSecureContext works with false-y input diff --git a/test/parallel/test-util-callbackify.js b/test/parallel/test-util-callbackify.js index 84b439e43f0702..bc2154940cb405 100644 --- a/test/parallel/test-util-callbackify.js +++ b/test/parallel/test-util-callbackify.js @@ -229,13 +229,13 @@ const values = [ { // Verify that non-function inputs throw. ['foo', null, undefined, false, 0, {}, Symbol(), []].forEach((value) => { - assert.throws(() => { + common.expectsError(() => { callbackify(value); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "original" argument must be of type Function' - })); + }); }); } @@ -250,12 +250,12 @@ const values = [ // Verify that the last argument to the callbackified function is a function. ['foo', null, undefined, false, 0, {}, Symbol(), []].forEach((value) => { args.push(value); - assert.throws(() => { + common.expectsError(() => { cb(...args); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The last argument must be of type Function' - })); + }); }); } diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js index f05135ec78cddc..9c610e380041ac 100644 --- a/test/parallel/test-util-inherits.js +++ b/test/parallel/test-util-inherits.js @@ -80,22 +80,22 @@ assert.strictEqual(e.e(), 'e'); assert.strictEqual(e.constructor, E); // should throw with invalid arguments -assert.throws(function() { +common.expectsError(function() { inherits(A, {}); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "superCtor.prototype" property must be of type Function' -}) +} ); assert.throws(function() { inherits(A, null); }, errCheck); -assert.throws(function() { +common.expectsError(function() { inherits(null, A); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "ctor" argument must be of type Function' -}) +} ); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 896c74ad96747e..3dd79682cf3596 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1137,22 +1137,22 @@ if (typeof Symbol !== 'undefined') { JSON.stringify(oldOptions) ); - assert.throws(() => { + common.expectsError(() => { util.inspect.defaultOptions = null; - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options" argument must be of type Object' - }) + } ); - assert.throws(() => { + common.expectsError(() => { util.inspect.defaultOptions = 'bad'; - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options" argument must be of type Object' - }) + } ); } diff --git a/test/parallel/test-whatwg-encoding-textdecoder.js b/test/parallel/test-whatwg-encoding-textdecoder.js index 55c601364d0add..c4f919289adf2f 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -52,12 +52,13 @@ assert(TextDecoder); if (common.hasIntl) { ['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => { const dec = new TextDecoder(i, { fatal: true }); - assert.throws(() => dec.decode(buf.slice(0, 8)), - common.expectsError({ - code: 'ERR_ENCODING_INVALID_ENCODED_DATA', - type: TypeError, - message: 'The encoded data was not valid for encoding utf-8' - })); + common.expectsError(() => dec.decode(buf.slice(0, 8)), + { + code: 'ERR_ENCODING_INVALID_ENCODED_DATA', + type: TypeError, + message: 'The encoded data was not valid ' + + 'for encoding utf-8' + }); }); ['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => { @@ -66,13 +67,13 @@ if (common.hasIntl) { assert.doesNotThrow(() => dec.decode(buf.slice(8))); }); } else { - assert.throws( + common.expectsError( () => new TextDecoder('utf-8', { fatal: true }), - common.expectsError({ + { code: 'ERR_NO_ICU', type: TypeError, message: '"fatal" option is not supported on Node.js compiled without ICU' - })); + }); } // Test TextDecoder, UTF-16le @@ -96,12 +97,12 @@ if (common.hasIntl) { }); [{}, [], true, 1, '', new TextEncoder()].forEach((i) => { - assert.throws(() => fn.call(i, Infinity, {}), - common.expectsError({ - code: 'ERR_INVALID_THIS', - type: TypeError, - message: 'Value of "this" must be of type TextDecoder' - })); + common.expectsError(() => fn.call(i, Infinity, {}), + { + code: 'ERR_INVALID_THIS', + type: TypeError, + message: 'Value of "this" must be of type TextDecoder' + }); }); } diff --git a/test/parallel/test-whatwg-encoding-textencoder.js b/test/parallel/test-whatwg-encoding-textencoder.js index 2e8ca9e9abafd1..fba5445c81941c 100644 --- a/test/parallel/test-whatwg-encoding-textencoder.js +++ b/test/parallel/test-whatwg-encoding-textencoder.js @@ -41,11 +41,11 @@ assert(TextEncoder); }); [{}, [], true, 1, '', new TextDecoder()].forEach((i) => { - assert.throws(() => fn.call(i, Infinity, {}), - common.expectsError({ - code: 'ERR_INVALID_THIS', - type: TypeError, - message: 'Value of "this" must be of type TextEncoder' - })); + common.expectsError(() => fn.call(i, Infinity, {}), + { + code: 'ERR_INVALID_THIS', + type: TypeError, + message: 'Value of "this" must be of type TextEncoder' + }); }); } diff --git a/test/parallel/test-whatwg-url-searchparams-append.js b/test/parallel/test-whatwg-url-searchparams-append.js index fc9f5bd75d160b..03e7205fb2cb51 100644 --- a/test/parallel/test-whatwg-url-searchparams-append.js +++ b/test/parallel/test-whatwg-url-searchparams-append.js @@ -52,20 +52,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.append.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.append('a'); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" and "value" arguments must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-delete.js b/test/parallel/test-whatwg-url-searchparams-delete.js index 2969f51a731c58..042ecb5d889beb 100644 --- a/test/parallel/test-whatwg-url-searchparams-delete.js +++ b/test/parallel/test-whatwg-url-searchparams-delete.js @@ -62,20 +62,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.delete.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.delete(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-entries.js b/test/parallel/test-whatwg-url-searchparams-entries.js index 1dfcdb0338dffb..fc3086545870ee 100644 --- a/test/parallel/test-whatwg-url-searchparams-entries.js +++ b/test/parallel/test-whatwg-url-searchparams-entries.js @@ -26,17 +26,17 @@ assert.deepStrictEqual(entries.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { entries.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.entries.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); diff --git a/test/parallel/test-whatwg-url-searchparams-foreach.js b/test/parallel/test-whatwg-url-searchparams-foreach.js index 0147418ff21f07..53c35da263f5ab 100644 --- a/test/parallel/test-whatwg-url-searchparams-foreach.js +++ b/test/parallel/test-whatwg-url-searchparams-foreach.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const { URL, URLSearchParams } = require('url'); const { test, assert_array_equals, assert_unreached } = require('../common/wpt'); @@ -50,11 +49,11 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.forEach.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); + }); } diff --git a/test/parallel/test-whatwg-url-searchparams-get.js b/test/parallel/test-whatwg-url-searchparams-get.js index 2e7d22c998bf02..e14bdc7e74fc8d 100644 --- a/test/parallel/test-whatwg-url-searchparams-get.js +++ b/test/parallel/test-whatwg-url-searchparams-get.js @@ -37,20 +37,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.get.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.get(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-getall.js b/test/parallel/test-whatwg-url-searchparams-getall.js index 3a8bf347ff1f3f..a4692c22f1b21d 100644 --- a/test/parallel/test-whatwg-url-searchparams-getall.js +++ b/test/parallel/test-whatwg-url-searchparams-getall.js @@ -42,20 +42,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.getAll.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.getAll(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-has.js b/test/parallel/test-whatwg-url-searchparams-has.js index dcdf585dcdf76d..47c6b6f7bae98f 100644 --- a/test/parallel/test-whatwg-url-searchparams-has.js +++ b/test/parallel/test-whatwg-url-searchparams-has.js @@ -40,20 +40,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.has.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.has(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-keys.js b/test/parallel/test-whatwg-url-searchparams-keys.js index cbf0766bc2e6c4..e4428eb3e98f6b 100644 --- a/test/parallel/test-whatwg-url-searchparams-keys.js +++ b/test/parallel/test-whatwg-url-searchparams-keys.js @@ -27,17 +27,17 @@ assert.deepStrictEqual(keys.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { keys.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.keys.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); diff --git a/test/parallel/test-whatwg-url-searchparams-set.js b/test/parallel/test-whatwg-url-searchparams-set.js index 46414ff23aba14..1bca12e31bcc28 100644 --- a/test/parallel/test-whatwg-url-searchparams-set.js +++ b/test/parallel/test-whatwg-url-searchparams-set.js @@ -38,20 +38,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.set.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.set('a'); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" and "value" arguments must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-stringifier.js b/test/parallel/test-whatwg-url-searchparams-stringifier.js index e2f73d262e590b..e3bfbdcf1982d8 100644 --- a/test/parallel/test-whatwg-url-searchparams-stringifier.js +++ b/test/parallel/test-whatwg-url-searchparams-stringifier.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals } = require('../common/wpt'); @@ -126,11 +125,11 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.toString.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); + }); } diff --git a/test/parallel/test-whatwg-url-searchparams-values.js b/test/parallel/test-whatwg-url-searchparams-values.js index 96f1a0fddbfb9f..e44b7f5e11267d 100644 --- a/test/parallel/test-whatwg-url-searchparams-values.js +++ b/test/parallel/test-whatwg-url-searchparams-values.js @@ -27,17 +27,17 @@ assert.deepStrictEqual(values.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { values.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.values.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); From 28b2d8ac20f2bc67284bd555d2164136899e2e63 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 14:07:52 +0530 Subject: [PATCH 339/379] test: use common.expectsError in tests PR-URL: https://github.com/nodejs/node/pull/17484 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss --- test/parallel/test-buffer-slow.js | 6 +++--- test/parallel/test-buffer-tostring-range.js | 12 ++++++------ test/parallel/test-child-process-send-type-error.js | 4 ++-- .../test-child-process-spawnsync-kill-signal.js | 4 ++-- test/parallel/test-child-process-stdio.js | 4 ++-- test/parallel/test-child-process-validate-stdio.js | 5 +++-- test/parallel/test-common.js | 6 +++--- test/parallel/test-console-instance.js | 6 +++--- test/parallel/test-dgram-bind.js | 6 +++--- test/parallel/test-dgram-create-socket-handle.js | 6 +++--- 10 files changed, 30 insertions(+), 29 deletions(-) diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 8889d8d77de135..e41dd1dd0fd3a0 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -58,13 +58,13 @@ const bufferMaxSizeMsg = common.expectsError({ assert.throws(function() { SlowBuffer(Infinity); }, bufferMaxSizeMsg); -assert.throws(function() { +common.expectsError(function() { SlowBuffer(-1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_OPT_VALUE', type: RangeError, message: 'The value "-1" is invalid for option "size"' -})); +}); assert.throws(function() { SlowBuffer(buffer.kMaxLength + 1); diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js index 0fba12fabfdef5..f6ee846dd8ef34 100644 --- a/test/parallel/test-buffer-tostring-range.js +++ b/test/parallel/test-buffer-tostring-range.js @@ -84,17 +84,17 @@ assert.strictEqual(rangeBuffer.toString({ toString: function() { } }), 'abc'); // try toString() with 0 and null as the encoding -assert.throws(() => { +common.expectsError(() => { rangeBuffer.toString(0, 1, 2); -}, common.expectsError({ +}, { code: 'ERR_UNKNOWN_ENCODING', type: TypeError, message: 'Unknown encoding: 0' -})); -assert.throws(() => { +}); +common.expectsError(() => { rangeBuffer.toString(null, 1, 2); -}, common.expectsError({ +}, { code: 'ERR_UNKNOWN_ENCODING', type: TypeError, message: 'Unknown encoding: null' -})); +}); diff --git a/test/parallel/test-child-process-send-type-error.js b/test/parallel/test-child-process-send-type-error.js index 29dd45f6bdd7ee..9c3a502a49a257 100644 --- a/test/parallel/test-child-process-send-type-error.js +++ b/test/parallel/test-child-process-send-type-error.js @@ -5,9 +5,9 @@ const assert = require('assert'); const cp = require('child_process'); function fail(proc, args) { - assert.throws(() => { + common.expectsError(() => { proc.send.apply(proc, args); - }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError }); } let target = process; diff --git a/test/parallel/test-child-process-spawnsync-kill-signal.js b/test/parallel/test-child-process-spawnsync-kill-signal.js index c9f601a0caff78..90222e04c97c9e 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -29,9 +29,9 @@ if (process.argv[2] === 'child') { } // Verify that an error is thrown for unknown signals. - assert.throws(() => { + common.expectsError(() => { spawn('SIG_NOT_A_REAL_SIGNAL'); - }, common.expectsError({ code: 'ERR_UNKNOWN_SIGNAL', type: TypeError })); + }, { code: 'ERR_UNKNOWN_SIGNAL', type: TypeError }); // Verify that the default kill signal is SIGTERM. { diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index f1d18d437fd458..8624a13e1beace 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -40,6 +40,6 @@ options = { stdio: 'ignore' }; child = spawnSync('cat', [], options); assert.deepStrictEqual(options, { stdio: 'ignore' }); -assert.throws(() => { +common.expectsError(() => { common.spawnPwd({ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'ipc'] }); -}, common.expectsError({ code: 'ERR_IPC_ONE_PIPE', type: Error })); +}, { code: 'ERR_IPC_ONE_PIPE', type: Error }); diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 129ca9822afcd5..4c4f137110b67e 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -26,8 +26,9 @@ assert.throws(() => _validateStdio(600), expectedError); // should throw if stdio has ipc and sync is true const stdio2 = ['ipc', 'ipc', 'ipc']; -assert.throws(() => _validateStdio(stdio2, true), - common.expectsError({ code: 'ERR_IPC_SYNC_FORK', type: Error })); +common.expectsError(() => _validateStdio(stdio2, true), + { code: 'ERR_IPC_SYNC_FORK', type: Error } +); { const stdio3 = [process.stdin, process.stdout, process.stderr]; diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js index 7a73f93ae0f926..7a89b37660d5f6 100644 --- a/test/parallel/test-common.js +++ b/test/parallel/test-common.js @@ -45,12 +45,12 @@ assert.throws(function() { }, /^TypeError: Invalid minimum value: \/foo\/$/); // assert.fail() tests -assert.throws( +common.expectsError( () => { assert.fail('fhqwhgads'); }, - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^fhqwhgads$/ - })); + }); const fnOnce = common.mustCall(() => {}); fnOnce(); diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 20ac2ceb72a36c..9f31ebf3afcb58 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -37,13 +37,13 @@ assert.strictEqual('function', typeof Console); // make sure that the Console constructor throws // when not given a writable stream instance -assert.throws( +common.expectsError( () => { new Console(); }, - common.expectsError({ + { code: 'ERR_CONSOLE_WRITABLE_STREAM', type: TypeError, message: /stdout/ - }) + } ); // Console constructor should throw if stderr exists but is not writable diff --git a/test/parallel/test-dgram-bind.js b/test/parallel/test-dgram-bind.js index 4e293a8021c160..0b8447c3115da1 100644 --- a/test/parallel/test-dgram-bind.js +++ b/test/parallel/test-dgram-bind.js @@ -27,13 +27,13 @@ const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); socket.on('listening', common.mustCall(() => { - assert.throws(() => { + common.expectsError(() => { socket.bind(); - }, common.expectsError({ + }, { code: 'ERR_SOCKET_ALREADY_BOUND', type: Error, message: /^Socket is already bound$/ - })); + }); socket.close(); })); diff --git a/test/parallel/test-dgram-create-socket-handle.js b/test/parallel/test-dgram-create-socket-handle.js index a593324de85418..57480f7d2cfaa6 100644 --- a/test/parallel/test-dgram-create-socket-handle.js +++ b/test/parallel/test-dgram-create-socket-handle.js @@ -6,12 +6,12 @@ const UDP = process.binding('udp_wrap').UDP; const _createSocketHandle = dgram._createSocketHandle; // Throws if an "existing fd" is passed in. -assert.throws(() => { +common.expectsError(() => { _createSocketHandle(common.localhostIPv4, 0, 'udp4', 42); -}, common.expectsError({ +}, { code: 'ERR_ASSERTION', message: /^false == true$/ -})); +}); { // Create a handle that is not bound. From ff59d3a30e05addb4ad50c5e10697821752980bd Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 13:40:46 +0530 Subject: [PATCH 340/379] test: replace assert.throws w/ common.expectsError PR-URL: https://github.com/nodejs/node/pull/17483 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: James M Snell --- ...t-async-hooks-asyncresource-constructor.js | 25 ++++++++-------- test/parallel/test-async-wrap-constructor.js | 7 ++--- test/parallel/test-buffer-alloc.js | 14 +++++---- test/parallel/test-buffer-arraybuffer.js | 28 +++++++++--------- test/parallel/test-buffer-compare-offset.js | 4 +-- test/parallel/test-buffer-compare.js | 4 +-- test/parallel/test-buffer-concat.js | 6 ++-- test/parallel/test-buffer-fill.js | 29 ++++++++++--------- test/parallel/test-buffer-new.js | 5 ++-- test/parallel/test-buffer-read.js | 6 ++-- 10 files changed, 66 insertions(+), 62 deletions(-) diff --git a/test/parallel/test-async-hooks-asyncresource-constructor.js b/test/parallel/test-async-hooks-asyncresource-constructor.js index ba6c1166bf6bd8..ebd5a4cf646bfd 100644 --- a/test/parallel/test-async-hooks-asyncresource-constructor.js +++ b/test/parallel/test-async-hooks-asyncresource-constructor.js @@ -3,7 +3,6 @@ // This tests that AsyncResource throws an error if bad parameters are passed const common = require('../common'); -const assert = require('assert'); const async_hooks = require('async_hooks'); const { AsyncResource } = async_hooks; @@ -12,30 +11,30 @@ async_hooks.createHook({ init() {} }).enable(); -assert.throws(() => { +common.expectsError(() => { return new AsyncResource(); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, -})); +}); -assert.throws(() => { +common.expectsError(() => { new AsyncResource(''); -}, common.expectsError({ +}, { code: 'ERR_ASYNC_TYPE', type: TypeError, -})); +}); -assert.throws(() => { +common.expectsError(() => { new AsyncResource('type', -4); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ASYNC_ID', type: RangeError, -})); +}); -assert.throws(() => { +common.expectsError(() => { new AsyncResource('type', Math.PI); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ASYNC_ID', type: RangeError, -})); +}); diff --git a/test/parallel/test-async-wrap-constructor.js b/test/parallel/test-async-wrap-constructor.js index 5fdf9e4fdf884e..6b1764337128b9 100644 --- a/test/parallel/test-async-wrap-constructor.js +++ b/test/parallel/test-async-wrap-constructor.js @@ -3,17 +3,16 @@ // This tests that using falsy values in createHook throws an error. const common = require('../common'); -const assert = require('assert'); const async_hooks = require('async_hooks'); for (const badArg of [0, 1, false, true, null, 'hello']) { const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve']; for (const field of hookNames) { - assert.throws(() => { + common.expectsError(() => { async_hooks.createHook({ [field]: badArg }); - }, common.expectsError({ + }, { code: 'ERR_ASYNC_CALLBACK', type: TypeError, - })); + }); } } diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 73dfce3624d9f8..85e0b3614bf435 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -887,12 +887,14 @@ assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), RangeError); } // Regression test for #5482: should throw but not assert in C++ land. -assert.throws(() => Buffer.from('', 'buffer'), - common.expectsError({ - code: 'ERR_UNKNOWN_ENCODING', - type: TypeError, - message: 'Unknown encoding: buffer' - })); +common.expectsError( + () => Buffer.from('', 'buffer'), + { + code: 'ERR_UNKNOWN_ENCODING', + type: TypeError, + message: 'Unknown encoding: buffer' + } +); // Regression test for #6111. Constructing a buffer from another buffer // should a) work, and b) not corrupt the source buffer. diff --git a/test/parallel/test-buffer-arraybuffer.js b/test/parallel/test-buffer-arraybuffer.js index ac1294ec8bac9f..5ecf0279e02c88 100644 --- a/test/parallel/test-buffer-arraybuffer.js +++ b/test/parallel/test-buffer-arraybuffer.js @@ -65,16 +65,16 @@ b.writeDoubleBE(11.11, 0, true); buf[0] = 9; assert.strictEqual(ab[1], 9); - assert.throws(() => Buffer.from(ab.buffer, 6), common.expectsError({ + common.expectsError(() => Buffer.from(ab.buffer, 6), { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"offset" is outside of buffer bounds' - })); - assert.throws(() => Buffer.from(ab.buffer, 3, 6), common.expectsError({ + }); + common.expectsError(() => Buffer.from(ab.buffer, 3, 6), { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"length" is outside of buffer bounds' - })); + }); } // Test the deprecated Buffer() version also @@ -93,16 +93,16 @@ b.writeDoubleBE(11.11, 0, true); buf[0] = 9; assert.strictEqual(ab[1], 9); - assert.throws(() => Buffer(ab.buffer, 6), common.expectsError({ + common.expectsError(() => Buffer(ab.buffer, 6), { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"offset" is outside of buffer bounds' - })); - assert.throws(() => Buffer(ab.buffer, 3, 6), common.expectsError({ + }); + common.expectsError(() => Buffer(ab.buffer, 3, 6), { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"length" is outside of buffer bounds' - })); + }); } { @@ -118,13 +118,13 @@ b.writeDoubleBE(11.11, 0, true); assert.deepStrictEqual(Buffer.from(ab, [1]), Buffer.from(ab, 1)); // If byteOffset is Infinity, throw. - assert.throws(() => { + common.expectsError(() => { Buffer.from(ab, Infinity); - }, common.expectsError({ + }, { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"offset" is outside of buffer bounds' - })); + }); } { @@ -140,11 +140,11 @@ b.writeDoubleBE(11.11, 0, true); assert.deepStrictEqual(Buffer.from(ab, 0, [1]), Buffer.from(ab, 0, 1)); //If length is Infinity, throw. - assert.throws(() => { + common.expectsError(() => { Buffer.from(ab, 0, Infinity); - }, common.expectsError({ + }, { code: 'ERR_BUFFER_OUT_OF_BOUNDS', type: RangeError, message: '"length" is outside of buffer bounds' - })); + }); } diff --git a/test/parallel/test-buffer-compare-offset.js b/test/parallel/test-buffer-compare-offset.js index 75cd9bed3d78bb..7f3121bef17ab5 100644 --- a/test/parallel/test-buffer-compare-offset.js +++ b/test/parallel/test-buffer-compare-offset.js @@ -66,9 +66,9 @@ assert.throws(() => a.compare(b, 0, '0xff'), oor); assert.throws(() => a.compare(b, 0, Infinity), oor); assert.throws(() => a.compare(b, 0, 1, -1), oor); assert.throws(() => a.compare(b, -Infinity, Infinity), oor); -assert.throws(() => a.compare(), common.expectsError({ +common.expectsError(() => a.compare(), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "target" argument must be one of ' + 'type Buffer or Uint8Array. Received type undefined' -})); +}); diff --git a/test/parallel/test-buffer-compare.js b/test/parallel/test-buffer-compare.js index d404b36c64dc33..9ebd3a970b47d6 100644 --- a/test/parallel/test-buffer-compare.js +++ b/test/parallel/test-buffer-compare.js @@ -38,9 +38,9 @@ assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'), errMsg); assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)), errMsg); -assert.throws(() => Buffer.alloc(1).compare('abc'), common.expectsError({ +common.expectsError(() => Buffer.alloc(1).compare('abc'), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "target" argument must be one of ' + 'type Buffer or Uint8Array. Received type string' -})); +}); diff --git a/test/parallel/test-buffer-concat.js b/test/parallel/test-buffer-concat.js index 166d2eebb96962..fb290568309ee2 100644 --- a/test/parallel/test-buffer-concat.js +++ b/test/parallel/test-buffer-concat.js @@ -52,14 +52,14 @@ assertWrongList(['hello', 'world']); assertWrongList(['hello', Buffer.from('world')]); function assertWrongList(value) { - assert.throws(() => { + common.expectsError(() => { Buffer.concat(value); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "list" argument must be one of type ' + 'Array, Buffer, or Uint8Array' - })); + }); } // eslint-disable-next-line crypto-check diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index 681207e95ef382..e7d3d4afaf2fa5 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -303,12 +303,12 @@ function testBufs(string, offset, length, encoding) { } // Make sure these throw. -assert.throws( +common.expectsError( () => Buffer.allocUnsafe(8).fill('a', -1), - common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); -assert.throws( + { code: 'ERR_INDEX_OUT_OF_RANGE' }); +common.expectsError( () => Buffer.allocUnsafe(8).fill('a', 0, 9), - common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); + { code: 'ERR_INDEX_OUT_OF_RANGE' }); // Make sure this doesn't hang indefinitely. Buffer.allocUnsafe(8).fill(''); @@ -357,7 +357,7 @@ Buffer.alloc(8, ''); // magically mangled using Symbol.toPrimitive. { let elseWasLast = false; - assert.throws(() => { + common.expectsError(() => { let ctr = 0; const start = { [Symbol.toPrimitive]() { @@ -374,8 +374,9 @@ Buffer.alloc(8, ''); } }; Buffer.alloc(1).fill(Buffer.alloc(1), start, 1); - }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); + }, { + code: undefined, type: RangeError, message: 'Index out of range' + }); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); @@ -383,16 +384,17 @@ Buffer.alloc(8, ''); // Testing process.binding. Make sure "start" is properly checked for -1 wrap // around. -assert.throws(() => { +common.expectsError(() => { process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1); -}, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); +}, { + code: undefined, type: RangeError, message: 'Index out of range' +}); // Make sure "end" is properly checked, even if it's magically mangled using // Symbol.toPrimitive. { let elseWasLast = false; - assert.throws(() => { + common.expectsError(() => { let ctr = 0; const end = { [Symbol.toPrimitive]() { @@ -409,8 +411,9 @@ assert.throws(() => { } }; Buffer.alloc(1).fill(Buffer.alloc(1), 0, end); - }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); + }, { + code: undefined, type: RangeError, message: 'Index out of range' + }); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); diff --git a/test/parallel/test-buffer-new.js b/test/parallel/test-buffer-new.js index 1a07f82bad2d56..31b29dee5b0815 100644 --- a/test/parallel/test-buffer-new.js +++ b/test/parallel/test-buffer-new.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -assert.throws(() => new Buffer(42, 'utf8'), common.expectsError({ +common.expectsError(() => new Buffer(42, 'utf8'), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "string" argument must be of type string. Received type number' -})); +}); diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index b5bdbbb7a4b403..88f97db3097b6e 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -8,9 +8,11 @@ const buf = Buffer.from([0xa4, 0xfd, 0x48, 0xea, 0xcf, 0xff, 0xd9, 0x01, 0xde]); function read(buff, funx, args, expected) { assert.strictEqual(buff[funx](...args), expected); - assert.throws( + common.expectsError( () => buff[funx](-1), - common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }) + { + code: 'ERR_INDEX_OUT_OF_RANGE' + } ); assert.doesNotThrow( From 8a17b7b6f3c18e37dd5e8504de5013de36cdae07 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 06:11:29 -0800 Subject: [PATCH 341/379] doc: use correct and consistent typography for products Use `GitHub` rather than `Github` and `Node.js` rather than `Node.JS`. PR-URL: https://github.com/nodejs/node/pull/17492 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca --- COLLABORATOR_GUIDE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 9a4b5184b3a43e..358fd59476d2cc 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -89,7 +89,7 @@ change. In the case of pull requests proposed by an existing Collaborator, an additional Collaborator is required for sign-off. In some cases, it may be necessary to summon a qualified Collaborator -or a Github team to a pull request for review by @-mention. +or a GitHub team to a pull request for review by @-mention. [See "Who to CC in issues"](./doc/onboarding-extras.md#who-to-cc-in-issues) If you are unsure about the modification and are not prepared to take @@ -160,7 +160,7 @@ trivial changes that do not require being tested on all platforms. * [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/) uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run `npm install && npm test` on a large selection of common modules. This is useful to check whether a -change will cause breakage in the ecosystem. To test Node.JS ABI changes +change will cause breakage in the ecosystem. To test Node.js ABI changes you can run [`citgm-abi-smoker`](https://ci.nodejs.org/job/citgm-abi-smoker/). * [`node-stress-single-test`](https://ci.nodejs.org/job/node-stress-single-test/) @@ -408,7 +408,7 @@ Changes" section of the release notes. Collaborators may opt to elevate pull requests or issues to the [TSC][] for discussion by assigning the `tsc-review` label or @-mentioning the -`@nodejs/tsc` Github team. This should be done where a pull request: +`@nodejs/tsc` GitHub team. This should be done where a pull request: - is labeled `semver-major`, or - has a significant impact on the codebase, or From e57af5aadae85818de809af8d6db7241f1ebca2e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 06:14:53 -0800 Subject: [PATCH 342/379] tools: lint for additional strings in docs Check for uses of `Github` (rather than `GitHub`) and `Node.JS` (rather than `Node.js`) in markdown files. PR-URL: https://github.com/nodejs/node/pull/17492 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca --- tools/remark-preset-lint-node/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/remark-preset-lint-node/index.js b/tools/remark-preset-lint-node/index.js index c5aef12d539542..a59d5d78d8fff8 100644 --- a/tools/remark-preset-lint-node/index.js +++ b/tools/remark-preset-lint-node/index.js @@ -42,8 +42,10 @@ module.exports.plugins = [ [ require('remark-lint-prohibited-strings'), [ - { no: 'v8', yes: 'V8' }, - { no: 'Javascript', yes: 'JavaScript' } + { no: 'Github', yes: 'GitHub' }, + { no: 'Javascript', yes: 'JavaScript' }, + { no: 'Node.JS', yes: 'Node.js' }, + { no: 'v8', yes: 'V8' } ] ], [require('remark-lint-strong-marker'), '*'], From f3d619882e4017a3c34c61ff9d41408dfb913ac6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 6 Dec 2017 19:26:36 -0800 Subject: [PATCH 343/379] test: fix flaky test-benchmark-es Allow zero iterations for short benchmark in test. PR-URL: https://github.com/nodejs/node/pull/17516 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig --- test/parallel/test-benchmark-es.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-benchmark-es.js b/test/parallel/test-benchmark-es.js index 569edfc293c29c..8176ad0b07e9ac 100644 --- a/test/parallel/test-benchmark-es.js +++ b/test/parallel/test-benchmark-es.js @@ -15,4 +15,5 @@ runBenchmark('es', 'n=1', 'encoding=ascii', 'size=1e1' - ]); + ], + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); From 4bb27a2db34c38eea37d29c464945239446ae391 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 26 Nov 2017 14:41:56 +0000 Subject: [PATCH 344/379] build: add a `make help` option for common targets PR-URL: https://github.com/nodejs/node/pull/17323 Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Evan Lucas Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- Makefile | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 50fabae087dfaa..6f89255f4ba3ae 100644 --- a/Makefile +++ b/Makefile @@ -63,11 +63,17 @@ V ?= 1 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile # just the debug build, run `make -C out BUILDTYPE=Debug` instead. ifeq ($(BUILDTYPE),Release) -all: out/Makefile $(NODE_EXE) +all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node. else all: out/Makefile $(NODE_EXE) $(NODE_G_EXE) endif +# To add a target to the help, add a double comment (##) on the target line. +help: ## Print help for targets with comments. + @printf "For more targets and info see the comments in the Makefile.\n\n" + @grep -E '^[a-zA-Z0-9._-]+:.*?## .*$$' Makefile | sort | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' + # The .PHONY is needed to ensure that we recursively use the out/Makefile # to check for changes. .PHONY: $(NODE_EXE) $(NODE_G_EXE) @@ -94,13 +100,13 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ config.gypi: configure $(error Missing or stale $@, please run ./$<) -install: all +install: all ## Installs node into $PREFIX (default=/usr/local). $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' -uninstall: +uninstall: ## Uninstalls node from $PREFIX (default=/usr/local). $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' -clean: +clean: ## Remove build artifacts. $(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \ out/$(BUILDTYPE)/node.exp @if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi @@ -145,7 +151,7 @@ coverage-clean: # For C++ coverage reporting, this needs to be run in conjunction with configure # --coverage. html coverage reports will be created under coverage/ -coverage: coverage-test +coverage: coverage-test ## Run the tests and generate a coverage report. coverage-build: all mkdir -p node_modules @@ -205,7 +211,7 @@ v8: tools/make-v8.sh $(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) -test: all +test: all ## Default test target. Runs default tests, linters, and builds docs. $(MAKE) -s build-addons $(MAKE) -s build-addons-napi $(MAKE) -s doc-only @@ -373,7 +379,7 @@ test-build: | all build-addons build-addons-napi test-build-addons-napi: all build-addons-napi -test-all: test-build test/gc/build/Release/binding.node +test-all: test-build test/gc/build/Release/binding.node ## Run everything in test/. $(PYTHON) tools/test.py --mode=debug,release test-all-valgrind: test-build @@ -452,7 +458,7 @@ test-doc: doc-only test-known-issues: all $(PYTHON) tools/test.py known_issues -test-npm: $(NODE_EXE) +test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm. $(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test-node test-npm-publish: $(NODE_EXE) @@ -494,7 +500,7 @@ test-with-async-hooks: ifneq ("","$(wildcard deps/v8/tools/run-tests.py)") -test-v8: v8 +test-v8: v8 ## Runs the V8 test suite on deps/v8. # note: performs full test unless QUICKCHECK is specified deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \ --mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \ @@ -860,7 +866,7 @@ ifeq ($(XZ), 0) endif $(RM) $(TARNAME).tar -tar: $(TARBALL) +tar: $(TARBALL) ## Create a source tarball. tar-upload: tar ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -896,7 +902,7 @@ ifeq ($(XZ), 0) endif $(RM) $(TARNAME)-headers.tar -tar-headers: $(TARBALL)-headers +tar-headers: $(TARBALL)-headers ## Build the node header tarball. tar-headers-upload: tar-headers ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -933,7 +939,7 @@ ifeq ($(XZ), 0) endif $(RM) $(BINARYNAME).tar -binary: $(BINARYTAR) +binary: $(BINARYTAR) ## Build release binary tarballs. binary-upload: binary ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -984,7 +990,7 @@ bench-dgram: all bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench-dgram bench-util -bench: bench-net bench-http bench-fs bench-tls +bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks. bench-ci: bench @@ -1110,7 +1116,7 @@ cpplint: lint-cpp @echo "Please use lint-cpp instead of cpplint" ifneq ("","$(wildcard tools/eslint/)") -lint: +lint: ## Run JS, C++, MD and doc linters. @EXIT_STATUS=0 ; \ $(MAKE) lint-js || EXIT_STATUS=$$? ; \ $(MAKE) lint-cpp || EXIT_STATUS=$$? ; \ @@ -1176,6 +1182,7 @@ lint-clean: docclean \ docopen \ dynamiclib \ + help \ install \ install-bin \ install-includes \ From fb3ea4c4dcda0e16c3c1930dfa4726ca59200b3a Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 7 Dec 2017 23:55:23 +0100 Subject: [PATCH 345/379] src: fix missing handlescope bug in inspector Fix a regression that was introduced in commit 5886e204f0 ("inspector: track async stacks when necessary") and that I overlooked during review: the persistent handle with the callback must be rematerialized *after* the `v8::HandleScope` is created, not before. Apparently `test/sequential/test-inspector-async-call-stack.js` has no test coverage for this scenario and I'm out of good ideas on how to create a concise and reliable test case. Fixes: https://github.com/nodejs/node/issues/17496 PR-URL: https://github.com/nodejs/node/pull/17539 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Khaidi Chu Reviewed-By: Timothy Gu --- src/inspector_agent.cc | 12 ++++++------ src/inspector_agent.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 48cc29324fbdbb..9677dca37b5939 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -30,6 +30,7 @@ using v8::HandleScope; using v8::Isolate; using v8::Local; using v8::Object; +using v8::Persistent; using v8::Value; using v8_inspector::StringBuffer; @@ -613,8 +614,7 @@ void Agent::RegisterAsyncHook(Isolate* isolate, void Agent::EnableAsyncHook() { if (!enable_async_hook_function_.IsEmpty()) { - Isolate* isolate = parent_env_->isolate(); - ToggleAsyncHook(isolate, enable_async_hook_function_.Get(isolate)); + ToggleAsyncHook(parent_env_->isolate(), enable_async_hook_function_); } else if (pending_disable_async_hook_) { CHECK(!pending_enable_async_hook_); pending_disable_async_hook_ = false; @@ -625,8 +625,7 @@ void Agent::EnableAsyncHook() { void Agent::DisableAsyncHook() { if (!disable_async_hook_function_.IsEmpty()) { - Isolate* isolate = parent_env_->isolate(); - ToggleAsyncHook(isolate, disable_async_hook_function_.Get(isolate)); + ToggleAsyncHook(parent_env_->isolate(), disable_async_hook_function_); } else if (pending_enable_async_hook_) { CHECK(!pending_disable_async_hook_); pending_enable_async_hook_ = false; @@ -635,10 +634,11 @@ void Agent::DisableAsyncHook() { } } -void Agent::ToggleAsyncHook(Isolate* isolate, Local fn) { +void Agent::ToggleAsyncHook(Isolate* isolate, const Persistent& fn) { HandleScope handle_scope(isolate); + CHECK(!fn.IsEmpty()); auto context = parent_env_->context(); - auto result = fn->Call(context, Undefined(isolate), 0, nullptr); + auto result = fn.Get(isolate)->Call(context, Undefined(isolate), 0, nullptr); if (result.IsEmpty()) { FatalError( "node::inspector::Agent::ToggleAsyncHook", diff --git a/src/inspector_agent.h b/src/inspector_agent.h index 7211f5a2a49a95..29b9546b514aea 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -96,7 +96,8 @@ class Agent { void DisableAsyncHook(); private: - void ToggleAsyncHook(v8::Isolate* isolate, v8::Local fn); + void ToggleAsyncHook(v8::Isolate* isolate, + const v8::Persistent& fn); node::Environment* parent_env_; std::unique_ptr client_; From 1eff647fd396104680d1d86be5c2be807446db57 Mon Sep 17 00:00:00 2001 From: Cameron Moorehead Date: Mon, 27 Nov 2017 18:01:56 -0800 Subject: [PATCH 346/379] doc: 'constructor' implies use of new keyword The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: https://github.com/nodejs/node/pull/17364 Reviewed-By: Anna Henningsen Reviewed-By: Jon Moss Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu --- doc/api/modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 8ca81cbda2f42f..4ecdf826a23820 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -41,9 +41,9 @@ or object). Below, `bar.js` makes use of the `square` module, which exports a constructor: ```js -const square = require('./square.js'); -const mySquare = square(2); -console.log(`The area of my square is ${mySquare.area()}`); +const Square = require('./square.js'); +const mySquare = new Square(2); +console.log(`The area of mySquare is ${mySquare.area()}`); ``` The `square` module is defined in `square.js`: From 70cfe687ca4fd97a5de285fb43b8ee192c84cde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Wed, 6 Dec 2017 00:10:14 -0500 Subject: [PATCH 347/379] tools: replace space with \b in regex PR-URL: https://github.com/nodejs/node/pull/17479 Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- tools/doc/html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 1c44c5f7d3c239..f2d3fcdbba6860 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -416,7 +416,7 @@ const BSD_ONLY_SYSCALLS = new Set(['lchmod']); // 'open(2)' function linkManPages(text) { return text.replace( - / ([a-z.]+)\((\d)([a-z]?)\)/gm, + /\b([a-z.]+)\((\d)([a-z]?)\)/gm, (match, name, number, optionalCharacter) => { // name consists of lowercase letters, number is a single digit const displayAs = `${name}(${number}${optionalCharacter})`; From 6576382eaa3e0c27990d0fa337e2e526e5c0b49a Mon Sep 17 00:00:00 2001 From: TomerOmri Date: Wed, 6 Dec 2017 21:13:37 +0200 Subject: [PATCH 348/379] test: update test-http-should-keep-alive to use countdown PR-URL: https://github.com/nodejs/node/pull/17505 Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss --- test/parallel/test-http-should-keep-alive.js | 28 ++++++++------------ 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index dd4709d6946a84..038af47ee4db97 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -24,6 +24,7 @@ require('../common'); const assert = require('assert'); const http = require('http'); const net = require('net'); +const Countdown = require('../common/countdown'); const SERVER_RESPONSES = [ 'HTTP/1.0 200 ok\r\nContent-Length: 0\r\n\r\n', @@ -41,34 +42,27 @@ const SHOULD_KEEP_ALIVE = [ true, // HTTP/1.1, Connection: keep-alive false // HTTP/1.1, Connection: close ]; -let requests = 0; -let responses = 0; http.globalAgent.maxSockets = 5; +const countdown = new Countdown(SHOULD_KEEP_ALIVE.length, () => server.close()); + +const getCountdownIndex = () => SERVER_RESPONSES.length - countdown.remaining; + const server = net.createServer(function(socket) { - socket.write(SERVER_RESPONSES[requests]); - ++requests; + socket.write(SERVER_RESPONSES[getCountdownIndex()]); }).listen(0, function() { function makeRequest() { const req = http.get({ port: server.address().port }, function(res) { assert.strictEqual( - req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], - `${SERVER_RESPONSES[responses]} should ${ - SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); - ++responses; - if (responses < SHOULD_KEEP_ALIVE.length) { + req.shouldKeepAlive, SHOULD_KEEP_ALIVE[getCountdownIndex()], + `${SERVER_RESPONSES[getCountdownIndex()]} should ${ + SHOULD_KEEP_ALIVE[getCountdownIndex()] ? '' : 'not '}Keep-Alive`); + countdown.dec(); + if (countdown.remaining) { makeRequest(); - } else { - server.close(); } res.resume(); }); } - makeRequest(); }); - -process.on('exit', function() { - assert.strictEqual(requests, SERVER_RESPONSES.length); - assert.strictEqual(responses, SHOULD_KEEP_ALIVE.length); -}); From 8383c348b831d511abcc6294851cbd52b9632d59 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Wed, 6 Dec 2017 15:09:07 -0600 Subject: [PATCH 349/379] util: fix negative 0 check in inspect PR-URL: https://github.com/nodejs/node/pull/17507 Reviewed-By: Refael Ackermann Reviewed-By: Anatoli Papirovski Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Khaidi Chu Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen --- lib/util.js | 6 ++---- test/parallel/test-util-inspect.js | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/util.js b/lib/util.js index 051f5f419fb1e7..175b9fea54f250 100644 --- a/lib/util.js +++ b/lib/util.js @@ -593,10 +593,8 @@ function formatValue(ctx, value, recurseTimes, ln) { } function formatNumber(fn, value) { - // Format -0 as '-0'. A `value === -0` check won't distinguish 0 from -0. - // Using a division check is currently faster than `Object.is(value, -0)` - // as of V8 6.1. - if (1 / value === -Infinity) + // Format -0 as '-0'. Checking `value === -0` won't distinguish 0 from -0. + if (Object.is(value, -0)) return fn('-0', 'number'); return fn(`${value}`, 'number'); } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 3dd79682cf3596..d64888306719db 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -416,6 +416,8 @@ assert.strictEqual( // test positive/negative zero assert.strictEqual(util.inspect(0), '0'); assert.strictEqual(util.inspect(-0), '-0'); +// edge case from check +assert.strictEqual(util.inspect(-5e-324), '-5e-324'); // test for sparse array { From 39d8e4413a6e37790c3b12e47c79fe8f7e84b25f Mon Sep 17 00:00:00 2001 From: Adri Van Houdt Date: Mon, 6 Nov 2017 16:49:07 +0000 Subject: [PATCH 350/379] test: improve assert messages in repl-reset-event PR-URL: https://github.com/nodejs/node/pull/16836 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/parallel/test-repl-reset-event.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-repl-reset-event.js b/test/parallel/test-repl-reset-event.js index e9772e3462cc83..83ab7fd6a3ec52 100644 --- a/test/parallel/test-repl-reset-event.js +++ b/test/parallel/test-repl-reset-event.js @@ -25,6 +25,7 @@ common.globalCheck = false; const assert = require('assert'); const repl = require('repl'); +const util = require('util'); // Create a dummy stream that does nothing const dummy = new common.ArrayStream(); @@ -38,11 +39,13 @@ function testReset(cb) { r.context.foo = 42; r.on('reset', common.mustCall(function(context) { assert(!!context, 'REPL did not emit a context with reset event'); - assert.strictEqual(context, r.context, 'REPL emitted incorrect context'); + assert.strictEqual(context, r.context, 'REPL emitted incorrect context. ' + + `context is ${util.inspect(context)}, expected ${util.inspect(r.context)}`); assert.strictEqual( context.foo, undefined, - 'REPL emitted the previous context, and is not using global as context' + 'REPL emitted the previous context and is not using global as context. ' + + `context.foo is ${context.foo}, expected undefined.` ); context.foo = 42; cb(); @@ -61,7 +64,8 @@ function testResetGlobal() { assert.strictEqual( context.foo, 42, - '"foo" property is missing from REPL using global as context' + '"foo" property is different from REPL using global as context. ' + + `context.foo is ${context.foo}, expected 42.` ); })); r.resetContext(); From 8c2143091d0333e6753a2cca357717b8daebe4dc Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 2 Nov 2017 20:09:31 -0400 Subject: [PATCH 351/379] crypto: do not reach into OpenSSL internals for ThrowCryptoError There is a perfectly serviceable ERR_get_error function which avoids having to sniff through the OpenSSL ring buffer like that. It does return the errors in the opposite order, but that's easily fixed with std::reverse. Note this behavior is slightly different in that an ERR_get_error loop will ultimately clear the error queue, but this is desirable. Leaving the error queue uncleared means errors in subsequent operations may get mixed up and cause issues. PR-URL: https://github.com/nodejs/node/pull/16701 Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 63 ++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index b833b7415d51ff..e1c0df8e52bceb 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -42,11 +42,13 @@ // StartComAndWoSignData.inc #include "StartComAndWoSignData.inc" +#include #include #include // INT_MAX #include #include #include +#include #define THROW_AND_RETURN_IF_NOT_STRING_OR_BUFFER(val, prefix) \ do { \ @@ -428,44 +430,33 @@ void ThrowCryptoError(Environment* env, Local exception_v = Exception::Error(message); CHECK(!exception_v.IsEmpty()); Local exception = exception_v.As(); - ERR_STATE* es = ERR_get_state(); - - if (es->bottom != es->top) { - Local error_stack = Array::New(env->isolate()); - int top = es->top; - - // Build the error_stack array to be added to opensslErrorStack property. - for (unsigned int i = 0; es->bottom != es->top;) { - unsigned long err_buf = es->err_buffer[es->top]; // NOLINT(runtime/int) - // Only add error string if there is valid err_buffer. - if (err_buf) { - char tmp_str[256]; - ERR_error_string_n(err_buf, tmp_str, sizeof(tmp_str)); - error_stack->Set(env->context(), i, - String::NewFromUtf8(env->isolate(), tmp_str, - v8::NewStringType::kNormal) - .ToLocalChecked()).FromJust(); - // Only increment if we added to error_stack. - i++; - } - // Since the ERR_STATE is a ring buffer, we need to use modular - // arithmetic to loop back around in the case where bottom is after top. - // Using ERR_NUM_ERRORS macro defined in openssl. - es->top = (((es->top - 1) % ERR_NUM_ERRORS) + ERR_NUM_ERRORS) % - ERR_NUM_ERRORS; + std::vector> errors; + for (;;) { + unsigned long err = ERR_get_error(); // NOLINT(runtime/int) + if (err == 0) { + break; } - - // Restore top. - es->top = top; - - // Add the opensslErrorStack property to the exception object. - // The new property will look like the following: - // opensslErrorStack: [ - // 'error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib', - // 'error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 err' - // ] - exception->Set(env->context(), env->openssl_error_stack(), error_stack) + char tmp_str[256]; + ERR_error_string_n(err, tmp_str, sizeof(tmp_str)); + errors.push_back(String::NewFromUtf8(env->isolate(), tmp_str, + v8::NewStringType::kNormal) + .ToLocalChecked()); + } + + // ERR_get_error returns errors in order of most specific to least + // specific. We wish to have the reverse ordering: + // opensslErrorStack: [ + // 'error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib', + // 'error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 err' + // ] + if (!errors.empty()) { + std::reverse(errors.begin(), errors.end()); + Local errors_array = Array::New(env->isolate(), errors.size()); + for (size_t i = 0; i < errors.size(); i++) { + errors_array->Set(env->context(), i, errors[i]).FromJust(); + } + exception->Set(env->context(), env->openssl_error_stack(), errors_array) .FromJust(); } From b015747156fdcbfdb970935bda74f601b37d6a6a Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 29 Nov 2017 10:58:11 +0200 Subject: [PATCH 352/379] doc: esm loader example with module.builtinModules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17385 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: Timothy Gu --- doc/api/esm.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index c352c24aa1c56d..b812d7cb76db0b 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -147,15 +147,13 @@ be written: import url from 'url'; import path from 'path'; import process from 'process'; +import Module from 'module'; -const builtins = new Set( - Object.keys(process.binding('natives')).filter((str) => - /^(?!(?:internal|node|v8)\/)/.test(str)) -); +const builtins = Module.builtinModules; const JS_EXTENSIONS = new Set(['.js', '.mjs']); export function resolve(specifier, parentModuleURL/*, defaultResolve */) { - if (builtins.has(specifier)) { + if (builtins.includes(specifier)) { return { url: specifier, format: 'builtin' From c951e2c7d4cfc85717d89f189366d3640ee85d4d Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 6 Dec 2017 12:26:29 +0100 Subject: [PATCH 353/379] crypto: remove explicit qualifiers in Initialize This commit removes the explicit namespace qualifiers in Connection::Initialize, and SecureContext:Initialize which should not necessary in a member function (using an unqualified name should resolve by searching the class of the member function). This is consistent with the other intialize functions in node_crypto like Hmac::Initialize, Hash::Initialize, Sign::Initialize, Verify::Initialize, DiffieHellman::Initialize, ECDH::Initialize, and InitCrypto. PR-URL: https://github.com/nodejs/node/pull/17490 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- src/node_crypto.cc | 67 +++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index e1c0df8e52bceb..47083790a923f2 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -515,34 +515,29 @@ void SecureContext::Initialize(Environment* env, Local target) { FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext"); t->SetClassName(secureContextString); - env->SetProtoMethod(t, "init", SecureContext::Init); - env->SetProtoMethod(t, "setKey", SecureContext::SetKey); - env->SetProtoMethod(t, "setCert", SecureContext::SetCert); - env->SetProtoMethod(t, "addCACert", SecureContext::AddCACert); - env->SetProtoMethod(t, "addCRL", SecureContext::AddCRL); - env->SetProtoMethod(t, "addRootCerts", SecureContext::AddRootCerts); - env->SetProtoMethod(t, "setCiphers", SecureContext::SetCiphers); - env->SetProtoMethod(t, "setECDHCurve", SecureContext::SetECDHCurve); - env->SetProtoMethod(t, "setDHParam", SecureContext::SetDHParam); - env->SetProtoMethod(t, "setOptions", SecureContext::SetOptions); - env->SetProtoMethod(t, "setSessionIdContext", - SecureContext::SetSessionIdContext); - env->SetProtoMethod(t, "setSessionTimeout", - SecureContext::SetSessionTimeout); - env->SetProtoMethod(t, "close", SecureContext::Close); - env->SetProtoMethod(t, "loadPKCS12", SecureContext::LoadPKCS12); + env->SetProtoMethod(t, "init", Init); + env->SetProtoMethod(t, "setKey", SetKey); + env->SetProtoMethod(t, "setCert", SetCert); + env->SetProtoMethod(t, "addCACert", AddCACert); + env->SetProtoMethod(t, "addCRL", AddCRL); + env->SetProtoMethod(t, "addRootCerts", AddRootCerts); + env->SetProtoMethod(t, "setCiphers", SetCiphers); + env->SetProtoMethod(t, "setECDHCurve", SetECDHCurve); + env->SetProtoMethod(t, "setDHParam", SetDHParam); + env->SetProtoMethod(t, "setOptions", SetOptions); + env->SetProtoMethod(t, "setSessionIdContext", SetSessionIdContext); + env->SetProtoMethod(t, "setSessionTimeout", SetSessionTimeout); + env->SetProtoMethod(t, "close", Close); + env->SetProtoMethod(t, "loadPKCS12", LoadPKCS12); #ifndef OPENSSL_NO_ENGINE - env->SetProtoMethod(t, "setClientCertEngine", - SecureContext::SetClientCertEngine); + env->SetProtoMethod(t, "setClientCertEngine", SetClientCertEngine); #endif // !OPENSSL_NO_ENGINE - env->SetProtoMethod(t, "getTicketKeys", SecureContext::GetTicketKeys); - env->SetProtoMethod(t, "setTicketKeys", SecureContext::SetTicketKeys); - env->SetProtoMethod(t, "setFreeListLength", SecureContext::SetFreeListLength); - env->SetProtoMethod(t, - "enableTicketKeyCallback", - SecureContext::EnableTicketKeyCallback); - env->SetProtoMethod(t, "getCertificate", SecureContext::GetCertificate); - env->SetProtoMethod(t, "getIssuer", SecureContext::GetCertificate); + env->SetProtoMethod(t, "getTicketKeys", GetTicketKeys); + env->SetProtoMethod(t, "setTicketKeys", SetTicketKeys); + env->SetProtoMethod(t, "setFreeListLength", SetFreeListLength); + env->SetProtoMethod(t, "enableTicketKeyCallback", EnableTicketKeyCallback); + env->SetProtoMethod(t, "getCertificate", GetCertificate); + env->SetProtoMethod(t, "getIssuer", GetCertificate); t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyReturnIndex"), Integer::NewFromUnsigned(env->isolate(), kTicketKeyReturnIndex)); @@ -3015,21 +3010,21 @@ void Connection::Initialize(Environment* env, Local target) { t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Connection")); AsyncWrap::AddWrapMethods(env, t); - env->SetProtoMethod(t, "encIn", Connection::EncIn); - env->SetProtoMethod(t, "clearOut", Connection::ClearOut); - env->SetProtoMethod(t, "clearIn", Connection::ClearIn); - env->SetProtoMethod(t, "encOut", Connection::EncOut); - env->SetProtoMethod(t, "clearPending", Connection::ClearPending); - env->SetProtoMethod(t, "encPending", Connection::EncPending); - env->SetProtoMethod(t, "start", Connection::Start); - env->SetProtoMethod(t, "close", Connection::Close); + env->SetProtoMethod(t, "encIn", EncIn); + env->SetProtoMethod(t, "clearOut", ClearOut); + env->SetProtoMethod(t, "clearIn", ClearIn); + env->SetProtoMethod(t, "encOut", EncOut); + env->SetProtoMethod(t, "clearPending", ClearPending); + env->SetProtoMethod(t, "encPending", EncPending); + env->SetProtoMethod(t, "start", Start); + env->SetProtoMethod(t, "close", Close); SSLWrap::AddMethods(env, t); #ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB - env->SetProtoMethod(t, "getServername", Connection::GetServername); - env->SetProtoMethod(t, "setSNICallback", Connection::SetSNICallback); + env->SetProtoMethod(t, "getServername", GetServername); + env->SetProtoMethod(t, "setSNICallback", SetSNICallback); #endif target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Connection"), From 5d1463a0bc80675515778b397b04c36728765e2e Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Mon, 4 Dec 2017 19:08:15 -0200 Subject: [PATCH 354/379] build: define HAVE_OPENSSL macro for cctest cctest build target wasn't defining the HAVE_OPENSSL macro when node_use_openssl was true, causing inconsistencies on most `node::Environment` member's addresses. For example, if someone wanted to access the context of an environment by using `node::Environment::context()`, the object returned by the function was pointing to an invalid address. PR-URL: https://github.com/nodejs/node/pull/17461 Reviewed-By: Joyee Cheung Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen --- node.gyp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node.gyp b/node.gyp index 70636e776592d3..5667bff6530968 100644 --- a/node.gyp +++ b/node.gyp @@ -859,6 +859,9 @@ '<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_clienthello.<(OBJ_SUFFIX)', '<(OBJ_PATH)<(OBJ_SEPARATOR)tls_wrap.<(OBJ_SUFFIX)', ], + 'defines': [ + 'HAVE_OPENSSL=1', + ], }], ['v8_enable_inspector==1', { 'sources': [ From 510116ebe6edd2e325aa8b8690ed865a4d8966f7 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Thu, 7 Dec 2017 21:48:59 +0300 Subject: [PATCH 355/379] test: update http test to use common.mustCall PR-URL: https://github.com/nodejs/node/pull/17528 Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-timeout-overflow.js | 22 +++++---------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-http-timeout-overflow.js b/test/parallel/test-http-timeout-overflow.js index dc93b3da7ae20d..e95405bc8b3554 100644 --- a/test/parallel/test-http-timeout-overflow.js +++ b/test/parallel/test-http-timeout-overflow.js @@ -20,19 +20,13 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); -const assert = require('assert'); - +const common = require('../common'); const http = require('http'); -let serverRequests = 0; -let clientRequests = 0; - -const server = http.createServer(function(req, res) { - serverRequests++; +const server = http.createServer(common.mustCall(function(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); -}); +})); server.listen(0, function() { function callback() {} @@ -44,10 +38,9 @@ server.listen(0, function() { }, function(res) { req.clearTimeout(callback); - res.on('end', function() { - clientRequests++; + res.on('end', common.mustCall(function() { server.close(); - }); + })); res.resume(); }); @@ -56,8 +49,3 @@ server.listen(0, function() { req.setTimeout(0xffffffff, callback); req.end(); }); - -process.once('exit', function() { - assert.strictEqual(clientRequests, 1); - assert.strictEqual(serverRequests, 1); -}); From dcb53c10e214bb82a5dc9ddbd4bfaf2c4fb55018 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 26 Nov 2017 13:30:08 +0000 Subject: [PATCH 356/379] build: allow running configure from any directory PR-URL: https://github.com/nodejs/node/pull/17321 Reviewed-By: Richard Lau Reviewed-By: Jon Moss Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Ruben Bridgewater --- configure | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 98a96ac0cbc64d..e434059d6f520b 100755 --- a/configure +++ b/configure @@ -35,21 +35,23 @@ import subprocess import shutil import string +# If not run from node/, cd to node/. +os.chdir(os.path.dirname(__file__) or '.') + # gcc and g++ as defaults matches what GYP's Makefile generator does, # except on OS X. CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'g++') -root_dir = os.path.dirname(__file__) -sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib')) +sys.path.insert(0, os.path.join('tools', 'gyp', 'pylib')) from gyp.common import GetFlavor # imports in tools/configure.d -sys.path.insert(0, os.path.join(root_dir, 'tools', 'configure.d')) +sys.path.insert(0, os.path.join('tools', 'configure.d')) import nodedownload # imports in tools/ -sys.path.insert(0, os.path.join(root_dir, 'tools')) +sys.path.insert(0, 'tools') import getmoduleversion from gyp_node import run_gyp @@ -432,7 +434,7 @@ intl_optgroup.add_option('--download', intl_optgroup.add_option('--download-path', action='store', dest='download_path', - default=os.path.join(root_dir, 'deps'), + default='deps', help='Download directory [default: %default]') parser.add_option_group(intl_optgroup) @@ -1046,7 +1048,7 @@ def configure_openssl(o): o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] if options.openssl_fips: o['variables']['openssl_fips'] = options.openssl_fips - fips_dir = os.path.join(root_dir, 'deps', 'openssl', 'fips') + fips_dir = os.path.join('deps', 'openssl', 'fips') fips_ld = os.path.abspath(os.path.join(fips_dir, 'fipsld')) # LINK is for Makefiles, LD/LDXX is for ninja o['make_fips_settings'] = [ @@ -1091,7 +1093,7 @@ def configure_static(o): def write(filename, data): - filename = os.path.join(root_dir, filename) + filename = filename print('creating %s' % filename) f = open(filename, 'w+') f.write(data) @@ -1213,7 +1215,7 @@ def configure_intl(o): return # this is just the 'deps' dir. Used for unpacking. - icu_parent_path = os.path.join(root_dir, 'deps') + icu_parent_path = 'deps' # The full path to the ICU source directory. Should not include './'. icu_full_path = 'deps/icu' From bb780d2d84c72c35e396c06e5373f7806d60f87a Mon Sep 17 00:00:00 2001 From: Federico Kauffman Date: Thu, 7 Dec 2017 19:20:54 -0300 Subject: [PATCH 357/379] test: use Countdown in http-agent test PR-URL: https://github.com/nodejs/node/pull/17537 Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-agent.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 106f641db72a18..6dc7f75ce0bc05 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const Countdown = require('../common/countdown'); const assert = require('assert'); const http = require('http'); common.crashOnUnhandledRejection(); @@ -33,14 +34,17 @@ const server = http.Server(common.mustCall(function(req, res) { }, (N * M))); // N * M = good requests (the errors will not be counted) function makeRequests(outCount, inCount, shouldFail) { - let responseCount = outCount * inCount; + const countdown = new Countdown( + outCount * inCount, + common.mustCall(() => server.close()) + ); let onRequest = common.mustNotCall(); // Temporary const p = new Promise((resolve) => { onRequest = common.mustCall((res) => { - if (--responseCount === 0) { - server.close(); + if (countdown.dec() === 0) { resolve(); } + if (!shouldFail) res.resume(); }, outCount * inCount); From 24dc57bc71e511f9bbffb918faadbf7830478bc3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 29 Nov 2017 18:37:09 -0800 Subject: [PATCH 358/379] http: simplify checkIsHttpToken() Replace code optimized for older versions of V8 with more straightforward code in checkIsHttpToken(). PR-URL: https://github.com/nodejs/node/pull/17399 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Reviewed-By: Timothy Gu --- lib/_http_common.js | 62 +++------------------------------------------ 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/lib/_http_common.js b/lib/_http_common.js index ad0dec520d1210..cf37bbebe36197 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -233,70 +233,14 @@ function httpSocketSetup(socket) { socket.on('drain', ondrain); } +const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; /** * Verifies that the given val is a valid HTTP token * per the rules defined in RFC 7230 * See https://tools.ietf.org/html/rfc7230#section-3.2.6 - * - * Allowed characters in an HTTP token: - * ^_`a-z 94-122 - * A-Z 65-90 - * - 45 - * 0-9 48-57 - * ! 33 - * #$%&' 35-39 - * *+ 42-43 - * . 46 - * | 124 - * ~ 126 - * - * This implementation of checkIsHttpToken() loops over the string instead of - * using a regular expression since the former is up to 180% faster with v8 4.9 - * depending on the string length (the shorter the string, the larger the - * performance difference) - * - * Additionally, checkIsHttpToken() is currently designed to be inlinable by v8, - * so take care when making changes to the implementation so that the source - * code size does not exceed v8's default max_inlined_source_size setting. - **/ -var validTokens = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, // 112 - 127 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 128 ... - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // ... 255 -]; +**/ function checkIsHttpToken(val) { - if (!validTokens[val.charCodeAt(0)]) - return false; - if (val.length < 2) - return true; - if (!validTokens[val.charCodeAt(1)]) - return false; - if (val.length < 3) - return true; - if (!validTokens[val.charCodeAt(2)]) - return false; - if (val.length < 4) - return true; - if (!validTokens[val.charCodeAt(3)]) - return false; - for (var i = 4; i < val.length; ++i) { - if (!validTokens[val.charCodeAt(i)]) - return false; - } - return true; + return tokenRegExp.test(val); } /** From a965dda8497dc59c8f8a88968f836888632dec37 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 7 Dec 2017 14:49:57 -0800 Subject: [PATCH 359/379] doc: simplify and clarify FIPS text in BUILDING.md PR-URL: https://github.com/nodejs/node/pull/17538 Fixes: https://github.com/nodejs/node/issues/17536 Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Jon Moss --- BUILDING.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index a1e7afc8c68e60..c459a867ba6096 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -347,17 +347,13 @@ as `deps/icu` (You'll have: `deps/icu/source/...`) ## Building Node.js with FIPS-compliant OpenSSL -NOTE: Windows is not yet supported +It is possible to build Node.js with the +[OpenSSL FIPS module](https://www.openssl.org/docs/fipsnotes.html) on POSIX +systems. Windows is not supported. -It is possible to build Node.js with -[OpenSSL FIPS module](https://www.openssl.org/docs/fipsnotes.html). - -**Note**: building in this way does **not** allow you to claim that the -runtime is FIPS 140-2 validated. Instead you can indicate that the runtime -uses a validated module. See the -[security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf) -page 60 for more details. In addition, the validation for the underlying module -is only valid if it is deployed in accordance with its +Building in this way does not mean the runtime is FIPS 140-2 validated, but +rather that the runtime uses a validated module. In addition, the validation for +the underlying module is only valid if it is deployed in accordance with its [security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf). If you need FIPS validated cryptography it is recommended that you read both the [security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf) From 4a5e32206aeae2f33149a000f972414aa06e1fa2 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 7 Dec 2017 15:35:53 +0100 Subject: [PATCH 360/379] crypto: remove BIO_set_shutdown I've not been able to find any reason for calling BIO_set_shutdown(bio, 1). This is done by default for the following versions of OpenSSL: https://github.com/openssl/openssl/blob/OpenSSL_1_1_0/ crypto/bio/bio_lib.c#L26 https://github.com/openssl/openssl/blob/OpenSSL_1_0_1/ crypto/bio/bio_lib.c#L90 https://github.com/openssl/openssl/blob/OpenSSL_1_0_2/ crypto/bio/bio_lib.c#L88 https://github.com/openssl/openssl/blob/OpenSSL_1_0_0/ crypto/bio/bio_lib.c#L90 This commit removes the call and the comment. PR-URL: https://github.com/nodejs/node/pull/17542 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/node_crypto_bio.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/node_crypto_bio.cc b/src/node_crypto_bio.cc index eb0500952b15a5..526d0d4ae568b1 100644 --- a/src/node_crypto_bio.cc +++ b/src/node_crypto_bio.cc @@ -68,8 +68,6 @@ void NodeBIO::AssignEnvironment(Environment* env) { int NodeBIO::New(BIO* bio) { BIO_set_data(bio, new NodeBIO()); - // XXX Why am I doing it?! - BIO_set_shutdown(bio, 1); BIO_set_init(bio, 1); return 1; From 8dcc40a84fa40de9da4b95172cf088f378b874a5 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 8 Dec 2017 15:17:53 +0100 Subject: [PATCH 361/379] src: remove unused include node_crypto_clienthello This commit removes the include of node.h which does not seem to be used. PR-URL: https://github.com/nodejs/node/pull/17546 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/node_crypto_clienthello.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node_crypto_clienthello.h b/src/node_crypto_clienthello.h index 3ae5452de38c8d..70f082b2c2a038 100644 --- a/src/node_crypto_clienthello.h +++ b/src/node_crypto_clienthello.h @@ -24,9 +24,8 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node.h" - #include // size_t +#include #include // nullptr namespace node { From 89964183c06eca25885f6a989a5739aabfe69967 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 7 Dec 2017 11:52:11 -0500 Subject: [PATCH 362/379] tools: don't lint-md as part of main lint target PR-URL: https://github.com/nodejs/node/pull/17587 Reviewed-By: Colin Ihrig Reviewed-By: Myles Borins Reviewed-By: Ruben Bridgewater --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 6f89255f4ba3ae..992af027687657 100644 --- a/Makefile +++ b/Makefile @@ -1120,7 +1120,6 @@ lint: ## Run JS, C++, MD and doc linters. @EXIT_STATUS=0 ; \ $(MAKE) lint-js || EXIT_STATUS=$$? ; \ $(MAKE) lint-cpp || EXIT_STATUS=$$? ; \ - $(MAKE) lint-md || EXIT_STATUS=$$? ; \ $(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \ exit $$EXIT_STATUS CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+ From 7e2fa5a2d6c9e4b38bec3aea5567479e3c12b2f1 Mon Sep 17 00:00:00 2001 From: Delapouite Date: Thu, 7 Dec 2017 11:11:41 +0100 Subject: [PATCH 363/379] doc: add link to debugger in process.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17522 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca Reviewed-By: Myles Borins --- doc/api/process.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 54704e6775da5d..8c91a6c9d7c210 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -379,7 +379,7 @@ terminal programs. It is important to take note of the following: -* `SIGUSR1` is reserved by Node.js to start the debugger. It's possible to +* `SIGUSR1` is reserved by Node.js to start the [debugger][]. It's possible to install a listener but doing so will _not_ stop the debugger from starting. * `SIGTERM` and `SIGINT` have default handlers on non-Windows platforms that resets the terminal mode before exiting with code `128 + signal number`. If @@ -1971,6 +1971,7 @@ cases: [`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags [Child Process]: child_process.html [Cluster]: cluster.html +[debugger]: debugger.html [Duplex]: stream.html#stream_duplex_and_transform_streams [LTS]: https://github.com/nodejs/LTS/ [note on process I/O]: process.html#process_a_note_on_process_i_o From f7e5ab082d9c35fe74ac86ca90f4dc46f9c38dd4 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Fri, 8 Dec 2017 22:44:28 +0530 Subject: [PATCH 364/379] test: refactored to remove unnecessary variables PR-URL: https://github.com/nodejs/node/pull/17553 Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/parallel/test-net-connect-options-fd.js | 5 ++--- test/parallel/test-net-connect-options-path.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 1ffc92257ced31..50c2a08efeb194 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -83,14 +83,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); path: serverPath }); const getConnectCb = (index) => common.mustCall(function clientOnConnect() { - const client = this; // Test if it's wrapping an existing fd assert(handleMap.has(index)); const oldHandle = handleMap.get(index); assert.strictEqual(oldHandle.fd, this._handle.fd); - client.write(String(oldHandle.fd)); + this.write(String(oldHandle.fd)); console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`); - client.on('error', function(err) { + this.on('error', function(err) { console.error(err); assert.fail(null, null, `[Pipe Client]${err}`); }); diff --git a/test/parallel/test-net-connect-options-path.js b/test/parallel/test-net-connect-options-path.js index 07c5446fc6c0ab..3868b85a78a6d2 100644 --- a/test/parallel/test-net-connect-options-path.js +++ b/test/parallel/test-net-connect-options-path.js @@ -20,9 +20,8 @@ const CLIENT_VARIANTS = 12; }, CLIENT_VARIANTS)) .listen(serverPath, common.mustCall(function() { const getConnectCb = () => common.mustCall(function() { - const client = this; - client.end(); - client.on('close', common.mustCall(function() { + this.end(); + this.on('close', common.mustCall(function() { counter++; if (counter === CLIENT_VARIANTS) { server.close(); From cbd0be59f0adef929920fe6112c46b010d2e1eb7 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 9 Dec 2017 17:32:48 -0500 Subject: [PATCH 365/379] benchmark: fix http/simple.js benchmark autocannon appears to have trouble recognizing URLs that contain true or false within them. Use 0 or 1 instead to represent the same. PR-URL: https://github.com/nodejs/node/pull/17583 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- benchmark/fixtures/simple-http-server.js | 2 +- benchmark/http/simple.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js index 5f56bebdafd75f..d2eda0c085c9f2 100644 --- a/benchmark/fixtures/simple-http-server.js +++ b/benchmark/fixtures/simple-http-server.js @@ -34,7 +34,7 @@ module.exports = http.createServer(function(req, res) { const arg = params[2]; const n_chunks = parseInt(params[3], 10); const resHow = params.length >= 5 ? params[4] : 'normal'; - const chunkedEnc = params.length >= 6 && params[5] === 'false' ? false : true; + const chunkedEnc = params.length >= 6 && params[5] === '0' ? false : true; var status = 200; var n, i; diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index 238cd1885d3ca7..544aad49688386 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -8,14 +8,14 @@ const bench = common.createBenchmark(main, { len: [4, 1024, 102400], chunks: [1, 4], c: [50, 500], - chunkedEnc: ['true', 'false'], + chunkedEnc: [1, 0], res: ['normal', 'setHeader', 'setHeaderWH'] }); function main(conf) { process.env.PORT = PORT; var server = require('../fixtures/simple-http-server.js') - .listen(process.env.PORT || common.PORT) + .listen(PORT) .on('listening', function() { const path = `/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}/${conf.chunkedEnc}`; From 49d662846ee11ea00d879dcef11c0b1927ceaa47 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Fri, 8 Dec 2017 16:41:38 -0500 Subject: [PATCH 366/379] test: replace assert.throws w/ common.expectsError PR-URL: https://github.com/nodejs/node/pull/17557 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- .../test-embedder.api.async-resource.js | 6 +- test/parallel/test-assert-fail.js | 2 + test/parallel/test-assert.js | 3 + test/parallel/test-buffer-alloc.js | 5 +- test/parallel/test-buffer-fill.js | 10 ++-- test/parallel/test-console-instance.js | 6 +- test/parallel/test-dns.js | 16 ++--- test/parallel/test-http-outgoing-proto.js | 60 +++++++++---------- ...est-http2-client-request-options-errors.js | 7 +-- test/parallel/test-http2-connect-method.js | 18 +++--- test/parallel/test-http2-respond-file-204.js | 7 +-- .../test-http2-server-push-disabled.js | 6 +- .../test-http2-server-rst-before-respond.js | 6 +- .../test-https-options-boolean-check.js | 12 ++-- test/parallel/test-internal-errors.js | 20 +++---- test/parallel/test-performance.js | 13 ++-- test/parallel/test-performanceobserver.js | 39 ++++++------ test/parallel/test-readline-interface.js | 24 ++++---- test/parallel/test-ttywrap-invalid-fd.js | 14 ++--- test/sequential/test-tls-lookup.js | 6 +- 20 files changed, 140 insertions(+), 140 deletions(-) diff --git a/test/async-hooks/test-embedder.api.async-resource.js b/test/async-hooks/test-embedder.api.async-resource.js index eeeaa447c9668c..89a889b20192e3 100644 --- a/test/async-hooks/test-embedder.api.async-resource.js +++ b/test/async-hooks/test-embedder.api.async-resource.js @@ -17,12 +17,12 @@ common.expectsError( code: 'ERR_INVALID_ARG_TYPE', type: TypeError, }); -assert.throws(() => { +common.expectsError(() => { new AsyncResource('invalid_trigger_id', { triggerAsyncId: null }); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ASYNC_ID', type: RangeError, -})); +}); assert.strictEqual( new AsyncResource('default_trigger_id').triggerAsyncId(), diff --git a/test/parallel/test-assert-fail.js b/test/parallel/test-assert-fail.js index 14d28e5cd0045f..8d67a6e63f51f5 100644 --- a/test/parallel/test-assert-fail.js +++ b/test/parallel/test-assert-fail.js @@ -1,5 +1,7 @@ 'use strict'; +/* eslint-disable prefer-common-expectserror */ + const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 87422e5ca0665b..e198ce5ae4e530 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -20,6 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; + +/* eslint-disable prefer-common-expectserror */ + const common = require('../common'); const assert = require('assert'); const a = assert; diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 85e0b3614bf435..38b0b5a4e5e387 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -974,12 +974,11 @@ assert.strictEqual(SlowBuffer.prototype.offset, undefined); } // ParseArrayIndex() should reject values that don't fit in a 32 bits size_t. -assert.throws(() => { +common.expectsError(() => { const a = Buffer.alloc(1); const b = Buffer.alloc(1); a.copy(b, 0, 0x100000000, 0x100000001); -}, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); +}, { code: undefined, type: RangeError, message: 'Index out of range' }); // Unpooled buffer (replaces SlowBuffer) { diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index e7d3d4afaf2fa5..604f6d9a7dab9c 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -421,21 +421,19 @@ common.expectsError(() => { // Testing process.binding. Make sure "end" is properly checked for -1 wrap // around. -assert.throws(() => { +common.expectsError(() => { process.binding('buffer').fill(Buffer.alloc(1), 1, 1, -2, 1); -}, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); +}, { code: undefined, type: RangeError, message: 'Index out of range' }); // Test that bypassing 'length' won't cause an abort. -assert.throws(() => { +common.expectsError(() => { const buf = new Buffer('w00t'); Object.defineProperty(buf, 'length', { value: 1337, enumerable: true }); buf.fill(''); -}, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); +}, { code: undefined, type: RangeError, message: 'Index out of range' }); assert.deepStrictEqual( Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 9f31ebf3afcb58..7e931e0d3b30de 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -47,17 +47,17 @@ common.expectsError( ); // Console constructor should throw if stderr exists but is not writable -assert.throws( +common.expectsError( () => { out.write = () => {}; err.write = undefined; new Console(out, err); }, - common.expectsError({ + { code: 'ERR_CONSOLE_WRITABLE_STREAM', type: TypeError, message: /stderr/ - }) + } ); out.write = err.write = (d) => {}; diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index f0e4b29d7c9b7f..dba14b397bc27c 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -205,20 +205,20 @@ assert.doesNotThrow(() => { }, common.mustCall()); }); -assert.throws(() => dns.lookupService('0.0.0.0'), common.expectsError({ +common.expectsError(() => dns.lookupService('0.0.0.0'), { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "host", "port", and "callback" arguments must be specified' -})); +}); const invalidHost = 'fasdfdsaf'; -assert.throws(() => { +common.expectsError(() => { dns.lookupService(invalidHost, 0, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: `The value "${invalidHost}" is invalid for option "host"` -})); +}); const portErr = (port) => { common.expectsError( @@ -238,9 +238,9 @@ portErr(undefined); portErr(65538); portErr('test'); -assert.throws(() => { +common.expectsError(() => { dns.lookupService('0.0.0.0', 80, null); -}, common.expectsError({ +}, { code: 'ERR_INVALID_CALLBACK', type: TypeError -})); +}); diff --git a/test/parallel/test-http-outgoing-proto.js b/test/parallel/test-http-outgoing-proto.js index 16b765c50a7b54..99643eda6d4042 100644 --- a/test/parallel/test-http-outgoing-proto.js +++ b/test/parallel/test-http-outgoing-proto.js @@ -21,80 +21,80 @@ assert.strictEqual( typeof ServerResponse.prototype._implicitHeader, 'function'); // validateHeader -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.setHeader(); -}, common.expectsError({ +}, { code: 'ERR_INVALID_HTTP_TOKEN', type: TypeError, message: 'Header name must be a valid HTTP token ["undefined"]' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.setHeader('test'); -}, common.expectsError({ +}, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "value" argument must be specified' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.setHeader(404); -}, common.expectsError({ +}, { code: 'ERR_INVALID_HTTP_TOKEN', type: TypeError, message: 'Header name must be a valid HTTP token ["404"]' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.setHeader.call({ _header: 'test' }, 'test', 'value'); -}, common.expectsError({ +}, { code: 'ERR_HTTP_HEADERS_SENT', type: Error, message: 'Cannot set headers after they are sent to the client' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.setHeader('200', 'あ'); -}, common.expectsError({ +}, { code: 'ERR_INVALID_CHAR', type: TypeError, message: 'Invalid character in header content ["200"]' -})); +}); // write -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.write(); -}, common.expectsError({ +}, { code: 'ERR_METHOD_NOT_IMPLEMENTED', type: Error, message: 'The _implicitHeader() method is not implemented' -})); +}); assert(OutgoingMessage.prototype.write.call({ _header: 'test' })); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.write.call({ _header: 'test', _hasBody: 'test' }); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The first argument must be one of type string or Buffer' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.write.call({ _header: 'test', _hasBody: 'test' }, 1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The first argument must be one of type string or Buffer' -})); +}); // addTrailers() // The `Error` comes from the JavaScript engine so confirm that it is a @@ -105,20 +105,20 @@ assert.throws(() => { outgoingMessage.addTrailers(); }, TypeError); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.addTrailers({ 'あ': 'value' }); -}, common.expectsError({ +}, { code: 'ERR_INVALID_HTTP_TOKEN', type: TypeError, message: 'Trailer name must be a valid HTTP token ["あ"]' -})); +}); -assert.throws(() => { +common.expectsError(() => { const outgoingMessage = new OutgoingMessage(); outgoingMessage.addTrailers({ 404: 'あ' }); -}, common.expectsError({ +}, { code: 'ERR_INVALID_CHAR', type: TypeError, message: 'Invalid character in trailer content ["404"]' -})); +}); diff --git a/test/parallel/test-http2-client-request-options-errors.js b/test/parallel/test-http2-client-request-options-errors.js index 5d3fc0ab5a1fd8..4b146a1bc8c2e4 100644 --- a/test/parallel/test-http2-client-request-options-errors.js +++ b/test/parallel/test-http2-client-request-options-errors.js @@ -3,7 +3,6 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const assert = require('assert'); const http2 = require('http2'); // Check if correct errors are emitted when wrong type of data is passed @@ -40,19 +39,19 @@ server.listen(0, common.mustCall(() => { return; } - assert.throws( + common.expectsError( () => client.request({ ':method': 'CONNECT', ':authority': `localhost:${port}` }, { [option]: types[type] }), - common.expectsError({ + { type: TypeError, code: 'ERR_INVALID_OPT_VALUE', message: `The value "${String(types[type])}" is invalid ` + `for option "${option}"` - }) + } ); }); }); diff --git a/test/parallel/test-http2-connect-method.js b/test/parallel/test-http2-connect-method.js index 78c9a345293c12..4d443d5c217421 100644 --- a/test/parallel/test-http2-connect-method.js +++ b/test/parallel/test-http2-connect-method.js @@ -55,36 +55,36 @@ server.listen(0, common.mustCall(() => { const client = http2.connect(`http://localhost:${proxy.address().port}`); // confirm that :authority is required and :scheme & :path are forbidden - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_AUTHORITY', message: ':authority header is required for CONNECT requests' - }) + } ); - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT', [HTTP2_HEADER_AUTHORITY]: `localhost:${port}`, [HTTP2_HEADER_SCHEME]: 'http' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_SCHEME', message: 'The :scheme header is forbidden for CONNECT requests' - }) + } ); - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT', [HTTP2_HEADER_AUTHORITY]: `localhost:${port}`, [HTTP2_HEADER_PATH]: '/' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_PATH', message: 'The :path header is forbidden for CONNECT requests' - }) + } ); // valid CONNECT request diff --git a/test/parallel/test-http2-respond-file-204.js b/test/parallel/test-http2-respond-file-204.js index 8181dbb317dab2..4be2d42c779a5e 100644 --- a/test/parallel/test-http2-respond-file-204.js +++ b/test/parallel/test-http2-respond-file-204.js @@ -5,7 +5,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const fixtures = require('../common/fixtures'); const http2 = require('http2'); -const assert = require('assert'); const { HTTP2_HEADER_CONTENT_TYPE, @@ -16,16 +15,16 @@ const fname = fixtures.path('elipses.txt'); const server = http2.createServer(); server.on('stream', (stream) => { - assert.throws(() => { + common.expectsError(() => { stream.respondWithFile(fname, { [HTTP2_HEADER_STATUS]: 204, [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain' }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_PAYLOAD_FORBIDDEN', type: Error, message: 'Responses with 204 status must not have a payload' - })); + }); stream.respond({}); stream.end(); }); diff --git a/test/parallel/test-http2-server-push-disabled.js b/test/parallel/test-http2-server-push-disabled.js index c0148fe63b672e..33390f2ecae886 100644 --- a/test/parallel/test-http2-server-push-disabled.js +++ b/test/parallel/test-http2-server-push-disabled.js @@ -21,16 +21,16 @@ server.on('stream', common.mustCall((stream) => { // and pushStream() must throw. assert.strictEqual(stream.pushAllowed, false); - assert.throws(() => { + common.expectsError(() => { stream.pushStream({ ':scheme': 'http', ':path': '/foobar', ':authority': `localhost:${server.address().port}`, }, common.mustNotCall()); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_PUSH_DISABLED', type: Error - })); + }); stream.respond({ ':status': 200 }); stream.end('test'); diff --git a/test/parallel/test-http2-server-rst-before-respond.js b/test/parallel/test-http2-server-rst-before-respond.js index 47ba68bd29ed81..950beea4eb39ab 100644 --- a/test/parallel/test-http2-server-rst-before-respond.js +++ b/test/parallel/test-http2-server-rst-before-respond.js @@ -14,15 +14,15 @@ server.on('stream', common.mustCall(onStream)); function onStream(stream, headers, flags) { stream.rstStream(); - assert.throws(() => { + common.expectsError(() => { stream.additionalHeaders({ ':status': 123, abc: 123 }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_STREAM', message: /^The stream has been destroyed$/ - })); + }); } server.listen(0); diff --git a/test/parallel/test-https-options-boolean-check.js b/test/parallel/test-https-options-boolean-check.js index eae319988e7c6a..ed124d43fbb74f 100644 --- a/test/parallel/test-https-options-boolean-check.js +++ b/test/parallel/test-https-options-boolean-check.js @@ -101,16 +101,16 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] ].map((params) => { - assert.throws(() => { + common.expectsError(() => { https.createServer({ key: params[0], cert: params[1] }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: params[2] - })); + }); }); // Checks to ensure https.createServer works with the CA parameter @@ -142,15 +142,15 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map((params) => { - assert.throws(() => { + common.expectsError(() => { https.createServer({ key: params[0], cert: params[1], ca: params[2] }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index 1b4abcf72c9ab3..78582a53504748 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -141,29 +141,29 @@ common.expectsError( // Tests for common.expectsError assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1' })); + }, { code: 'TEST_ERROR_1' }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', - type: TypeError, - message: /^Error for testing/ })); + }, { code: 'TEST_ERROR_1', + type: TypeError, + message: /^Error for testing/ }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: TypeError })); + }, { code: 'TEST_ERROR_1', type: TypeError }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: Error })); + }, { code: 'TEST_ERROR_1', type: Error }); }); common.expectsError(() => { diff --git a/test/parallel/test-performance.js b/test/parallel/test-performance.js index 23ae4370c3cd7a..ba15479050f9e1 100644 --- a/test/parallel/test-performance.js +++ b/test/parallel/test-performance.js @@ -68,12 +68,13 @@ assert.strictEqual(typeof performance.timeOrigin, 'number'); }); [undefined, null, 'foo', 1].forEach((i) => { - assert.throws(() => performance.measure('test', 'A', i), - common.expectsError({ - code: 'ERR_INVALID_PERFORMANCE_MARK', - type: Error, - message: `The "${i}" performance mark has not been set` - })); + common.expectsError( + () => performance.measure('test', 'A', i), + { + code: 'ERR_INVALID_PERFORMANCE_MARK', + type: Error, + message: `The "${i}" performance mark has not been set` + }); }); performance.clearMeasures(); diff --git a/test/parallel/test-performanceobserver.js b/test/parallel/test-performanceobserver.js index 9b7dba5eb2a6f5..779e9740d7cc62 100644 --- a/test/parallel/test-performanceobserver.js +++ b/test/parallel/test-performanceobserver.js @@ -28,33 +28,34 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); { [1, null, undefined, {}, [], Infinity].forEach((i) => { - assert.throws(() => new PerformanceObserver(i), - common.expectsError({ - code: 'ERR_INVALID_CALLBACK', - type: TypeError, - message: 'Callback must be a function' - })); + common.expectsError(() => new PerformanceObserver(i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: 'Callback must be a function' + }); }); const observer = new PerformanceObserver(common.mustNotCall()); [1, null, undefined].forEach((i) => { //observer.observe(i); - assert.throws(() => observer.observe(i), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "options" argument must be of type Object' - })); + common.expectsError( + () => observer.observe(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "options" argument must be of type Object' + }); }); [1, undefined, null, {}, Infinity].forEach((i) => { - assert.throws(() => observer.observe({ entryTypes: i }), - common.expectsError({ - code: 'ERR_INVALID_OPT_VALUE', - type: TypeError, - message: 'The value "[object Object]" is invalid for ' + - 'option "entryTypes"' - })); + common.expectsError(() => observer.observe({ entryTypes: i }), + { + code: 'ERR_INVALID_OPT_VALUE', + type: TypeError, + message: 'The value "[object Object]" is invalid ' + + 'for option "entryTypes"' + }); }); } diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index fd622f8cabc564..22cb5891bb5d74 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -357,46 +357,46 @@ function isWarned(emitter) { // constructor throws if completer is not a function or undefined { const fi = new FakeInput(); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, completer: 'string is not valid' }); - }, common.expectsError({ + }, { type: TypeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); } // constructor throws if historySize is not a positive number { const fi = new FakeInput(); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: 'not a number' }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: -1 }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: NaN }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); } // duplicate lines are removed from history when diff --git a/test/parallel/test-ttywrap-invalid-fd.js b/test/parallel/test-ttywrap-invalid-fd.js index 44647590ccb413..f54adb1ddc8737 100644 --- a/test/parallel/test-ttywrap-invalid-fd.js +++ b/test/parallel/test-ttywrap-invalid-fd.js @@ -4,14 +4,13 @@ const assert = require('assert'); const fs = require('fs'); const tty = require('tty'); -assert.throws(() => { +common.expectsError(() => { new tty.WriteStream(-1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_FD', type: RangeError, message: '"fd" must be a positive integer: -1' -}) -); +}); const err_regex = common.isWindows ? /^Error: EBADF: bad file descriptor, uv_tty_init$/ : @@ -25,14 +24,13 @@ assert.throws(() => { new tty.WriteStream(fd); }, err_regex); -assert.throws(() => { +common.expectsError(() => { new tty.ReadStream(-1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_FD', type: RangeError, message: '"fd" must be a positive integer: -1' -}) -); +}); assert.throws(() => { let fd = 2; diff --git a/test/sequential/test-tls-lookup.js b/test/sequential/test-tls-lookup.js index fddbb20ee00f36..ff759cf2fe6bea 100644 --- a/test/sequential/test-tls-lookup.js +++ b/test/sequential/test-tls-lookup.js @@ -13,12 +13,12 @@ const tls = require('tls'); lookup: input }; - assert.throws(function() { + common.expectsError(function() { tls.connect(opts); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - })); + }); }); connectDoesNotThrow(common.mustCall(() => {})); From aa32bd08a8985cadc29ad98fbdd3d3813152d85f Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Fri, 8 Dec 2017 16:06:02 -0500 Subject: [PATCH 367/379] tools: prefer common.expectsError in tests Add lint rule to validate that common.expectsError(fn, err) is being used instead of assert.throws(fn, common.expectsError(err)); PR-URL: https://github.com/nodejs/node/pull/17557 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/.eslintrc.yaml | 1 + .../test-eslint-prefer-common-expectserror.js | 27 +++++++++++++++++++ .../prefer-common-expectserror.js | 21 +++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 test/parallel/test-eslint-prefer-common-expectserror.js create mode 100644 tools/eslint-rules/prefer-common-expectserror.js diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index aa320996aa4b16..7a5d002e1b51e8 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -10,6 +10,7 @@ rules: # Custom rules in tools/eslint-rules prefer-assert-iferror: error prefer-assert-methods: error + prefer-common-expectserror: error prefer-common-mustnotcall: error crypto-check: error inspector-check: error diff --git a/test/parallel/test-eslint-prefer-common-expectserror.js b/test/parallel/test-eslint-prefer-common-expectserror.js new file mode 100644 index 00000000000000..16ce66bc24e644 --- /dev/null +++ b/test/parallel/test-eslint-prefer-common-expectserror.js @@ -0,0 +1,27 @@ +'use strict'; + +require('../common'); + +const RuleTester = require('../../tools/eslint').RuleTester; +const rule = require('../../tools/eslint-rules/prefer-common-expectserror'); + +const message = 'Please use common.expectsError(fn, err) instead of ' + + 'assert.throws(fn, common.expectsError(err)).'; + +new RuleTester().run('prefer-common-expectserror', rule, { + valid: [ + 'assert.throws(fn, /[a-z]/)', + 'assert.throws(function () {}, function() {})', + 'common.expectsError(function() {}, err)' + ], + invalid: [ + { + code: 'assert.throws(function() {}, common.expectsError(err))', + errors: [{ message }] + }, + { + code: 'assert.throws(fn, common.expectsError(err))', + errors: [{ message }] + } + ] +}); diff --git a/tools/eslint-rules/prefer-common-expectserror.js b/tools/eslint-rules/prefer-common-expectserror.js new file mode 100644 index 00000000000000..f33241697a68ef --- /dev/null +++ b/tools/eslint-rules/prefer-common-expectserror.js @@ -0,0 +1,21 @@ +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const msg = 'Please use common.expectsError(fn, err) instead of ' + + 'assert.throws(fn, common.expectsError(err)).'; + +const astSelector = + 'CallExpression[arguments.length=2]' + + '[callee.object.name="assert"]' + + '[callee.property.name="throws"]' + + '[arguments.1.callee.object.name="common"]' + + '[arguments.1.callee.property.name="expectsError"]'; + +module.exports = function(context) { + return { + [astSelector]: (node) => context.report(node, msg) + }; +}; From 54cd7dfd88c64771c7df1f619dec0b64660262e4 Mon Sep 17 00:00:00 2001 From: Eugene Ostroukhov Date: Fri, 10 Nov 2017 16:01:00 -0800 Subject: [PATCH 368/379] inspector: Fix crash for WS connection Attaching WS session will now include a roundtrip onto the main thread to make sure there is no other session (e.g. JS bindings) This change also required refactoring WS socket implementation to better support scenarios like this. Fixes: https://github.com/nodejs/node/issues/16852 PR-URL: https://github.com/nodejs/node/pull/17085 Reviewed-By: James M Snell Reviewed-By: Timothy Gu --- src/inspector_agent.cc | 4 - src/inspector_agent.h | 1 - src/inspector_io.cc | 73 +- src/inspector_io.h | 8 +- src/inspector_socket.cc | 825 ++++++++++-------- src/inspector_socket.h | 96 +- src/inspector_socket_server.cc | 306 +++---- src/inspector_socket_server.h | 28 +- src/node.cc | 2 +- test/cctest/test_inspector_socket.cc | 601 ++++++------- test/cctest/test_inspector_socket_server.cc | 17 +- test/common/inspector-helper.js | 55 +- ...st-inspector-no-crash-ws-after-bindings.js | 30 + 13 files changed, 1022 insertions(+), 1024 deletions(-) create mode 100644 test/parallel/test-inspector-no-crash-ws-after-bindings.js diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 9677dca37b5939..216b43ca6c3379 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -548,10 +548,6 @@ void Agent::Connect(InspectorSessionDelegate* delegate) { client_->connectFrontend(delegate); } -bool Agent::IsConnected() { - return io_ && io_->IsConnected(); -} - void Agent::WaitForDisconnect() { CHECK_NE(client_, nullptr); client_->contextDestroyed(parent_env_->context()); diff --git a/src/inspector_agent.h b/src/inspector_agent.h index 29b9546b514aea..a2d61d0c8db28e 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -48,7 +48,6 @@ class Agent { bool IsStarted() { return !!client_; } // IO thread started, and client connected - bool IsConnected(); bool IsWaitingForConnect(); void WaitForDisconnect(); diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 538cbab3c9fe84..9af4458c6b20f1 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -136,7 +136,7 @@ class InspectorIoDelegate: public node::inspector::SocketServerDelegate { const std::string& script_name, bool wait); // Calls PostIncomingMessage() with appropriate InspectorAction: // kStartSession - bool StartSession(int session_id, const std::string& target_id) override; + void StartSession(int session_id, const std::string& target_id) override; // kSendMessage void MessageReceived(int session_id, const std::string& message) override; // kEndSession @@ -145,19 +145,22 @@ class InspectorIoDelegate: public node::inspector::SocketServerDelegate { std::vector GetTargetIds() override; std::string GetTargetTitle(const std::string& id) override; std::string GetTargetUrl(const std::string& id) override; - bool IsConnected() { return connected_; } void ServerDone() override { io_->ServerDone(); } + void AssignTransport(InspectorSocketServer* server) { + server_ = server; + } + private: InspectorIo* io_; - bool connected_; int session_id_; const std::string script_name_; const std::string script_path_; const std::string target_id_; bool waiting_; + InspectorSocketServer* server_; }; void InterruptCallback(v8::Isolate*, void* agent) { @@ -226,10 +229,6 @@ void InspectorIo::Stop() { DispatchMessages(); } -bool InspectorIo::IsConnected() { - return delegate_ != nullptr && delegate_->IsConnected(); -} - bool InspectorIo::IsStarted() { return platform_ != nullptr; } @@ -264,6 +263,7 @@ void InspectorIo::IoThreadAsyncCb(uv_async_t* async) { MessageQueue outgoing_message_queue; io->SwapBehindLock(&io->outgoing_message_queue_, &outgoing_message_queue); for (const auto& outgoing : outgoing_message_queue) { + int session_id = std::get<1>(outgoing); switch (std::get<0>(outgoing)) { case TransportAction::kKill: transport->TerminateConnections(); @@ -272,8 +272,14 @@ void InspectorIo::IoThreadAsyncCb(uv_async_t* async) { transport->Stop(nullptr); break; case TransportAction::kSendMessage: - std::string message = StringViewToUtf8(std::get<2>(outgoing)->string()); - transport->Send(std::get<1>(outgoing), message); + transport->Send(session_id, + StringViewToUtf8(std::get<2>(outgoing)->string())); + break; + case TransportAction::kAcceptSession: + transport->AcceptSession(session_id); + break; + case TransportAction::kDeclineSession: + transport->DeclineSession(session_id); break; } } @@ -293,6 +299,7 @@ void InspectorIo::ThreadMain() { wait_for_connect_); delegate_ = &delegate; Transport server(&delegate, &loop, options_.host_name(), options_.port()); + delegate.AssignTransport(&server); TransportAndIo queue_transport(&server, this); thread_req_.data = &queue_transport; if (!server.Start()) { @@ -308,6 +315,7 @@ void InspectorIo::ThreadMain() { uv_run(&loop, UV_RUN_DEFAULT); thread_req_.data = nullptr; CHECK_EQ(uv_loop_close(&loop), 0); + delegate.AssignTransport(nullptr); delegate_ = nullptr; } @@ -358,6 +366,21 @@ void InspectorIo::NotifyMessageReceived() { incoming_message_cond_.Broadcast(scoped_lock); } +TransportAction InspectorIo::Attach(int session_id) { + Agent* agent = parent_env_->inspector_agent(); + if (agent->delegate() != nullptr) + return TransportAction::kDeclineSession; + + CHECK_EQ(session_delegate_, nullptr); + session_id_ = session_id; + state_ = State::kConnected; + fprintf(stderr, "Debugger attached.\n"); + session_delegate_ = std::unique_ptr( + new IoSessionDelegate(this)); + agent->Connect(session_delegate_.get()); + return TransportAction::kAcceptSession; +} + void InspectorIo::DispatchMessages() { // This function can be reentered if there was an incoming message while // V8 was processing another inspector request (e.g. if the user is @@ -375,16 +398,14 @@ void InspectorIo::DispatchMessages() { MessageQueue::value_type task; std::swap(dispatching_message_queue_.front(), task); dispatching_message_queue_.pop_front(); + int id = std::get<1>(task); StringView message = std::get<2>(task)->string(); switch (std::get<0>(task)) { case InspectorAction::kStartSession: - CHECK_EQ(session_delegate_, nullptr); - session_id_ = std::get<1>(task); - state_ = State::kConnected; - fprintf(stderr, "Debugger attached.\n"); - session_delegate_ = std::unique_ptr( - new IoSessionDelegate(this)); - parent_env_->inspector_agent()->Connect(session_delegate_.get()); + Write(Attach(id), id, StringView()); + break; + case InspectorAction::kStartSessionUnconditionally: + Attach(id); break; case InspectorAction::kEndSession: CHECK_NE(session_delegate_, nullptr); @@ -428,22 +449,23 @@ InspectorIoDelegate::InspectorIoDelegate(InspectorIo* io, const std::string& script_name, bool wait) : io_(io), - connected_(false), session_id_(0), script_name_(script_name), script_path_(script_path), target_id_(GenerateID()), - waiting_(wait) { } + waiting_(wait), + server_(nullptr) { } -bool InspectorIoDelegate::StartSession(int session_id, +void InspectorIoDelegate::StartSession(int session_id, const std::string& target_id) { - if (connected_) - return false; - connected_ = true; - session_id_++; - io_->PostIncomingMessage(InspectorAction::kStartSession, session_id, ""); - return true; + session_id_ = session_id; + InspectorAction action = InspectorAction::kStartSession; + if (waiting_) { + action = InspectorAction::kStartSessionUnconditionally; + server_->AcceptSession(session_id); + } + io_->PostIncomingMessage(action, session_id, ""); } void InspectorIoDelegate::MessageReceived(int session_id, @@ -464,7 +486,6 @@ void InspectorIoDelegate::MessageReceived(int session_id, } void InspectorIoDelegate::EndSession(int session_id) { - connected_ = false; io_->PostIncomingMessage(InspectorAction::kEndSession, session_id, ""); } diff --git a/src/inspector_io.h b/src/inspector_io.h index 7c15466eed91ff..79ccc6095ffec3 100644 --- a/src/inspector_io.h +++ b/src/inspector_io.h @@ -36,6 +36,7 @@ class InspectorIoDelegate; enum class InspectorAction { kStartSession, + kStartSessionUnconditionally, // First attach with --inspect-brk kEndSession, kSendMessage }; @@ -44,7 +45,9 @@ enum class InspectorAction { enum class TransportAction { kKill, kSendMessage, - kStop + kStop, + kAcceptSession, + kDeclineSession }; class InspectorIo { @@ -61,7 +64,6 @@ class InspectorIo { void Stop(); bool IsStarted(); - bool IsConnected(); void WaitForDisconnect(); // Called from thread to queue an incoming message and trigger @@ -124,6 +126,8 @@ class InspectorIo { void WaitForFrontendMessageWhilePaused(); // Broadcast incoming_message_cond_ void NotifyMessageReceived(); + // Attach session to an inspector. Either kAcceptSession or kDeclineSession + TransportAction Attach(int session_id); const DebugOptions options_; diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index 49d337b70b1198..23b77f6aa5609f 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -1,4 +1,6 @@ #include "inspector_socket.h" + +#include "http_parser.h" #include "util-inl.h" #define NODE_WANT_INTERNALS 1 @@ -18,12 +20,71 @@ namespace node { namespace inspector { -static const char CLOSE_FRAME[] = {'\x88', '\x00'}; +class TcpHolder { + public: + using Pointer = std::unique_ptr; -enum ws_decode_result { - FRAME_OK, FRAME_INCOMPLETE, FRAME_CLOSE, FRAME_ERROR + static Pointer Accept(uv_stream_t* server, + InspectorSocket::DelegatePointer delegate); + void SetHandler(ProtocolHandler* handler); + int WriteRaw(const std::vector& buffer, uv_write_cb write_cb); + uv_tcp_t* tcp() { + return &tcp_; + } + InspectorSocket::Delegate* delegate(); + + private: + static TcpHolder* From(void* handle) { + return node::ContainerOf(&TcpHolder::tcp_, + reinterpret_cast(handle)); + } + static void OnClosed(uv_handle_t* handle); + static void OnDataReceivedCb(uv_stream_t* stream, ssize_t nread, + const uv_buf_t* buf); + static void DisconnectAndDispose(TcpHolder* holder); + explicit TcpHolder(InspectorSocket::DelegatePointer delegate); + ~TcpHolder() = default; + void ReclaimUvBuf(const uv_buf_t* buf, ssize_t read); + + uv_tcp_t tcp_; + const InspectorSocket::DelegatePointer delegate_; + ProtocolHandler* handler_; + std::vector buffer; +}; + + +class ProtocolHandler { + public: + ProtocolHandler(InspectorSocket* inspector, TcpHolder::Pointer tcp); + + virtual void AcceptUpgrade(const std::string& accept_key) = 0; + virtual void OnData(std::vector* data) = 0; + virtual void OnEof() = 0; + virtual void Write(const std::vector data) = 0; + virtual void CancelHandshake() = 0; + + std::string GetHost(); + + InspectorSocket* inspector() { + return inspector_; + } + + static void Shutdown(ProtocolHandler* handler) { + handler->Shutdown(); + } + + protected: + virtual ~ProtocolHandler() = default; + virtual void Shutdown() = 0; + int WriteRaw(const std::vector& buffer, uv_write_cb write_cb); + InspectorSocket::Delegate* delegate(); + + InspectorSocket* const inspector_; + TcpHolder::Pointer tcp_; }; +namespace { + #if DUMP_READS || DUMP_WRITES static void dump_hex(const char* buf, size_t len) { const char* ptr = buf; @@ -50,64 +111,52 @@ static void dump_hex(const char* buf, size_t len) { } #endif -static void remove_from_beginning(std::vector* buffer, size_t count) { - buffer->erase(buffer->begin(), buffer->begin() + count); -} - -static void dispose_inspector(uv_handle_t* handle) { - InspectorSocket* inspector = inspector_from_stream(handle); - inspector_cb close = - inspector->ws_mode ? inspector->ws_state->close_cb : nullptr; - inspector->buffer.clear(); - delete inspector->ws_state; - inspector->ws_state = nullptr; - if (close) { - close(inspector, 0); - } -} - -static void close_connection(InspectorSocket* inspector) { - uv_handle_t* socket = reinterpret_cast(&inspector->tcp); - if (!uv_is_closing(socket)) { - uv_read_stop(reinterpret_cast(socket)); - uv_close(socket, dispose_inspector); - } -} - -struct WriteRequest { - WriteRequest(InspectorSocket* inspector, const char* data, size_t size) - : inspector(inspector) - , storage(data, data + size) - , buf(uv_buf_init(&storage[0], storage.size())) {} +class WriteRequest { + public: + WriteRequest(ProtocolHandler* handler, const std::vector& buffer) + : handler(handler) + , storage(buffer) + , buf(uv_buf_init(storage.data(), storage.size())) {} static WriteRequest* from_write_req(uv_write_t* req) { return node::ContainerOf(&WriteRequest::req, req); } - InspectorSocket* const inspector; + static void Cleanup(uv_write_t* req, int status) { + delete WriteRequest::from_write_req(req); + } + + ProtocolHandler* const handler; std::vector storage; uv_write_t req; uv_buf_t buf; }; -// Cleanup -static void write_request_cleanup(uv_write_t* req, int status) { - delete WriteRequest::from_write_req(req); +void allocate_buffer(uv_handle_t* stream, size_t len, uv_buf_t* buf) { + *buf = uv_buf_init(new char[len], len); } -static int write_to_client(InspectorSocket* inspector, - const char* msg, - size_t len, - uv_write_cb write_cb = write_request_cleanup) { -#if DUMP_WRITES - printf("%s (%ld bytes):\n", __FUNCTION__, len); - dump_hex(msg, len); -#endif +static void remove_from_beginning(std::vector* buffer, size_t count) { + buffer->erase(buffer->begin(), buffer->begin() + count); +} - // Freed in write_request_cleanup - WriteRequest* wr = new WriteRequest(inspector, msg, len); - uv_stream_t* stream = reinterpret_cast(&inspector->tcp); - return uv_write(&wr->req, stream, &wr->buf, 1, write_cb) < 0; +// Cleanup + +static const char CLOSE_FRAME[] = {'\x88', '\x00'}; + +enum ws_decode_result { + FRAME_OK, FRAME_INCOMPLETE, FRAME_CLOSE, FRAME_ERROR +}; + +static void generate_accept_string(const std::string& client_key, + char (*buffer)[ACCEPT_KEY_LENGTH]) { + // Magic string from websockets spec. + static const char ws_magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + std::string input(client_key + ws_magic); + char hash[SHA_DIGEST_LENGTH]; + SHA1(reinterpret_cast(&input[0]), input.size(), + reinterpret_cast(hash)); + node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer)); } // Constants for hybi-10 frame format. @@ -134,11 +183,11 @@ const size_t kTwoBytePayloadLengthField = 126; const size_t kEightBytePayloadLengthField = 127; const size_t kMaskingKeyWidthInBytes = 4; -static std::vector encode_frame_hybi17(const char* message, - size_t data_length) { +static std::vector encode_frame_hybi17(const std::vector& message) { std::vector frame; OpCode op_code = kOpCodeText; frame.push_back(kFinalBit | op_code); + const size_t data_length = message.size(); if (data_length <= kMaxSingleBytePayloadLength) { frame.push_back(static_cast(data_length)); } else if (data_length <= 0xFFFF) { @@ -158,7 +207,7 @@ static std::vector encode_frame_hybi17(const char* message, extended_payload_length + 8); CHECK_EQ(0, remaining); } - frame.insert(frame.end(), message, message + data_length); + frame.insert(frame.end(), message.begin(), message.end()); return frame; } @@ -248,272 +297,368 @@ static ws_decode_result decode_frame_hybi17(const std::vector& buffer, return closed ? FRAME_CLOSE : FRAME_OK; } -static void invoke_read_callback(InspectorSocket* inspector, - int status, const uv_buf_t* buf) { - if (inspector->ws_state->read_cb) { - inspector->ws_state->read_cb( - reinterpret_cast(&inspector->tcp), status, buf); + +// WS protocol +class WsHandler : public ProtocolHandler { + public: + WsHandler(InspectorSocket* inspector, TcpHolder::Pointer tcp) + : ProtocolHandler(inspector, std::move(tcp)), + OnCloseSent(&WsHandler::WaitForCloseReply), + OnCloseRecieved(&WsHandler::CloseFrameReceived), + dispose_(false) { } + + void AcceptUpgrade(const std::string& accept_key) override { } + void CancelHandshake() override {} + + void OnEof() override { + tcp_.reset(); + if (dispose_) + delete this; } -} -static void shutdown_complete(InspectorSocket* inspector) { - close_connection(inspector); -} + void OnData(std::vector* data) override { + // 1. Parse. + int processed = 0; + do { + processed = ParseWsFrames(*data); + // 2. Fix the data size & length + if (processed > 0) { + remove_from_beginning(data, processed); + } + } while (processed > 0 && !data->empty()); + } -static void on_close_frame_written(uv_write_t* req, int status) { - WriteRequest* wr = WriteRequest::from_write_req(req); - InspectorSocket* inspector = wr->inspector; - delete wr; - inspector->ws_state->close_sent = true; - if (inspector->ws_state->received_close) { - shutdown_complete(inspector); + void Write(const std::vector data) { + std::vector output = encode_frame_hybi17(data); + WriteRaw(output, WriteRequest::Cleanup); } -} -static void close_frame_received(InspectorSocket* inspector) { - inspector->ws_state->received_close = true; - if (!inspector->ws_state->close_sent) { - invoke_read_callback(inspector, 0, 0); - write_to_client(inspector, CLOSE_FRAME, sizeof(CLOSE_FRAME), - on_close_frame_written); - } else { - shutdown_complete(inspector); + protected: + void Shutdown() override { + if (tcp_) { + dispose_ = true; + SendClose(); + } else { + delete this; + } } -} -static int parse_ws_frames(InspectorSocket* inspector) { - int bytes_consumed = 0; - std::vector output; - bool compressed = false; - - ws_decode_result r = decode_frame_hybi17(inspector->buffer, - true /* client_frame */, - &bytes_consumed, &output, - &compressed); - // Compressed frame means client is ignoring the headers and misbehaves - if (compressed || r == FRAME_ERROR) { - invoke_read_callback(inspector, UV_EPROTO, nullptr); - close_connection(inspector); - bytes_consumed = 0; - } else if (r == FRAME_CLOSE) { - close_frame_received(inspector); - bytes_consumed = 0; - } else if (r == FRAME_OK && inspector->ws_state->alloc_cb - && inspector->ws_state->read_cb) { - uv_buf_t buffer; - size_t len = output.size(); - inspector->ws_state->alloc_cb( - reinterpret_cast(&inspector->tcp), - len, &buffer); - CHECK_GE(buffer.len, len); - memcpy(buffer.base, &output[0], len); - invoke_read_callback(inspector, len, &buffer); - } - return bytes_consumed; -} + private: + using Callback = void (WsHandler::*)(void); -static void prepare_buffer(uv_handle_t* stream, size_t len, uv_buf_t* buf) { - *buf = uv_buf_init(new char[len], len); -} + static void OnCloseFrameWritten(uv_write_t* req, int status) { + WriteRequest* wr = WriteRequest::from_write_req(req); + WsHandler* handler = static_cast(wr->handler); + delete wr; + Callback cb = handler->OnCloseSent; + (handler->*cb)(); + } -static void reclaim_uv_buf(InspectorSocket* inspector, const uv_buf_t* buf, - ssize_t read) { - if (read > 0) { - std::vector& buffer = inspector->buffer; - buffer.insert(buffer.end(), buf->base, buf->base + read); + void WaitForCloseReply() { + OnCloseRecieved = &WsHandler::OnEof; } - delete[] buf->base; -} -static void websockets_data_cb(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) { - InspectorSocket* inspector = inspector_from_stream(stream); - reclaim_uv_buf(inspector, buf, nread); - if (nread < 0 || nread == UV_EOF) { - inspector->connection_eof = true; - if (!inspector->shutting_down && inspector->ws_state->read_cb) { - inspector->ws_state->read_cb(stream, nread, nullptr); + void SendClose() { + WriteRaw(std::vector(CLOSE_FRAME, CLOSE_FRAME + sizeof(CLOSE_FRAME)), + OnCloseFrameWritten); + } + + void CloseFrameReceived() { + OnCloseSent = &WsHandler::OnEof; + SendClose(); + } + + int ParseWsFrames(const std::vector& buffer) { + int bytes_consumed = 0; + std::vector output; + bool compressed = false; + + ws_decode_result r = decode_frame_hybi17(buffer, + true /* client_frame */, + &bytes_consumed, &output, + &compressed); + // Compressed frame means client is ignoring the headers and misbehaves + if (compressed || r == FRAME_ERROR) { + OnEof(); + bytes_consumed = 0; + } else if (r == FRAME_CLOSE) { + (this->*OnCloseRecieved)(); + bytes_consumed = 0; + } else if (r == FRAME_OK) { + delegate()->OnWsFrame(output); } - if (inspector->ws_state->close_sent && - !inspector->ws_state->received_close) { - shutdown_complete(inspector); // invoke callback + return bytes_consumed; + } + + + Callback OnCloseSent; + Callback OnCloseRecieved; + bool dispose_; +}; + +// HTTP protocol +class HttpEvent { + public: + HttpEvent(const std::string& path, bool upgrade, + bool isGET, const std::string& ws_key) : path(path), + upgrade(upgrade), + isGET(isGET), + ws_key(ws_key) { } + + std::string path; + bool upgrade; + bool isGET; + std::string ws_key; + std::string current_header_; +}; + +class HttpHandler : public ProtocolHandler { + public: + explicit HttpHandler(InspectorSocket* inspector, TcpHolder::Pointer tcp) + : ProtocolHandler(inspector, std::move(tcp)), + parsing_value_(false) { + http_parser_init(&parser_, HTTP_REQUEST); + http_parser_settings_init(&parser_settings); + parser_settings.on_header_field = OnHeaderField; + parser_settings.on_header_value = OnHeaderValue; + parser_settings.on_message_complete = OnMessageComplete; + parser_settings.on_url = OnPath; + } + + void AcceptUpgrade(const std::string& accept_key) override { + char accept_string[ACCEPT_KEY_LENGTH]; + generate_accept_string(accept_key, &accept_string); + const char accept_ws_prefix[] = "HTTP/1.1 101 Switching Protocols\r\n" + "Upgrade: websocket\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Accept: "; + const char accept_ws_suffix[] = "\r\n\r\n"; + std::vector reply(accept_ws_prefix, + accept_ws_prefix + sizeof(accept_ws_prefix) - 1); + reply.insert(reply.end(), accept_string, + accept_string + sizeof(accept_string)); + reply.insert(reply.end(), accept_ws_suffix, + accept_ws_suffix + sizeof(accept_ws_suffix) - 1); + if (WriteRaw(reply, WriteRequest::Cleanup) >= 0) { + inspector_->SwitchProtocol(new WsHandler(inspector_, std::move(tcp_))); + } else { + tcp_.reset(); } - } else { - #if DUMP_READS - printf("%s read %ld bytes\n", __FUNCTION__, nread); - if (nread > 0) { - dump_hex(inspector->buffer.data() + inspector->buffer.size() - nread, - nread); - } - #endif - // 2. Parse. - int processed = 0; - do { - processed = parse_ws_frames(inspector); - // 3. Fix the buffer size & length - if (processed > 0) { - remove_from_beginning(&inspector->buffer, processed); + } + + void CancelHandshake() { + const char HANDSHAKE_FAILED_RESPONSE[] = + "HTTP/1.0 400 Bad Request\r\n" + "Content-Type: text/html; charset=UTF-8\r\n\r\n" + "WebSockets request was expected\r\n"; + WriteRaw(std::vector(HANDSHAKE_FAILED_RESPONSE, + HANDSHAKE_FAILED_RESPONSE + sizeof(HANDSHAKE_FAILED_RESPONSE) - 1), + ThenCloseAndReportFailure); + } + + + void OnEof() override { + tcp_.reset(); + } + + void OnData(std::vector* data) override { + http_parser_execute(&parser_, &parser_settings, data->data(), data->size()); + data->clear(); + if (parser_.http_errno != HPE_OK) { + CancelHandshake(); + } + // Event handling may delete *this + std::vector events; + std::swap(events, events_); + for (const HttpEvent& event : events) { + bool shouldContinue = event.isGET && !event.upgrade; + if (!event.isGET) { + CancelHandshake(); + } else if (!event.upgrade) { + delegate()->OnHttpGet(event.path); + } else if (event.ws_key.empty()) { + CancelHandshake(); + } else { + delegate()->OnSocketUpgrade(event.path, event.ws_key); } - } while (processed > 0 && !inspector->buffer.empty()); + if (!shouldContinue) + return; + } } -} -int inspector_read_start(InspectorSocket* inspector, - uv_alloc_cb alloc_cb, uv_read_cb read_cb) { - CHECK(inspector->ws_mode); - CHECK(!inspector->shutting_down || read_cb == nullptr); - inspector->ws_state->close_sent = false; - inspector->ws_state->alloc_cb = alloc_cb; - inspector->ws_state->read_cb = read_cb; - int err = - uv_read_start(reinterpret_cast(&inspector->tcp), - prepare_buffer, - websockets_data_cb); - if (err < 0) { - close_connection(inspector); - } - return err; -} + void Write(const std::vector data) override { + WriteRaw(data, WriteRequest::Cleanup); + } -void inspector_read_stop(InspectorSocket* inspector) { - uv_read_stop(reinterpret_cast(&inspector->tcp)); - inspector->ws_state->alloc_cb = nullptr; - inspector->ws_state->read_cb = nullptr; -} + protected: + void Shutdown() override { + delete this; + } -static void generate_accept_string(const std::string& client_key, - char (*buffer)[ACCEPT_KEY_LENGTH]) { - // Magic string from websockets spec. - static const char ws_magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - std::string input(client_key + ws_magic); - char hash[SHA_DIGEST_LENGTH]; - SHA1(reinterpret_cast(&input[0]), input.size(), - reinterpret_cast(hash)); - node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer)); -} + private: + static void ThenCloseAndReportFailure(uv_write_t* req, int status) { + ProtocolHandler* handler = WriteRequest::from_write_req(req)->handler; + WriteRequest::Cleanup(req, status); + handler->inspector()->SwitchProtocol(nullptr); + } -static int header_value_cb(http_parser* parser, const char* at, size_t length) { - static const char SEC_WEBSOCKET_KEY_HEADER[] = "Sec-WebSocket-Key"; - auto inspector = static_cast(parser->data); - auto state = inspector->http_parsing_state; - state->parsing_value = true; - if (state->current_header.size() == sizeof(SEC_WEBSOCKET_KEY_HEADER) - 1 && - node::StringEqualNoCaseN(state->current_header.data(), - SEC_WEBSOCKET_KEY_HEADER, - sizeof(SEC_WEBSOCKET_KEY_HEADER) - 1)) { - state->ws_key.append(at, length); - } - return 0; -} + static int OnHeaderValue(http_parser* parser, const char* at, size_t length) { + static const char SEC_WEBSOCKET_KEY_HEADER[] = "Sec-WebSocket-Key"; + HttpHandler* handler = From(parser); + handler->parsing_value_ = true; + if (handler->current_header_.size() == + sizeof(SEC_WEBSOCKET_KEY_HEADER) - 1 && + node::StringEqualNoCaseN(handler->current_header_.data(), + SEC_WEBSOCKET_KEY_HEADER, + sizeof(SEC_WEBSOCKET_KEY_HEADER) - 1)) { + handler->ws_key_.append(at, length); + } + return 0; + } -static int header_field_cb(http_parser* parser, const char* at, size_t length) { - auto inspector = static_cast(parser->data); - auto state = inspector->http_parsing_state; - if (state->parsing_value) { - state->parsing_value = false; - state->current_header.clear(); + static int OnHeaderField(http_parser* parser, const char* at, size_t length) { + HttpHandler* handler = From(parser); + if (handler->parsing_value_) { + handler->parsing_value_ = false; + handler->current_header_.clear(); + } + handler->current_header_.append(at, length); + return 0; } - state->current_header.append(at, length); - return 0; -} -static int path_cb(http_parser* parser, const char* at, size_t length) { - auto inspector = static_cast(parser->data); - auto state = inspector->http_parsing_state; - state->path.append(at, length); - return 0; -} + static int OnPath(http_parser* parser, const char* at, size_t length) { + HttpHandler* handler = From(parser); + handler->path_.append(at, length); + return 0; + } + + static HttpHandler* From(http_parser* parser) { + return node::ContainerOf(&HttpHandler::parser_, parser); + } + + static int OnMessageComplete(http_parser* parser) { + // Event needs to be fired after the parser is done. + HttpHandler* handler = From(parser); + handler->events_.push_back(HttpEvent(handler->path_, parser->upgrade, + parser->method == HTTP_GET, + handler->ws_key_)); + handler->path_ = ""; + handler->ws_key_ = ""; + handler->parsing_value_ = false; + handler->current_header_ = ""; + + return 0; + } + + bool parsing_value_; + http_parser parser_; + http_parser_settings parser_settings; + std::vector events_; + std::string current_header_; + std::string ws_key_; + std::string path_; +}; + +} // namespace -static void handshake_complete(InspectorSocket* inspector) { - uv_read_stop(reinterpret_cast(&inspector->tcp)); - handshake_cb callback = inspector->http_parsing_state->callback; - inspector->ws_state = new ws_state_s(); - inspector->ws_mode = true; - callback(inspector, kInspectorHandshakeUpgraded, - inspector->http_parsing_state->path); +// Any protocol +ProtocolHandler::ProtocolHandler(InspectorSocket* inspector, + TcpHolder::Pointer tcp) + : inspector_(inspector), tcp_(std::move(tcp)) { + CHECK_NE(nullptr, tcp_); + tcp_->SetHandler(this); } -static void cleanup_http_parsing_state(InspectorSocket* inspector) { - delete inspector->http_parsing_state; - inspector->http_parsing_state = nullptr; +int ProtocolHandler::WriteRaw(const std::vector& buffer, + uv_write_cb write_cb) { + return tcp_->WriteRaw(buffer, write_cb); } -static void report_handshake_failure_cb(uv_handle_t* handle) { - dispose_inspector(handle); - InspectorSocket* inspector = inspector_from_stream(handle); - handshake_cb cb = inspector->http_parsing_state->callback; - cleanup_http_parsing_state(inspector); - cb(inspector, kInspectorHandshakeFailed, std::string()); +InspectorSocket::Delegate* ProtocolHandler::delegate() { + return tcp_->delegate(); } -static void close_and_report_handshake_failure(InspectorSocket* inspector) { - uv_handle_t* socket = reinterpret_cast(&inspector->tcp); - if (uv_is_closing(socket)) { - report_handshake_failure_cb(socket); +std::string ProtocolHandler::GetHost() { + char ip[INET6_ADDRSTRLEN]; + sockaddr_storage addr; + int len = sizeof(addr); + int err = uv_tcp_getsockname(tcp_->tcp(), + reinterpret_cast(&addr), + &len); + if (err != 0) + return ""; + if (addr.ss_family == AF_INET6) { + const sockaddr_in6* v6 = reinterpret_cast(&addr); + err = uv_ip6_name(v6, ip, sizeof(ip)); } else { - uv_read_stop(reinterpret_cast(socket)); - uv_close(socket, report_handshake_failure_cb); + const sockaddr_in* v4 = reinterpret_cast(&addr); + err = uv_ip4_name(v4, ip, sizeof(ip)); + } + if (err != 0) + return ""; + return ip; +} + +// RAII uv_tcp_t wrapper +TcpHolder::TcpHolder(InspectorSocket::DelegatePointer delegate) + : tcp_(), + delegate_(std::move(delegate)), + handler_(nullptr) { } + +// static +TcpHolder::Pointer TcpHolder::Accept( + uv_stream_t* server, + InspectorSocket::DelegatePointer delegate) { + TcpHolder* result = new TcpHolder(std::move(delegate)); + uv_stream_t* tcp = reinterpret_cast(&result->tcp_); + int err = uv_tcp_init(server->loop, &result->tcp_); + if (err == 0) { + err = uv_accept(server, tcp); + } + if (err == 0) { + err = uv_read_start(tcp, allocate_buffer, OnDataReceivedCb); + } + if (err == 0) { + return { result, DisconnectAndDispose }; + } else { + fprintf(stderr, "[%s:%d@%s]\n", __FILE__, __LINE__, __FUNCTION__); + + delete result; + return { nullptr, nullptr }; } } -static void then_close_and_report_failure(uv_write_t* req, int status) { - InspectorSocket* inspector = WriteRequest::from_write_req(req)->inspector; - write_request_cleanup(req, status); - close_and_report_handshake_failure(inspector); +void TcpHolder::SetHandler(ProtocolHandler* handler) { + handler_ = handler; } -static void handshake_failed(InspectorSocket* inspector) { - const char HANDSHAKE_FAILED_RESPONSE[] = - "HTTP/1.0 400 Bad Request\r\n" - "Content-Type: text/html; charset=UTF-8\r\n\r\n" - "WebSockets request was expected\r\n"; - write_to_client(inspector, HANDSHAKE_FAILED_RESPONSE, - sizeof(HANDSHAKE_FAILED_RESPONSE) - 1, - then_close_and_report_failure); +int TcpHolder::WriteRaw(const std::vector& buffer, uv_write_cb write_cb) { +#if DUMP_WRITES + printf("%s (%ld bytes):\n", __FUNCTION__, buffer.size()); + dump_hex(buffer.data(), buffer.size()); + printf("\n"); +#endif + + // Freed in write_request_cleanup + WriteRequest* wr = new WriteRequest(handler_, buffer); + uv_stream_t* stream = reinterpret_cast(&tcp_); + int err = uv_write(&wr->req, stream, &wr->buf, 1, write_cb); + if (err < 0) + delete wr; + return err < 0; } -// init_handshake references message_complete_cb -static void init_handshake(InspectorSocket* socket); - -static int message_complete_cb(http_parser* parser) { - InspectorSocket* inspector = static_cast(parser->data); - struct http_parsing_state_s* state = inspector->http_parsing_state; - if (parser->method != HTTP_GET) { - handshake_failed(inspector); - } else if (!parser->upgrade) { - if (state->callback(inspector, kInspectorHandshakeHttpGet, state->path)) { - init_handshake(inspector); - } else { - handshake_failed(inspector); - } - } else if (state->ws_key.empty()) { - handshake_failed(inspector); - } else if (state->callback(inspector, kInspectorHandshakeUpgrading, - state->path)) { - char accept_string[ACCEPT_KEY_LENGTH]; - generate_accept_string(state->ws_key, &accept_string); - const char accept_ws_prefix[] = "HTTP/1.1 101 Switching Protocols\r\n" - "Upgrade: websocket\r\n" - "Connection: Upgrade\r\n" - "Sec-WebSocket-Accept: "; - const char accept_ws_suffix[] = "\r\n\r\n"; - std::string reply(accept_ws_prefix, sizeof(accept_ws_prefix) - 1); - reply.append(accept_string, sizeof(accept_string)); - reply.append(accept_ws_suffix, sizeof(accept_ws_suffix) - 1); - if (write_to_client(inspector, &reply[0], reply.size()) >= 0) { - handshake_complete(inspector); - inspector->http_parsing_state->done = true; - } else { - close_and_report_handshake_failure(inspector); - } - } else { - handshake_failed(inspector); - } - return 0; +InspectorSocket::Delegate* TcpHolder::delegate() { + return delegate_.get(); +} + +// static +void TcpHolder::OnClosed(uv_handle_t* handle) { + delete From(handle); } -static void data_received_cb(uv_stream_t* tcp, ssize_t nread, - const uv_buf_t* buf) { +void TcpHolder::OnDataReceivedCb(uv_stream_t* tcp, ssize_t nread, + const uv_buf_t* buf) { #if DUMP_READS if (nread >= 0) { printf("%s (%ld bytes)\n", __FUNCTION__, nread); @@ -522,107 +667,65 @@ static void data_received_cb(uv_stream_t* tcp, ssize_t nread, printf("[%s:%d] %s\n", __FUNCTION__, __LINE__, uv_err_name(nread)); } #endif - InspectorSocket* inspector = inspector_from_stream(tcp); - reclaim_uv_buf(inspector, buf, nread); + TcpHolder* holder = From(tcp); + holder->ReclaimUvBuf(buf, nread); if (nread < 0 || nread == UV_EOF) { - close_and_report_handshake_failure(inspector); + holder->handler_->OnEof(); } else { - http_parsing_state_s* state = inspector->http_parsing_state; - http_parser* parser = &state->parser; - http_parser_execute(parser, &state->parser_settings, - inspector->buffer.data(), nread); - remove_from_beginning(&inspector->buffer, nread); - if (parser->http_errno != HPE_OK) { - handshake_failed(inspector); - } - if (inspector->http_parsing_state->done) { - cleanup_http_parsing_state(inspector); - } + holder->handler_->OnData(&holder->buffer); } } -static void init_handshake(InspectorSocket* socket) { - http_parsing_state_s* state = socket->http_parsing_state; - CHECK_NE(state, nullptr); - state->current_header.clear(); - state->ws_key.clear(); - state->path.clear(); - state->done = false; - http_parser_init(&state->parser, HTTP_REQUEST); - state->parser.data = socket; - http_parser_settings* settings = &state->parser_settings; - http_parser_settings_init(settings); - settings->on_header_field = header_field_cb; - settings->on_header_value = header_value_cb; - settings->on_message_complete = message_complete_cb; - settings->on_url = path_cb; +// static +void TcpHolder::DisconnectAndDispose(TcpHolder* holder) { + uv_handle_t* handle = reinterpret_cast(&holder->tcp_); + uv_close(handle, OnClosed); } -int inspector_accept(uv_stream_t* server, InspectorSocket* socket, - handshake_cb callback) { - CHECK_NE(callback, nullptr); - CHECK_EQ(socket->http_parsing_state, nullptr); - - socket->http_parsing_state = new http_parsing_state_s(); - uv_stream_t* tcp = reinterpret_cast(&socket->tcp); - int err = uv_tcp_init(server->loop, &socket->tcp); - - if (err == 0) { - err = uv_accept(server, tcp); - } - if (err == 0) { - init_handshake(socket); - socket->http_parsing_state->callback = callback; - err = uv_read_start(tcp, prepare_buffer, - data_received_cb); - } - if (err != 0) { - uv_close(reinterpret_cast(tcp), nullptr); +void TcpHolder::ReclaimUvBuf(const uv_buf_t* buf, ssize_t read) { + if (read > 0) { + buffer.insert(buffer.end(), buf->base, buf->base + read); } - return err; + delete[] buf->base; } -void inspector_write(InspectorSocket* inspector, const char* data, - size_t len) { - if (inspector->ws_mode) { - std::vector output = encode_frame_hybi17(data, len); - write_to_client(inspector, &output[0], output.size()); +// Public interface +InspectorSocket::InspectorSocket() + : protocol_handler_(nullptr, ProtocolHandler::Shutdown) { } + +InspectorSocket::~InspectorSocket() = default; + +// static +InspectorSocket::Pointer InspectorSocket::Accept(uv_stream_t* server, + DelegatePointer delegate) { + auto tcp = TcpHolder::Accept(server, std::move(delegate)); + if (tcp) { + InspectorSocket* inspector = new InspectorSocket(); + inspector->SwitchProtocol(new HttpHandler(inspector, std::move(tcp))); + return InspectorSocket::Pointer(inspector); } else { - write_to_client(inspector, data, len); + return InspectorSocket::Pointer(nullptr); } } -void inspector_close(InspectorSocket* inspector, - inspector_cb callback) { - // libuv throws assertions when closing stream that's already closed - we - // need to do the same. - CHECK(!uv_is_closing(reinterpret_cast(&inspector->tcp))); - CHECK(!inspector->shutting_down); - inspector->shutting_down = true; - inspector->ws_state->close_cb = callback; - if (inspector->connection_eof) { - close_connection(inspector); - } else { - inspector_read_stop(inspector); - write_to_client(inspector, CLOSE_FRAME, sizeof(CLOSE_FRAME), - on_close_frame_written); - inspector_read_start(inspector, nullptr, nullptr); - } +void InspectorSocket::AcceptUpgrade(const std::string& ws_key) { + protocol_handler_->AcceptUpgrade(ws_key); +} + +void InspectorSocket::CancelHandshake() { + protocol_handler_->CancelHandshake(); +} + +std::string InspectorSocket::GetHost() { + return protocol_handler_->GetHost(); } -bool inspector_is_active(const InspectorSocket* inspector) { - const uv_handle_t* tcp = - reinterpret_cast(&inspector->tcp); - return !inspector->shutting_down && !uv_is_closing(tcp); +void InspectorSocket::SwitchProtocol(ProtocolHandler* handler) { + protocol_handler_.reset(std::move(handler)); } -void InspectorSocket::reinit() { - http_parsing_state = nullptr; - ws_state = nullptr; - buffer.clear(); - ws_mode = false; - shutting_down = false; - connection_eof = false; +void InspectorSocket::Write(const char* data, size_t len) { + protocol_handler_->Write(std::vector(data, data + len)); } } // namespace inspector diff --git a/src/inspector_socket.h b/src/inspector_socket.h index f93150d6f9a1cf..1a3411435ee2c5 100644 --- a/src/inspector_socket.h +++ b/src/inspector_socket.h @@ -1,7 +1,6 @@ #ifndef SRC_INSPECTOR_SOCKET_H_ #define SRC_INSPECTOR_SOCKET_H_ -#include "http_parser.h" #include "util-inl.h" #include "uv.h" @@ -11,88 +10,41 @@ namespace node { namespace inspector { -enum inspector_handshake_event { - kInspectorHandshakeUpgrading, - kInspectorHandshakeUpgraded, - kInspectorHandshakeHttpGet, - kInspectorHandshakeFailed -}; - -class InspectorSocket; - -typedef void (*inspector_cb)(InspectorSocket*, int); -// Notifies as handshake is progressing. Returning false as a response to -// kInspectorHandshakeUpgrading or kInspectorHandshakeHttpGet event will abort -// the connection. inspector_write can be used from the callback. -typedef bool (*handshake_cb)(InspectorSocket*, - enum inspector_handshake_event state, - const std::string& path); - -struct http_parsing_state_s { - http_parser parser; - http_parser_settings parser_settings; - handshake_cb callback; - bool done; - bool parsing_value; - std::string ws_key; - std::string path; - std::string current_header; -}; - -struct ws_state_s { - uv_alloc_cb alloc_cb; - uv_read_cb read_cb; - inspector_cb close_cb; - bool close_sent; - bool received_close; -}; +class ProtocolHandler; // HTTP Wrapper around a uv_tcp_t class InspectorSocket { public: - InspectorSocket() : data(nullptr), http_parsing_state(nullptr), - ws_state(nullptr), buffer(0), ws_mode(false), - shutting_down(false), connection_eof(false) { } - void reinit(); - void* data; - struct http_parsing_state_s* http_parsing_state; - struct ws_state_s* ws_state; - std::vector buffer; - uv_tcp_t tcp; - bool ws_mode; - bool shutting_down; - bool connection_eof; + class Delegate { + public: + virtual void OnHttpGet(const std::string& path) = 0; + virtual void OnSocketUpgrade(const std::string& path, + const std::string& accept_key) = 0; + virtual void OnWsFrame(const std::vector& frame) = 0; + virtual ~Delegate() {} + }; - private: - DISALLOW_COPY_AND_ASSIGN(InspectorSocket); -}; + using DelegatePointer = std::unique_ptr; + using Pointer = std::unique_ptr; + + static Pointer Accept(uv_stream_t* server, DelegatePointer delegate); -int inspector_accept(uv_stream_t* server, InspectorSocket* inspector, - handshake_cb callback); + ~InspectorSocket(); -void inspector_close(InspectorSocket* inspector, - inspector_cb callback); + void AcceptUpgrade(const std::string& accept_key); + void CancelHandshake(); + void Write(const char* data, size_t len); + void SwitchProtocol(ProtocolHandler* handler); + std::string GetHost(); -// Callbacks will receive stream handles. Use inspector_from_stream to get -// InspectorSocket* from the stream handle. -int inspector_read_start(InspectorSocket* inspector, uv_alloc_cb, - uv_read_cb); -void inspector_read_stop(InspectorSocket* inspector); -void inspector_write(InspectorSocket* inspector, - const char* data, size_t len); -bool inspector_is_active(const InspectorSocket* inspector); + private: + InspectorSocket(); -inline InspectorSocket* inspector_from_stream(uv_tcp_t* stream) { - return node::ContainerOf(&InspectorSocket::tcp, stream); -} + std::unique_ptr protocol_handler_; -inline InspectorSocket* inspector_from_stream(uv_stream_t* stream) { - return inspector_from_stream(reinterpret_cast(stream)); -} + DISALLOW_COPY_AND_ASSIGN(InspectorSocket); +}; -inline InspectorSocket* inspector_from_stream(uv_handle_t* stream) { - return inspector_from_stream(reinterpret_cast(stream)); -} } // namespace inspector } // namespace node diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index 958c41a654adff..bf114251cb134b 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -33,7 +33,6 @@ std::string FormatWsAddress(const std::string& host, int port, return url.str(); } - namespace { static const uint8_t PROTOCOL_JSON[] = { @@ -114,8 +113,8 @@ void SendHttpResponse(InspectorSocket* socket, const std::string& response) { "\r\n"; char header[sizeof(HEADERS) + 20]; int header_len = snprintf(header, sizeof(header), HEADERS, response.size()); - inspector_write(socket, header, header_len); - inspector_write(socket, response.data(), response.size()); + socket->Write(header, header_len); + socket->Write(response.data(), response.size()); } void SendVersionResponse(InspectorSocket* socket) { @@ -145,28 +144,6 @@ void SendProtocolJson(InspectorSocket* socket) { CHECK_EQ(Z_OK, inflateEnd(&strm)); SendHttpResponse(socket, data); } - -int GetSocketHost(uv_tcp_t* socket, std::string* out_host) { - char ip[INET6_ADDRSTRLEN]; - sockaddr_storage addr; - int len = sizeof(addr); - int err = uv_tcp_getsockname(socket, - reinterpret_cast(&addr), - &len); - if (err != 0) - return err; - if (addr.ss_family == AF_INET6) { - const sockaddr_in6* v6 = reinterpret_cast(&addr); - err = uv_ip6_name(v6, ip, sizeof(ip)); - } else { - const sockaddr_in* v4 = reinterpret_cast(&addr); - err = uv_ip4_name(v4, ip, sizeof(ip)); - } - if (err != 0) - return err; - *out_host = ip; - return err; -} } // namespace @@ -209,46 +186,58 @@ class Closer { class SocketSession { public: - static int Accept(InspectorSocketServer* server, int server_port, - uv_stream_t* server_socket); + SocketSession(InspectorSocketServer* server, int id, int server_port); + void Close() { + ws_socket_.reset(); + } void Send(const std::string& message); - void Close(); - + void Own(InspectorSocket::Pointer ws_socket) { + ws_socket_ = std::move(ws_socket); + } int id() const { return id_; } - bool IsForTarget(const std::string& target_id) const { - return target_id_ == target_id; + int server_port() { + return server_port_; } - static int ServerPortForClient(InspectorSocket* client) { - return From(client)->server_port_; + InspectorSocket* ws_socket() { + return ws_socket_.get(); } - - private: - SocketSession(InspectorSocketServer* server, int server_port); - static SocketSession* From(InspectorSocket* socket) { - return node::ContainerOf(&SocketSession::socket_, socket); + void set_ws_key(const std::string& ws_key) { + ws_key_ = ws_key; + } + void Accept() { + ws_socket_->AcceptUpgrade(ws_key_); + } + void Decline() { + ws_socket_->CancelHandshake(); } - enum class State { kHttp, kWebSocket, kClosing, kEOF, kDeclined }; - static bool HandshakeCallback(InspectorSocket* socket, - enum inspector_handshake_event state, - const std::string& path); - static void ReadCallback(uv_stream_t* stream, ssize_t read, - const uv_buf_t* buf); - static void CloseCallback(InspectorSocket* socket, int code); + class Delegate : public InspectorSocket::Delegate { + public: + Delegate(InspectorSocketServer* server, int session_id) + : server_(server), session_id_(session_id) { } + ~Delegate() { + server_->SessionTerminated(session_id_); + } + void OnHttpGet(const std::string& path) override; + void OnSocketUpgrade(const std::string& path, + const std::string& ws_key) override; + void OnWsFrame(const std::vector& data) override; + + private: + SocketSession* Session() { + return server_->Session(session_id_); + } - void FrontendConnected(); - void SetDeclined() { state_ = State::kDeclined; } - void SetTargetId(const std::string& target_id) { - CHECK(target_id_.empty()); - target_id_ = target_id; - } + InspectorSocketServer* server_; + int session_id_; + }; + private: const int id_; - InspectorSocket socket_; + InspectorSocket::Pointer ws_socket_; InspectorSocketServer* server_; - std::string target_id_; - State state_; const int server_port_; + std::string ws_key_; }; class ServerSocket { @@ -269,7 +258,6 @@ class ServerSocket { return node::ContainerOf(&ServerSocket::tcp_socket_, reinterpret_cast(socket)); } - static void SocketConnectedCallback(uv_stream_t* tcp_socket, int status); static void SocketClosedCallback(uv_handle_t* tcp_socket); static void FreeOnCloseCallback(uv_handle_t* tcp_socket_) { @@ -296,41 +284,57 @@ InspectorSocketServer::InspectorSocketServer(SocketServerDelegate* delegate, state_ = ServerState::kNew; } -bool InspectorSocketServer::SessionStarted(SocketSession* session, - const std::string& id) { - if (TargetExists(id) && delegate_->StartSession(session->id(), id)) { - connected_sessions_[session->id()] = session; - return true; - } else { - return false; +InspectorSocketServer::~InspectorSocketServer() = default; + +SocketSession* InspectorSocketServer::Session(int session_id) { + auto it = connected_sessions_.find(session_id); + return it == connected_sessions_.end() ? nullptr : it->second.second.get(); +} + +void InspectorSocketServer::SessionStarted(int session_id, + const std::string& id, + const std::string& ws_key) { + SocketSession* session = Session(session_id); + if (!TargetExists(id)) { + Session(session_id)->Decline(); + return; } + connected_sessions_[session_id].first = id; + session->set_ws_key(ws_key); + delegate_->StartSession(session_id, id); } -void InspectorSocketServer::SessionTerminated(SocketSession* session) { - int id = session->id(); - if (connected_sessions_.erase(id) != 0) { - delegate_->EndSession(id); - if (connected_sessions_.empty()) { - if (state_ == ServerState::kRunning && !server_sockets_.empty()) { - PrintDebuggerReadyMessage(host_, server_sockets_[0]->port(), - delegate_->GetTargetIds(), out_); - } - if (state_ == ServerState::kStopped) { - delegate_->ServerDone(); - } +void InspectorSocketServer::SessionTerminated(int session_id) { + if (Session(session_id) == nullptr) { + return; + } + bool was_attached = connected_sessions_[session_id].first != ""; + if (was_attached) { + delegate_->EndSession(session_id); + } + connected_sessions_.erase(session_id); + if (connected_sessions_.empty()) { + if (was_attached && state_ == ServerState::kRunning + && !server_sockets_.empty()) { + PrintDebuggerReadyMessage(host_, server_sockets_[0]->port(), + delegate_->GetTargetIds(), out_); + } + if (state_ == ServerState::kStopped) { + delegate_->ServerDone(); } } - delete session; } -bool InspectorSocketServer::HandleGetRequest(InspectorSocket* socket, +bool InspectorSocketServer::HandleGetRequest(int session_id, const std::string& path) { + SocketSession* session = Session(session_id); + InspectorSocket* socket = session->ws_socket(); const char* command = MatchPathSegment(path.c_str(), "/json"); if (command == nullptr) return false; if (MatchPathSegment(command, "list") || command[0] == '\0') { - SendListResponse(socket); + SendListResponse(socket, session); return true; } else if (MatchPathSegment(command, "protocol")) { SendProtocolJson(socket); @@ -348,7 +352,8 @@ bool InspectorSocketServer::HandleGetRequest(InspectorSocket* socket, return false; } -void InspectorSocketServer::SendListResponse(InspectorSocket* socket) { +void InspectorSocketServer::SendListResponse(InspectorSocket* socket, + SocketSession* session) { std::vector> response; for (const std::string& id : delegate_->GetTargetIds()) { response.push_back(std::map()); @@ -366,15 +371,14 @@ void InspectorSocketServer::SendListResponse(InspectorSocket* socket) { bool connected = false; for (const auto& session : connected_sessions_) { - if (session.second->IsForTarget(id)) { + if (session.second.first == id) { connected = true; break; } } if (!connected) { - std::string host; - int port = SocketSession::ServerPortForClient(socket); - GetSocketHost(&socket->tcp, &host); + std::string host = socket->GetHost(); + int port = session->server_port(); std::ostringstream frontend_url; frontend_url << "chrome-devtools://devtools/bundled"; frontend_url << "/inspector.html?experiments=true&v8only=true&ws="; @@ -444,9 +448,8 @@ void InspectorSocketServer::Stop(ServerCallback cb) { } void InspectorSocketServer::TerminateConnections() { - for (const auto& session : connected_sessions_) { - session.second->Close(); - } + for (const auto& key_value : connected_sessions_) + key_value.second.second->Close(); } bool InspectorSocketServer::TargetExists(const std::string& id) { @@ -455,13 +458,6 @@ bool InspectorSocketServer::TargetExists(const std::string& id) { return found != target_ids.end(); } -void InspectorSocketServer::Send(int session_id, const std::string& message) { - auto session_iterator = connected_sessions_.find(session_id); - if (session_iterator != connected_sessions_.end()) { - session_iterator->second->Send(message); - } -} - void InspectorSocketServer::ServerSocketListening(ServerSocket* server_socket) { server_sockets_.push_back(server_socket); } @@ -491,92 +487,73 @@ int InspectorSocketServer::Port() const { return port_; } -// InspectorSession tracking -SocketSession::SocketSession(InspectorSocketServer* server, int server_port) - : id_(server->GenerateSessionId()), - server_(server), - state_(State::kHttp), - server_port_(server_port) { } +void InspectorSocketServer::Accept(int server_port, + uv_stream_t* server_socket) { + std::unique_ptr session( + new SocketSession(this, next_session_id_++, server_port)); + + InspectorSocket::DelegatePointer delegate = + InspectorSocket::DelegatePointer( + new SocketSession::Delegate(this, session->id())); -void SocketSession::Close() { - CHECK_NE(state_, State::kClosing); - state_ = State::kClosing; - inspector_close(&socket_, CloseCallback); + InspectorSocket::Pointer inspector = + InspectorSocket::Accept(server_socket, std::move(delegate)); + if (inspector) { + session->Own(std::move(inspector)); + connected_sessions_[session->id()].second = std::move(session); + } } -// static -int SocketSession::Accept(InspectorSocketServer* server, int server_port, - uv_stream_t* server_socket) { - // Memory is freed when the socket closes. - SocketSession* session = new SocketSession(server, server_port); - int err = inspector_accept(server_socket, &session->socket_, - HandshakeCallback); - if (err != 0) { - delete session; +void InspectorSocketServer::AcceptSession(int session_id) { + SocketSession* session = Session(session_id); + if (session == nullptr) { + delegate_->EndSession(session_id); + } else { + session->Accept(); } - return err; } -// static -bool SocketSession::HandshakeCallback(InspectorSocket* socket, - inspector_handshake_event event, - const std::string& path) { - SocketSession* session = SocketSession::From(socket); - InspectorSocketServer* server = session->server_; - const std::string& id = path.empty() ? path : path.substr(1); - switch (event) { - case kInspectorHandshakeHttpGet: - return server->HandleGetRequest(socket, path); - case kInspectorHandshakeUpgrading: - if (server->SessionStarted(session, id)) { - session->SetTargetId(id); - return true; - } else { - session->SetDeclined(); - return false; - } - case kInspectorHandshakeUpgraded: - session->FrontendConnected(); - return true; - case kInspectorHandshakeFailed: - server->SessionTerminated(session); - return false; - default: - UNREACHABLE(); - return false; +void InspectorSocketServer::DeclineSession(int session_id) { + auto it = connected_sessions_.find(session_id); + if (it != connected_sessions_.end()) { + it->second.first.clear(); + it->second.second->Decline(); } } -// static -void SocketSession::CloseCallback(InspectorSocket* socket, int code) { - SocketSession* session = SocketSession::From(socket); - CHECK_EQ(State::kClosing, session->state_); - session->server_->SessionTerminated(session); +void InspectorSocketServer::Send(int session_id, const std::string& message) { + SocketSession* session = Session(session_id); + if (session != nullptr) { + session->Send(message); + } +} + +// InspectorSession tracking +SocketSession::SocketSession(InspectorSocketServer* server, int id, + int server_port) + : id_(id), + server_(server), + server_port_(server_port) { } + + +void SocketSession::Send(const std::string& message) { + ws_socket_->Write(message.data(), message.length()); } -void SocketSession::FrontendConnected() { - CHECK_EQ(State::kHttp, state_); - state_ = State::kWebSocket; - inspector_read_start(&socket_, OnBufferAlloc, ReadCallback); +void SocketSession::Delegate::OnHttpGet(const std::string& path) { + if (!server_->HandleGetRequest(session_id_, path)) + Session()->ws_socket()->CancelHandshake(); } -// static -void SocketSession::ReadCallback(uv_stream_t* stream, ssize_t read, - const uv_buf_t* buf) { - InspectorSocket* socket = inspector_from_stream(stream); - SocketSession* session = SocketSession::From(socket); - if (read > 0) { - session->server_->MessageReceived(session->id_, - std::string(buf->base, read)); - } else { - session->Close(); - } - if (buf != nullptr && buf->base != nullptr) - delete[] buf->base; +void SocketSession::Delegate::OnSocketUpgrade(const std::string& path, + const std::string& ws_key) { + std::string id = path.empty() ? path : path.substr(1); + server_->SessionStarted(session_id_, id, ws_key); } -void SocketSession::Send(const std::string& message) { - inspector_write(&socket_, message.data(), message.length()); +void SocketSession::Delegate::OnWsFrame(const std::vector& data) { + server_->MessageReceived(session_id_, + std::string(data.data(), data.size())); } // ServerSocket implementation @@ -624,8 +601,7 @@ void ServerSocket::SocketConnectedCallback(uv_stream_t* tcp_socket, if (status == 0) { ServerSocket* server_socket = ServerSocket::FromTcpSocket(tcp_socket); // Memory is freed when the socket closes. - SocketSession::Accept(server_socket->server_, server_socket->port_, - tcp_socket); + server_socket->server_->Accept(server_socket->port_, tcp_socket); } } diff --git a/src/inspector_socket_server.h b/src/inspector_socket_server.h index 16b047da333f68..b193e33a46d6d3 100644 --- a/src/inspector_socket_server.h +++ b/src/inspector_socket_server.h @@ -22,7 +22,7 @@ class ServerSocket; class SocketServerDelegate { public: - virtual bool StartSession(int session_id, const std::string& target_id) = 0; + virtual void StartSession(int session_id, const std::string& target_id) = 0; virtual void EndSession(int session_id) = 0; virtual void MessageReceived(int session_id, const std::string& message) = 0; virtual std::vector GetTargetIds() = 0; @@ -34,8 +34,6 @@ class SocketServerDelegate { // HTTP Server, writes messages requested as TransportActions, and responds // to HTTP requests and WS upgrades. - - class InspectorSocketServer { public: using ServerCallback = void (*)(InspectorSocketServer*); @@ -44,6 +42,8 @@ class InspectorSocketServer { const std::string& host, int port, FILE* out = stderr); + ~InspectorSocketServer(); + // Start listening on host/port bool Start(); @@ -54,6 +54,10 @@ class InspectorSocketServer { void Send(int session_id, const std::string& message); // kKill void TerminateConnections(); + // kAcceptSession + void AcceptSession(int session_id); + // kDeclineSession + void DeclineSession(int session_id); int Port() const; @@ -62,19 +66,18 @@ class InspectorSocketServer { void ServerSocketClosed(ServerSocket* server_socket); // Session connection lifecycle - bool HandleGetRequest(InspectorSocket* socket, const std::string& path); - bool SessionStarted(SocketSession* session, const std::string& id); - void SessionTerminated(SocketSession* session); + void Accept(int server_port, uv_stream_t* server_socket); + bool HandleGetRequest(int session_id, const std::string& path); + void SessionStarted(int session_id, const std::string& target_id, + const std::string& ws_id); + void SessionTerminated(int session_id); void MessageReceived(int session_id, const std::string& message) { delegate_->MessageReceived(session_id, message); } - - int GenerateSessionId() { - return next_session_id_++; - } + SocketSession* Session(int session_id); private: - void SendListResponse(InspectorSocket* socket); + void SendListResponse(InspectorSocket* socket, SocketSession* session); bool TargetExists(const std::string& id); enum class ServerState {kNew, kRunning, kStopping, kStopped}; @@ -85,7 +88,8 @@ class InspectorSocketServer { std::string path_; std::vector server_sockets_; Closer* closer_; - std::map connected_sessions_; + std::map>> + connected_sessions_; int next_session_id_; FILE* out_; ServerState state_; diff --git a/src/node.cc b/src/node.cc index f9b67dd675dc13..fed5fe8681db5b 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2341,7 +2341,7 @@ static void InitGroups(const FunctionCallbackInfo& args) { static void WaitForInspectorDisconnect(Environment* env) { #if HAVE_INSPECTOR - if (env->inspector_agent()->IsConnected()) { + if (env->inspector_agent()->delegate() != nullptr) { // Restore signal dispositions, the app is done and is no longer // capable of handling signals. #if defined(__POSIX__) && !defined(NODE_SHARED_MODE) diff --git a/test/cctest/test_inspector_socket.cc b/test/cctest/test_inspector_socket.cc index d1f5b4a98ac37a..943109b8a594d2 100644 --- a/test/cctest/test_inspector_socket.cc +++ b/test/cctest/test_inspector_socket.cc @@ -1,57 +1,17 @@ #include "inspector_socket.h" #include "gtest/gtest.h" +#include + #define PORT 9444 namespace { using node::inspector::InspectorSocket; -using node::inspector::inspector_from_stream; -using node::inspector::inspector_handshake_event; -using node::inspector::kInspectorHandshakeFailed; -using node::inspector::kInspectorHandshakeHttpGet; -using node::inspector::kInspectorHandshakeUpgraded; -using node::inspector::kInspectorHandshakeUpgrading; static const int MAX_LOOP_ITERATIONS = 10000; -#define SPIN_WHILE(condition) \ - { \ - Timeout timeout(&loop); \ - while ((condition) && !timeout.timed_out) { \ - uv_run(&loop, UV_RUN_NOWAIT); \ - } \ - ASSERT_FALSE((condition)); \ - } - -static bool connected = false; -static bool inspector_ready = false; -static int handshake_events = 0; -static enum inspector_handshake_event last_event = kInspectorHandshakeHttpGet; static uv_loop_t loop; -static uv_tcp_t server, client_socket; -static InspectorSocket inspector; -static std::string last_path; // NOLINT(runtime/string) -static void (*handshake_delegate)(enum inspector_handshake_event state, - const std::string& path, - bool* should_continue); -static const char SERVER_CLOSE_FRAME[] = {'\x88', '\x00'}; - - -struct read_expects { - const char* expected; - size_t expected_len; - size_t pos; - bool read_expected; - bool callback_called; -}; - -static const char HANDSHAKE_REQ[] = "GET /ws/path HTTP/1.1\r\n" - "Host: localhost:9222\r\n" - "Upgrade: websocket\r\n" - "Connection: Upgrade\r\n" - "Sec-WebSocket-Key: aaa==\r\n" - "Sec-WebSocket-Version: 13\r\n\r\n"; class Timeout { public: @@ -86,16 +46,176 @@ class Timeout { uv_timer_t timer_; }; -static void stop_if_stop_path(enum inspector_handshake_event state, - const std::string& path, bool* cont) { - *cont = path.empty() || path != "/close"; +#define SPIN_WHILE(condition) \ + { \ + Timeout timeout(&loop); \ + while ((condition) && !timeout.timed_out) { \ + uv_run(&loop, UV_RUN_NOWAIT); \ + } \ + ASSERT_FALSE((condition)); \ + } + +enum inspector_handshake_event { + kInspectorHandshakeHttpGet, + kInspectorHandshakeUpgraded, + kInspectorHandshakeNoEvents +}; + +struct expectations { + std::string actual_data; + size_t actual_offset; + size_t actual_end; + int err_code; +}; + +static bool waiting_to_close = true; + +void handle_closed(uv_handle_t* handle) { + waiting_to_close = false; } -static bool connected_cb(InspectorSocket* socket, - enum inspector_handshake_event state, - const std::string& path) { - inspector_ready = state == kInspectorHandshakeUpgraded; - last_event = state; +static void really_close(uv_handle_t* handle) { + waiting_to_close = true; + if (!uv_is_closing(handle)) { + uv_close(handle, handle_closed); + SPIN_WHILE(waiting_to_close); + } +} + +static void buffer_alloc_cb(uv_handle_t* stream, size_t len, uv_buf_t* buf) { + buf->base = new char[len]; + buf->len = len; +} + +class TestInspectorDelegate; + +static TestInspectorDelegate* delegate = nullptr; + +// Gtest asserts can't be used in dtor directly. +static void assert_is_delegate(TestInspectorDelegate* d) { + GTEST_ASSERT_EQ(delegate, d); +} + +class TestInspectorDelegate : public InspectorSocket::Delegate { + public: + using delegate_fn = void(*)(inspector_handshake_event, const std::string&, + bool* should_continue); + + TestInspectorDelegate() : inspector_ready(false), + last_event(kInspectorHandshakeNoEvents), + handshake_events(0), + handshake_delegate_(stop_if_stop_path), + fail_on_ws_frame_(false) { } + + ~TestInspectorDelegate() { + assert_is_delegate(this); + delegate = nullptr; + } + + void OnHttpGet(const std::string& path) override { + process(kInspectorHandshakeHttpGet, path); + } + + void OnSocketUpgrade(const std::string& path, + const std::string& ws_key) override { + ws_key_ = ws_key; + process(kInspectorHandshakeUpgraded, path); + } + + void OnWsFrame(const std::vector& buffer) override { + ASSERT_FALSE(fail_on_ws_frame_); + frames.push(buffer); + } + + void SetDelegate(delegate_fn d) { + handshake_delegate_ = d; + } + + void SetInspector(InspectorSocket::Pointer inspector) { + socket_ = std::move(inspector); + } + + void Write(const char* buf, size_t len) { + socket_->Write(buf, len); + } + + void ExpectReadError() { + SPIN_WHILE(frames.empty() || !frames.back().empty()); + } + + void ExpectData(const char* data, size_t len) { + const char* cur = data; + const char* end = data + len; + while (cur < end) { + SPIN_WHILE(frames.empty()); + const std::vector& frame = frames.front(); + EXPECT_FALSE(frame.empty()); + auto c = frame.begin(); + for (; c < frame.end() && cur < end; c++) { + GTEST_ASSERT_EQ(*cur, *c) << "Character #" << cur - data; + cur = cur + 1; + } + EXPECT_EQ(c, frame.end()); + frames.pop(); + } + } + + void FailOnWsFrame() { + fail_on_ws_frame_ = true; + } + + void WaitForDispose() { + SPIN_WHILE(delegate != nullptr); + } + + void Close() { + socket_.reset(); + } + + bool inspector_ready; + std::string last_path; // NOLINT(runtime/string) + inspector_handshake_event last_event; + int handshake_events; + std::queue> frames; + + private: + static void stop_if_stop_path(enum inspector_handshake_event state, + const std::string& path, bool* cont) { + *cont = path.empty() || path != "/close"; + } + + void process(inspector_handshake_event event, const std::string& path); + + bool disposed_ = false; + delegate_fn handshake_delegate_; + InspectorSocket::Pointer socket_; + std::string ws_key_; + bool fail_on_ws_frame_; +}; + +static bool connected = false; +static uv_tcp_t server, client_socket; +static const char SERVER_CLOSE_FRAME[] = {'\x88', '\x00'}; + +struct read_expects { + const char* expected; + size_t expected_len; + size_t pos; + bool read_expected; + bool callback_called; +}; + +static const char HANDSHAKE_REQ[] = "GET /ws/path HTTP/1.1\r\n" + "Host: localhost:9222\r\n" + "Upgrade: websocket\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Key: aaa==\r\n" + "Sec-WebSocket-Version: 13\r\n\r\n"; + +void TestInspectorDelegate::process(inspector_handshake_event event, + const std::string& path) { + inspector_ready = event == kInspectorHandshakeUpgraded; + last_event = event; if (path.empty()) { last_path = "@@@ Nothing received @@@"; } else { @@ -103,15 +223,23 @@ static bool connected_cb(InspectorSocket* socket, } handshake_events++; bool should_continue = true; - handshake_delegate(state, path, &should_continue); - return should_continue; + handshake_delegate_(event, path, &should_continue); + if (should_continue) { + if (inspector_ready) + socket_->AcceptUpgrade(ws_key_); + } else { + socket_->CancelHandshake(); + } } static void on_new_connection(uv_stream_t* server, int status) { GTEST_ASSERT_EQ(0, status); connected = true; - inspector_accept(server, static_cast(server->data), - connected_cb); + delegate = new TestInspectorDelegate(); + delegate->SetInspector( + InspectorSocket::Accept(server, + InspectorSocket::DelegatePointer(delegate))); + GTEST_ASSERT_NE(nullptr, delegate); } void write_done(uv_write_t* req, int status) { req->data = nullptr; } @@ -129,11 +257,6 @@ static void do_write(const char* data, int len) { SPIN_WHILE(req.data); } -static void buffer_alloc_cb(uv_handle_t* stream, size_t len, uv_buf_t* buf) { - buf->base = new char[len]; - buf->len = len; -} - static void check_data_cb(read_expects* expectation, ssize_t nread, const uv_buf_t* buf, bool* retval) { *retval = false; @@ -207,102 +330,6 @@ static void expect_on_client(const char* data, size_t len) { SPIN_WHILE(!expectation.read_expected); } -struct expectations { - std::string actual_data; - size_t actual_offset; - size_t actual_end; - int err_code; -}; - -static void grow_expects_buffer(uv_handle_t* stream, size_t size, uv_buf_t* b) { - expectations* expects = static_cast( - inspector_from_stream(stream)->data); - size_t end = expects->actual_end; - // Grow the buffer in chunks of 64k. - size_t new_length = (end + size + 65535) & ~((size_t) 0xFFFF); - expects->actual_data.resize(new_length); - *b = uv_buf_init(&expects->actual_data[end], new_length - end); -} - -// static void dump_hex(const char* buf, size_t len) { -// const char* ptr = buf; -// const char* end = ptr + len; -// const char* cptr; -// char c; -// int i; - -// while (ptr < end) { -// cptr = ptr; -// for (i = 0; i < 16 && ptr < end; i++) { -// printf("%2.2X ", *(ptr++)); -// } -// for (i = 72 - (i * 4); i > 0; i--) { -// printf(" "); -// } -// for (i = 0; i < 16 && cptr < end; i++) { -// c = *(cptr++); -// printf("%c", (c > 0x19) ? c : '.'); -// } -// printf("\n"); -// } -// printf("\n\n"); -// } - -static void save_read_data(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) { - expectations* expects = static_cast( - inspector_from_stream(stream)->data); - expects->err_code = nread < 0 ? nread : 0; - if (nread > 0) { - expects->actual_end += nread; - } -} - -static void setup_inspector_expecting() { - if (inspector.data) { - return; - } - expectations* expects = new expectations(); - inspector.data = expects; - inspector_read_start(&inspector, grow_expects_buffer, save_read_data); -} - -static void expect_on_server(const char* data, size_t len) { - setup_inspector_expecting(); - expectations* expects = static_cast(inspector.data); - for (size_t i = 0; i < len;) { - SPIN_WHILE(expects->actual_offset == expects->actual_end); - for (; i < len && expects->actual_offset < expects->actual_end; i++) { - char actual = expects->actual_data[expects->actual_offset++]; - char expected = data[i]; - if (expected != actual) { - fprintf(stderr, "Character %zu:\n", i); - GTEST_ASSERT_EQ(expected, actual); - } - } - } - expects->actual_end -= expects->actual_offset; - if (!expects->actual_end) { - memmove(&expects->actual_data[0], - &expects->actual_data[expects->actual_offset], - expects->actual_end); - } - expects->actual_offset = 0; -} - -static void inspector_record_error_code(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) { - InspectorSocket *inspector = inspector_from_stream(stream); - // Increment instead of assign is to ensure the function is only called once - *(static_cast(inspector->data)) += nread; -} - -static void expect_server_read_error() { - setup_inspector_expecting(); - expectations* expects = static_cast(inspector.data); - SPIN_WHILE(expects->err_code != UV_EPROTO); -} - static void expect_handshake() { const char UPGRADE_RESPONSE[] = "HTTP/1.1 101 Switching Protocols\r\n" @@ -320,35 +347,6 @@ static void expect_handshake_failure() { expect_on_client(UPGRADE_RESPONSE, sizeof(UPGRADE_RESPONSE) - 1); } -static bool waiting_to_close = true; - -void handle_closed(uv_handle_t* handle) { waiting_to_close = false; } - -static void really_close(uv_handle_t* handle) { - waiting_to_close = true; - if (!uv_is_closing(handle)) { - uv_close(handle, handle_closed); - SPIN_WHILE(waiting_to_close); - } -} - -// Called when the test leaves inspector socket in active state -static void manual_inspector_socket_cleanup() { - EXPECT_EQ(0, uv_is_active( - reinterpret_cast(&inspector.tcp))); - really_close(reinterpret_cast(&inspector.tcp)); - delete inspector.ws_state; - inspector.ws_state = nullptr; - delete inspector.http_parsing_state; - inspector.http_parsing_state = nullptr; - inspector.buffer.clear(); -} - -static void assert_both_sockets_closed() { - SPIN_WHILE(uv_is_active(reinterpret_cast(&client_socket))); - SPIN_WHILE(uv_is_active(reinterpret_cast(&inspector.tcp))); -} - static void on_connection(uv_connect_t* connect, int status) { GTEST_ASSERT_EQ(0, status); connect->data = connect; @@ -357,16 +355,10 @@ static void on_connection(uv_connect_t* connect, int status) { class InspectorSocketTest : public ::testing::Test { protected: virtual void SetUp() { - inspector.reinit(); - handshake_delegate = stop_if_stop_path; - handshake_events = 0; connected = false; - inspector_ready = false; - last_event = kInspectorHandshakeHttpGet; GTEST_ASSERT_EQ(0, uv_loop_init(&loop)); server = uv_tcp_t(); client_socket = uv_tcp_t(); - server.data = &inspector; sockaddr_in addr; uv_tcp_init(&loop, &server); uv_tcp_init(&loop, &client_socket); @@ -386,13 +378,7 @@ class InspectorSocketTest : public ::testing::Test { virtual void TearDown() { really_close(reinterpret_cast(&client_socket)); - EXPECT_TRUE(inspector.buffer.empty()); - expectations* expects = static_cast(inspector.data); - if (expects != nullptr) { - GTEST_ASSERT_EQ(expects->actual_end, expects->actual_offset); - delete expects; - inspector.data = nullptr; - } + SPIN_WHILE(delegate != nullptr); const int err = uv_loop_close(&loop); if (err != 0) { uv_print_all_handles(&loop, stderr); @@ -403,22 +389,22 @@ class InspectorSocketTest : public ::testing::Test { TEST_F(InspectorSocketTest, ReadsAndWritesInspectorMessage) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(!inspector_ready); + SPIN_WHILE(!delegate->inspector_ready); expect_handshake(); // 2. Brief exchange const char SERVER_MESSAGE[] = "abcd"; const char CLIENT_FRAME[] = {'\x81', '\x04', 'a', 'b', 'c', 'd'}; - inspector_write(&inspector, SERVER_MESSAGE, sizeof(SERVER_MESSAGE) - 1); + delegate->Write(SERVER_MESSAGE, sizeof(SERVER_MESSAGE) - 1); expect_on_client(CLIENT_FRAME, sizeof(CLIENT_FRAME)); const char SERVER_FRAME[] = {'\x81', '\x84', '\x7F', '\xC2', '\x66', '\x31', '\x4E', '\xF0', '\x55', '\x05'}; const char CLIENT_MESSAGE[] = "1234"; do_write(SERVER_FRAME, sizeof(SERVER_FRAME)); - expect_on_server(CLIENT_MESSAGE, sizeof(CLIENT_MESSAGE) - 1); + delegate->ExpectData(CLIENT_MESSAGE, sizeof(CLIENT_MESSAGE) - 1); // 3. Close const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D', @@ -487,53 +473,34 @@ TEST_F(InspectorSocketTest, BufferEdgeCases) { "{\"id\":17,\"method\":\"Network.canEmulateNetworkConditions\"}"}; do_write(MULTIPLE_REQUESTS, sizeof(MULTIPLE_REQUESTS)); - expect_on_server(EXPECT, sizeof(EXPECT) - 1); - inspector_read_stop(&inspector); - manual_inspector_socket_cleanup(); + delegate->ExpectData(EXPECT, sizeof(EXPECT) - 1); } TEST_F(InspectorSocketTest, AcceptsRequestInSeveralWrites) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); // Specifically, break up the request in the "Sec-WebSocket-Key" header name // and value const int write1 = 95; const int write2 = 5; const int write3 = sizeof(HANDSHAKE_REQ) - write1 - write2 - 1; do_write(const_cast(HANDSHAKE_REQ), write1); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ) + write1, write2); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ) + write1 + write2, write3); - SPIN_WHILE(!inspector_ready); + SPIN_WHILE(!delegate->inspector_ready); expect_handshake(); - inspector_read_stop(&inspector); GTEST_ASSERT_EQ(uv_is_active(reinterpret_cast(&client_socket)), 0); - manual_inspector_socket_cleanup(); } TEST_F(InspectorSocketTest, ExtraTextBeforeRequest) { - last_event = kInspectorHandshakeUpgraded; - char UNCOOL_BRO[] = "Uncool, bro: Text before the first req\r\n"; - do_write(const_cast(UNCOOL_BRO), sizeof(UNCOOL_BRO) - 1); - - ASSERT_FALSE(inspector_ready); - do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(last_event != kInspectorHandshakeFailed); - expect_handshake_failure(); - assert_both_sockets_closed(); -} - -TEST_F(InspectorSocketTest, ExtraLettersBeforeRequest) { - char UNCOOL_BRO[] = "Uncool!!"; + delegate->last_event = kInspectorHandshakeUpgraded; + char UNCOOL_BRO[] = "Text before the first req, shouldn't be her\r\n"; do_write(const_cast(UNCOOL_BRO), sizeof(UNCOOL_BRO) - 1); - - ASSERT_FALSE(inspector_ready); - do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(last_event != kInspectorHandshakeFailed); expect_handshake_failure(); - assert_both_sockets_closed(); + GTEST_ASSERT_EQ(nullptr, delegate); } TEST_F(InspectorSocketTest, RequestWithoutKey) { @@ -544,87 +511,65 @@ TEST_F(InspectorSocketTest, RequestWithoutKey) { "Sec-WebSocket-Version: 13\r\n\r\n"; do_write(const_cast(BROKEN_REQUEST), sizeof(BROKEN_REQUEST) - 1); - SPIN_WHILE(last_event != kInspectorHandshakeFailed); expect_handshake_failure(); - assert_both_sockets_closed(); } TEST_F(InspectorSocketTest, KillsConnectionOnProtocolViolation) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(!inspector_ready); - ASSERT_TRUE(inspector_ready); + SPIN_WHILE(!delegate->inspector_ready); + ASSERT_TRUE(delegate->inspector_ready); expect_handshake(); const char SERVER_FRAME[] = "I'm not a good WS frame. Nope!"; do_write(SERVER_FRAME, sizeof(SERVER_FRAME)); - expect_server_read_error(); + SPIN_WHILE(delegate != nullptr); GTEST_ASSERT_EQ(uv_is_active(reinterpret_cast(&client_socket)), 0); } TEST_F(InspectorSocketTest, CanStopReadingFromInspector) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); - ASSERT_TRUE(inspector_ready); + ASSERT_TRUE(delegate->inspector_ready); // 2. Brief exchange const char SERVER_FRAME[] = {'\x81', '\x84', '\x7F', '\xC2', '\x66', '\x31', '\x4E', '\xF0', '\x55', '\x05'}; const char CLIENT_MESSAGE[] = "1234"; do_write(SERVER_FRAME, sizeof(SERVER_FRAME)); - expect_on_server(CLIENT_MESSAGE, sizeof(CLIENT_MESSAGE) - 1); + delegate->ExpectData(CLIENT_MESSAGE, sizeof(CLIENT_MESSAGE) - 1); - inspector_read_stop(&inspector); do_write(SERVER_FRAME, sizeof(SERVER_FRAME)); GTEST_ASSERT_EQ(uv_is_active( reinterpret_cast(&client_socket)), 0); - manual_inspector_socket_cleanup(); -} - -static int inspector_closed = 0; - -void inspector_closed_cb(InspectorSocket *inspector, int code) { - inspector_closed++; } TEST_F(InspectorSocketTest, CloseDoesNotNotifyReadCallback) { - inspector_closed = 0; do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); - int error_code = 0; - inspector.data = &error_code; - inspector_read_start(&inspector, buffer_alloc_cb, - inspector_record_error_code); - inspector_close(&inspector, inspector_closed_cb); + delegate->Close(); char CLOSE_FRAME[] = {'\x88', '\x00'}; expect_on_client(CLOSE_FRAME, sizeof(CLOSE_FRAME)); - EXPECT_EQ(0, inspector_closed); const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D', '\x0E', '\x1E', '\xFA'}; + delegate->FailOnWsFrame(); do_write(CLIENT_CLOSE_FRAME, sizeof(CLIENT_CLOSE_FRAME)); - EXPECT_NE(UV_EOF, error_code); - SPIN_WHILE(inspector_closed == 0); - EXPECT_EQ(1, inspector_closed); - inspector.data = nullptr; + SPIN_WHILE(delegate != nullptr); } TEST_F(InspectorSocketTest, CloseWorksWithoutReadEnabled) { - inspector_closed = 0; do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); - inspector_close(&inspector, inspector_closed_cb); + delegate->Close(); char CLOSE_FRAME[] = {'\x88', '\x00'}; expect_on_client(CLOSE_FRAME, sizeof(CLOSE_FRAME)); - EXPECT_EQ(0, inspector_closed); const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D', '\x0E', '\x1E', '\xFA'}; do_write(CLIENT_CLOSE_FRAME, sizeof(CLIENT_CLOSE_FRAME)); - SPIN_WHILE(inspector_closed == 0); - EXPECT_EQ(1, inspector_closed); } // Make sure buffering works @@ -641,26 +586,24 @@ static void send_in_chunks(const char* data, size_t len) { } static const char TEST_SUCCESS[] = "Test Success\n\n"; +static int ReportsHttpGet_eventsCount = 0; static void ReportsHttpGet_handshake(enum inspector_handshake_event state, const std::string& path, bool* cont) { *cont = true; enum inspector_handshake_event expected_state = kInspectorHandshakeHttpGet; std::string expected_path; - switch (handshake_events) { + switch (delegate->handshake_events) { case 1: expected_path = "/some/path"; break; case 2: expected_path = "/respond/withtext"; - inspector_write(&inspector, TEST_SUCCESS, sizeof(TEST_SUCCESS) - 1); + delegate->Write(TEST_SUCCESS, sizeof(TEST_SUCCESS) - 1); break; case 3: expected_path = "/some/path2"; break; - case 5: - expected_state = kInspectorHandshakeFailed; - break; case 4: expected_path = "/close"; *cont = false; @@ -670,10 +613,11 @@ static void ReportsHttpGet_handshake(enum inspector_handshake_event state, } EXPECT_EQ(expected_state, state); EXPECT_EQ(expected_path, path); + ReportsHttpGet_eventsCount = delegate->handshake_events; } TEST_F(InspectorSocketTest, ReportsHttpGet) { - handshake_delegate = ReportsHttpGet_handshake; + delegate->SetDelegate(ReportsHttpGet_handshake); const char GET_REQ[] = "GET /some/path HTTP/1.1\r\n" "Host: localhost:9222\r\n" @@ -688,7 +632,6 @@ TEST_F(InspectorSocketTest, ReportsHttpGet) { send_in_chunks(WRITE_REQUEST, sizeof(WRITE_REQUEST) - 1); expect_on_client(TEST_SUCCESS, sizeof(TEST_SUCCESS) - 1); - const char GET_REQS[] = "GET /some/path2 HTTP/1.1\r\n" "Host: localhost:9222\r\n" "Sec-WebSocket-Key: aaa==\r\n" @@ -698,53 +641,50 @@ TEST_F(InspectorSocketTest, ReportsHttpGet) { "Sec-WebSocket-Key: aaa==\r\n" "Sec-WebSocket-Version: 13\r\n\r\n"; send_in_chunks(GET_REQS, sizeof(GET_REQS) - 1); - expect_handshake_failure(); - EXPECT_EQ(5, handshake_events); + EXPECT_EQ(4, ReportsHttpGet_eventsCount); + EXPECT_EQ(nullptr, delegate); } -static void -HandshakeCanBeCanceled_handshake(enum inspector_handshake_event state, - const std::string& path, bool* cont) { - switch (handshake_events - 1) { +static int HandshakeCanBeCanceled_eventCount = 0; + +static +void HandshakeCanBeCanceled_handshake(enum inspector_handshake_event state, + const std::string& path, bool* cont) { + switch (delegate->handshake_events - 1) { case 0: - EXPECT_EQ(kInspectorHandshakeUpgrading, state); + EXPECT_EQ(kInspectorHandshakeUpgraded, state); EXPECT_EQ("/ws/path", path); break; - case 1: - EXPECT_EQ(kInspectorHandshakeFailed, state); - EXPECT_TRUE(path.empty()); - break; default: EXPECT_TRUE(false); break; } *cont = false; + HandshakeCanBeCanceled_eventCount = delegate->handshake_events; } TEST_F(InspectorSocketTest, HandshakeCanBeCanceled) { - handshake_delegate = HandshakeCanBeCanceled_handshake; + delegate->SetDelegate(HandshakeCanBeCanceled_handshake); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake_failure(); - EXPECT_EQ(2, handshake_events); + EXPECT_EQ(1, HandshakeCanBeCanceled_eventCount); + EXPECT_EQ(nullptr, delegate); } static void GetThenHandshake_handshake(enum inspector_handshake_event state, const std::string& path, bool* cont) { *cont = true; std::string expected_path = "/ws/path"; - switch (handshake_events - 1) { + switch (delegate->handshake_events - 1) { case 0: EXPECT_EQ(kInspectorHandshakeHttpGet, state); expected_path = "/respond/withtext"; - inspector_write(&inspector, TEST_SUCCESS, sizeof(TEST_SUCCESS) - 1); + delegate->Write(TEST_SUCCESS, sizeof(TEST_SUCCESS) - 1); break; case 1: - EXPECT_EQ(kInspectorHandshakeUpgrading, state); - break; - case 2: EXPECT_EQ(kInspectorHandshakeUpgraded, state); break; default: @@ -755,7 +695,7 @@ static void GetThenHandshake_handshake(enum inspector_handshake_event state, } TEST_F(InspectorSocketTest, GetThenHandshake) { - handshake_delegate = GetThenHandshake_handshake; + delegate->SetDelegate(GetThenHandshake_handshake); const char WRITE_REQUEST[] = "GET /respond/withtext HTTP/1.1\r\n" "Host: localhost:9222\r\n\r\n"; send_in_chunks(WRITE_REQUEST, sizeof(WRITE_REQUEST) - 1); @@ -764,15 +704,7 @@ TEST_F(InspectorSocketTest, GetThenHandshake) { do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); - EXPECT_EQ(3, handshake_events); - manual_inspector_socket_cleanup(); -} - -static void WriteBeforeHandshake_inspector_delegate(inspector_handshake_event e, - const std::string& path, - bool* cont) { - if (e == kInspectorHandshakeFailed) - inspector_closed = 1; + EXPECT_EQ(2, delegate->handshake_events); } TEST_F(InspectorSocketTest, WriteBeforeHandshake) { @@ -780,51 +712,31 @@ TEST_F(InspectorSocketTest, WriteBeforeHandshake) { const char MESSAGE2[] = "Message 2"; const char EXPECTED[] = "Message 1Message 2"; - inspector_write(&inspector, MESSAGE1, sizeof(MESSAGE1) - 1); - inspector_write(&inspector, MESSAGE2, sizeof(MESSAGE2) - 1); + delegate->Write(MESSAGE1, sizeof(MESSAGE1) - 1); + delegate->Write(MESSAGE2, sizeof(MESSAGE2) - 1); expect_on_client(EXPECTED, sizeof(EXPECTED) - 1); - inspector_closed = 0; - handshake_delegate = WriteBeforeHandshake_inspector_delegate; really_close(reinterpret_cast(&client_socket)); - SPIN_WHILE(inspector_closed == 0); -} - -static void CleanupSocketAfterEOF_close_cb(InspectorSocket* inspector, - int status) { - *(static_cast(inspector->data)) = true; -} - -static void CleanupSocketAfterEOF_read_cb(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) { - EXPECT_EQ(UV_EOF, nread); - InspectorSocket* insp = inspector_from_stream(stream); - inspector_close(insp, CleanupSocketAfterEOF_close_cb); + SPIN_WHILE(delegate != nullptr); } TEST_F(InspectorSocketTest, CleanupSocketAfterEOF) { do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); - inspector_read_start(&inspector, buffer_alloc_cb, - CleanupSocketAfterEOF_read_cb); - for (int i = 0; i < MAX_LOOP_ITERATIONS; ++i) { uv_run(&loop, UV_RUN_NOWAIT); } uv_close(reinterpret_cast(&client_socket), nullptr); - bool flag = false; - inspector.data = &flag; - SPIN_WHILE(!flag); - inspector.data = nullptr; + SPIN_WHILE(delegate != nullptr); } TEST_F(InspectorSocketTest, EOFBeforeHandshake) { const char MESSAGE[] = "We'll send EOF afterwards"; - inspector_write(&inspector, MESSAGE, sizeof(MESSAGE) - 1); + delegate->Write(MESSAGE, sizeof(MESSAGE) - 1); expect_on_client(MESSAGE, sizeof(MESSAGE) - 1); uv_close(reinterpret_cast(&client_socket), nullptr); - SPIN_WHILE(last_event != kInspectorHandshakeFailed); + SPIN_WHILE(delegate != nullptr); } static void fill_message(std::string* buffer) { @@ -843,9 +755,9 @@ static void mask_message(const std::string& message, TEST_F(InspectorSocketTest, Send1Mb) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(!inspector_ready); + SPIN_WHILE(!delegate->inspector_ready); expect_handshake(); // 2. Brief exchange @@ -860,7 +772,7 @@ TEST_F(InspectorSocketTest, Send1Mb) { std::string expected(EXPECTED_FRAME_HEADER, sizeof(EXPECTED_FRAME_HEADER)); expected.append(message); - inspector_write(&inspector, &message[0], message.size()); + delegate->Write(&message[0], message.size()); expect_on_client(&expected[0], expected.size()); char MASK[4] = {'W', 'h', 'O', 'a'}; @@ -874,9 +786,8 @@ TEST_F(InspectorSocketTest, Send1Mb) { outgoing.resize(outgoing.size() + message.size()); mask_message(message, &outgoing[sizeof(FRAME_TO_SERVER_HEADER)], MASK); - setup_inspector_expecting(); // Buffer on the client side. do_write(&outgoing[0], outgoing.size()); - expect_on_server(&message[0], message.size()); + delegate->ExpectData(&message[0], message.size()); // 3. Close const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D', @@ -887,53 +798,33 @@ TEST_F(InspectorSocketTest, Send1Mb) { reinterpret_cast(&client_socket))); } -static ssize_t err; - -void ErrorCleansUpTheSocket_cb(uv_stream_t* stream, ssize_t read, - const uv_buf_t* buf) { - err = read; -} - TEST_F(InspectorSocketTest, ErrorCleansUpTheSocket) { - inspector_closed = 0; do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); expect_handshake(); const char NOT_A_GOOD_FRAME[] = {'H', 'e', 'l', 'l', 'o'}; - err = 42; - inspector_read_start(&inspector, buffer_alloc_cb, - ErrorCleansUpTheSocket_cb); do_write(NOT_A_GOOD_FRAME, sizeof(NOT_A_GOOD_FRAME)); - SPIN_WHILE(err > 0); - EXPECT_EQ(UV_EPROTO, err); -} - -static void ServerClosedByClient_cb(InspectorSocket* socket, int code) { - *static_cast(socket->data) = true; + SPIN_WHILE(delegate != nullptr); } -TEST_F(InspectorSocketTest, NoCloseResponseFromClinet) { +TEST_F(InspectorSocketTest, NoCloseResponseFromClient) { ASSERT_TRUE(connected); - ASSERT_FALSE(inspector_ready); + ASSERT_FALSE(delegate->inspector_ready); do_write(const_cast(HANDSHAKE_REQ), sizeof(HANDSHAKE_REQ) - 1); - SPIN_WHILE(!inspector_ready); + SPIN_WHILE(!delegate->inspector_ready); expect_handshake(); // 2. Brief exchange const char SERVER_MESSAGE[] = "abcd"; const char CLIENT_FRAME[] = {'\x81', '\x04', 'a', 'b', 'c', 'd'}; - inspector_write(&inspector, SERVER_MESSAGE, sizeof(SERVER_MESSAGE) - 1); + delegate->Write(SERVER_MESSAGE, sizeof(SERVER_MESSAGE) - 1); expect_on_client(CLIENT_FRAME, sizeof(CLIENT_FRAME)); - bool closed = false; - - inspector.data = &closed; - inspector_close(&inspector, ServerClosedByClient_cb); + delegate->Close(); expect_on_client(SERVER_CLOSE_FRAME, sizeof(SERVER_CLOSE_FRAME)); uv_close(reinterpret_cast(&client_socket), nullptr); - SPIN_WHILE(!closed); - inspector.data = nullptr; GTEST_ASSERT_EQ(0, uv_is_active( - reinterpret_cast(&client_socket))); + reinterpret_cast(&client_socket))); + delegate->WaitForDispose(); } } // anonymous namespace diff --git a/test/cctest/test_inspector_socket_server.cc b/test/cctest/test_inspector_socket_server.cc index ab74917234eefb..49a3ca9f95857d 100644 --- a/test/cctest/test_inspector_socket_server.cc +++ b/test/cctest/test_inspector_socket_server.cc @@ -95,16 +95,17 @@ class TestInspectorServerDelegate : public SocketServerDelegate { server_ = server; } - bool StartSession(int session_id, const std::string& target_id) override { + void StartSession(int session_id, const std::string& target_id) override { buffer_.clear(); CHECK_NE(targets_.end(), std::find(targets_.begin(), targets_.end(), target_id)); if (target_id == UNCONNECTABLE_TARGET_ID) { - return false; + server_->DeclineSession(session_id); + return; } connected++; session_id_ = session_id; - return true; + server_->AcceptSession(session_id); } void MessageReceived(int session_id, const std::string& message) override { @@ -350,12 +351,13 @@ class ServerHolder { class ServerDelegateNoTargets : public SocketServerDelegate { public: + ServerDelegateNoTargets() : server_(nullptr) { } void Connect(InspectorSocketServer* server) { } void MessageReceived(int session_id, const std::string& message) override { } void EndSession(int session_id) override { } - bool StartSession(int session_id, const std::string& target_id) override { - return false; + void StartSession(int session_id, const std::string& target_id) override { + server_->DeclineSession(session_id); } std::vector GetTargetIds() override { @@ -375,6 +377,9 @@ class ServerDelegateNoTargets : public SocketServerDelegate { } bool done = false; + + private: + InspectorSocketServer* server_; }; static void TestHttpRequest(int port, const std::string& path, @@ -407,7 +412,6 @@ TEST_F(InspectorSocketServerTest, InspectorSessions) { well_behaved_socket.Write(WsHandshakeRequest(MAIN_TARGET_ID)); well_behaved_socket.Expect(WS_HANDSHAKE_RESPONSE); - EXPECT_EQ(1, delegate.connected); well_behaved_socket.Write("\x81\x84\x7F\xC2\x66\x31\x4E\xF0\x55\x05"); @@ -416,7 +420,6 @@ TEST_F(InspectorSocketServerTest, InspectorSessions) { delegate.Write("5678"); well_behaved_socket.Expect("\x81\x4" "5678"); - well_behaved_socket.Write(CLIENT_CLOSE_FRAME); well_behaved_socket.Expect(SERVER_CLOSE_FRAME); diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 454eef4c5e26da..0d010a8ca70617 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -369,28 +369,43 @@ class NodeInstance { }); } - wsHandshake(devtoolsUrl) { - return this.portPromise.then((port) => new Promise((resolve) => { - http.get({ - port, - path: url.parse(devtoolsUrl).path, - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Sec-WebSocket-Version': 13, - 'Sec-WebSocket-Key': 'key==' - } - }).on('upgrade', (message, socket) => { - resolve(new InspectorSession(socket, this)); - }).on('response', common.mustNotCall('Upgrade was not received')); - })); + async sendUpgradeRequest() { + const response = await this.httpGet(null, '/json/list'); + const devtoolsUrl = response[0]['webSocketDebuggerUrl']; + const port = await this.portPromise; + return http.get({ + port, + path: url.parse(devtoolsUrl).path, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Version': 13, + 'Sec-WebSocket-Key': 'key==' + } + }); } async connectInspectorSession() { console.log('[test]', 'Connecting to a child Node process'); - const response = await this.httpGet(null, '/json/list'); - const url = response[0]['webSocketDebuggerUrl']; - return this.wsHandshake(url); + const upgradeRequest = await this.sendUpgradeRequest(); + return new Promise((resolve, reject) => { + upgradeRequest + .on('upgrade', + (message, socket) => resolve(new InspectorSession(socket, this))) + .on('response', common.mustNotCall('Upgrade was not received')); + }); + } + + async expectConnectionDeclined() { + console.log('[test]', 'Checking upgrade is not possible'); + const upgradeRequest = await this.sendUpgradeRequest(); + return new Promise((resolve, reject) => { + upgradeRequest + .on('upgrade', common.mustNotCall('Upgrade was received')) + .on('response', (response) => + response.on('data', () => {}) + .on('end', () => resolve(response.statusCode))); + }); } expectShutdown() { @@ -403,6 +418,10 @@ class NodeInstance { return new Promise((resolve) => this._stderrLineCallback = resolve); } + write(message) { + this._process.stdin.write(message); + } + kill() { this._process.kill(); } diff --git a/test/parallel/test-inspector-no-crash-ws-after-bindings.js b/test/parallel/test-inspector-no-crash-ws-after-bindings.js new file mode 100644 index 00000000000000..286373068e8e9b --- /dev/null +++ b/test/parallel/test-inspector-no-crash-ws-after-bindings.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); +common.skipIfInspectorDisabled(); +common.crashOnUnhandledRejection(); +const { NodeInstance } = require('../common/inspector-helper.js'); +const assert = require('assert'); + +const expected = 'Can connect now!'; + +const script = ` + 'use strict'; + const { Session } = require('inspector'); + + const s = new Session(); + s.connect(); + console.error('${expected}'); + process.stdin.on('data', () => process.exit(0)); +`; + +async function runTests() { + const instance = new NodeInstance(['--inspect=0', '--expose-internals'], + script); + while (await instance.nextStderrString() !== expected); + assert.strictEqual(400, await instance.expectConnectionDeclined()); + instance.write('Stop!\n'); + assert.deepStrictEqual({ exitCode: 0, signal: null }, + await instance.expectShutdown()); +} + +runTests(); From ccffbd96d1c465e8ce6278eb771594d3895222f0 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 9 Dec 2017 13:27:31 -0500 Subject: [PATCH 369/379] doc: fix modules.md export example Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: https://github.com/nodejs/node/pull/17579 Refs: https://github.com/nodejs/node/pull/17364 Reviewed-By: Rich Trott --- doc/api/modules.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 4ecdf826a23820..cdb591563ce649 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -38,7 +38,7 @@ In this example, the variable `PI` is private to `circle.js`. The `module.exports` property can be assigned a new value (such as a function or object). -Below, `bar.js` makes use of the `square` module, which exports a constructor: +Below, `bar.js` makes use of the `square` module, which exports a Square class: ```js const Square = require('./square.js'); @@ -50,10 +50,14 @@ The `square` module is defined in `square.js`: ```js // assigning to exports will not modify module, must use module.exports -module.exports = (width) => { - return { - area: () => width ** 2 - }; +module.exports = class Square { + constructor(width) { + this.width = width; + } + + area() { + return this.width ** 2; + } }; ``` From f45ef442bbfd056517d0b5ab13e27eee98a0a58f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 9 Dec 2017 05:56:22 +0100 Subject: [PATCH 370/379] test: refactor test-http-default-port - Remove redundant `hasCrypto` checks - Use `common.mustCall()` - Use arrow functions - Deduplicate HTTP & HTTPS code PR-URL: https://github.com/nodejs/node/pull/17562 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski --- test/parallel/test-http-default-port.js | 55 +++++++------------------ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index 0b3530e76c3139..a5af439a8ec6c3 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -34,54 +34,27 @@ const options = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }; -let gotHttpsResp = false; -let gotHttpResp = false; -process.on('exit', function() { - if (common.hasCrypto) { - assert(gotHttpsResp); - } - assert(gotHttpResp); - console.log('ok'); -}); - -http.createServer(function(req, res) { - assert.strictEqual(req.headers.host, hostExpect); - assert.strictEqual(req.headers['x-port'], this.address().port.toString()); - res.writeHead(200); - res.end('ok'); - this.close(); -}).listen(0, function() { - http.globalAgent.defaultPort = this.address().port; - http.get({ - host: 'localhost', - headers: { - 'x-port': this.address().port - } - }, function(res) { - gotHttpResp = true; - res.resume(); - }); -}); - -if (common.hasCrypto) { - https.createServer(options, function(req, res) { +for (const { mod, createServer } of [ + { mod: http, createServer: http.createServer }, + { mod: https, createServer: https.createServer.bind(null, options) } +]) { + const server = createServer(common.mustCall((req, res) => { assert.strictEqual(req.headers.host, hostExpect); - assert.strictEqual(req.headers['x-port'], this.address().port.toString()); + assert.strictEqual(req.headers['x-port'], `${server.address().port}`); res.writeHead(200); res.end('ok'); - this.close(); - }).listen(0, function() { - https.globalAgent.defaultPort = this.address().port; - https.get({ + server.close(); + })).listen(0, common.mustCall(() => { + mod.globalAgent.defaultPort = server.address().port; + mod.get({ host: 'localhost', rejectUnauthorized: false, headers: { - 'x-port': this.address().port + 'x-port': server.address().port } - }, function(res) { - gotHttpsResp = true; + }, common.mustCall((res) => { res.resume(); - }); - }); + })); + })); } From d59b0a7c73e5509a6eb5897b317f17b1678af555 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 9 Dec 2017 09:38:14 -0500 Subject: [PATCH 371/379] tools: simplify prefer-common-mustnotcall rule PR-URL: https://github.com/nodejs/node/pull/17572 Reviewed-By: Anatoli Papirovski --- .../eslint-rules/prefer-common-mustnotcall.js | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/tools/eslint-rules/prefer-common-mustnotcall.js b/tools/eslint-rules/prefer-common-mustnotcall.js index 6bc428ed59a8b8..ef3c5fb729f31f 100644 --- a/tools/eslint-rules/prefer-common-mustnotcall.js +++ b/tools/eslint-rules/prefer-common-mustnotcall.js @@ -10,30 +10,21 @@ const msg = 'Please use common.mustNotCall(msg) instead of ' + 'common.mustCall(fn, 0) or common.mustCall(0).'; - -function isCommonMustCall(node) { - return node && - node.callee && - node.callee.object && - node.callee.object.name === 'common' && - node.callee.property && - node.callee.property.name === 'mustCall'; -} - -function isArgZero(argument) { - return argument && - typeof argument.value === 'number' && - argument.value === 0; -} +const mustCallSelector = 'CallExpression[callee.object.name="common"]' + + '[callee.property.name="mustCall"]'; +const arg0Selector = `${mustCallSelector}[arguments.0.value=0]`; +const arg1Selector = `${mustCallSelector}[arguments.1.value=0]`; module.exports = function(context) { + function report(node) { + context.report(node, msg); + } + return { - CallExpression(node) { - if (isCommonMustCall(node) && - (isArgZero(node.arguments[0]) || // catch common.mustCall(0) - isArgZero(node.arguments[1]))) { // catch common.mustCall(fn, 0) - context.report(node, msg); - } - } + // Catch common.mustCall(0) + [arg0Selector]: report, + + // Catch common.mustCall(fn, 0) + [arg1Selector]: report }; }; From 01e7b446d1d48afe3ff3c1286e15d2ad66f4aa6e Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 9 Dec 2017 09:54:33 -0500 Subject: [PATCH 372/379] tools: simplify prefer-assert-methods rule PR-URL: https://github.com/nodejs/node/pull/17572 Reviewed-By: Anatoli Papirovski --- tools/eslint-rules/prefer-assert-methods.js | 27 ++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/tools/eslint-rules/prefer-assert-methods.js b/tools/eslint-rules/prefer-assert-methods.js index fa345eb7c3fc33..0604fd3ed99046 100644 --- a/tools/eslint-rules/prefer-assert-methods.js +++ b/tools/eslint-rules/prefer-assert-methods.js @@ -1,15 +1,8 @@ 'use strict'; -function isAssert(node) { - return node.expression && - node.expression.type === 'CallExpression' && - node.expression.callee && - node.expression.callee.name === 'assert'; -} - -function getFirstArg(expression) { - return expression.arguments && expression.arguments[0]; -} +const astSelector = 'ExpressionStatement[expression.type="CallExpression"]' + + '[expression.callee.name="assert"]' + + '[expression.arguments.0.type="BinaryExpression"]'; function parseError(method, op) { return `'assert.${method}' should be used instead of '${op}'`; @@ -24,15 +17,11 @@ const preferedAssertMethod = { module.exports = function(context) { return { - ExpressionStatement(node) { - if (isAssert(node)) { - const arg = getFirstArg(node.expression); - if (arg && arg.type === 'BinaryExpression') { - const assertMethod = preferedAssertMethod[arg.operator]; - if (assertMethod) { - context.report(node, parseError(assertMethod, arg.operator)); - } - } + [astSelector]: function(node) { + const arg = node.expression.arguments[0]; + const assertMethod = preferedAssertMethod[arg.operator]; + if (assertMethod) { + context.report(node, parseError(assertMethod, arg.operator)); } } }; From e157e1c9222f351ecb09aae4e6453e2bba4e0578 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 9 Dec 2017 10:06:57 -0500 Subject: [PATCH 373/379] tools: simplify buffer-constructor rule PR-URL: https://github.com/nodejs/node/pull/17572 Reviewed-By: Anatoli Papirovski --- tools/eslint-rules/buffer-constructor.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/eslint-rules/buffer-constructor.js b/tools/eslint-rules/buffer-constructor.js index 938598e8dbf618..412fdaa934664b 100644 --- a/tools/eslint-rules/buffer-constructor.js +++ b/tools/eslint-rules/buffer-constructor.js @@ -10,16 +10,11 @@ const msg = 'Use of the Buffer() constructor has been deprecated. ' + 'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' + 'or Buffer.from()'; - -function test(context, node) { - if (node.callee.name === 'Buffer') { - context.report(node, msg); - } -} +const astSelector = 'NewExpression[callee.name="Buffer"],' + + 'CallExpression[callee.name="Buffer"]'; module.exports = function(context) { return { - 'NewExpression': (node) => test(context, node), - 'CallExpression': (node) => test(context, node) + [astSelector]: (node) => context.report(node, msg) }; }; From f7a1e391396763fad607b4e778b0c4ee54126ec7 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 9 Dec 2017 10:21:23 -0500 Subject: [PATCH 374/379] tools: simplify no-let-in-for-declaration rule PR-URL: https://github.com/nodejs/node/pull/17572 Reviewed-By: Anatoli Papirovski --- .../eslint-rules/no-let-in-for-declaration.js | 46 ++++++------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/tools/eslint-rules/no-let-in-for-declaration.js b/tools/eslint-rules/no-let-in-for-declaration.js index 34ad2d5761fda2..1ae49a48dee8a2 100644 --- a/tools/eslint-rules/no-let-in-for-declaration.js +++ b/tools/eslint-rules/no-let-in-for-declaration.js @@ -11,46 +11,28 @@ //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ +const message = 'Use of `let` as the loop variable in a for-loop is ' + + 'not recommended. Please use `var` instead.'; +const forSelector = 'ForStatement[init.kind="let"]'; +const forInOfSelector = 'ForOfStatement[left.kind="let"],' + + 'ForInStatement[left.kind="let"]'; module.exports = { create(context) { const sourceCode = context.getSourceCode(); - const msg = 'Use of `let` as the loop variable in a for-loop is ' + - 'not recommended. Please use `var` instead.'; - - /** - * Report function to test if the for-loop is declared using `let`. - */ - function testForLoop(node) { - if (node.init && node.init.kind === 'let') { - context.report({ - node: node.init, - message: msg, - fix: (fixer) => - fixer.replaceText(sourceCode.getFirstToken(node.init), 'var') - }); - } - } - /** - * Report function to test if the for-in or for-of loop - * is declared using `let`. - */ - function testForInOfLoop(node) { - if (node.left && node.left.kind === 'let') { - context.report({ - node: node.left, - message: msg, - fix: (fixer) => - fixer.replaceText(sourceCode.getFirstToken(node.left), 'var') - }); - } + function report(node) { + context.report({ + node, + message, + fix: (fixer) => + fixer.replaceText(sourceCode.getFirstToken(node), 'var') + }); } return { - 'ForStatement': testForLoop, - 'ForInStatement': testForInOfLoop, - 'ForOfStatement': testForInOfLoop + [forSelector]: (node) => report(node.init), + [forInOfSelector]: (node) => report(node.left), }; } }; From 39e2fb6ad4f639bd5293cedd7175f4835e452ae8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 8 Dec 2017 18:03:30 -0800 Subject: [PATCH 375/379] test: simplify common.PORT code common.PORT is no longer used in parallelized tests and should not be. Remove code that accommodates parallelized tests. PR-URL: https://github.com/nodejs/node/pull/17559 Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- test/common/index.js | 4 ++-- test/testpy/__init__.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 90df0a4e698cb7..6a1b6509d12a6f 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -39,8 +39,9 @@ const noop = () => {}; // Using a `.` prefixed name, which is the convention for "hidden" on POSIX, // gets tools to ignore it by default or by simple rules, especially eslint. let tmpDirName = '.tmp'; -// PORT should match the definition in test/testpy/__init__.py. + exports.PORT = +process.env.NODE_COMMON_PORT || 12346; + exports.isWindows = process.platform === 'win32'; exports.isWOW64 = exports.isWindows && (process.env.PROCESSOR_ARCHITEW6432 !== undefined); @@ -162,7 +163,6 @@ exports.refreshTmpDir = function() { }; if (process.env.TEST_THREAD_ID) { - exports.PORT += process.env.TEST_THREAD_ID * 100; tmpDirName += `.${process.env.TEST_THREAD_ID}`; } exports.tmpDir = path.join(testRoot, tmpDirName); diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index f113c1253a477f..455d57f4d9157a 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -61,10 +61,7 @@ def GetCommand(self): source = open(self.file).read() flags_match = FLAGS_PATTERN.search(source) if flags_match: - # PORT should match the definition in test/common/index.js. - env = { 'PORT': int(os.getenv('NODE_COMMON_PORT', '12346')) } - env['PORT'] += self.thread_id * 100 - flag = flags_match.group(1).strip().format(**env).split() + flag = flags_match.group(1).strip().split() # The following block reads config.gypi to extract the v8_enable_inspector # value. This is done to check if the inspector is disabled in which case # the '--inspect' flag cannot be passed to the node process as it will From 03d2514b466f2b1c446246f881fa244549dee948 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 8 Dec 2017 18:33:36 -0800 Subject: [PATCH 376/379] tools,test: throw if common.PORT used in parallel tests common.PORT should not be used in parallelized tests. (There can be a port collision if another tests requests an arbitrary open port from the operating system and ends up getting common.PORT before a test that uses common.PORT uses the port.) In such a situation, throw an error. PR-URL: https://github.com/nodejs/node/pull/17559 Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- test/common/index.js | 11 ++++++++++- tools/test.py | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 6a1b6509d12a6f..3bc3500516ca06 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -40,7 +40,16 @@ const noop = () => {}; // gets tools to ignore it by default or by simple rules, especially eslint. let tmpDirName = '.tmp'; -exports.PORT = +process.env.NODE_COMMON_PORT || 12346; +Object.defineProperty(exports, 'PORT', { + get: () => { + if (+process.env.TEST_PARALLEL) { + throw new Error('common.PORT cannot be used in a parallelized test'); + } + return +process.env.NODE_COMMON_PORT || 12346; + }, + enumerable: true +}); + exports.isWindows = process.platform === 'win32'; exports.isWOW64 = exports.isWindows && diff --git a/tools/test.py b/tools/test.py index ccc25f2a883c15..230774b25619da 100755 --- a/tools/test.py +++ b/tools/test.py @@ -532,7 +532,8 @@ def Run(self): try: result = self.RunCommand(self.GetCommand(), { - "TEST_THREAD_ID": "%d" % self.thread_id + "TEST_THREAD_ID": "%d" % self.thread_id, + "TEST_PARALLEL" : "%d" % self.parallel }) finally: # Tests can leave the tty in non-blocking mode. If the test runner From 5a9172fe06f5034f3e2d1508fe16744c79b92af2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 8 Dec 2017 21:23:29 -0800 Subject: [PATCH 377/379] test: remove unnecessary use of common.PORT in addons test Using port 0 to request an open port from the operating system is sufficient in openssl-client-cert-engine/test.js. PR-URL: https://github.com/nodejs/node/pull/17563 Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau Reviewed-By: Jon Moss Reviewed-By: Colin Ihrig --- test/addons/openssl-client-cert-engine/test.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/addons/openssl-client-cert-engine/test.js b/test/addons/openssl-client-cert-engine/test.js index d07b9c6a1c2c81..1c0e4564a5c3e9 100644 --- a/test/addons/openssl-client-cert-engine/test.js +++ b/test/addons/openssl-client-cert-engine/test.js @@ -21,8 +21,6 @@ const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem')); const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem')); const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem')); -const port = common.PORT; - const serverOptions = { key: agentKey, cert: agentCert, @@ -34,11 +32,11 @@ const serverOptions = { const server = https.createServer(serverOptions, (req, res) => { res.writeHead(200); res.end('hello world'); -}).listen(port, common.localhostIPv4, () => { +}).listen(0, common.localhostIPv4, () => { const clientOptions = { method: 'GET', host: common.localhostIPv4, - port: port, + port: server.address().port, path: '/test', clientCertEngine: engine, // engine will provide key+cert rejectUnauthorized: false, // prevent failing on self-signed certificates From e7ae8eb457ae764565bd3cee6d36bfe7919601c7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 10 Dec 2017 15:55:00 -0800 Subject: [PATCH 378/379] test: refactor test-child-process-pass-fd Add a comment explaining the test (especailly why it forks 80 processes. Use destructuring and an arrow function callback. PR-URL: https://github.com/nodejs/node/pull/17596 Reviewed-By: Khaidi Chu Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Minwoo Jung --- test/sequential/test-child-process-pass-fd.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index 8cc11f6c11f5b4..73e469cdede2be 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -1,11 +1,20 @@ 'use strict'; const common = require('../common'); + +// On some OS X versions, when passing fd's between processes: +// When the handle associated to a specific file descriptor is closed by the +// sender process before it's received in the destination, the handle is indeed +// closed while it should remain opened. In order to fix this behavior, don't +// close the handle until the `NODE_HANDLE_ACK` is received by the sender. +// This test is basically `test-cluster-net-send` but creating lots of workers +// so the issue reproduces on OS X consistently. + if ((process.config.variables.arm_version === '6') || (process.config.variables.arm_version === '7')) common.skip('Too slow for armv6 and armv7 bots'); const assert = require('assert'); -const fork = require('child_process').fork; +const { fork } = require('child_process'); const net = require('net'); const N = 80; @@ -46,14 +55,14 @@ if (process.argv[2] !== 'child') { process.on('message', common.mustCall()); const server = net.createServer((c) => { - process.once('message', function(msg) { + process.once('message', (msg) => { assert.strictEqual(msg, 'got'); c.end('hello'); }); socketConnected(); }).unref(); server.listen(0, common.localhostIPv4, () => { - const port = server.address().port; + const { port } = server.address(); socket = net.connect(port, common.localhostIPv4, socketConnected).unref(); }); } From 08941e9f1b3f1e8214e0a23d02b19bb07de8b951 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 12 Dec 2017 03:09:37 -0500 Subject: [PATCH 379/379] 2017-12-12 Version 9.3.0 (Current) Notable changes: * async\_hooks: - add trace events to async_hooks (Andreas Madsen) https://github.com/nodejs/node/pull/15538 - add provider types for net server (Andreas Madsen) https://github.com/nodejs/node/pull/17157 * console: - console.debug can now be used outside of the inspector (Benjamin Zaslavsky) https://github.com/nodejs/node/pull/17033 * deps: - upgrade libuv to 1.18.0 (cjihrig) https://github.com/nodejs/node/pull/17282 - patch V8 to 6.2.414.46 (Myles Borins) https://github.com/nodejs/node/pull/17206 * module: - module.builtinModules will return a list of built in modules (Jon Moss) https://github.com/nodejs/node/pull/16386 * n-api: - add helper for addons to get the event loop (Anna Henningsen) https://github.com/nodejs/node/pull/17109 * process: - process.setUncaughtExceptionCaptureCallback can now be used to customize behavior for `--abort-on-uncaught-exception` (Anna Henningsen) https://github.com/nodejs/node/pull/17159 - A signal handler is now able to receive the signal code that triggered the handler. (Robert Rossmann) https://github.com/nodejs/node/pull/15606 * src: - embedders can now use Node::CreatePlatform to create an instance of NodePlatform (Cheng Zhao) https://github.com/nodejs/node/pull/16981 * stream: - writable.writableHighWaterMark and readable.readableHighWaterMark will return the values the stream object was instantiated with (Calvin Metcalf) https://github.com/nodejs/node/pull/12860 * **Added new collaborators** * [maclover7](https://github.com/maclover7) Jon Moss * [guybedford](https://github.com/guybedford) Guy Bedford * [hashseed](https://github.com/hashseed) Yang Guo PR-URL: https://github.com/nodejs/node/pull/17631 --- CHANGELOG.md | 3 +- doc/api/console.md | 4 +- doc/api/https.md | 2 +- doc/api/modules.md | 2 +- doc/api/n-api.md | 2 +- doc/api/process.md | 4 +- doc/api/stream.md | 4 +- doc/api/tls.md | 4 +- doc/changelogs/CHANGELOG_V9.md | 411 +++++++++++++++++++++++++++++++++ src/node_version.h | 6 +- 10 files changed, 427 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1801a86ae42ea..6b17c36f3e215d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,8 @@ release.
Current
S_IRWXUFile mode indicating readable, writable and executable by owner.File mode indicating readable, writable, and executable by owner.
S_IRUSR
S_IRWXGFile mode indicating readable, writable and executable by group.File mode indicating readable, writable, and executable by group.
S_IRGRP
S_IRWXOFile mode indicating readable, writable and executable by others.File mode indicating readable, writable, and executable by others.
S_IROTH
SIGILL Sent to a process to notify that it has attempted to perform an illegal, - malformed, unknown or privileged instruction.
SIGTRAP
-9.2.1
+9.3.0
+9.2.1
9.2.0
9.1.0
9.0.0
diff --git a/doc/api/console.md b/doc/api/console.md index 6dac2a8a5e7c66..5722f362841484 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -241,7 +241,7 @@ undefined @@ -280,7 +280,7 @@ Defaults to `false`. Colors are customizable; see diff --git a/doc/api/https.md b/doc/api/https.md index 96ba80f29fa034..48a2aa2a8022c4 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -150,7 +150,7 @@ Global instance of [`https.Agent`][] for all HTTPS client requests. * {string[]} diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 0843165f075be9..ad6e3c7eeab02a 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3695,7 +3695,7 @@ a specific `napi_env`. ### napi_get_uv_event_loop ```C NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, diff --git a/doc/api/process.md b/doc/api/process.md index 8c91a6c9d7c210..60545ff06281a1 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1137,7 +1137,7 @@ or Android). ## process.hasUncaughtExceptionCaptureCallback() * Returns: {boolean} @@ -1647,7 +1647,7 @@ or Android). ## process.setUncaughtExceptionCaptureCallback(fn) * `fn` {Function|null} diff --git a/doc/api/stream.md b/doc/api/stream.md index dec38202221b70..f3780ee4c49b01 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -439,7 +439,7 @@ See also: [`writable.cork()`][]. ##### writable.writableHighWaterMark Return the value of `highWaterMark` passed when constructing this @@ -889,7 +889,7 @@ options. ##### readable.readableHighWaterMark Return the value of `highWaterMark` passed when constructing this diff --git a/doc/api/tls.md b/doc/api/tls.md index 2898c28cd323ca..6239ec6f4174d4 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -956,7 +956,7 @@ port or host argument.