Bug 218061 - Web Inspector: Uncaught Exception: undefined is not an object (evaluating 'value.truncate')
Summary: Web Inspector: Uncaught Exception: undefined is not an object (evaluating 'va...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: https://www.cbc.ca/account/profile
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-21 16:46 PDT by Devin Rousso
Modified: 2020-10-29 17:55 PDT (History)
4 users (show)

See Also:


Attachments
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate') (1.70 KB, patch)
2020-10-27 17:22 PDT, Federico Bucchi
no flags Details | Formatted Diff | Diff
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate') (2.08 KB, patch)
2020-10-27 20:43 PDT, Federico Bucchi
no flags Details | Formatted Diff | Diff
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate') (1.88 KB, patch)
2020-10-28 15:59 PDT, Federico Bucchi
no flags Details | Formatted Diff | Diff
Patch (1.50 KB, patch)
2020-10-29 15:48 PDT, Federico Bucchi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2020-10-21 16:46:30 PDT
not really sure what I was doing, but I was looking at cookies :|

Uncaught Exceptions:
-----------------------
 - undefined is not an object (evaluating 'value.truncate') (at DOMStorageContentView.js:160:21)
    _truncateValue @ DOMStorageContentView.js:160:21
    itemUpdated @ DOMStorageContentView.js:136:36
    dispatch @ Object.js:165:30
    dispatchEventToListeners @ Object.js:172:17
    itemUpdated @ DOMStorageObject.js:135:38
    itemUpdated @ DOMStorageManager.js:142:35
    domStorageItemUpdated @ DOMStorageObserver.js:48:41
    _dispatchEvent @ Connection.js:210:26
    dispatch @ Connection.js:79:32
    dispatchMessageFromTarget @ TargetManager.js:176:39
    dispatchMessageFromTarget @ TargetObserver.js:47:51
    _dispatchEvent @ Connection.js:210:26
    dispatch @ Connection.js:79:32
    dispatch @ InspectorBackend.js:232:52
    ? @ MessageDispatcher.js:42:34

Additional Details:
    cause --> An uncaught exception was thrown while handling event: DOMStorage.domStorageItemUpdated
-----------------------

Notes:
Inspected URL:        https://www.cbc.ca/account/profile
Loading completed:    true
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)
Dispatch Source:      Protocol Event

Protocol Event:
{"method":"DOMStorage.domStorageItemUpdated","params":{"storageId":{"securityOrigin":"https://www.cbc.ca","isLocalStorage":true},"key":"_cX_atfr","oldValue":"&altm=1603323791017&arnd=kgk1l6splslgirr7&aatm=2&axtl=&awsz=2560x446&amvw=2560x593&ascp=45x593&aclk=0","newValue":"&altm=1603323791017&arnd=kgk1l6splslgirr7&aatm=29&axtl=&awsz=2560x446&amvw=2560x593&ascp=45x593&aclk=0"}}
Comment 1 Radar WebKit Bug Importer 2020-10-21 16:46:50 PDT
<rdar://problem/70551334>
Comment 2 Devin Rousso 2020-10-21 16:52:21 PDT
(In reply to Devin Rousso from comment #0)
> not really sure what I was doing, but I was looking at cookies :|
sorry i meant session storage 😅
Comment 3 Federico Bucchi 2020-10-27 17:22:33 PDT
Created attachment 412482 [details]
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate')
Comment 4 Devin Rousso 2020-10-27 17:30:22 PDT
Comment on attachment 412482 [details]
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate')

r-, as this covers up the issue instead of solving it

I think the real problem is that `WI.DOMStorageObject.Event.ItemUpdated` dispatches with `{key, oldValue, newValue}` but `WI.DOMStorageContentView.prototype.itemUpdated` uses `value`.
Comment 5 Federico Bucchi 2020-10-27 20:43:47 PDT
Created attachment 412506 [details]
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate')
Comment 6 Devin Rousso 2020-10-28 10:23:23 PDT
Comment on attachment 412506 [details]
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate')

View in context: https://bugs.webkit.org/attachment.cgi?id=412506&action=review

> Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js:130
> -    itemUpdated(key, oldValue, newValue)
> +    itemUpdated(key, value)

This has to stay as it was before, as this is being called by `WI.DOMStorageObserver.prototype.domStorageItemUpdated` which comes from the protocol.

Basically, I think all you need to do is change `{key, oldValue, newValue}` to `{key, value: newValue}`.
Comment 7 Federico Bucchi 2020-10-28 15:59:30 PDT
Created attachment 412581 [details]
Fix Uncaught Exception: undefined is not an object (evaluating 'value.truncate')
Comment 8 Federico Bucchi 2020-10-29 15:48:01 PDT
Created attachment 412696 [details]
Patch
Comment 9 Devin Rousso 2020-10-29 15:54:56 PDT
Comment on attachment 412696 [details]
Patch

r=me
Comment 10 EWS 2020-10-29 17:55:20 PDT
Committed r269175: <https://trac.webkit.org/changeset/269175>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 412696 [details].