Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: sky/framework/inspector/runtime-agent.sky

Issue 951673003: Remove outdated examples and framework pieces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/inspector/page-agent.sky ('k') | sky/framework/inspector/worker-agent.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/inspector/runtime-agent.sky
diff --git a/sky/framework/inspector/runtime-agent.sky b/sky/framework/inspector/runtime-agent.sky
deleted file mode 100644
index 62f6a9c2c75d3c6e68e3325e8fa904ef9365e5ed..0000000000000000000000000000000000000000
--- a/sky/framework/inspector/runtime-agent.sky
+++ /dev/null
@@ -1,135 +0,0 @@
-<import src="debug.sky" as="debug" />
-<script>
-class Runtime {
- constructor(delegate) {
- this.delegate_ = delegate;
- Object.preventExtensions(this);
- }
-
- enable() {
- this.delegate_.sendMessage("Runtime.executionContextCreated", {
- "context": {
- "frameId": 1,
- "id": 1,
- }
- });
- return {
- result: true,
- };
- }
-
- callFunctionOn(params) {
- var object = g_objectRegistry.lookup(params.objectId);
- // This is a horrible hack:
- var functionName = params.functionDeclaration.match(/^function (\w+)\(/)[1];
- var expression = params.functionDeclaration + "; return " + functionName + ";";
- var wasThrown = false;
- var value;
- try {
- var func = new Function('', expression)();
- value = func(object);
- } catch (e) {
- value = e;
- wasThrown = true;
- }
-
- return makeResult(params, value, wasThrown);
- }
-
- // FIXME: See Blink"s inspected-script-source.js InjectedScript.RemoteObject.
- evaluate(params) {
- var wasThrown = false;
- var value;
- try {
- value = eval(params.expression);
- } catch (e) {
- value = e;
- wasThrown = true;
- }
-
- return makeResult(params, value, wasThrown);
- }
-
- getProperties(params) {
- var properties = injectedScript.getProperties(params.objectId, !!params.ownProperties, !!params.accessorPropertiesOnly);
- var result = {
- result: properties
- };
- if (!params.accessorPropertiesOnly) {
- result.internalProperties = injectedScript.getInternalProperties(params.objectId);
- }
- return result;
- }
-}
-
-// FIXME: This should release all objects associated with an object
-// group, see InjectedScriptSource.js for an example. Just have to
-// track which object ids are associated with which object groups first.
-Runtime.prototype.releaseObjectGroup = debug.loggingStub("releaseObjectGroup");
-
-// See InjectedScript._bind for a fancier version of this:
-
-class RemoteObjectRegistery {
- constructor() {
- this.lastObjectId = 0;
- this.objectsById = [];
- Object.preventExtensions(this);
- }
-
- register(object) {
- var objectId = ++this.lastObjectId;
- this.objectsById[objectId] = object;
- return String(objectId);
- }
-
- lookup(objectId) {
- return this.objectsById[Number(objectId)];
- }
-}
-
-var g_objectRegistry = new RemoteObjectRegistery();
-
-function makeResult(params, value, wasThrown) {
- var type = typeof(value)
- var result = {
- "result": {
- "type": type,
- },
- "wasThrown": wasThrown,
- };
-
- // Unclear why this often fails with:
- // "TypeError: Cannot convert object to primitive value"
- try {
- result['result']['description'] = String(value);
- } catch (e) {}
-
- if (type == "object") {
- result["result"]["objectId"] = g_objectRegistry.register(value);
- }
-
- if (params.returnByValue) {
- result["result"]["value"] = value;
- }
-
- if (wasThrown) {
- // If we don"t have exceptionDetails, inspector hits an exception.
- result["exceptionDetails"] = {
- "text": value.message,
- "url": "",
- "line": 0,
- "column": 0,
- "stackTrace": [{
- "functionName": "",
- "scriptId": "1",
- "url": "",
- "lineNumber": 0,
- "columnNumber": 0
- }]
- }
- }
- return result;
-}
-
-module.exports = Runtime;
-</script>
« no previous file with comments | « sky/framework/inspector/page-agent.sky ('k') | sky/framework/inspector/worker-agent.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698