Skip to content

Commit e4d302f

Browse files
author
Michael Fiess
authored
Merge branch 'master' into master
2 parents 341ea57 + 9f54273 commit e4d302f

24 files changed

+622
-765
lines changed

ci/leak.supp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,30 @@
9999
fun:_ZL16drawImageTextureffff5rtRefI9pxTextureES1_bPfN18pxConstantsStretch9constantsES4_
100100
fun:_ZN9pxContext9drawImageEffff5rtRefI9pxTextureES2_bPfN18pxConstantsStretch9constantsES5_b
101101
}
102+
{
103+
downloadExpiresThreadLeaks
104+
Memcheck:Leak
105+
match-leak-kinds: definite
106+
fun:calloc
107+
fun:allocate_dtv
108+
fun:_dl_allocate_tls
109+
fun:allocate_stack
110+
fun:pthread_create@@GLIBC_2.2.5
111+
fun:_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE
112+
fun:_ZNSt6threadC1IRFvvEJEEEOT_DpOT0_
113+
fun:_ZN16rtFileDownloader8instanceEv
114+
fun:_ZN9pxArchive11initFromUrlERK8rtStringRK5rtRefI6rtCORSE11rtObjectRef
115+
fun:_ZN9pxScene2d11loadArchiveERK8rtStringR11rtObjectRef
116+
fun:_ZN9pxScene2d17loadArchive_thunkEiPK7rtValueRS0_
117+
fun:_ZN16rtObjectFunction4SendEiPK7rtValuePS0_
118+
fun:_ZN19rtScriptV8NodeUtils17rtFunctionWrapper4callERKN2v820FunctionCallbackInfoINS1_5ValueEEE
119+
fun:_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE
120+
fun:_ZN2v88internalL36HandleApiCallAsFunctionOrConstructorEPNS0_7IsolateEbNS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE0EEE
121+
fun:_ZN2v88internalL31Builtin_HandleApiCallAsFunctionEiPPNS0_6ObjectEPNS0_7IsolateE
122+
obj:*
123+
obj:*
124+
obj:*
125+
obj:*
126+
obj:*
127+
obj:*
128+
}

cmake/V8Deps.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ if (PREFER_SYSTEM_LIBRARIES)
3030
set(V8_LIBRARIES
3131
v8
3232
v8_libbase
33-
v8_libplatform)
33+
v8_libplatform
34+
uv
35+
uWS)
3436
endif(V8_VERSION_DIR)
3537
endif (PREFER_SYSTEM_LIBRARIES)
3638

examples/pxScene2d/src/pxScene2d.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,17 +1901,13 @@ pxScene2d::pxScene2d(bool top, pxScriptView* scriptView)
19011901
mScriptView = scriptView;
19021902
mTag = gTag++;
19031903

1904-
if (scriptView != NULL)
1905-
{
1906-
mOrigin = rtUrlGetOrigin(scriptView->getUrl().cString());
1907-
}
1908-
1904+
rtString origin = scriptView != NULL ? rtUrlGetOrigin(scriptView->getUrl().cString()) : rtString();
19091905
#ifdef ENABLE_PERMISSIONS_CHECK
19101906
// rtPermissions accounts parent scene permissions too
1911-
mPermissions = new rtPermissions(mOrigin.cString());
1907+
mPermissions = new rtPermissions(origin.cString());
19121908
#endif
19131909
#ifdef ENABLE_ACCESS_CONTROL_CHECK
1914-
mCORS = new rtCORS(mOrigin.cString());
1910+
mCORS = new rtCORS(origin.cString());
19151911
#endif
19161912

19171913
// make sure that initial onFocus is sent
@@ -3728,7 +3724,6 @@ rtDefineProperty(pxScene2d,alignHorizontal);
37283724
rtDefineProperty(pxScene2d,truncation);
37293725
rtDefineMethod(pxScene2d, dispose);
37303726

