You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chrome devtools extension intended to display result of deep in-memory object
6
-
comparisons with the help of dedicated console commands.
5
+
Chrome extension to compare objects in memory with console.diff(old, new) devtools function.
7
6
8
7
<details>
9
8
<summary> <strong>Screenshots</strong> </summary>
@@ -23,20 +22,23 @@ comparisons with the help of dedicated console commands.
23
22
24
23
### Features
25
24
26
-
- compare objects between multiple [sub]domains, chrome tabs, or single page reloads
27
-
- function code included in comparison result in form of a string, may help to see if it was altered
28
-
- document, dom-elements and other non-serializable objects are filtered-out from the results
29
-
- self recurring references displayed only once, the rest of occurrences are filtered-out
30
-
- basic integration with search functionality within devtools
31
-
- if search query contains upper-case letter - the search will be case-sensitive
25
+
- Compare objects between multiple [sub]domains, chrome tabs, or single page reloads.
26
+
- Function code included in comparison result in form of a string, combined from a function name (if declared) and a SHA-256 function body hash; so it may help to detect if it was altered. Native functions delcared as silmply as `ƒ(native)`.
27
+
- Unserializable objects, like Document or Elements, are serialized as `0x####: unserializable`.
28
+
- Self recurring references displayed only once, and the rest of ocurrences are mentioned with object reference like `0x####: ...`.
29
+
- Basic integration with search functionality within devtools:
30
+
- if search query contains upper-case letter - the search will be case-sensitive.
31
+
- Serialization of Set, Map, +/-Infinity, NaN, BigInt, Symbols and proper serialization of `undefined` values.
32
+
- Failsafe serialization of objects having security issues accessing their props.
33
+
- Failsefe serialization of objects having `toJSON()` function (instead of serialization of all object properties, - only toJSON() return value are serialized, similar to the way JSON.strigify() works)
32
34
33
35
### Limitations and workarounds
34
36
35
-
-some instances of objects may cause exception during preparations for comparison
36
-
-try to narrow compared contexts
37
-
-if it's some Browser API that causes an exception and not a framework, consider opening an issue,
38
-
so it will be possible to solve it on a permanent basis
39
-
-while paused in debug mode, JSDiff panel won't reflect the result until runtime is resumed ([#10][i10])
37
+
-Some instances of objects may cause exception during preparations for comparison
38
+
-Try to narrow compared contexts
39
+
-If it's some Browser API that causes an exception and not a framework, consider opening an issue, so it will be possible to solve it on a permanent basis
40
+
- While paused in debug mode, JSDiff panel won't reflect the result until runtime is resumed ([#10][i10])
41
+
-Compared objects, after being serialized, are stored in `chrome.storage.local` wich has 10MB limit, so if you see `QUOTA_BYTES quota exceeded` error message - this is it.
-**console.diff\_(\*)** - deprecated, left for backward compatibility, uses `nativeClone` based of JSON.parse(JSON.stringify(...)) serialization method
78
+
75
79
### Usage basics
76
80
77
81
Historically, left side represents the old state and right side the new state.
78
82
79
83
- Things that are present on the left side but missing on the right side are colour-coded as red (old).
80
84
- Things that are missing on the left side but present on the right side are colour-coded as green (new).
81
-
82
-
To track changes of the same variable in timed manner you can push it with `diffPush` or `diff`
83
-
with a single argument, that will shift objects from right to left, showing differences with previous push state.
85
+
- To track changes of the same variable in timed manner you can push it with `diffPush` or `diff` with a single argument, - that will shift objects from right to left, showing differences with previous push state.
84
86
85
87
### How it works
86
88
87
-
-`jsdiff-devtools.js` registers devtools panel
88
-
- injects `console.diff` commands into inspected window's console interface
89
-
- each function clones arguments and sends them via `postMessage` to `jsdiff-proxy.js` in `jsdiff-console-to-proxy` message
90
-
- injects `jsdiff-proxy.js` that listens on window `jsdiff-console-to-proxy` message and sends it further to chrome runtime in `jsdiff-proxy-to-devtools` message
91
-
- listens on `jsdiff-proxy-to-devtools` and prepares payload for `view/panel.vue` and sends it with `jsdiff-devtools-to-panel-compare` message
92
-
- when user invokes devtools search command - informs `view/panel.vue` with `jsdiff-devtools-to-panel-search` message
93
-
- when `view/panel.vue` is visible in devtools
94
-
- reflects result of last compare request
95
-
- listens on `jsdiff-devtools-to-panel-compare` requests
96
-
- listens on `jsdiff-devtools-to-panel-search` and tries to find query in DOM
89
+
-`manifest.json` injects content scripts to each visited site (except for chrome web store site and google-protected alike):
90
+
-`jsdiff-console.ts` as [MAIN world](https://developer.chrome.com/docs/extensions/reference/scripting/#type-ExecutionWorld), - to have access to the target site memory
91
+
- sends messages to `jsdiff-proxy.ts`.
92
+
-`jsdiff-proxy.ts` as `ISOLATED` world (has access to chrome runtime)
93
+
- stores data from `jsdiff-console.ts` in `chrome.storage.local` and sends runtime messages to `panel.vue`.
94
+
-`jsdiff-devtools.ts` registers `panel.vue` as a JSDiff devtools panel that reads current state of `chorme.storage.local` and listens to incomming `chrome.runtime` mesages from `jsdiff-proxy.ts`.
0 commit comments