RESOLVED FIXED169638
Web Inspector: Exception when fetching computed styles can break future updates of section
https://bugs.webkit.org/show_bug.cgi?id=169638
Summary Web Inspector: Exception when fetching computed styles can break future updat...
Joseph Pecoraro
Reported 2017-03-14 15:37:06 PDT
Summary: Our style fetching should be resilient in the face of exceptions. Steps to Reproduce: 1. Introduce an exception inside of `fetchedComputedStyle` or its friends 2. Inspect a page 3. Show Computed Styles sidebar 4. Select a bunch of nodes 5. Switch between nodes => No updates
Attachments
[PATCH] Proposed Fix (3.17 KB, patch)
2017-03-14 15:38 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (3.17 KB, patch)
2017-03-14 16:21 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2017-03-14 15:37:16 PDT
Joseph Pecoraro
Comment 2 2017-03-14 15:38:03 PDT
This was originally detected with an Augmented JSContext with CSS Styles. In that case certain assumptions (like the computed style must contain certain properties) fails and we get unexpected exceptions. In any case we should be resilient against that.
Joseph Pecoraro
Comment 3 2017-03-14 15:38:56 PDT
Created attachment 304436 [details] [PATCH] Proposed Fix
Blaze Burg
Comment 4 2017-03-14 15:42:21 PDT
Comment on attachment 304436 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=304436&action=review > Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:89 > + promise.resolve(); Shouldn't this reject (and ignore if appropriate where the promise is chained)?
Devin Rousso
Comment 5 2017-03-14 15:47:50 PDT
Comment on attachment 304436 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=304436&action=review > Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:84 > + return function() { I'm not sure if this will ever happen, but I don't think this will capture `this` correctly. You might want to use an arrow function instead. An example: function wrap() { console.log("outer", this); return function() { console.log("inner", this); } } wrap.call()() // outer - Window // inner - Window wrap.call({})() // outer - {} // inner - Window
Joseph Pecoraro
Comment 6 2017-03-14 16:04:19 PDT
Comment on attachment 304436 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=304436&action=review >> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:84 >> + return function() { > > I'm not sure if this will ever happen, but I don't think this will capture `this` correctly. You might want to use an arrow function instead. An example: > > function wrap() { > console.log("outer", this); > return function() { > console.log("inner", this); > } > } > > wrap.call()() > // outer - Window > // inner - Window > > wrap.call({})() > // outer - {} > // inner - Window `this` is never captured. In here, `this` is bound by the caller of wrap. wrap(...).bind(this). Should I make it more explicit? >> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:89 >> + promise.resolve(); > > Shouldn't this reject (and ignore if appropriate where the promise is chained)? This won't trigger the Promise.all below. I can make that include a catch, but I figured it ultimately doesn't matter here.
Joseph Pecoraro
Comment 7 2017-03-14 16:21:15 PDT
Created attachment 304439 [details] [PATCH] Proposed Fix
Devin Rousso
Comment 8 2017-03-14 16:33:04 PDT
Comment on attachment 304439 [details] [PATCH] Proposed Fix r=me
WebKit Commit Bot
Comment 9 2017-03-14 17:05:30 PDT
Comment on attachment 304439 [details] [PATCH] Proposed Fix Clearing flags on attachment: 304439 Committed r213961: <http://trac.webkit.org/changeset/213961>
WebKit Commit Bot
Comment 10 2017-03-14 17:05:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.