REGRESSION(r134328) - ASSERT(isMainThread()) when subresources redirect in the NetworkProcessPass through
https://bugs.webkit.org/show_bug.cgi?id=102167

Reviewed by Simon Fraser.

willSendRequest comes in on a background thread but we need to do HostRecord accounting on the main thread.

So we'll just dispatch the receivedRedirect call to the main thread RunLoop.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::willSendRequest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add DOMRequestState to maintain world/ScriptExecutionContext state
https://bugs.webkit.org/show_bug.cgi?id=102102

Reviewed by Adam Barth.

Introduce DOMRequestState, and convert IndexedDB over.

No new tests, this is an abstraction layer for existing code.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::dispatchEvent):
* Modules/indexeddb/IDBRequest.h:
(IDBRequest):
* WebCore.gypi:
* bindings/v8/DOMRequestState.h: Added.
(WebCore):
(DOMRequestState):
(WebCore::DOMRequestState::DOMRequestState):
(Scope):
(WebCore::DOMRequestState::Scope::Scope):
(WebCore::DOMRequestState::scope):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Refactor theme font lookup into a factory
https://bugs.webkit.org/show_bug.cgi?id=101949

Patch by Scott Violet <sky@chromium.org> on 2012-11-13
Reviewed by Tony Chang.

This will ultimately allow us to use what is currently in RenderThemeChromiumLinux on windows.

No new tests. Refactoring only.

* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* rendering/RenderThemeChromiumFontProvider.cpp: Added.
(WebCore):
(WebCore::RenderThemeChromiumFontProvider::defaultGUIFont): Moved into RenderThemeFontProvider.
* rendering/RenderThemeChromiumFontProvider.h: Added.
(WTF):
(WebCore):
(RenderThemeChromiumFontProvider): This is the font related methods.
* rendering/RenderThemeChromiumFontProviderLinux.cpp: Added.
(WebCore):
(WebCore::RenderThemeChromiumFontProvider::setDefaultFontSize): What was in RenderThemeChromiumSkia::setDefaultFontSize.
(WebCore::RenderThemeChromiumFontProvider::systemFont): What was in RenderThemeChromiumSkia::systemFont.
* rendering/RenderThemeChromiumFontProviderWin.cpp: Added.
(WebCore):
(WebCore::pointsToPixels): Moved from RenderThemeChromiumWin.
(WebCore::getNonClientMetrics): Moved from RenderThemeChromiumWin.
(WebCore::systemFontSize): Moved from RenderThemeChromiumWin.
(WebCore::RenderThemeChromiumFontProvider::systemFont): Moved from RenderThemeChromiumWin.
(WebCore::RenderThemeChromiumFontProvider::setDefaultFontSize): Moved from RenderThemeChromiumWin.
* rendering/RenderThemeChromiumSkia.cpp:
(WebCore::RenderThemeChromiumSkia::RenderThemeChromiumSkia): Moved into RenderThemeFontProvider.
(WebCore::RenderThemeChromiumSkia::systemFont): Calls to RenderThemeChromiumFontProvider.
(WebCore::RenderThemeChromiumSkia::setDefaultFontSize): Calls to RenderThemeChromiumFontProvider.
* rendering/RenderThemeChromiumSkia.h:
(RenderThemeChromiumSkia): Moves defaultFontSize into RenderThemeChromiumFontProvider.
* rendering/RenderThemeChromiumWin.cpp: Moves font code into RenderThemeFontProviderWin.
(WebCore):
* rendering/RenderThemeChromiumWin.h: Removed overriden methods now handled by RenderThemeChromiumSkia.
(RenderThemeChromiumWin):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Notify embedder of lost contexts and allow overriding of WebGL support
https://bugs.webkit.org/show_bug.cgi?id=101826

Reviewed by Adam Barth.

Source/WebCore:

Add hooks notifying the embedder when OpenGL contexts are lost and
allowing overriding of WebGL support on a per-frame basis.

No tests yet; don't know how to test this solely within WebKit.
Currently developing tests in the Chromium port exercising the
notifications end-to-end. Once those are in place, I'm prepared to
investigate adding tests for all ports.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::create):
  Check whether embedder vetoes creation of new WebGL contexts.
(WebCore::WebGLRenderingContext::loseContextImpl):
  Notify embedder that context was lost.
(WebCore::WebGLRenderingContext::maybeRestoreContext):
  Check whether embedder vetoes restoration of existing WebGL contexts.
* loader/FrameLoaderClient.h:
(FrameLoaderClient):
(WebCore::FrameLoaderClient::allowWebGL):
(WebCore::FrameLoaderClient::didLoseWebGLContext):
  Hooks notifying embedder of lost contexts and asking permission to run WebGL.

Source/WebKit/chromium:

Expose new FrameLoaderClient hooks through Chromium's
WebPermissionClient and WebFrameClient. Downstream browser tests
will exercise this new functionality.

