Going "back" to a cached page from a page with a main resource error breaks scrolling, amongst other issues.
<rdar://problem/13751844> and https://bugs.webkit.org/show_bug.cgi?id=117112

Reviewed by Alexey Proskuryakov.

Source/WebCore:

If a main resource load ends in error, the Document's parser is never cleared out.

If you then return to a CachedPage, we run the Document->clearParser() step for the
old page and that incorrectly dispatches didFinishLoad for the previous page load
in the middle of the load for the cached page.

The parser should never be needed after a load completes (even if it fails) and
holding on to the parser after the page load failed but before a new navigation is
actually using unnecessary resources.

So we should just clear the parser right when the main resource fails.

Test: http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoading): After canceling the main resource load, also clear the parser.

LayoutTests:

* http/tests/loading/resources/resource-that-goes-back-while-still-loading.php: Added.
* http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt: Added.
* http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Move Qt port off legacy clipboard
https://bugs.webkit.org/show_bug.cgi?id=116416

Patch by Arunprasad Rajkumar <arurajku@cisco.com> on 2013-06-02
Reviewed by Darin Adler.

Source/WebCore:

No change in behavior, no new tests added.

* Target.pri: Removed ClipboardQt.h and EditorQt.cpp from compilation.
* dom/Clipboard.h:
* editing/qt/EditorQt.cpp: Removed.
* page/qt/EventHandlerQt.cpp: Use Clipboard::createForDragAndDrop().
(WebCore::EventHandler::createDraggingClipboard):
* platform/Pasteboard.h:
(WebCore::Pasteboard::clipboardData): Expose writable QMimeData* to outside, so that it is accessible
from DragClientQt.cpp and WebDragClientQt.cpp.
(WebCore::Pasteboard::invalidateWritableData):
(WebCore::Pasteboard::isForDragAndDrop):
(WebCore::Pasteboard::isForCopyAndPaste):
* platform/qt/ClipboardQt.cpp:
(WebCore::Clipboard::createDragImage):
(WebCore::Clipboard::declareAndWriteDragImage):
* platform/qt/ClipboardQt.h: Removed.
* platform/qt/PasteboardQt.cpp: Moved required methods from ClipboardQt.cpp.
(WebCore::isTextMimeType):
(WebCore::isHtmlMimeType):
(WebCore::Pasteboard::create):
(WebCore::Pasteboard::createForCopyAndPaste):
(WebCore::Pasteboard::createPrivate):
(WebCore::Pasteboard::createForDragAndDrop):
(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::~Pasteboard):
(WebCore::Pasteboard::generalPasteboard):
(WebCore::Pasteboard::isSelectionMode):
(WebCore::Pasteboard::setSelectionMode):
(WebCore::Pasteboard::readData):
(WebCore::Pasteboard::hasData):
(WebCore::Pasteboard::clear):
(WebCore::Pasteboard::readString):
(WebCore::Pasteboard::writeString):
(WebCore::Pasteboard::types):
(WebCore::Pasteboard::readFilenames):
(WebCore::Pasteboard::setDragImage):
(WebCore::Pasteboard::writePasteboard):

Source/WebKit/qt:

* WebCoreSupport/DragClientQt.cpp:
(WebCore::DragClientQt::startDrag):

Source/WebKit2:

* WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp:
(WebKit::WebDragClient::startDrag):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL Gardening.

* platform/efl-wk2/TestExpectations: Unskipping some of webgl passing tests.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WTF] Add OwnArrayPtr vectortraits template
https://bugs.webkit.org/show_bug.cgi?id=117131

Reviewed by Darin Adler.

To support Vector<OwnArrayPtr<P>>, which will be used by EFL port.

* wtf/VectorTraits.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening.

Rebaseline several mozilla tables layout tests for EFL port.

