Merge pull request #6904 from NativeScript/bektchiev/enable-ios-inspector-modules

fix(debugger): Enable iOS inspector modules on creation
This commit is contained in:
Nataliya Hristova
2019-02-15 18:59:22 +02:00
committed by GitHub
3 changed files with 29 additions and 17 deletions

View File

@ -18,6 +18,10 @@ export class CSSDomainDebugger implements inspectorCommandTypes.CSSDomain.CSSDom
this.commands = {};
attachCSSInspectorCommandCallbacks(this.commands);
// By default start enabled because we can miss the "enable" event when
// running with `--debug-brk` -- the frontend will send it before we've been created
this.enable();
}
get enabled(): boolean {

View File

@ -20,6 +20,10 @@ export class DOMDomainDebugger implements inspectorCommandTypes.DOMDomain.DOMDom
attachDOMInspectorEventCallbacks(this.events);
attachDOMInspectorCommandCallbacks(this.commands);
// By default start enabled because we can miss the "enable event when
// running with `--debug-brk` -- the frontend will send it before we've been created
this.enable();
}
get enabled(): boolean {

View File

@ -64,7 +64,7 @@ export class Request {
this._resourceType = "Other";
return;
}
this._mimeType = value;
var resourceType = "Other";
@ -112,19 +112,19 @@ export class Request {
this._resourceType = value;
}
}
public responseReceived(response: inspectorCommandTypes.NetworkDomain.Response): void {
if (this._networkDomainDebugger.enabled) {
this._networkDomainDebugger.events.responseReceived(this.requestID, frameId, loaderId, __inspectorTimestamp(), <any>this.resourceType, response);
}
}
public loadingFinished(): void {
if (this._networkDomainDebugger.enabled) {
this._networkDomainDebugger.events.loadingFinished(this.requestID, __inspectorTimestamp());
}
}
public requestWillBeSent(request: inspectorCommandTypes.NetworkDomain.Request): void {
if (this._networkDomainDebugger.enabled) {
this._networkDomainDebugger.events.requestWillBeSent(this.requestID, frameId, loaderId, request.url, request, __inspectorTimestamp(), { type: "Script" });
@ -136,9 +136,13 @@ export class Request {
export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomain.NetworkDomainDispatcher {
private _enabled: boolean;
public events: inspectorCommandTypes.NetworkDomain.NetworkFrontend;
constructor() {
this.events = new inspectorCommands.NetworkDomain.NetworkFrontend();
// By default start enabled because we can miss the "enable" event when
// running with `--debug-brk` -- the frontend will send it before we've been created
this.enable();
}
get enabled(): boolean {
@ -156,7 +160,7 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
}
this._enabled = true;
}
/**
* Disables network tracking, prevents network events from being sent to the client.
*/
@ -166,14 +170,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
}
this._enabled = false;
}
/**
* Specifies whether to always send extra HTTP headers with the requests from this page.
*/
setExtraHTTPHeaders(params: inspectorCommandTypes.NetworkDomain.SetExtraHTTPHeadersMethodArguments): void {
//
}
/**
* Returns content served for the given request.
*/
@ -187,9 +191,9 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
body: body,
base64Encoded: !resource_data.hasTextContent
};
}
}
}
/**
* Tells whether clearing browser cache is supported.
*/
@ -198,14 +202,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
result: false
};
}
/**
* Clears browser cache.
*/
clearBrowserCache(): void {
//
}
/**
* Tells whether clearing browser cookies is supported.
*/
@ -214,21 +218,21 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
result: false
};
}
/**
* Clears browser cookies.
*/
clearBrowserCookies(): void {
//
}
/**
* Toggles ignoring cache for each request. If <code>true</code>, cache will not be used.
*/
setCacheDisabled(params: inspectorCommandTypes.NetworkDomain.SetCacheDisabledMethodArguments): void {
//
}
/**
* Loads a resource in the context of a frame on the inspected page without cross origin checks.
*/
@ -245,7 +249,7 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
status: 200
}
}
public static idSequence: number = 0;
create(): Request {
let id = (++NetworkDomainDebugger.idSequence).toString();
@ -264,4 +268,4 @@ export class RuntimeDomainDebugger {
compileScript(): { scriptId?: string, exceptionDetails?: Object } {
return {};
}
}
}