* public/WebFrameClient.h:
(WebFrameClient):
(WebKit::WebFrameClient::didLoseWebGLContext):
* public/WebPermissionClient.h:
(WebPermissionClient):
(WebKit::WebPermissionClient::allowWebGL):
* src/FrameLoaderClientImpl.cpp:
(WebKit):
(WebKit::FrameLoaderClientImpl::allowWebGL):
(WebKit::FrameLoaderClientImpl::didLoseWebGLContext):
* src/FrameLoaderClientImpl.h:
(FrameLoaderClientImpl):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Automatically run small plugins
https://bugs.webkit.org/show_bug.cgi?id=102148
<rdar://problem/12695560>

Reviewed by Darin Adler.

* rendering/RenderEmbeddedObject.h: Promote layout() to protected.
* rendering/RenderSnapshottedPlugIn.cpp: Add constants for threshold size for plugins that will auto-start.
(WebCore::RenderSnapshottedPlugIn::layout): After layout, obtain the width and height of the element.
If either dimension is 0, or the overall size of the plugin is smaller that the threshold size, move the
display state to Playing. Assuming we will always layout before first paint, changing the state here
should be safe.
* rendering/RenderSnapshottedPlugIn.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Add missing ENABLE(SVG) test in header
https://bugs.webkit.org/show_bug.cgi?id=102143

Reviewed by Kentaro Hara.

Need to wrap the #include of a header that's only conditionally generated.

Fixes build error if compiling e.g. w/ GYP_DEFINES="enable_svg=0"

* bindings/v8/custom/V8ElementCustom.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disable frame loading instead of throwing exceptions on subtree modifications in ChildFrameDisconnector
https://bugs.webkit.org/show_bug.cgi?id=102012

Patch by Elliott Sprehn <esprehn@chromium.org> on 2012-11-13
Reviewed by Ojan Vafai.

Source/WebCore:

Previously if you modified the subtree that was being removed from a
removeChild from inside an unload handler on an <iframe> inside the
subtree you'd get an exception which is wrong. Instead we just need to
disable all frame loading there.

This works because either the subtree will be removed and the frame never
loading doesn't matter, or some section of the subtree that contains the
frame will be moved to another part of the document which will cause the
frame to load when it's inserted there.

I also added a check for <object> elements. It doesn't seem this is actually
reachable in the existing code, but I'm not entirely sure since the frame
loading and object/plugin handling is very confusing.

A better fix could be to repeatedly walk the subtree until all frames
were disconnected or some iteration limit was hit and then force all leftover
subframes to disconnect without firing unload handlers but this is such an
edge case I don't think the complexity is necessary.

Test: fast/frames/modifications-in-subtree-unload.html

* dom/ContainerNodeAlgorithms.h:
(WebCore::ChildFrameDisconnector::ChildFrameDisconnector):
(WebCore::ChildFrameDisconnector::~ChildFrameDisconnector):
(ChildFrameDisconnector):
(WebCore::ChildFrameDisconnector::disconnect):
* dom/Node.cpp:
(WebCore::checkAcceptChild): Removed exception.
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::didNotifySubtreeInsertions): Check canLoadFrame().
* html/HTMLFrameOwnerElement.h:
(SubframeLoadingDisabler):
(WebCore::SubframeLoadingDisabler::SubframeLoadingDisabler):
(WebCore::SubframeLoadingDisabler::~SubframeLoadingDisabler):
(WebCore::SubframeLoadingDisabler::canLoadFrame):
  Returns true if frames can be loaded in the subtree.
(WebCore::SubframeLoadingDisabler::disabledSubtreeRoots):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
  Check canLoadFrame(). I think this case is impossible, but it's better
  to be safe than sorry later.

LayoutTests:

Remove console log output from the exception we no longer throw. Since we no
longer throw an exception we don't need a platform specific output file either.

Also add a test that we don't throw an exception during modifications to subtrees
during unload.

* fast/frames/modifications-in-subtree-unload-expected.html: Added.
* fast/frames/modifications-in-subtree-unload.html: Added.
* fast/frames/out-of-document-iframe-has-child-frame-expected.txt:
* platform/chromium/fast/frames/out-of-document-iframe-has-child-frame-expected.txt: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Run multiple tasks per transaction tick
https://bugs.webkit.org/show_bug.cgi?id=97738

Reviewed by Tony Chang.

Process multiple tasks from the pending queue(s) when the timer fires. The
task may initiate new tasks that change which queue is active (e.g. indexing
operations) so the loop must re-check each tick which queue to use.

In DumpRenderTree, time to make 20k puts/20k gets dropped from 3.2s to 2.0s (-37%);
in Chromium's content_shell, the time dropped from 8.1s to 4.6s (-42%).

No new tests - just perf improvements, covered by (nearly) all existing IDB tests.

* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::abort): Use takeFirst() to clean up code.
(WebCore::IDBTransactionBackendImpl::taskTimerFired): Process as many tasks as are available.


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