* platform/efl/tables/mozilla/bugs/bug13169-expected.png:
* platform/efl/tables/mozilla/bugs/bug13169-expected.txt:
* platform/efl/tables/mozilla/bugs/bug133756-1-expected.png:
* platform/efl/tables/mozilla/bugs/bug133756-1-expected.txt:
* platform/efl/tables/mozilla/bugs/bug133756-2-expected.png:
* platform/efl/tables/mozilla/bugs/bug133756-2-expected.txt:
* platform/efl/tables/mozilla/bugs/bug17138-expected.png:
* platform/efl/tables/mozilla/bugs/bug17138-expected.txt:
* platform/efl/tables/mozilla/bugs/bug17548-expected.png:
* platform/efl/tables/mozilla/bugs/bug17548-expected.txt:
* platform/efl/tables/mozilla/bugs/bug220536-expected.png:
* platform/efl/tables/mozilla/bugs/bug220536-expected.txt:
* platform/efl/tables/mozilla/bugs/bug6304-expected.png:
* platform/efl/tables/mozilla/bugs/bug6304-expected.txt:
* platform/efl/tables/mozilla/bugs/bug73321-expected.png:
* platform/efl/tables/mozilla/bugs/bug73321-expected.txt:
* platform/efl/tables/mozilla/bugs/bug7714-expected.txt:
* platform/efl/tables/mozilla/bugs/bug8858-expected.png:
* platform/efl/tables/mozilla/bugs/bug8858-expected.txt:
* platform/efl/tables/mozilla/core/bloomberg-expected.png:
* platform/efl/tables/mozilla/core/bloomberg-expected.txt:
* platform/efl/tables/mozilla/core/cell_heights-expected.png:
* platform/efl/tables/mozilla/core/cell_heights-expected.txt:
* platform/efl/tables/mozilla/other/test6-expected.png:
* platform/efl/tables/mozilla/other/test6-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug1010-expected.png:
* platform/efl/tables/mozilla_expected_failures/bugs/bug1010-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug131020-3-expected.png:
* platform/efl/tables/mozilla_expected_failures/bugs/bug131020-3-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug23847-expected.png:
* platform/efl/tables/mozilla_expected_failures/bugs/bug23847-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug58402-2-expected.png:
* platform/efl/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug65372-expected.png:
* platform/efl/tables/mozilla_expected_failures/bugs/bug65372-expected.txt:
* platform/efl/tables/mozilla_expected_failures/bugs/bug6933-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening.

Rebaseline several test cases on EFL.

* platform/efl-wk2/compositing/overflow/content-gains-scrollbars-expected.txt: Added.
* platform/efl-wk2/compositing/overflow/content-loses-scrollbars-expected.txt: Added.
* platform/efl-wk2/fast/dynamic/002-expected.txt:
* platform/efl/fast/block/float/float-not-removed-from-next-sibling2-expected.png:
* platform/efl/fast/block/float/float-not-removed-from-next-sibling2-expected.txt:
* platform/efl/fast/dynamic/002-expected.png:
* platform/efl/fast/table/007-expected.png:
* platform/efl/fast/table/007-expected.txt:
* platform/efl/fast/table/colspanMinWidth-expected.png:
* platform/efl/fast/table/colspanMinWidth-expected.txt:
* platform/efl/fast/table/spanOverlapRepaint-expected.png:
* platform/efl/fast/table/spanOverlapRepaint-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening.

Skip 2 webaudio tests that are failing due to the onended event not getting
fired.

* platform/efl/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening.

Rebaseline 2 printing test cases on EFL port.

* platform/efl/printing/compositing-layer-printing-expected.png:
* platform/efl/printing/compositing-layer-printing-expected.txt:
* platform/efl/printing/page-rule-in-media-query-expected.png:
* platform/efl/printing/page-rule-in-media-query-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Process launcher uses system() for wrapping the WebProcess when using WEB_PROCESS_CMD_PREFIX
https://bugs.webkit.org/show_bug.cgi?id=105156

Patch by Sergio Correia <sergio.correia@openbossa.org> on 2013-06-03
Reviewed by Christophe Dumez.

When using WEB_PROCESS_CMD_PREFIX - which allows us for instance to analyze
WebProcess under tools like valgrind or gdb -, the ProcessLauncher would
spawn the new process using system(), which would, among other things, keep
an extra UIProcess waiting and executing the shell.

