Skip to content

Commit 121ad5d

Browse files
author
Alexander Vakrilov
authored
Enable evaluating in Chrome Console (NativeScript#3405) (NativeScript#4713)
Chrome calls compileScript method when an expression is evaluated in the console. So to enable the console evaluate add an empty compileScript implementation. Also send an Runtime.executionContextCreated which is needed for Console evaluation. Both of the command and the event do not exist in the Webkit protocol, so we cannot use InspectorBackendCommands definition file
1 parent bba7a82 commit 121ad5d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tns-core-modules/debugger/webinspector.ios.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBacken
33

44
import * as debuggerDomains from "./debugger";
55

6+
declare var __inspectorSendEvent;
67
/**
78
* Checks if the property is a function and if it is, calls it on this.
89
* Designed to support backward compatibility for methods that became properties.
@@ -253,3 +254,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
253254
return resourceData;
254255
}
255256
}
257+
258+
@inspectorCommands.DomainDispatcher("Runtime")
259+
export class RuntimeDomainDebugger {
260+
constructor() {
261+
__inspectorSendEvent(`{"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"http://main.xml","name":"","auxData":{"isDefault":true,"frameId":"${frameId}"}}}}`);
262+
}
263+
264+
compileScript(): { scriptId?: string, exceptionDetails?: Object } {
265+
return {};
266+
}
267+
}

0 commit comments

Comments
 (0)