fix(ios): devtools inspector_modules

This commit is contained in:
Nathan Walker
2020-10-25 18:16:32 -07:00
parent 0eb2246b7d
commit 15f3d882d9
9 changed files with 71 additions and 8 deletions

View File

@ -50,6 +50,7 @@ export namespace HeapDomain {
// Returns the strongly referenced Runtime.RemoteObject for a Heap.HeapObjectId. // Returns the strongly referenced Runtime.RemoteObject for a Heap.HeapObjectId.
getRemoteObject(params: GetRemoteObjectMethodArguments): { result: RuntimeDomain.RemoteObject }; getRemoteObject(params: GetRemoteObjectMethodArguments): { result: RuntimeDomain.RemoteObject };
} }
@NativeClass()
export class HeapFrontend { export class HeapFrontend {
// Information about the garbage collection. // Information about the garbage collection.
garbageCollected(collection: GarbageCollection): void { garbageCollected(collection: GarbageCollection): void {
@ -325,6 +326,7 @@ export namespace DebuggerDomain {
// Sets overlay message. // Sets overlay message.
setOverlayMessage(params: SetOverlayMessageMethodArguments): void; setOverlayMessage(params: SetOverlayMessageMethodArguments): void;
} }
@NativeClass()
export class DebuggerFrontend { export class DebuggerFrontend {
// Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload. // Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload.
globalObjectCleared(): void { globalObjectCleared(): void {
@ -758,6 +760,7 @@ export namespace RuntimeDomain {
// Returns a list of basic blocks for the given sourceID with information about their text ranges and whether or not they have executed. // Returns a list of basic blocks for the given sourceID with information about their text ranges and whether or not they have executed.
getBasicBlocks(params: GetBasicBlocksMethodArguments): { basicBlocks: BasicBlock[] }; getBasicBlocks(params: GetBasicBlocksMethodArguments): { basicBlocks: BasicBlock[] };
} }
@NativeClass()
export class RuntimeFrontend { export class RuntimeFrontend {
// Issued when new execution context is created. // Issued when new execution context is created.
executionContextCreated(context: ExecutionContextDescription): void { executionContextCreated(context: ExecutionContextDescription): void {
@ -832,6 +835,7 @@ export namespace ConsoleDomain {
// Enables console to refer to the node with given id via $0 (see Command Line API for more details). // Enables console to refer to the node with given id via $0 (see Command Line API for more details).
addInspectedNode(params: AddInspectedNodeMethodArguments): void; addInspectedNode(params: AddInspectedNodeMethodArguments): void;
} }
@NativeClass()
export class ConsoleFrontend { export class ConsoleFrontend {
// Issued when new console message is added. // Issued when new console message is added.
messageAdded(message: ConsoleMessage): void { messageAdded(message: ConsoleMessage): void {
@ -1130,6 +1134,7 @@ export namespace PageDomain {
// Grab an archive of the page. // Grab an archive of the page.
archive(): { data: string }; archive(): { data: string };
} }
@NativeClass()
export class PageFrontend { export class PageFrontend {
domContentEventFired(timestamp: number): void { domContentEventFired(timestamp: number): void {
__inspectorSendEvent( __inspectorSendEvent(
@ -1377,6 +1382,7 @@ export namespace NetworkDomain {
// Loads a resource in the context of a frame on the inspected page without cross origin checks. // Loads a resource in the context of a frame on the inspected page without cross origin checks.
loadResource(params: LoadResourceMethodArguments): { content: string; mimeType: string; status: number }; loadResource(params: LoadResourceMethodArguments): { content: string; mimeType: string; status: number };
} }
@NativeClass()
export class NetworkFrontend { export class NetworkFrontend {
// Fired when page is about to send HTTP request. // Fired when page is about to send HTTP request.
requestWillBeSent(requestId: RequestId, frameId: FrameId, loaderId: LoaderId, documentURL: string, request: Request, timestamp: Timestamp, initiator: Initiator, redirectResponse?: Response, type?: PageDomain.ResourceType): void { requestWillBeSent(requestId: RequestId, frameId: FrameId, loaderId: LoaderId, documentURL: string, request: Request, timestamp: Timestamp, initiator: Initiator, redirectResponse?: Response, type?: PageDomain.ResourceType): void {
@ -1750,6 +1756,7 @@ export namespace DOMDomain {
// Resolves JavaScript node object for given node id. // Resolves JavaScript node object for given node id.
resolveNode(params: ResolveNodeMethodArguments): { object: RuntimeDomain.RemoteObject }; resolveNode(params: ResolveNodeMethodArguments): { object: RuntimeDomain.RemoteObject };
} }
@NativeClass()
export class DOMFrontend { export class DOMFrontend {
// Fired when <code>Document</code> has been totally updated. Node ids are no longer valid. // Fired when <code>Document</code> has been totally updated. Node ids are no longer valid.
documentUpdated(): void { documentUpdated(): void {
@ -2133,6 +2140,7 @@ export namespace CSSDomain {
// Returns the current textual content and the URL for a stylesheet. // Returns the current textual content and the URL for a stylesheet.
getStyleSheetText(params: GetStyleSheetTextMethodArguments): { text: string }; getStyleSheetText(params: GetStyleSheetTextMethodArguments): { text: string };
} }
@NativeClass()
export class CSSFrontend { export class CSSFrontend {
// Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features. // Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
mediaQueryResultChanged(): void { mediaQueryResultChanged(): void {

View File

@ -1,5 +1,5 @@
// Types // Types
import { ViewBase } from '../ui/core/view-base'; import type { ViewBase } from '../ui/core/view-base';
//Requires //Requires
import { getNodeById } from './dom-node'; import { getNodeById } from './dom-node';

View File

@ -1,5 +1,5 @@
import { ViewBase } from '../ui/core/view-base'; import type { ViewBase } from '../ui/core/view-base';
import { CSSComputedStyleProperty } from './css-agent'; import type { CSSComputedStyleProperty } from './css-agent';
export declare function getNodeById(id: number): DOMNode; export declare function getNodeById(id: number): DOMNode;
declare class WeakRef<T> { declare class WeakRef<T> {
constructor(obj: T); constructor(obj: T);

View File

@ -2,7 +2,7 @@ import { CSSComputedStyleProperty } from './css-agent';
import { InspectorEvents } from './devtools-elements-interfaces'; import { InspectorEvents } from './devtools-elements-interfaces';
// Needed for typings only // Needed for typings only
import { ViewBase } from '../ui/core/view-base'; import type { ViewBase } from '../ui/core/view-base';
const registeredDomNodes = {}; const registeredDomNodes = {};
const ELEMENT_NODE_TYPE = 1; const ELEMENT_NODE_TYPE = 1;

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"outDir": "../../../dist/packages/core/debugger",
"rootDirs": ["."],
"module": "commonjs",
"target": "es5",
"moduleResolution": "node",
"declaration": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": false,
"noEmitOnError": true,
"removeComments": true,
"skipLibCheck": true,
"baseUrl": "."
},
"include": ["../references.d.ts", "./devtools-elements-interfaces.ts"],
"files": ["index.ts", "devtools-elements.common.ts", "devtools-elements.android.ts", "devtools-elements.ios.ts", "dom-node.ts", "InspectorBackendCommands.ios.ts", "webinspector-css.ios.ts", "webinspector-dom.ios.ts", "webinspector-network.ios.ts"]
}

View File

@ -5,6 +5,7 @@ import * as debuggerDomains from '.';
import { attachCSSInspectorCommandCallbacks } from './devtools-elements'; import { attachCSSInspectorCommandCallbacks } from './devtools-elements';
@NativeClass()
@inspectorCommands.DomainDispatcher('CSS') @inspectorCommands.DomainDispatcher('CSS')
export class CSSDomainDebugger implements inspectorCommandTypes.CSSDomain.CSSDomainDispatcher { export class CSSDomainDebugger implements inspectorCommandTypes.CSSDomain.CSSDomainDispatcher {
private _enabled: boolean; private _enabled: boolean;

View File

@ -5,6 +5,7 @@ import * as debuggerDomains from '.';
import { attachDOMInspectorEventCallbacks, attachDOMInspectorCommandCallbacks } from './devtools-elements'; import { attachDOMInspectorEventCallbacks, attachDOMInspectorCommandCallbacks } from './devtools-elements';
@NativeClass()
@inspectorCommands.DomainDispatcher('DOM') @inspectorCommands.DomainDispatcher('DOM')
export class DOMDomainDebugger implements inspectorCommandTypes.DOMDomain.DOMDomainDispatcher { export class DOMDomainDebugger implements inspectorCommandTypes.DOMDomain.DOMDomainDispatcher {
private _enabled: boolean; private _enabled: boolean;

View File

@ -31,6 +31,7 @@ const documentTypeByMimeType = {
'text/typescript': 'Script', 'text/typescript': 'Script',
}; };
@NativeClass()
export class Request { export class Request {
private _resourceType: string; private _resourceType: string;
private _data: any; private _data: any;
@ -118,6 +119,7 @@ export class Request {
} }
} }
@NativeClass()
@inspectorCommands.DomainDispatcher('Network') @inspectorCommands.DomainDispatcher('Network')
export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomain.NetworkDomainDispatcher { export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomain.NetworkDomainDispatcher {
private _enabled: boolean; private _enabled: boolean;

View File

@ -1,6 +1,38 @@
console.log('Loading inspector modules...'); console.log('Loading inspector modules...');
import './globals'; // ts-helpers
require('./debugger/webinspector-network'); // Required by V8 snapshot generator
require('./debugger/webinspector-dom'); if (!(<any>global).__extends) {
require('./debugger/webinspector-css'); (<any>global).__extends = function (d, b) {
for (let p in b) {
if (b.hasOwnProperty(p)) {
d[p] = b[p];
}
}
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
}
import * as tslib from 'tslib';
// Bind the tslib helpers to global scope.
// This is needed when we don't use importHelpers, which
// breaks extending native-classes
for (const fnName of Object.keys(tslib)) {
if (typeof tslib[fnName] !== 'function') {
continue;
}
if (fnName in global) {
// Don't override globals that are already defined (ex. __extends)
continue;
}
global[fnName] = tslib[fnName];
}
import './debugger/webinspector-network';
import './debugger/webinspector-dom';
import './debugger/webinspector-css';
console.log('Finished loading inspector modules.'); console.log('Finished loading inspector modules.');