This patch handles the normal case and the case where we have something to
prefix WebProcess (i.e., by using WEB_PROCESS_CMD_PREFIX in a debug build)
the same way, through a call to execvp().

To achieve this a function was introduced to create an array with the given
arguments to the full command to be executed, to be used by execvp(). We use
a Vector<OwnArrayPtr<char>>, so that we can take advantage of the destructor
of OwnArrayPtr to handle the memory deallocation when it goes out of scope.

* UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
(WebKit::createArgsArray):  This function creates the array to be used by
execvp(), out of the Strings given as arguments.
(WebKit::ProcessLauncher::launchProcess): Rework the logic to accomodate
both the cases with and without WEB_PROCESS_CMD_PREFIX. The execl() call
was replaced with an execvp() call, since now we should deal with having
a variable number of arguments (WEB_PROCESS_CMD_PREFIX) as well.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Webkit crashes while loading content from Application Cache.
https://bugs.webkit.org/show_bug.cgi?id=116814

Reviewed by Darin Adler.

With the refacor for 112722, which removes MainResourceLoader and moves the functionality to DocumentLoader,
the processing of appcache for main resource error (because of network error) was moved DocumentLoader::
mainReceivedError(), which was trigged by ResourceHandle::didFail->SubResourceLoader::didFail, which already
in a Finishing state after notifying the DocumentLoader of the load failure.

Before patch for 112722, the appcache for main resource error was in MainResourceLoader::didFail(),
which will start processing the potential fallback before notifying DocumentLoader and moving the the state
of the resource loader to finishing state.

So we should move maybeLoadFallbackForMainError out of DocumentLoader::mainReceivedError, and move it to
ApplicationCacheHost::maybeLoadFallbackForError, if the resource that has error is the main resource.

Test: http/tests/appcache/main-resource-fallback-for-network-error-crash.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::mainReceivedError):
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
* loader/appcache/ApplicationCacheHost.h:

LayoutTests: Webkit crashes while loading  content from Application Cache.
https://bugs.webkit.org/show_bug.cgi?id=116814

Reviewed by Darin Adler.

* http/tests/appcache/main-resource-fallback-for-network-error-crash-expected.txt: Added.
* http/tests/appcache/main-resource-fallback-for-network-error-crash.html: Added.
* http/tests/appcache/resources/main-resource-fallback-for-network-error-crash.manifest: Added.
* http/tests/appcache/resources/success-and-notify-done.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL]<select> element's text is clipped when a height is specified along with CSS line-height.
https://bugs.webkit.org/show_bug.cgi?id=114862

Patch by Rashmi Kulakarni <rashmi.vijay@samsung.com> on 2013-06-03
Reviewed by Gyuyoung Kim.

Source/WebCore:

Fix <select> element getting clipped when element height becomes less than the line-height.
Set minimum height for <select> element.

No new tests, no behavior change.

* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::adjustMenuListButtonStyle):

LayoutTests:

Rebaselined the test case fast/forms/001.html.

* platform/efl/fast/forms/001-expected.png:
* platform/efl/fast/forms/001-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151100 268f45cc-cd09-0410-ab3c-d52691b4dbfc
'onended' event is not received in AudioBufferSourceNode and OscillatorNode.
https://bugs.webkit.org/show_bug.cgi?id=117132.

Patch by Praveen R Jadhav <praveen.j@samsung.com> on 2013-06-03
Reviewed by Christophe Dumez.

Source/WebCore:

The listener argument is a PassRefPtr which becomes NULL after the call to
setAttributeEventListener() in setOnended(). This causes the m_hasEndedListener
boolean to be incorrectly initialized. This patch reverses the two statements so
that the m_hasEndedListener is updated before the call to setAttributeEventListener().

No new tests, already covered by existing tests.

* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::setOnended):

LayoutTests:

Unskip webaudio test cases that were failing due to the 'onended' event not being fired.

* platform/efl/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151101 268f45cc-cd09-0410-ab3c-d52691b4dbfc