Skip to content

Commit 2b58cae

Browse files
author
Nataliya Hristova
authored
Merge pull request #6904 from NativeScript/bektchiev/enable-ios-inspector-modules
fix(debugger): Enable iOS inspector modules on creation
2 parents 44b8acd + 1b5d307 commit 2b58cae

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export class CSSDomainDebugger implements inspectorCommandTypes.CSSDomain.CSSDom
1818
this.commands = {};
1919

2020
attachCSSInspectorCommandCallbacks(this.commands);
21+
22+
// By default start enabled because we can miss the "enable" event when
23+
// running with `--debug-brk` -- the frontend will send it before we've been created
24+
this.enable();
2125
}
2226

2327
get enabled(): boolean {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export class DOMDomainDebugger implements inspectorCommandTypes.DOMDomain.DOMDom
2020

2121
attachDOMInspectorEventCallbacks(this.events);
2222
attachDOMInspectorCommandCallbacks(this.commands);
23+
24+
// By default start enabled because we can miss the "enable event when
25+
// running with `--debug-brk` -- the frontend will send it before we've been created
26+
this.enable();
2327
}
2428

2529
get enabled(): boolean {

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class Request {
6464
this._resourceType = "Other";
6565
return;
6666
}
67-
67+
6868
this._mimeType = value;
6969

7070
var resourceType = "Other";
@@ -112,19 +112,19 @@ export class Request {
112112
this._resourceType = value;
113113
}
114114
}
115-
115+
116116
public responseReceived(response: inspectorCommandTypes.NetworkDomain.Response): void {
117117
if (this._networkDomainDebugger.enabled) {
118118
this._networkDomainDebugger.events.responseReceived(this.requestID, frameId, loaderId, __inspectorTimestamp(), <any>this.resourceType, response);
119119
}
120120
}
121-
121+
122122
public loadingFinished(): void {
123123
if (this._networkDomainDebugger.enabled) {
124124
this._networkDomainDebugger.events.loadingFinished(this.requestID, __inspectorTimestamp());
125125
}
126126
}
127-
127+
128128
public requestWillBeSent(request: inspectorCommandTypes.NetworkDomain.Request): void {
129129
if (this._networkDomainDebugger.enabled) {
130130
this._networkDomainDebugger.events.requestWillBeSent(this.requestID, frameId, loaderId, request.url, request, __inspectorTimestamp(), { type: "Script" });
@@ -136,9 +136,13 @@ export class Request {
136136
export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomain.NetworkDomainDispatcher {
137137
private _enabled: boolean;
138138
public events: inspectorCommandTypes.NetworkDomain.NetworkFrontend;
139-
139+
140140
constructor() {
141141
this.events = new inspectorCommands.NetworkDomain.NetworkFrontend();
142+
143+
// By default start enabled because we can miss the "enable" event when
144+
// running with `--debug-brk` -- the frontend will send it before we've been created
145+
this.enable();
142146
}
143147

144148
get enabled(): boolean {
@@ -156,7 +160,7 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
156160
}
157161
this._enabled = true;
158162
}
159-
163+
160164
/**
161165
* Disables network tracking, prevents network events from being sent to the client.
162166
*/
@@ -166,14 +170,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
166170
}
167171
this._enabled = false;
168172
}
169-
173+
170174
/**
171175
* Specifies whether to always send extra HTTP headers with the requests from this page.
172176
*/
173177
setExtraHTTPHeaders(params: inspectorCommandTypes.NetworkDomain.SetExtraHTTPHeadersMethodArguments): void {
174178
//
175179
}
176-
180+
177181
/**
178182
* Returns content served for the given request.
179183
*/
@@ -187,9 +191,9 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
187191
body: body,
188192
base64Encoded: !resource_data.hasTextContent
189193
};
190-
}
194+
}
191195
}
192-
196+
193197
/**
194198
* Tells whether clearing browser cache is supported.
195199
*/
@@ -198,14 +202,14 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
198202
result: false
199203
};
200204
}
201-
205+
202206
/**
203207
* Clears browser cache.
204208
*/
205209
clearBrowserCache(): void {
206210
//
207211
}
208-
212+
209213
/**
210214
* Tells whether clearing browser cookies is supported.
211215
*/
@@ -214,21 +218,21 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
214218
result: false
215219
};
216220
}
217-
221+
218222
/**
219223
* Clears browser cookies.
220224
*/
221225
clearBrowserCookies(): void {
222226
//
223227
}
224-
228+
225229
/**
226230
* Toggles ignoring cache for each request. If <code>true</code>, cache will not be used.
227231
*/
228232
setCacheDisabled(params: inspectorCommandTypes.NetworkDomain.SetCacheDisabledMethodArguments): void {
229233
//
230234
}
231-
235+
232236
/**
233237
* Loads a resource in the context of a frame on the inspected page without cross origin checks.
234238
*/
@@ -245,7 +249,7 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
245249
status: 200
246250
}
247251
}
248-
252+
249253
public static idSequence: number = 0;
250254
create(): Request {
251255
let id = (++NetworkDomainDebugger.idSequence).toString();
@@ -264,4 +268,4 @@ export class RuntimeDomainDebugger {
264268
compileScript(): { scriptId?: string, exceptionDetails?: Object } {
265269
return {};
266270
}
267-
}
271+
}

0 commit comments

Comments
 (0)