Bug 108689 - Web Inspector: fix "DOM Exception 8" when deleting lines containing decoration in DTE.
Summary: Web Inspector: fix "DOM Exception 8" when deleting lines containing decoratio...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Lushnikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 14:03 PST by Andrey Lushnikov
Modified: 2013-02-02 04:11 PST (History)
9 users (show)

See Also:


Attachments
Patch (1.95 KB, patch)
2013-02-01 14:08 PST, Andrey Lushnikov
no flags Details | Formatted Diff | Diff
Patch (1.97 KB, patch)
2013-02-01 15:15 PST, Andrey Lushnikov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Lushnikov 2013-02-01 14:03:31 PST
Fix "DOM Exception 8" when deleting lines containing decoration in DTE.
Comment 1 Andrey Lushnikov 2013-02-01 14:08:17 PST
Created attachment 186134 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2013-02-01 14:16:26 PST
Comment on attachment 186134 [details]
Patch

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

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2931
> +            if (this.element.contains(this.element.decorationsElement))

We usually use the parentElement check, something like

if (this.element.decorationsElement.parentElement)
    this.element.decorationsElement.parentElement.removeChild(this.element.decorationsElement);

The node.contains() method is potentially slower, since it will check all the element's descendants, not only immediate children.
Comment 3 Andrey Lushnikov 2013-02-01 14:29:31 PST
Comment on attachment 186134 [details]
Patch

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

>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2931
>> +            if (this.element.contains(this.element.decorationsElement))
> 
> We usually use the parentElement check, something like
> 
> if (this.element.decorationsElement.parentElement)
>     this.element.decorationsElement.parentElement.removeChild(this.element.decorationsElement);
> 
> The node.contains() method is potentially slower, since it will check all the element's descendants, not only immediate children.

That is reasonable!
Comment 4 Andrey Lushnikov 2013-02-01 15:15:01 PST
Created attachment 186157 [details]
Patch
Comment 5 Alexander Pavlov (apavlov) 2013-02-01 16:44:01 PST
Comment on attachment 186157 [details]
Patch

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

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2931
> +            if (this.element.decorationsElement.parentElement)

I DO hope the parentElement is guaranteed to be this.element
Comment 6 WebKit Review Bot 2013-02-01 18:19:05 PST
Comment on attachment 186157 [details]
Patch

Clearing flags on attachment: 186157

Committed r141673: <http://trac.webkit.org/changeset/141673>
Comment 7 WebKit Review Bot 2013-02-01 18:19:09 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Pavel Feldman 2013-02-02 04:11:09 PST
Comment on attachment 186157 [details]
Patch

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

>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2931
>> +            if (this.element.decorationsElement.parentElement)
> 
> I DO hope the parentElement is guaranteed to be this.element

Should have been this.element.decorationElement.removeSelf();