Bug 153824

Summary: Indent inline box test fails due to assertion in VisibleSelection::selectionFromContentsOfNode()
Product: WebKit Reporter: Adrien Plazas <aplazas>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Check if the node can offer a position before trying to get one from it.
none
Check if the node can offer a position before trying to get one from it. none

Description Adrien Plazas 2016-02-02 23:18:05 PST
The editing/execCommand/indent-inline-box-crash.html test is crashing due to an assert in the GTK+ debug bot. It seems to be caused because we are not checking if the node we are trying to get a position from can offer one.

STDERR: ASSERTION FAILED: !editingIgnoresContent(node)
STDERR: ../../Source/WebCore/editing/VisibleSelection.cpp(98) : static WebCore::VisibleSelection WebCore::VisibleSelection::selectionFromContentsOfNode(WebCore::Node*)
STDERR: 1   0x7f46bafbe161 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x1e) [0x7f46bafbe161]
STDERR: 2   0x7f46c1d64567 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::VisibleSelection::selectionFromContentsOfNode(WebCore::Node*)+0x45) [0x7f46c1d64567]
STDERR: 3   0x7f46c1d7f2df /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5ad82df) [0x7f46c1d7f2df]
STDERR: 4   0x7f46c1d7f9e4 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5ad89e4) [0x7f46c1d7f9e4]
STDERR: 5   0x7f46c1d80642 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::createMarkup(WebCore::Range const&, WTF::Vector<WebCore::Node*, 0ul, WTF::CrashOnOverflow, 16ul>*, WebCore::EAnnotateForInterchange, bool, WebCore::EAbsoluteURLs)+0x5d) [0x7f46c1d80642]
STDERR: 6   0x7f46c1468fff /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebEditorClient::updateGlobalSelection(WebCore::Frame*)+0x197) [0x7f46c1468fff]
STDERR: 7   0x7f46c12af3af /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebEditorClient::respondToChangedSelection(WebCore::Frame*)+0xd7) [0x7f46c12af3af]
STDERR: 8   0x7f46c1d00d21 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::Editor::respondToChangedSelection(WebCore::VisibleSelection const&, unsigned int)+0x51) [0x7f46c1d00d21]
STDERR: 9   0x7f46c1d1184e /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance(WebCore::VisibleSelection const&, unsigned int, WebCore::FrameSelection::CursorAlignOnScroll, WebCore::TextGranularity)+0x420) [0x7f46c1d1184e]
STDERR: 10  0x7f46c1d11985 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::FrameSelection::setSelection(WebCore::VisibleSelection const&, unsigned int, WebCore::AXTextStateChangeIntent, WebCore::FrameSelection::CursorAlignOnScroll, WebCore::TextGranularity)+0x3f) [0x7f46c1d11985]
STDERR: 11  0x7f46c1d1acd7 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::FrameSelection::selectAll()+0x3f7) [0x7f46c1d1acd7]
STDERR: 12  0x7f46c1d0a0ca /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5a630ca) [0x7f46c1d0a0ca]
STDERR: 13  0x7f46c1d0c066 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::Editor::Command::execute(WTF::String const&, WebCore::Event*) const+0xde) [0x7f46c1d0c066]
STDERR: 14  0x7f46c1b7f626 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::Document::execCommand(WTF::String const&, bool, WTF::String const&)+0x56) [0x7f46c1b7f626]
STDERR: 15  0x7f46c2c94347 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::jsDocumentPrototypeFunctionExecCommand(JSC::ExecState*)+0x29f) [0x7f46c2c94347]
STDERR: 16  0x7f4668dfe0c8 [0x7f4668dfe0c8]
STDERR: LEAK: 1 WebProcessPool
STDERR: LEAK: 1 WebPageProxy
Comment 1 Adrien Plazas 2016-02-03 00:59:41 PST
Created attachment 270565 [details]
Check if the node can offer a position before trying to get one from it.
Comment 2 Carlos Garcia Campos 2016-02-03 01:11:22 PST
This doesn't look specific to GTK+, patch changes only cross platform code.
Comment 3 Michael Catanzaro 2016-02-05 10:36:27 PST
Comment on attachment 270565 [details]
Check if the node can offer a position before trying to get one from it.

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

> Source/WebCore/ChangeLog:3
> +        [GTK] Indent inline box test fails due to assertion in VisibleSelection::selectionFromContentsOfNode()

So, please remove the [GTK] prefix from the changelog
Comment 4 Adrien Plazas 2016-02-08 00:43:03 PST
Created attachment 270848 [details]
Check if the node can offer a position before trying to get one from it.
Comment 5 Michael Catanzaro 2016-02-08 04:55:42 PST
Comment on attachment 270848 [details]
Check if the node can offer a position before trying to get one from it.

The change is small, the current code is obviously wrong, and no other reviewer has objected for several days, so r=me.
Comment 6 WebKit Commit Bot 2016-02-08 05:41:51 PST
Comment on attachment 270848 [details]
Check if the node can offer a position before trying to get one from it.

Clearing flags on attachment: 270848

Committed r196249: <http://trac.webkit.org/changeset/196249>
Comment 7 WebKit Commit Bot 2016-02-08 05:41:54 PST
All reviewed patches have been landed.  Closing bug.