diff --git a/tests/app/debugger/dom-node-tests.ts b/tests/app/debugger/dom-node-tests.ts
index be805d855..ae7c2c249 100644
--- a/tests/app/debugger/dom-node-tests.ts
+++ b/tests/app/debugger/dom-node-tests.ts
@@ -1,7 +1,7 @@
import { assert, assertEqual } from "../TKUnit";
import { DOMNode } from "tns-core-modules/debugger/dom-node";
-import { attachInspectorCallbacks } from "tns-core-modules/debugger/devtools-elements";
-import { Inspector } from "tns-core-modules/debugger/devtools-elements";
+import { attachDOMInspectorCommandCallbacks, attachCSSInspectorCommandCallbacks, attachDOMInspectorEventCallbacks } from "tns-core-modules/debugger/devtools-elements";
+import { InspectorCommands, InspectorEvents } from "tns-core-modules/debugger/devtools-elements";
import { unsetValue } from "tns-core-modules/ui/core/properties";
import { Button } from "tns-core-modules/ui/button";
import { Slider } from "tns-core-modules/ui/slider";
@@ -9,35 +9,64 @@ import { Label } from "tns-core-modules/ui/label";
import { textProperty } from "tns-core-modules/ui/text-base";
import { TextView } from "tns-core-modules/ui/text-view";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { isAndroid } from "tns-core-modules/platform/platform";
-let originalInspectorGlobal: Inspector;
-let currentInspector: Inspector;
-function getTestInspector(): Inspector {
+let originalInspectorGlobal: InspectorCommands & InspectorEvents;
+
+let currentInspector: InspectorCommands & InspectorEvents;
+function getTestInspector(): InspectorCommands & InspectorEvents {
let inspector = {
- getDocument(): string { return ""; },
+ getDocument(): any { return {}; },
removeNode(nodeId: number): void { /* */ },
- getComputedStylesForNode(nodeId: number): string { return ""; },
- setAttributeAsText(nodeId: number, text: string, name: string): void { /* */},
+ getComputedStylesForNode(nodeId: number): any { return []; },
+ setAttributeAsText(nodeId: number, text: string, name: string): void { /* */ },
- childNodeInserted(parentId: number, lastId: number, nodeStr: string): void { /* to be replaced */ },
+ childNodeInserted(parentId: number, lastId: number, node: string | DOMNode): void { /* to be replaced */ },
childNodeRemoved(parentId: number, nodeId: number): void { /* to be replaced */ },
attributeModified(nodeId: number, attrName: string, attrValue: string) { /* to be replaced */ },
attributeRemoved(nodeId: number, attrName: string) { /* to be replaced */ }
}
- attachInspectorCallbacks(inspector);
+ attachDOMInspectorCommandCallbacks(inspector);
+ attachDOMInspectorEventCallbacks(inspector);
+ attachCSSInspectorCommandCallbacks(inspector);
return inspector;
}
+function getIOSDOMInspector() {
+ return {
+ events: {
+ childNodeInserted(parentId: number, lastId: number, node: DOMNode): void { return; },
+ childNodeRemoved(parentId: number, nodeId: number): void { return; },
+ attributeModified(nodeId: number, attrName: string, attrValue: string): void { return; },
+ attributeRemoved(nodeId: number, attrName: string): void { return; }
+ },
+ commands: {
+ getDocument(): any { return {}; },
+ removeNode(nodeId: number): void { /* */ },
+ getComputedStylesForNode(nodeId: number): any { return []; },
+ setAttributeAsText(nodeId: number, text: string, name: string): void { /* */ }
+ }
+ }
+}
+
export function setUp(): void {
- originalInspectorGlobal = global.__inspector;
- currentInspector = getTestInspector();
- global.__inspector = currentInspector;
+ if (isAndroid) {
+ originalInspectorGlobal = global.__inspector;
+ currentInspector = getTestInspector();
+ global.__inspector = currentInspector;
+ } else {
+ let domInspector = getIOSDOMInspector();
+ currentInspector = getTestInspector();
+ domInspector.events = currentInspector;
+ }
}
export function tearDown(): void {
- global.__inspector = originalInspectorGlobal;
+ if (isAndroid) {
+ global.__inspector = originalInspectorGlobal;
+ }
}
function assertAttribute(domNode: DOMNode, name: string, value: any) {
@@ -95,7 +124,7 @@ export function test_childNodeInserted_in_dom_node() {
btn1.text = "button1";
stack.addChild(btn1);
- assert(childNodeInsertedCalled, "global.__inspector.childNodeInserted not called.");
+ assert(childNodeInsertedCalled, "global inspector childNodeInserted not called.");
assertEqual(actualParentId, expectedParentId);
}
@@ -122,9 +151,9 @@ export function test_childNodeInserted_at_index_in_dom_node() {
lbl.text = "label me this";
let called = false;
- currentInspector.childNodeInserted = (parentId, lastNodeId, node) => {
+ currentInspector.childNodeInserted = (parentId, lastNodeId, node: any) => {
assertEqual(lastNodeId, btn1._domId, "Child inserted at index 1's previous sibling does not match.");
- assertEqual(JSON.parse(node).nodeId, lbl._domId, "Child id doesn't match");
+ assertEqual(node.toObject().nodeId, lbl._domId, "Child id doesn't match");
called = true;
}
@@ -157,7 +186,7 @@ export function test_childNodeRemoved_in_dom_node() {
stack.removeChild(btn1);
console.log("btn2: " + btn2);
- assert(childNodeRemovedCalled, "global.__inspector.childNodeRemoved not called.");
+ assert(childNodeRemovedCalled, "global inspector childNodeRemoved not called.");
assertEqual(actualRemovedNodeId, expectedRemovedNodeId);
}
diff --git a/tns-core-modules/debugger/InspectorBackendCommands.ios.ts b/tns-core-modules/debugger/InspectorBackendCommands.ios.ts
index 677c34393..65ca06512 100644
--- a/tns-core-modules/debugger/InspectorBackendCommands.ios.ts
+++ b/tns-core-modules/debugger/InspectorBackendCommands.ios.ts
@@ -3,1118 +3,59 @@ declare var __inspectorSendEvent;
export function DomainDispatcher(domain: string): ClassDecorator {
return klass => __registerDomainDispatcher(domain, klass);
}
- // ApplicationCache
-export namespace ApplicationCacheDomain {
+ // Heap
+// Heap domain exposes JavaScript heap attributes and capabilities.
+export namespace HeapDomain {
+// JavaScriptCore HeapSnapshot JSON data.
+export type HeapSnapshotData = string
-export interface ApplicationCacheResource {
- // Resource url.
- url: string;
- // Resource size.
- size: number;
- // Resource type.
- type: string;
+export interface GarbageCollection {
+ // The type of garbage collection.
+ type: any /* full,partial */;
+ startTime: number;
+ endTime: number;
}
-export interface ApplicationCache {
- // Manifest URL.
- manifestURL: string;
- // Application cache size.
- size: number;
- // Application cache creation time.
- creationTime: number;
- // Application cache update time.
- updateTime: number;
- // Application cache resources.
- resources: ApplicationCacheResource[];
+export interface GetPreviewMethodArguments {
+ // Identifier of the heap object within the snapshot.
+ heapObjectId: number
}
-
-export interface FrameWithManifest {
- // Frame identifier.
- frameId: NetworkDomain.FrameId;
- // Manifest URL.
- manifestURL: string;
- // Application cache status.
- status: number;
-}
-
-export interface GetManifestForFrameMethodArguments {
- // Identifier of the frame containing document whose manifest is retrieved.
- frameId: NetworkDomain.FrameId
-}
-export interface GetApplicationCacheForFrameMethodArguments {
- // Identifier of the frame containing document whose application cache is retrieved.
- frameId: NetworkDomain.FrameId
-}
-export interface ApplicationCacheDomainDispatcher {
- // Returns array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
- getFramesWithManifests(): { frameIds: FrameWithManifest[] };
- // Enables application cache domain notifications.
- enable(): void;
- // Returns manifest URL for document in the given frame.
- getManifestForFrame(params: GetManifestForFrameMethodArguments): { manifestURL: string };
- // Returns relevant application cache data for the document in given frame.
- getApplicationCacheForFrame(params: GetApplicationCacheForFrameMethodArguments): { applicationCache: ApplicationCache };
-}
-export class ApplicationCacheFrontend {
- applicationCacheStatusUpdated(frameId: NetworkDomain.FrameId, manifestURL: string, status: number): void {
- __inspectorSendEvent(JSON.stringify( { "method": "ApplicationCache.applicationCacheStatusUpdated", "params": { "frameId": frameId, "manifestURL": manifestURL, "status": status } } ));
- }
- networkStateUpdated(isNowOnline: boolean): void {
- __inspectorSendEvent(JSON.stringify( { "method": "ApplicationCache.networkStateUpdated", "params": { "isNowOnline": isNowOnline } } ));
- }
-}
-}
-
-// CSS
-// This domain exposes CSS read/write operations. All CSS objects, like stylesheets, rules, and styles, have an associated id
used in subsequent operations on the related object. Each object type has a specific id
structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the get*ForNode()
calls (which accept a DOM node id). Alternatively, a client can discover all the existing stylesheets with the getAllStyleSheets()
method and subsequently load the required stylesheet contents using the getStyleSheet[Text]()
methods.
-export namespace CSSDomain {
-export type StyleSheetId = string
-
-export interface CSSStyleId {
- // Enclosing stylesheet identifier.
- styleSheetId: StyleSheetId;
- // The style ordinal within the stylesheet.
- ordinal: number;
-}
-
-export interface CSSRuleId {
- // Enclosing stylesheet identifier.
- styleSheetId: StyleSheetId;
- // The rule ordinal within the stylesheet.
- ordinal: number;
-}
-
-export interface PseudoIdMatches {
- // Pseudo style identifier (see enum PseudoId
in RenderStyleConstants.h
).
- pseudoId: number;
- // Matches of CSS rules applicable to the pseudo style.
- matches: RuleMatch[];
-}
-
-export interface InheritedStyleEntry {
- // The ancestor node's inline style, if any, in the style inheritance chain.
- inlineStyle?: CSSStyle;
- // Matches of CSS rules matching the ancestor node in the style inheritance chain.
- matchedCSSRules: RuleMatch[];
-}
-
-export interface RuleMatch {
- // CSS rule in the match.
- rule: CSSRule;
- // Matching selector indices in the rule's selectorList selectors (0-based).
- matchingSelectors: number[];
-}
-
-export interface CSSSelector {
- // Canonicalized selector text.
- text: string;
- // Specificity (a, b, c) tuple. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element.
- specificity?: number[];
- // Whether or not the specificity can be dynamic. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element.
- dynamic?: boolean;
-}
-
-export interface SelectorList {
- // Selectors in the list.
- selectors: CSSSelector[];
- // Rule selector text.
- text: string;
- // Rule selector range in the underlying resource (if available).
- range?: SourceRange;
-}
-
-export interface CSSStyleAttribute {
- // DOM attribute name (e.g. "width").
- name: string;
- // CSS style generated by the respective DOM attribute.
- style: CSSStyle;
-}
-
-export interface CSSStyleSheetHeader {
- // The stylesheet identifier.
- styleSheetId: StyleSheetId;
- // Owner frame identifier.
- frameId: NetworkDomain.FrameId;
- // Stylesheet resource URL.
- sourceURL: string;
- // Stylesheet origin.
- origin: StyleSheetOrigin;
- // Stylesheet title.
- title: string;
- // Denotes whether the stylesheet is disabled.
- disabled: boolean;
- // Whether this stylesheet is a