WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
202840
Web Inspector: Convert CSSRule selectorText setter to setSelectorText method because it's asynchronous
https://bugs.webkit.org/show_bug.cgi?id=202840
Summary
Web Inspector: Convert CSSRule selectorText setter to setSelectorText method ...
Nikita Vasilyev
Reported
2019-10-10 22:41:27 PDT
Currently, selectorText setter has a rather unpredictable behaviour: cssRule.selectorText // "foo" cssRule.selectorText = "bar"; cssRule.selectorText // Still "foo"! Internally, selectorText setter is asyncronous. Since it's a setter, it doesn't have a callback. My patch converts the setter to setSelectorText method that returns a promise.
Attachments
Patch
(3.86 KB, patch)
2019-10-10 22:46 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews210 for win-future
(14.12 MB, application/zip)
2019-10-11 09:05 PDT
,
EWS Watchlist
no flags
Details
Patch
(6.38 KB, patch)
2019-10-14 12:26 PDT
,
Nikita Vasilyev
mattbaker
: review+
Details
Formatted Diff
Diff
Patch
(6.37 KB, patch)
2019-10-15 16:10 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Nikita Vasilyev
Comment 1
2019-10-10 22:46:45 PDT
Created
attachment 380723
[details]
Patch
EWS Watchlist
Comment 2
2019-10-11 09:05:43 PDT
Comment on
attachment 380723
[details]
Patch
Attachment 380723
[details]
did not pass win-ews (win): Output:
https://webkit-queues.webkit.org/results/13120434
New failing tests: fast/workers/worker-cloneport.html js/dom/try-catch-crash.html
EWS Watchlist
Comment 3
2019-10-11 09:05:50 PDT
Created
attachment 380758
[details]
Archive of layout-test-results from ews210 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews210 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Nikita Vasilyev
Comment 4
2019-10-11 09:28:01 PDT
Comment on
attachment 380723
[details]
Patch Unrelated crash.
Matt Baker
Comment 5
2019-10-11 18:09:45 PDT
Comment on
attachment 380723
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=380723&action=review
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:71 > + return this._nodeStyles.changeRuleSelector(this, selectorText).then(this._selectorResolved.bind(this), this._selectorRejected);
This can just be: return this._nodeStyles.changeRuleSelector(this, selectorText).then(this._selectorResolved.bind(this)); Here's a little stand alone example showing why: function changeRuleSelector(rule, selectorText) { return selectorText ? Promise.resolve() : Promise.reject("Uh oh") } function setSelectorText(text) { function resolved() { // Do some stuff with resolved text. No need to return a Promise. } return changeRuleSelector(this, text).then(resolved); } setSelectorText("Some text").then(() => { console.log("success!"); }).catch((error) => { console.error("Error: " + error); }); // Outputs "success!" setSelectorText(null).then(() => { console.log("success!"); }).catch((error) => { console.error("Error: " + error); }); // Outputs "Error: Uh oh"
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:116 > + return Promise.reject(error);
This method is no longer needed.
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:147 > + return Promise.resolve();
This can be removed.
Nikita Vasilyev
Comment 6
2019-10-14 12:26:32 PDT
Created
attachment 380907
[details]
Patch
Matt Baker
Comment 7
2019-10-15 15:46:29 PDT
Comment on
attachment 380907
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=380907&action=review
r=me
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:114 > + // This method is only needed to be called for CSS rules that don't match the selected DOM node.
// This method only needs to be called
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:115 > + // CSS rules that do match the selected DOM node get updated by WI.DOMNodeStyles.prototype._parseRulePayload.
// CSS rules that match
Nikita Vasilyev
Comment 8
2019-10-15 16:10:19 PDT
Created
attachment 381036
[details]
Patch
WebKit Commit Bot
Comment 9
2019-10-15 16:39:13 PDT
Comment on
attachment 381036
[details]
Patch Clearing flags on attachment: 381036 Committed
r251168
: <
https://trac.webkit.org/changeset/251168
>
WebKit Commit Bot
Comment 10
2019-10-15 16:39:15 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11
2019-10-15 16:40:20 PDT
<
rdar://problem/56313428
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug