V8Proxy::retrieve(*) leads to really obfuscated code and should be removed
https://bugs.webkit.org/show_bug.cgi?id=93072

Reviewed by Eric Seidel.

Source/WebCore:

Once upon a time, V8Proxy::retrieve did a bunch of checks before
returning the V8Proxy object (such as checking whether script was
enabled). Over time, we've removed all of these checks in order to fix
various bugs. Now all it does is check whether the Frame is 0. However,
because the function ends up returning 0 when its argument is 0, the
caller sill needs to have a null check.

This patch deletes all the variations of V8Proxy::retrieve(*) and
inlines them into their callers. In several cases, inlining the
function call showed that we were testing the Frame for 0 twice, and
I've removed the redundant null checks. In other cases, I've
uncontorted the callers to make the code more readable.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateToV8Converters):
* bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
(WebCore::V8TestActiveDOMObject::wrapSlow):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructorConstructorCallback):
* bindings/scripts/test/V8/V8TestNode.cpp:
(WebCore::V8TestNode::wrapSlow):
* bindings/v8/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
* bindings/v8/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* bindings/v8/ScriptController.h:
(WebCore::ScriptController::windowShell):
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::instantiateV8Object):
* bindings/v8/V8EventListener.cpp:
(WebCore::V8EventListener::callListenerFunction):
* bindings/v8/V8Helpers.cpp:
(WebCore::toV8Proxy):
* bindings/v8/V8LazyEventListener.cpp:
(WebCore::V8LazyEventListener::callListenerFunction):
(WebCore::V8LazyEventListener::prepareListenerObject):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::handleOutOfMemory):
(WebCore::V8Proxy::retrievePerContextData):
(WebCore::V8Proxy::mainWorldContext):
(WebCore::toV8Context):
* bindings/v8/V8Proxy.h:
(V8Proxy):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::V8DOMWindow::addEventListenerCallback):
(WebCore::V8DOMWindow::removeEventListenerCallback):
* bindings/v8/custom/V8DocumentCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::openCallback):
(WebCore::toV8):
* bindings/v8/custom/V8SVGDocumentCustom.cpp:
(WebCore::toV8):

Source/WebKit/chromium:

* src/WebDevToolsAgentImpl.cpp:
(WebKit::WebDevToolsAgentImpl::didCreateScriptContext):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Make textModel private to textEditor
https://bugs.webkit.org/show_bug.cgi?id=92999

Patch by Jan Keromnes <janx@linux.com> on 2012-08-03
Reviewed by Pavel Feldman.

Source/WebCore:

Making textModel private to the textEditor ensures that it is accessed
only through the textEditor, making the latter more modular.

Tests were changed accordingly.

* inspector/front-end/JavaScriptSourceFrame.js:
(WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged):
(WebInspector.JavaScriptSourceFrame.prototype._restoreBreakpointsAfterEditing):
(WebInspector.JavaScriptSourceFrame.prototype._addBreakpointDecoration):
(WebInspector.JavaScriptSourceFrame.prototype._removeBreakpointDecoration):
(WebInspector.JavaScriptSourceFrame.prototype._lineNumberAfterEditing):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype.setContent):
(WebInspector.SourceFrame.prototype.replaceAllWith):
(WebInspector.SourceFrame.prototype._collectRegexMatches):
(WebInspector.SourceFrame.prototype.addMessageToSource):
(WebInspector.SourceFrame.prototype.removeMessageFromSource):
(WebInspector.TextEditorDelegateForSourceFrame.prototype.commitEditing):
* inspector/front-end/TextEditor.js:
(WebInspector.TextEditor.prototype.setText):
(WebInspector.TextEditor.prototype.text):
(WebInspector.TextEditor.prototype.range):
(WebInspector.TextEditor.prototype.line):
(WebInspector.TextEditor.prototype.get linesCount):
(WebInspector.TextEditor.prototype.setAttribute):
(WebInspector.TextEditor.prototype.getAttribute):
(WebInspector.TextEditor.prototype.removeAttribute):
* inspector/front-end/UISourceCodeFrame.js:
(WebInspector.UISourceCodeFrame.prototype.afterTextChanged):

LayoutTests:

Tests no longer access textModel directly from sourceFrame.

* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):
* http/tests/inspector/live-edit-test.js:
(initialize_LiveEditTest.InspectorTest.replaceInSource):
(initialize_LiveEditTest):
* inspector/debugger/pause-in-inline-script.html:
* inspector/debugger/script-formatter.html:
* inspector/debugger/source-url-comment.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK gardening, adding text failure expectations for 20 MathML
Presentation tests that started failing after r124512.

* platform/gtk/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Delete text from password does nothing.
https://bugs.webkit.org/show_bug.cgi?id=92040

Patch by Sergio Carlos Morales Angeles <carloschilazo@gmail.com> on 2012-08-03
Reviewed by Ryosuke Niwa.

Source/WebCore:

Use Editor::canDelete() to determine if field is editable or not.
Added password-delete-contents test.

Test: editing/deleting/password-delete-contents.html

* editing/EditorCommand.cpp:
(WebCore::enabledDelete):

LayoutTests:

Added regression test for password field content delete.

* editing/deleting/password-delete-contents-expected.txt: Added.
* editing/deleting/password-delete-contents.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[cmake] Cleanup FindHarfBuzz.cmake
https://bugs.webkit.org/show_bug.cgi?id=92984

Patch by Dominik Röttsches <dominik.rottsches@intel.com> on 2012-08-03
Reviewed by Hajime Morita.

Cleanup which didn't make it into my previous ptch.

* Source/cmake/FindHarfBuzz.cmake: Remove duplicate line, add a bit of documentation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore::DragController::cleanupAfterSystemDrag should null-check page
https://bugs.webkit.org/show_bug.cgi?id=61815

Reviewed by Eric Seidel.

* page/DragController.cpp:
(WebCore::DragController::dragEnteredOrUpdated):
(WebCore::DragController::doSystemDrag):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: add CSSRule memory instrumentation
https://bugs.webkit.org/show_bug.cgi?id=92962

Reviewed by Pavel Feldman.

Added memory footprint reporting method to CSSRule and its descendants.

* css/CSSCharsetRule.cpp:
(WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSCharsetRule.h:
(CSSCharsetRule):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::reportMemoryUsage):
(WebCore):
* css/CSSComputedStyleDeclaration.h:
(CSSComputedStyleDeclaration):
* css/CSSFontFaceRule.cpp:
(WebCore::CSSFontFaceRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSFontFaceRule.h:
(CSSFontFaceRule):
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSImportRule.h:
(CSSImportRule):
* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSMediaRule.h:
(CSSMediaRule):
* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSPageRule.h:
(CSSPageRule):
* css/CSSRule.cpp:
(WebCore::CSSRule::reportMemoryUsage): we manually implement polymorphic
call here to avoid adding vtable pointer to all CSSRule objects. Descendants
are expected to report their memory via reportDescendantMemoryUsage. The name
is intentionally different from reportMemoryUsage to avoid accidential infitite
recursion: if the descendants overrode non-virtual CSSRule::reportMemoryUsage,
it would be easy to add a new descendant type to the switch in
CSSRule::reportMemoryUsage without providing proper override for reportMemoryUsage
and CSSRule::reportMemoryUsage would end up calling itself.
(WebCore):
(WebCore::CSSRule::reportBaseClassMemoryUsage): again we cannot use
MemoryClassInfo::visitBaseClass like we do for virtual methods because it would
lead to a recursive call of CSSRule::reportMemoryUsage. This is why we use
reportBaseClassMemoryUsage to allow descendants to report objects referenced
from their base class.
* css/CSSRule.h:
(WebCore):
(CSSRule):
* css/CSSRuleList.cpp:
(WebCore::StaticCSSRuleList::reportMemoryUsage):
(WebCore):
* css/CSSRuleList.h:
(WebCore):
(CSSRuleList):
(StaticCSSRuleList):
(LiveCSSRuleList):
* css/CSSStyleDeclaration.h:
(WebCore):
(CSSStyleDeclaration):
* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::reportDescendantMemoryUsage):
(WebCore):
* css/CSSStyleRule.h:
(CSSStyleRule):
* css/CSSStyleSheet.cpp:
(StyleSheetCSSRuleList):
(WebCore::CSSStyleSheet::reportMemoryUsage):
* css/CSSUnknownRule.h:
(CSSUnknownRule):
(WebCore::CSSUnknownRule::reportDescendantMemoryUsage):
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::reportMemoryUsage):
(WebCore):
(WebCore::StyleRuleCSSStyleDeclaration::reportMemoryUsage):
(WebCore::InlineCSSStyleDeclaration::reportMemoryUsage):
* css/PropertySetCSSStyleDeclaration.h:
(PropertySetCSSStyleDeclaration):
(StyleRuleCSSStyleDeclaration):
(InlineCSSStyleDeclaration):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::WebKitCSSKeyframeRule::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSKeyframeRule.h:
(WebKitCSSKeyframeRule):
* css/WebKitCSSKeyframesRule.cpp:
(WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSKeyframesRule.h:
(WebKitCSSKeyframesRule):
* css/WebKitCSSRegionRule.cpp:
(WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSRegionRule.h:
(WebKitCSSRegionRule):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Incorrect blob url href when inspecting
https://bugs.webkit.org/show_bug.cgi?id=93076

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Special-cased the "blob" scheme to return the original URL intact on completion.

* inspector/front-end/ResourceUtils.js:
(WebInspector.completeURL):

LayoutTests:

* inspector/styles/styles-url-linkify-expected.txt:
* inspector/styles/styles-url-linkify.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Profiles: extract save to file / load from code
https://bugs.webkit.org/show_bug.cgi?id=92348

Patch by Eugene Klyuchnikov <eustas.big@gmail.com> on 2012-08-03
Reviewed by Yury Semikhatsky.

Source/WebCore:

Motivation: extract reusable code for timeline load/save.
FileUtils.js will contain common code. Not all code moved to FileUtils
to make review easier. This code will be moved in next patch.

Core abstractions: OutputStream and OutputStreamDelegate.

OutputStream is interface that is used to transfer entity divded
to chunks. Transfer process is explicitly initialized (startTransfer)
and finalized (finishTrnsfer).

OutputStreamDelegate is interface to receive notifications about
transfer process: onTransferStarted, onChunkTransferred, onTransferFinished.

ChunkedFileReader: utility class that loads file by chunks of specified
size and notifies given delegate. OutputStream is supplied as a
parameter of method "start".

ChunkedFileWriter: implementation of OutputStream that saves data
to file specified by file name and notifies given delegate.

* WebCore.gypi: Added 'FileUtils.js'.
* WebCore.vcproj/WebCore.vcproj: Added 'FileUtils.js'.
* inspector/compile-front-end.py: Added 'FileUtils.js'.
* inspector/front-end/FileUtils.js: Added.
(WebInspector.OutputStreamDelegate): Added.
(WebInspector.ChunkedFileReader): Added.
(WebInspector.createFileSelectorElement): Added utility method to construct
hidden input element to select file.
* inspector/front-end/HeapSnapshotLoader.js: Adopted new API.
* inspector/front-end/HeapSnapshotProxy.js: Adopted new API.
* inspector/front-end/HeapSnapshotView.js: Adopted new API.
(WebInspector.HeapSnapshotLoadFromFileDelegate):
Extracted from existing code.
(WebInspector.ChunkedFileWriter): Renamed and refactored.
(WebInspector.HeapSnapshotSaveToFileDelegate):
Extracted from existing code.
* inspector/front-end/ProfilesPanel.js: Adopted new API.

LayoutTests:

Changed test to adopt new API. Replaced FS mock with
reader mock.

* inspector/profiler/heap-snapshot-loader.html:
Adopted new API.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Remove InspectorCSSAgent from InstrumentingAgents on clearFrontend()
https://bugs.webkit.org/show_bug.cgi?id=93082

Reviewed by Yury Semikhatsky.

* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::InspectorCSSAgent):
(WebCore::InspectorCSSAgent::~InspectorCSSAgent):
(WebCore::InspectorCSSAgent::setFrontend):
(WebCore::InspectorCSSAgent::clearFrontend):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ColorSuggestionPicker popup's height doesn't get smaller than 100 px
https://bugs.webkit.org/show_bug.cgi?id=92945

Reviewed by Kent Tamura.

Source/WebCore:

A window cannot be resized to be smaller than 100x100 pixels so this
adjust the color suggestion popup UI to look better when there are only
a few suggestions.

Tests: platform/chromium/fast/forms/color/color-suggestion-picker-one-row-appearance.html
       platform/chromium/fast/forms/color/color-suggestion-picker-two-row-appearance.html

* Resources/colorSuggestionPicker.css:
(.color-swatch-container): Vertically center the swatches.

LayoutTests:

* platform/chromium-mac/platform/chromium/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.png: Added.
* platform/chromium-mac/platform/chromium/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.png: Added.
* platform/chromium/TestExpectations:
* platform/chromium/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.txt: Added.
* platform/chromium/fast/forms/color/color-suggestion-picker-one-row-appearance.html: Added.
* platform/chromium/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.txt: Added.
* platform/chromium/fast/forms/color/color-suggestion-picker-two-row-appearance.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Re-wire "target" half of the same-origin security check through Document rather than DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=93079

Reviewed by Eric Seidel.

Before this patch, we were traversing from Nodes to Frames to
DOMWindows to SecurityOrigins when determing the "target" of an
operation for the same-origin policy security check. Rather than
detouring through DOMWindow, these security checks should operate in
terms of ScriptExecutionContexts (aka Documents) because that's the
canonical place we store SecurityOrigin objects.

A future patch will re-wire the "active" part of the security check to
use ScriptExecutionContexts as well and we'll be able to remove the
extra copy of SecurityOrigin that we keep in DOMWindow.

* bindings/generic/BindingSecurity.cpp:
(WebCore::canAccessDocument):
(WebCore::BindingSecurity::canAccessFrame):
(WebCore::BindingSecurity::shouldAllowAccessToNode):
* bindings/v8/BindingState.cpp:
(WebCore::immediatelyReportUnsafeAccessTo):
* bindings/v8/BindingState.h:
(WebCore):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::reportUnsafeJavaScriptAccess):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::reportUnsafeAccessTo):
* bindings/v8/V8Proxy.h:
(V8Proxy):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] (REGRESSION 124581) : EFL 64-bit Debug bot is red and build is exiting early after 20 test crashes
https://bugs.webkit.org/show_bug.cgi?id=93084