3731-
rtDefineProperty(pxScene2d, origin);
37323727
#ifdef ENABLE_PERMISSIONS_CHECK
37333728
rtDefineProperty(pxScene2d, permissions);
37343729
#endif

examples/pxScene2d/src/pxScene2d.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,8 +1406,6 @@ class pxScene2d: public rtObject, public pxIView, public rtIServiceProvider
14061406
rtReadOnlyProperty(alignHorizontal,alignHorizontal,rtObjectRef);
14071407
rtReadOnlyProperty(truncation,truncation,rtObjectRef);
14081408

1409-
rtReadOnlyProperty(origin, origin, rtString);
1410-
14111409
rtMethodNoArgAndNoReturn("dispose",dispose);
14121410

14131411
rtMethod1ArgAndReturn("sparkSetting", sparkSetting, rtString, rtValue);
@@ -1570,7 +1568,6 @@ class pxScene2d: public rtObject, public pxIView, public rtIServiceProvider
15701568
rtCORSRef cors() const { return mCORS; }
15711569
rtError cors(rtObjectRef& v) const { v = mCORS; return RT_OK; }
15721570
rtError sparkSetting(const rtString& setting, rtValue& value) const;
1573-
rtError origin(rtString& v) const { v = mOrigin; return RT_OK; }
15741571

15751572
void setMouseEntered(rtRef<pxObject> o);//setMouseEntered(pxObject* o);
15761573

@@ -1753,7 +1750,6 @@ class pxScene2d: public rtObject, public pxIView, public rtIServiceProvider
17531750
bool mPointerHidden;
17541751
std::vector<rtObjectRef> mInnerpxObjects;
17551752
rtFunctionRef mCustomAnimator;
1756-
rtString mOrigin;
17571753
#ifdef ENABLE_PERMISSIONS_CHECK
17581754
rtPermissionsRef mPermissions;
17591755
#endif

examples/pxScene2d/src/rcvrcore/AppSceneContext.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ var Logger = require('rcvrcore/Logger').Logger;
2828
var SceneModuleLoader = require('rcvrcore/SceneModuleLoader');
2929
var XModule = require('rcvrcore/XModule');
3030
var loadFile = require('rcvrcore/utils/FileUtils').loadFile;
31-
var loadFileWithSparkPermissionsCheck = require('rcvrcore/utils/FileUtils').loadFileWithSparkPermissionsCheck;
3231
var SceneModuleManifest = require('rcvrcore/SceneModuleManifest');
3332
var JarFileMap = require('rcvrcore/utils/JarFileMap');
3433
var AsyncFileAcquisition = require('rcvrcore/utils/AsyncFileAcquisition');
35-
var AccessControl = isV8?null:require('rcvrcore/utils/AccessControl');
3634
var WrapObj = require('rcvrcore/utils/WrapObj');
35+
var http_wrap = isV8?null:require('rcvrcore/http_wrap');
3736

3837
var log = new Logger('AppSceneContext');
3938
//overriding original timeout and interval functions
@@ -42,10 +41,6 @@ var ClearTimeout = (isDuk || isV8)?timers.clearTimeout:clearTimeout;
4241
var SetInterval = (isDuk || isV8)?timers.setInterval:setInterval;
4342
var ClearInterval = (isDuk || isV8)?timers.clearInterval:clearInterval;
4443

