/* * weinre is available under *either* the terms of the modified BSD license *or* the * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * * Copyright (c) 2010, 2011 IBM Corporation */ requireClass ../common/Weinre //----------------------------------------------------------------------------- class InjectedScriptHostImpl //----------------------------------------------------------------------------- method clearConsoleMessages(callback) if (callback) { Weinre.WeinreTargetCommands.sendClientCallback(callback) } //----------------------------------------------------------------------------- method nodeForId(/*int*/ nodeId, callback) return Weinre.nodeStore.getNode(nodeId) //----------------------------------------------------------------------------- method pushNodePathToFrontend(/*any*/ node, /*boolean*/ withChildren, /*boolean*/ selectInUI, callback) // callback: function() var nodeId = Weinre.nodeStore.getNodeId(node) var children = Weinre.nodeStore.serializeNode(node, 1) Weinre.wi.DOMNotify.setChildNodes(nodeId, children) if (callback) { Weinre.WeinreTargetCommands.sendClientCallback(callback) } //----------------------------------------------------------------------------- method inspectedNode(/*int*/ num, callback) // callback: function() var nodeId = Weinre.nodeStore.getInspectedNode(num) return nodeId //----------------------------------------------------------------------------- method internalConstructorName(object) var ctor = object.constructor var ctorName = ctor.fullClassName || ctor.displayName || ctor.name if (ctorName && (ctorName != "Object")) return ctorName var pattern = /\[object (.*)\]/ var match = pattern.exec(ctor.toString()) if (match) return match[1] return "Object"