Patch by Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> on 2012-08-03
Reviewed by Csaba Osztrogonác.

Fix regression introduced in r124581.

* DumpRenderTree/efl/DumpRenderTree.cpp:
(getFinalTestURL): Convert the path into a full file URL.
(runTest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WTR] process unresponsiveness is reported to the wrong test
https://bugs.webkit.org/show_bug.cgi?id=88404

Reviewed by Zoltan Herczeg.

Do resetting to consistent state after the finished test,
not before the next. This way we can report unresponsiveness
to the test that triggered it, and we do a restart before the
next test so it will start in a functional state.

* Scripts/webkitpy/layout_tests/port/webkit.py:
(WebKitDriver._check_for_driver_crash):
Print the error line for unresponsive web process, otherwise
it's hard to tell what happened.
* WebKitTestRunner/TestController.cpp:
(WTR):
Decreased the default short timeout so we can detect unresponsiveness
before the timer of the test harness times out. It was unnecessarily
high anyway, we should get answer from the web process in those cases
when the short timeout is used in less than a second.
(WTR::TestController::runTest):
(WTR::TestController::run):
* WebKitTestRunner/TestController.h:
(TestController):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke):
(WTR::TestInvocation::dump):
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/TestInvocation.h:
(TestInvocation): Make the dump function static as it doesn't need an object.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add missing include to build on Mac OS 10.8

Reviewed by Ossy.

* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WTR] process unresponsiveness is reported to the wrong test
https://bugs.webkit.org/show_bug.cgi?id=88404

Unreviewed buildfix. Also made the change on the array size
suggested on review because I forgot it when landed.

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][DRT] fast/loader/stop-provisional-loads.html fails
https://bugs.webkit.org/show_bug.cgi?id=92219

Patch by Joone Hur <joone.hur@intel.com> on 2012-08-03
Reviewed by Kenneth Rohde Christiansen.

This patch adds the ability to tell DRT to call ewk_frame_stop
inside of a didStartProvisionalLoadForFrame signal handler.
It allows to pass fast/loader/stop-provisional-loads.html.

* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::onFrameProvisionalLoad):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WTR] process unresponsiveness is reported to the wrong test
https://bugs.webkit.org/show_bug.cgi?id=88404

2nd unreviewed buildfix.

* WebKitTestRunner/TestInvocation.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Always save CONFIG & DEFINES in default_pre

Always doing it is cheaper than checking whether it needs to be done.
apart from that, it would break configuration initiated from another
project.

Patch by Oswald Buddenhagen <oswald.buddenhagen@nokia.com> on 2012-08-03
Reviewed by Tor Arne Vestbø.

* qmake/mkspecs/features/default_pre.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124601 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix for GTK after r124581.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(runTest): Fix wrong variable name in ASSERT.

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