Skip to content

Commit

Permalink
v0.18.3
Browse files Browse the repository at this point in the history
Use Isolate::IsDead, Nan::NewInstance, latest node-gyp for tests

Use latest node-gyp for AppVeyor builds

Fix snprintf macro

Fix IsDead version. Use latest node-pre-gyp.

Fix AppVeyor builds for Node v4 on win32
  • Loading branch information
rchipka committed Jan 16, 2017
1 parent cb87eaf commit 35c4ccf
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -21,3 +21,4 @@ sudo: false
before_install:
- $CXX --version
- case ${TRAVIS_NODE_VERSION} in 0.8*|0.10*) npm install -g npm@2 ;; esac
- npm install node-gyp -g
9 changes: 8 additions & 1 deletion appveyor.yml
Expand Up @@ -24,13 +24,20 @@ install:
- npm config set msvs_version 2015
- npm config set python C:\Python27\python.exe
- npm install -g npm
- npm install -g node-gyp
- npm install -g node-pre-gyp

# work around an issue with node-gyp v3.3.1 and node 4x
# https://github.com/nodejs/node-gyp/issues/921
- npm config set -g cafile=package.json
- npm config set -g strict-ssl=false
- npm config set registry http://registry.npmjs.org/

build_script:
- npm install --msvs_version=2015

test_script:
- cmd: node --expose-gc node_modules/nodeunit/bin/nodeunit test
- cmd: node --expose-gc node_modules/nodeunit/bin/nodeunit test

after_test:
- cmd: node-pre-gyp package 2>&1
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -12,7 +12,7 @@
"package_name": "{node_abi}-{platform}-{arch}.tar.gz"
},
"description": "libxml bindings for v8 javascript engine",
"version": "0.18.2",
"version": "0.18.3",
"scripts": {
"install": "node-pre-gyp install --fallback-to-build --loglevel http",
"test": "node --expose_gc ./node_modules/.bin/nodeunit test"
Expand All @@ -30,7 +30,7 @@
"node": ">=0.8.0"
},
"dependencies": {
"node-pre-gyp": "0.6.28",
"node-pre-gyp": "~0.6.32",
"bindings": "1.2.1",
"nan": "~2.5.0"
},
Expand Down
11 changes: 9 additions & 2 deletions src/libxmljs.cc
Expand Up @@ -51,16 +51,23 @@ void xmlMemFreeWrap(void* p)
// our cleanup routines for libxml will be called (freeing memory)
// but v8 is already offline and does not need to be informed
// trying to adjust after shutdown will result in a fatal error
#if (NODE_MODULE_VERSION > 0x000B)
#if (NODE_MODULE_VERSION > 14)
if (v8::Isolate::GetCurrent() == 0 ||
v8::Isolate::GetCurrent()->IsDead())
{
return;
}
#elif (NODE_MODULE_VERSION > 0x000B)
if (v8::Isolate::GetCurrent() == 0)
{
return;
}
#endif
#else
if (v8::V8::IsDead())
{
return;
}
#endif

const int diff = xmlMemUsed() - xml_memory_used;
xml_memory_used += diff;
Expand Down
4 changes: 2 additions & 2 deletions src/xml_attribute.cc
Expand Up @@ -23,7 +23,7 @@ XmlAttribute::New(xmlNode* xml_obj, const xmlChar* name, const xmlChar* value)
}

XmlAttribute* attribute = new XmlAttribute(attr);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
attribute->Wrap(obj);
return scope.Escape(obj);
}
Expand All @@ -39,7 +39,7 @@ XmlAttribute::New(xmlAttr* attr)
}

XmlAttribute* attribute = new XmlAttribute(attr);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
attribute->Wrap(obj);
return scope.Escape(obj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml_comment.cc
Expand Up @@ -87,7 +87,7 @@ XmlComment::New(xmlNode* node)
}

XmlComment* comment = new XmlComment(node);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
comment->Wrap(obj);
return scope.Escape(obj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml_document.cc
Expand Up @@ -250,7 +250,7 @@ XmlDocument::New(xmlDoc* doc)
return scope.Escape(static_cast<XmlDocument*>(doc->_private)->handle());
}

v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();

XmlDocument* document = Nan::ObjectWrap::Unwrap<XmlDocument>(obj);

Expand Down
2 changes: 1 addition & 1 deletion src/xml_element.cc
Expand Up @@ -500,7 +500,7 @@ XmlElement::New(xmlNode* node)
}

XmlElement* element = new XmlElement(node);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
element->Wrap(obj);
return scope.Escape(obj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml_namespace.cc
Expand Up @@ -57,7 +57,7 @@ XmlNamespace::New(xmlNs* node)
}

XmlNamespace* ns = new XmlNamespace(node);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
ns->Wrap(obj);
return scope.Escape(obj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml_node.cc
Expand Up @@ -76,7 +76,7 @@ NAN_METHOD(XmlNode::Namespace) {
// will create a new namespace attached to this node
// since we keep the document around, the namespace, like the node, won't be
// garbage collected
v8::Local<v8::Value> new_ns = define_namespace->NewInstance(argc, argv);
v8::Local<v8::Value> new_ns = Nan::NewInstance(define_namespace, argc, argv).ToLocalChecked();
ns = Nan::ObjectWrap::Unwrap<XmlNamespace>(new_ns->ToObject());
}

Expand Down
2 changes: 1 addition & 1 deletion src/xml_text.cc
Expand Up @@ -207,7 +207,7 @@ XmlText::New(xmlNode* node)
}

XmlText* element = new XmlText(node);
v8::Local<v8::Object> obj = Nan::New(constructor_template)->GetFunction()->NewInstance();
v8::Local<v8::Object> obj = Nan::NewInstance(Nan::New(constructor_template)->GetFunction()).ToLocalChecked();
element->Wrap(obj);
return scope.Escape(obj);
}
Expand Down
9 changes: 5 additions & 4 deletions vendor/libxml/config.h
Expand Up @@ -173,13 +173,14 @@
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1

/* Define to 1 if you have the `snprintf' function. */
#if defined(_WIN32) && _MSC_VER >= 1900
#define HAVE_SNPRINTF 1
#else
/* snprintf macro for older MSVS versions */
#if defined(_WIN32) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1

/* Define to 1 if you have the `sprintf' function. */
#define HAVE_SPRINTF 1

Expand Down

0 comments on commit 35c4ccf

Please sign in to comment.