45-
46-
var http_wrap = isV8?null:require('rcvrcore/http_wrap');
47-
var https_wrap = isV8?null:require('rcvrcore/https_wrap');
48-
4944
function AppSceneContext(params) {
5045

5146
this.getContextID = params.getContextID;
@@ -70,7 +65,6 @@ function AppSceneContext(params) {
7065
this.scriptMap = {};
7166
this.xmoduleMap = {};
7267
this.asyncFileAcquisition = new AsyncFileAcquisition(params.scene);
73-
this.accessControl = isV8?null:new AccessControl(params.scene);
7468
this.lastHrTime = isDuk?uv.hrtime():(isV8?uv_hrtime():process.hrtime());
7569
this.resizeTimer = null;
7670
this.topXModule = null;
@@ -80,8 +74,6 @@ function AppSceneContext(params) {
8074
this.timers = [];
8175
this.timerIntervals = [];
8276
this.webSocketManager = null;
83-
this.httpwrap = isV8?null:new http_wrap(this.accessControl);
84-
this.httpswrap = isV8?null:new https_wrap(this.accessControl);
8577
this.disableFilePermissionCheck = isV8?true:this.innerscene.sparkSetting("disableFilePermissionCheck");
8678
if (undefined == this.disableFilePermissionCheck)
8779
{
@@ -194,12 +186,6 @@ function terminateScene() {
194186
this.sceneWrapper.close();
195187
this.sceneWrapper = null;
196188
this.rpcController = null;
197-
if (this.accessControl) {
198-
this.accessControl.destroy();
199-
this.accessControl = null;
200-
}
201-
this.httpwrap = null;
202-
this.httpswrap = null;
203189
this.isCloseEvtRcvd = false;
204190
this.isTermEvtRcvd = false;
205191
this.termEvent = null;
@@ -611,14 +597,10 @@ AppSceneContext.prototype.getModuleFile = function(filePath, xModule) {
611597

612598
AppSceneContext.prototype.getFile = function(filePath) {
613599
log.message(4, "getFile: requestedFile=" + filePath);
614-
if ((isV8) || ("true" == this.disableFilePermissionCheck || true == this.disableFilePermissionCheck))
615-
{
600+
if ((isV8) || ("true" === this.disableFilePermissionCheck || true === this.disableFilePermissionCheck)) {
616601
return loadFile(filePath);
617602
}
618-
else
619-
{
620-
return loadFileWithSparkPermissionsCheck(this.accessControl, this.httpwrap, this.httpswrap, filePath);
621-
}
603+
return loadFile(filePath, this);
622604
};
623605

624606
AppSceneContext.prototype.resolveModulePath = function(filePath, currentXModule) {
@@ -688,7 +670,7 @@ AppSceneContext.prototype.include = function(filePath, currentXModule) {
688670
onImportComplete([modData, origFilePath]);
689671
return;
690672
}
691-
} else if( filePath === 'http' || filePath === 'https' ) {
673+
} else if(/^(http|https|http2)$/.test(filePath)) {
692674
if (isV8) {
693675
modData = require('native_http_wrap')(_this.innerscene);
694676
onImportComplete([modData, origFilePath]);

examples/pxScene2d/src/rcvrcore/SceneModuleLoader.js

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@ limitations under the License.
1818

1919
"use strict";
2020

21-
var fs = require('fs');
22-
var url = require('url');
23-
var http = require('http');
2421
var FileArchive = require('rcvrcore/utils/FileArchive');
2522
var SceneModuleManifest = require('rcvrcore/SceneModuleManifest');
26-
//var loadFile = require('rcvrcore/utils/FileUtils').loadFile;
2723
var Logger = require('rcvrcore/Logger').Logger;
2824
var log = new Logger('SceneModuleLoader');
2925

30-
3126
function SceneModuleLoader() {
3227
this.fileArchive = null;
3328
this.manifest = null;
@@ -90,43 +85,6 @@ function isFileInList(fileName, list) {
9085
return false;
9186
}
9287

93-
SceneModuleLoader.prototype.loadScenePackage0 = function(scene, fileSpec) {
94-
log.message(4, "loadScenePackage - fileSpec.fileUri=" + fileSpec.fileUri);
95-
var _this = this;
96-
var filePath = fileSpec.fileUri;
97-
98-
return new Promise(function (resolve, reject) {
99-
if (filePath.substring(0, 4) === "http" || filePath.substring(0,5) == "https") {
100-
_this.loadRemoteFile(filePath).then(function dataAvailable(data) {
101-
_this.processFileData(filePath, data);
102-
if(_this.processFileArchive() === 0) {
103-
resolve();
104-
} else {
105-
reject();
106-
}
107-
}).catch(function onError(err) {
108-
console.error("SceneModuleLoader#loadScenePackage: error on http get of " + filePath + ": Error=" + err);
109-
reject(err);
110-
});
111-
} else {
112-
if( filePath.substring(0,5) === 'file:' ) {
113-
filePath = filePath.substring(5);
114-
}
115-
_this.loadLocalFile(filePath).then(function dataAvailable(data) {
116-
_this.processFileData(filePath, data);
117-
if(_this.processFileArchive() === 0) {
118-
resolve();
119-
} else {
120-
reject();
121-
}
122-
}).catch(function onError(err) {
123-
console.error("SceneModuleLoader#loadScenePackage: error on file get: " + err);
124-
reject(err);
125-
});
126-
}
127-
});
128-
};
129-
13088
SceneModuleLoader.prototype.processFileData = function(filePath, data) {
13189
this.fileArchive = new FileArchive(filePath);
13290
if( data[0] === 80 && data[1] === 75 && data[2] === 3 && data[3] === 4) {
@@ -138,76 +96,6 @@ SceneModuleLoader.prototype.processFileData = function(filePath, data) {
13896
}
13997
};
14098

141-
142-
SceneModuleLoader.prototype.loadRemoteFile = function(filePath) {
143-
var _this = this;
144-
return new Promise(function (resolve, reject) {
145-
log.message(3, "loadRemoteFile: " + filePath);
146-
var req = http.get(url.parse(filePath), function (res) {
147-
if (res.statusCode !== 200) {
148-
console.error(res.statusCode);
149-
reject("http get error. statusCode=" + res.statusCode);
150-
}
151-
var data = [], dataLen = 0;
152-
153-
// don't set the encoding, it will break everything !
154-
res.on("data", function (chunk) {
155-
data.push(chunk);
156-
dataLen += chunk.length;
157-
});
158-
159-
res.on("end", function () {
160-
var buf = new Buffer(dataLen);
161-
for (var i=0,len=data.length,pos=0; i<len; i++) {
162-
data[i].copy(buf, pos);
163-
pos += data[i].length;
164-
}
165-
166-
resolve(buf);
167-
});
168-
});
169-
170-
req.on("error", function(err){
171-
reject(err);
172-
});
173-
req.setTimeout(10000, function httpGetTimeout() {
174-
reject("Timeout on http.get(" + filePath +")");
175-
});
176-
});
177-
};
178-
179-
SceneModuleLoader.prototype.loadLocalFile = function(filePath) {
180-
var _this = this;
181-
182-
return new Promise( function(resolve, reject) {
183-
fs.readFile(filePath, function (err, data) {
184-
if (err) {
185-
reject(err);
186-
}
187-
resolve(data);
188-
});
189-
});
190-
};
191-
192-
193-
SceneModuleLoader.prototype.processFileArchive = function() {
194-
if( this.fileArchive.getFileCount() >= 2 ) {
195-
var packageFileContents = this.fileArchive.getFileContents("package.json");
196-
if( packageFileContents !== null ) {
197-
this.manifest = new SceneModuleManifest();
198-
this.manifest.loadFromJSON(packageFileContents);
199-
this.fileArchive.removeFile("package.json");
200-
return 0;
201-
} else {
202-
console.error("No package manifest");
203-
return -1;
204-
}
205-
} else {
206-
console.error("Expected archive to have at least two files.");
207-
return -1;
208-
}
209-
};
210-
21199
SceneModuleLoader.prototype.getFileArchive = function() {
212100
return this.fileArchive;
213101
};
@@ -225,9 +113,3 @@ SceneModuleLoader.prototype.jarFileWasLoaded = function() {
225113
};
226114

227115
module.exports = SceneModuleLoader;
228-
229-
function hasExtension(filePath, extension) {
230-
var idx = filePath.lastIndexOf(extension);
231-
var rtnValue = (idx !== -1) && ((idx + extension.length) === filePath.length);
232-
return rtnValue;
233-
}

examples/pxScene2d/src/rcvrcore/http2_wrap.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)