Skip to content

fix(debugger): Enable iOS inspector modules on creation #6904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tns-core-modules/debugger/webinspector-css.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions tns-core-modules/debugger/webinspector-dom.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
38 changes: 21 additions & 17 deletions tns-core-modules/debugger/webinspector-network.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Request {
this._resourceType = "Other";
return;
}

this._mimeType = value;

var resourceType = "Other";
Expand Down Expand Up @@ -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" });
Expand All @@ -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 {
Expand All @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -187,9 +191,9 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
body: body,
base64Encoded: !resource_data.hasTextContent
};
}
}
}

/**
* Tells whether clearing browser cache is supported.
*/
Expand All @@ -198,14 +202,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
result: false
};
}

/**
* Clears browser cache.
*/
clearBrowserCache(): void {
//
}

/**
* Tells whether clearing browser cookies is supported.
*/
Expand All @@ -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.
*/
Expand All @@ -245,7 +249,7 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
status: 200
}
}

public static idSequence: number = 0;
create(): Request {
let id = (++NetworkDomainDebugger.idSequence).toString();
Expand All @@ -264,4 +268,4 @@ export class RuntimeDomainDebugger {
compileScript(): { scriptId?: string, exceptionDetails?: Object } {
return {};
}
}
}