diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index 33af7da1ae..97c8854c86 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -170,20 +170,24 @@ Item { objectName: "loader" asynchronous: false - width: parent.width height: parent.height + // Hook up callback for clara.io download from the marketplace. + Connections { + id: eventBridgeConnection + target: null + onWebEventReceived: { + if (message.slice(0, 17) === "CLARA.IO DOWNLOAD") { + ApplicationInterface.addAssetToWorldFromURL(message.slice(18)); + } + } + } + onLoaded: { if (loader.item.hasOwnProperty("eventBridge")) { loader.item.eventBridge = eventBridge; - - // Hook up callback for clara.io download from the marketplace. - eventBridge.webEventReceived.connect(function (event) { - if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") { - ApplicationInterface.addAssetToWorldFromURL(event.slice(18)); - } - }); + eventBridgeConnection.target = eventBridge } if (loader.item.hasOwnProperty("sendToScript")) { loader.item.sendToScript.connect(tabletRoot.sendToScript); diff --git a/interface/resources/qml/hifi/tablet/WindowRoot.qml b/interface/resources/qml/hifi/tablet/WindowRoot.qml index 470fd4a830..ee8dbbff59 100644 --- a/interface/resources/qml/hifi/tablet/WindowRoot.qml +++ b/interface/resources/qml/hifi/tablet/WindowRoot.qml @@ -90,16 +90,21 @@ Windows.ScrollingWindow { anchors.left: parent.left anchors.top: parent.top + // Hook up callback for clara.io download from the marketplace. + Connections { + id: eventBridgeConnection + target: null + onWebEventReceived: { + if (message.slice(0, 17) === "CLARA.IO DOWNLOAD") { + ApplicationInterface.addAssetToWorldFromURL(message.slice(18)); + } + } + } + onLoaded: { if (loader.item.hasOwnProperty("eventBridge")) { loader.item.eventBridge = eventBridge; - - // Hook up callback for clara.io download from the marketplace. - eventBridge.webEventReceived.connect(function (event) { - if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") { - ApplicationInterface.addAssetToWorldFromURL(event.slice(18)); - } - }); + eventBridgeConnection.target = eventBridge } if (loader.item.hasOwnProperty("sendToScript")) { loader.item.sendToScript.connect(tabletRoot.sendToScript); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index f39165f3df..6a1ede88c6 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2100,7 +2100,13 @@ function selectParticleEntity(entityID) { } entityListTool.webView.webEventReceived.connect(function (data) { - data = JSON.parse(data); + try { + data = JSON.parse(data); + } catch(e) { + print("edit.js: Error parsing JSON: " + e.name + " data " + data) + return; + } + if (data.type === 'parent') { parentSelectedEntities(); } else if(data.type === 'unparent') { diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 3b6d32ec1c..64a05fcebf 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -109,7 +109,13 @@ EntityListTool = function(opts) { }; webView.webEventReceived.connect(function(data) { - data = JSON.parse(data); + try { + data = JSON.parse(data); + } catch(e) { + print("entityList.js: Error parsing JSON: " + e.name + " data " + data) + return; + } + if (data.type == "selectionUpdate") { var ids = data.entityIds; var entityIDs = []; diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index 0290674a0f..de9596e9be 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -238,7 +238,13 @@ GridTool = function(opts) { }); webView.webEventReceived.connect(function(data) { - data = JSON.parse(data); + try { + data = JSON.parse(data); + } catch(e) { + print("gridTool.js: Error parsing JSON: " + e.name + " data " + data) + return; + } + if (data.type == "init") { horizontalGrid.emitUpdate(); } else if (data.type == "update") {