WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195793
Web Inspector: DOM: "Capture Screenshot" should only be shown if the node is attached
https://bugs.webkit.org/show_bug.cgi?id=195793
Summary
Web Inspector: DOM: "Capture Screenshot" should only be shown if the node is ...
Devin Rousso
Reported
2019-03-14 23:17:30 PDT
I shouldn't be able to capture a screenshot of any random node that I've logged to the console (e.g. `document.createElement("div")`).
Attachments
Patch
(3.11 KB, patch)
2019-03-14 23:33 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(5.42 KB, patch)
2019-03-18 20:31 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(7.13 KB, patch)
2019-03-19 10:29 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-03-14 23:17:44 PDT
<
rdar://problem/48916594
>
Devin Rousso
Comment 2
2019-03-14 23:33:10 PDT
Created
attachment 364777
[details]
Patch
Joseph Pecoraro
Comment 3
2019-03-18 15:37:33 PDT
Comment on
attachment 364777
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364777&action=review
> Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js:239 > - if (window.PageAgent) { > + if (window.PageAgent && domNode.ownerDocument) {
This feels wrong. Every Node should be associated with a document: document.createElement("div").ownerDocument; // => #document We may want to update our interface, as it doesn't make sense that a detached node doesn't have an ownerDocument... It might be good to have an isAttached() method that resolves this state.
Devin Rousso
Comment 4
2019-03-18 15:46:38 PDT
Comment on
attachment 364777
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364777&action=review
>> Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js:239 >> + if (window.PageAgent && domNode.ownerDocument) { > > This feels wrong. > > Every Node should be associated with a document: > > document.createElement("div").ownerDocument; // => #document > > We may want to update our interface, as it doesn't make sense that a detached node doesn't have an ownerDocument... > > It might be good to have an isAttached() method that resolves this state.
I would agree, but this is the current "reality" of how we're able to determine such things. When we push a detached root to the frontend (e.g. logging a node which you've just created), we don't set a document for it (`WI.DOMManager.prototype._setDetachedRoot`). I'd like to rework this when doing the DOM agent redesign as well.
Joseph Pecoraro
Comment 5
2019-03-18 16:08:43 PDT
> > It might be good to have an isAttached() method that resolves this state. > > I would agree, but this is the current "reality" of how we're able to > determine such things. When we push a detached root to the frontend (e.g. > logging a node which you've just created), we don't set a document for it > (`WI.DOMManager.prototype._setDetachedRoot`). I'd like to rework this when > doing the DOM agent redesign as well.
There should be another way to check if we are actually attached or not, perhaps by walking up the parentNode hierarchy.
Devin Rousso
Comment 6
2019-03-18 20:31:45 PDT
Created
attachment 365115
[details]
Patch
Joseph Pecoraro
Comment 7
2019-03-18 21:24:37 PDT
Comment on
attachment 365115
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=365115&action=review
r=me
> Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js:210 > - if (WI.domDebuggerManager.supported && isElement && !domNode.isPseudoElement() && domNode.ownerDocument) { > + if (WI.domDebuggerManager.supported &&isElement && !domNode.isPseudoElement() && attached) {
Style: Oops on the lost space.
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:781 > + if (WI.cssManager.canForcePseudoClasses() && this.representedObject.attached) {
Might want to extract the attached into a bool hear to avoid people potentially recomputing it later.
Devin Rousso
Comment 8
2019-03-19 10:29:32 PDT
Created
attachment 365179
[details]
Patch
WebKit Commit Bot
Comment 9
2019-03-19 11:03:39 PDT
Comment on
attachment 365179
[details]
Patch Clearing flags on attachment: 365179 Committed
r243152
: <
https://trac.webkit.org/changeset/243152
>
WebKit Commit Bot
Comment 10
2019-03-19 11:03:40 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.
Top of Page
Format For Printing
XML
Clone This Bug