Crash when reloading a Chromium "platform" app
https://bugs.webkit.org/show_bug.cgi?id=93497

Reviewed by Eric Seidel.

Source/WebCore:

The framework for Chromium "platform" apps executes a big blob of
script during the didCreateScriptContext callback. This blob of scripts
interacts with a bunch of JavaScript objects and triggers a number of
security checks.

When reloading a frame, the didCreateScriptContext is called during
Frame::setDocument (as a consequence of calling
ScriptController::updateDocument). At that time, the SecurityOrigin
object hasn't yet been copied over to the DOMWindow, and we crash
trying to grab it.

The long-term fix for this bug is to fix
https://bugs.webkit.org/show_bug.cgi?id=75793, at which point there
will no longer be a SecurityOrigin object on DOMWindow. In the
meantime, however, we can fix this crash by null checking the
DOMWindow's SecurityOrigin object.

* bindings/generic/BindingSecurity.cpp:
(WebCore::canAccessDocument):

Source/WebKit/chromium:

Test that we don't crash when executing script during the
didCreateScriptContext callback.

* tests/WebFrameTest.cpp:
* tests/data/hello_world.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Enable occlusion tracker in the occlusion tests for surface cacheing
https://bugs.webkit.org/show_bug.cgi?id=93500

Reviewed by Adrienne Walker.

The occlusion tracker is not being used in these tests except to do
scissoring. We want to test occlusion with these occlusion tests,
and when scissoring is not part of occlusion tracker, these
tests would become useless otherwise.

* tests/CCLayerTreeHostImplTest.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r125046): Breaks debug build (assertion in protocol type checks) (Requested by pfeldman on #webkit).
https://bugs.webkit.org/show_bug.cgi?id=93505

Not reviewed: roll out.

Source/WebCore:

* inspector/ConsoleMessage.cpp:
(WebCore::ConsoleMessage::addToFrontend):
* inspector/ConsoleMessage.h:
(ConsoleMessage):
* inspector/InjectedScript.cpp:
(WebCore::InjectedScript::wrapObject):
* inspector/InjectedScript.h:
(InjectedScript):
* inspector/InjectedScriptSource.js:
(.):
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::enable):
(WebCore::InspectorConsoleAgent::addConsoleMessage):
* inspector/front-end/ConsoleMessage.js:
(WebInspector.ConsoleMessageImpl.prototype._format):
(WebInspector.ConsoleMessageImpl.prototype._formatParameter):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsObject):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsNode):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
(WebInspector.ConsoleMessageImpl.prototype._printArray):
(WebInspector.ConsoleMessageImpl.prototype._formatAsArrayEntry):
(WebInspector.ConsoleMessageImpl.prototype._formatWithSubstitutionString):
* inspector/front-end/DOMExtension.js:
* inspector/front-end/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertiesSection):
* inspector/front-end/PropertiesSection.js:
* inspector/front-end/RemoteObject.js:
(WebInspector.RemoteObject):
(WebInspector.RemoteObject.fromPayload):
* inspector/front-end/Section.js:
* inspector/front-end/inspector.css:
(.console-group-messages .section .header .title):
(.section .properties .name, .event-properties .name):

LayoutTests:

* inspector/console/command-line-api-inspect-expected.txt:
* inspector/console/console-dir-expected.txt:
* inspector/console/console-eval-global-expected.txt:
* inspector/console/console-eval-global.html:
* inspector/console/console-format-collections-expected.txt:
* inspector/console/console-format-collections.html:
* inspector/console/console-format-expected.txt:
* inspector/console/console-format.html:
* inspector/console/console-log-document-proto-expected.txt:
* inspector/console/console-log-document-proto.html:
* inspector/console/console-log-toString-object-expected.txt:
* inspector/debugger/watch-expressions-panel-switch-expected.txt:
* inspector/elements/event-listener-sidebar-expected.txt:
* inspector/elements/event-listeners-about-blank-expected.txt:
* platform/chromium/inspector/console/console-dir-expected.txt:
* platform/chromium/inspector/console/console-eval-global-expected.txt: Copied from LayoutTests/inspector/console/console-eval-global-expected.txt.
* platform/chromium/inspector/console/console-format-collections-expected.txt:
* platform/chromium/inspector/console/console-format-expected.txt: Copied from LayoutTests/inspector/console/console-format-expected.txt.
* platform/chromium/inspector/console/console-log-document-proto-expected.txt:
* platform/chromium/inspector/debugger/watch-expressions-panel-switch-expected.txt:
* platform/chromium/inspector/elements/event-listener-sidebar-expected.txt: Copied from LayoutTests/inspector/elements/event-listener-sidebar-expected.txt.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make the Silverlight CAOpenGLLayer opaque if we know the plug-in contents is opaque to reduce blending
https://bugs.webkit.org/show_bug.cgi?id=93508
<rdar://problem/12056765>

Reviewed by Simon Fraser.

* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::determineQuirks):
* Shared/Plugins/PluginQuirks.h:
Rename the MakeTransparentIfBackgroundAttributeExists quirk to MakeOpaqueUnlessTransparentSilverlightBackgroundAttributeExists
since we'll explicitly check for opaque background colors (at least one opaque background color for now), instead of just making the
plug-in transparent whenever there's a background specified.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::isTransparentSilverlightBackgroundValue):
Helper function for determining if a background value is transparent. Just check for opaque black now and treat everything else as transparent.

(WebKit::NetscapePlugin::initialize):
Call isTransparentSilverlightBackgroundValue.

* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::makeCGLPresentLayerOpaque):
Helper function for grabbing the CGLPresentLayer from the layer hierarchy and setting it to be opaque.

(WebKit::NetscapePlugin::updatePluginLayer):
Call makeCGLPresentLayerOpaque if the plug-in has the MakeOpaqueUnlessTransparentSilverlightBackgroundAttributeExists quirk and
the plug-in is not transparent.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add MountainLion WebKit Bots.
https://bugs.webkit.org/show_bug.cgi?id=93417

Patch by Josh Hawn <jhawn@apple.com> on 2012-08-08
Reviewed by Stephanie Lewis.

Mountain Lion is now available, so we've added the appropriate Apple bots,
mirroring the configuration of the Lion bots.

* BuildSlaveSupport/build.webkit.org-config/config.json:
Added 10 "apple-mini-###" slaves.
Added MountainLion Builders and Schedulers.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Implement about:memory-live
https://bugs.webkit.org/show_bug.cgi?id=93153

Reviewed by Yong Li.
Patch by Jacky Jiang  <zhajiang@rim.com>

Implementing about:memory-live to track memory peaks:
- about:memory-live/start: start tracking memory peaks.
- about:memory-live: show memory peaks every 30ms.
- about:memory-live/stop: stop tracking and show memory peaks.

Mainly track the following memory peaks:
- Total used memory (malloc + JSC).
- Total committed memory.
- Total mapped memory.

Add total committed memory for about:memory

* WebKitSupport/AboutData.cpp:
(BlackBerry::WebKit::memoryPage):
(WebKit):
(MemoryTracker):
(BlackBerry::WebKit::MemoryTracker::isActive):
(BlackBerry::WebKit::MemoryTracker::clear):
(BlackBerry::WebKit::MemoryTracker::peakTotalUsedMemory):
(BlackBerry::WebKit::MemoryTracker::peakTotalCommittedMemory):
(BlackBerry::WebKit::MemoryTracker::peakTotalMappedMemory):
(BlackBerry::WebKit::MemoryTracker::MemoryTracker):
(BlackBerry::WebKit::MemoryTracker::instance):
(BlackBerry::WebKit::MemoryTracker::start):
(BlackBerry::WebKit::MemoryTracker::stop):
(BlackBerry::WebKit::MemoryTracker::updateMemoryPeaks):
(BlackBerry::WebKit::memoryPeaksToHtmlTable):
(BlackBerry::WebKit::memoryLivePage):
(BlackBerry::WebKit::aboutData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: new enums and openCursor stub
https://bugs.webkit.org/show_bug.cgi?id=93410

Patch by Alec Flett <alecflett@chromium.org> on 2012-08-08
Reviewed by Adam Barth.

Source/WebCore:

Introduce a new TaskType enum that will be used to prioritize
internal tasks. This is preliminary staging for
https://bugs.webkit.org/show_bug.cgi?id=91125.

No new tests, coming in bug 91125.

* Modules/indexeddb/IDBTransactionBackendInterface.h:

Source/WebKit/chromium:

This stubs out the TaskType and Direction enums that will be
required to land the chromium side of
https://bugs.webkit.org/show_bug.cgi?id=91125.

* public/WebIDBCursor.h:
* public/WebIDBObjectStore.h:
(WebKit::WebIDBObjectStore::setIndexKeys):
(WebKit::WebIDBObjectStore::setIndexesReady):
(WebIDBObjectStore):
(WebKit::WebIDBObjectStore::openCursor):
* public/WebIDBTransaction.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r124710-r124713): media/video-seek-past-end-paused.html failing on Apple Lion Debug WK1 (Tests)
https://bugs.webkit.org/show_bug.cgi?id=93394

Unreviewed. Adding the correct results for failing tests on Mac.

* platform/mac/media/video-seek-past-end-paused-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125085 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=93393
Overflow regions sometimes repaint incorrectly after going into or 
coming out of compositing mode
-and corresponding-
<rdar://problem/12006463>

Reviewed by Simon Fraser.

Source/WebCore: 

New RenderLayer function computeRepaintRectsIncludingDescendants()
* rendering/RenderLayer.cpp:
(WebCore):
(WebCore::RenderLayer::computeRepaintRectsIncludingDescendants):
* rendering/RenderLayer.h:
(RenderLayer):

It is not sufficient to compute repaint rects just for the current 
layer when compositing changes. They must be recomputed for all 
descendant layers as well.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):

LayoutTests: 

* compositing/repaint/newly-composited-on-scroll.html: Added.
* platform/mac/compositing/repaint/newly-composited-on-scroll-expected.png: Added.
* platform/mac/compositing/repaint/newly-composited-on-scroll-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Only use public Platform API in NonCompositedContentHost
https://bugs.webkit.org/show_bug.cgi?id=93423

Reviewed by Adrienne Walker.

Source/Platform:

Adds setters to control text antialiasing and checkerboarding behavior for content layers.

* chromium/public/WebContentLayer.h:
(WebContentLayer):

Source/WebCore:

This renames the "NonCompositedContentHost" flag to "useLCDText", which is the primary purpose of the flag. We
also use this flag to control whether we have border texels or not on the "root" layer, but I can't think of a
clean name that encapsulates both behaviors.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setUseLCDText):
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/LayerChromium.h:
(LayerChromium):
(WebCore::LayerChromium::useLCDText):
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::setUseLCDText):
* platform/graphics/chromium/TiledLayerChromium.h:
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::setUseLCDText):
(WebCore::CCLayerImpl::useLCDText):
(CCLayerImpl):

Source/WebKit/chromium:

Switches to using Web*Layer APIs in NonCompositedContentHost instead of reaching in to the LayerChromium and
updates unit tests for the nonCompositedContent->useLCDText flag rename.

* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::NonCompositedContentHost):
* src/WebContentLayer.cpp:
(WebKit::WebContentLayer::setUseLCDText):
(WebKit):
(WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles):
* src/WebViewImpl.cpp:
* tests/CCLayerImplTest.cpp:
(WebCore::TEST):
* tests/CCLayerTreeHostImplTest.cpp:
* tests/LayerChromiumTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Calling internals from the performance test runner prevents manual running
https://bugs.webkit.org/show_bug.cgi?id=93527

Reviewed by Ryosuke Niwa.

Since r125065, it is impossible to run the Performance tests manually. The problem is
"internals" is not defined when running outside the test runner, so the whole script
evaluation fails.

* resources/runner.js: Verify is window.internals is available before invoking something on it.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=92275
Need a way to get a snapshot image that does not show the selection
-and corresponding-
<rdar://problem/11956802>

Reviewed by Anders Carlsson.

../WebCore: 

New function FrameView::paintContentsForSnapshot() has the option to 
exclude selection from the snapshot.

Export new function
* WebCore.exp.in:

Clear the selection from the RenderView when selection is to be excluded. Restore 
all of this information via FrameSelection::updateAppearance() after calling 
paintContents().
* page/FrameView.cpp:
(WebCore::FrameView::paintContentsForSnapshot):
(WebCore):
* page/FrameView.h:

../WebKit2: 

Added new API WKBundlePageCreateSnapshotWithOptions()

New enum SnapshotOptions tracks whether snapshots should exclude 
selection highlighting in addition to tracking whether the image is 
sharable like the original ImageOptions.
* Shared/API/c/WKImage.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::snapshotOptionsFromImageOptions):
(WebKit):
(WebKit::toSnapshotOptions):
* Shared/ImageOptions.h:

New API.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCreateSnapshotWithOptions):

These existing APIs all now call 
WebPage::scaledSnapshotWithOptions().
(WKBundlePageCreateSnapshotInViewCoordinates):
(WKBundlePageCreateSnapshotInDocumentCoordinates):
(WKBundlePageCreateScaledSnapshotInDocumentCoordinates):

This patch removes WebPage::snapshotInViewCoordinates(), 
WebPage::snapshotInDocumentCoordinates(), and 
WebPage::scaledSnapshotInDocumentCoordinates(). All of the logic is 
now consolidated into WebPage::scaledSnapshotWithOptions(). It turns 
out that we never did anything different for document coordinates 
versus view coordinates, so that complexity could just be eliminated 
outright.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::snapshotOptionsToImageOptions):
(WebKit::WebPage::scaledSnapshotWithOptions):
(WebKit):
* WebProcess/WebPage/WebPage.h:
(WebPage):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DOM4: classList should be defined on Element and not on HTMLElement
https://bugs.webkit.org/show_bug.cgi?id=93015

Reviewed by Adam Barth.

DOM4 specs that Element should have the classList WebIDL attribute. This moves the
attribute to the correct IDL file.

Source/WebCore:

Test: fast/dom/Element/class-list.html

* dom/Element.idl:
* html/HTMLElement.idl:

LayoutTests:

* fast/dom/Element/class-list-expected.txt: Added.
* fast/dom/Element/class-list.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
css3/flexbox/content-height-with-scrollbars.html failing image test on Lion and MountainLion
https://bugs.webkit.org/show_bug.cgi?id=93530

Unreviewed test expectations update.

* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium-Android] Apply all Linux layout test expectations
https://bugs.webkit.org/show_bug.cgi?id=92653

Reviewed by Adam Barth.

Tools:

* Scripts/webkitpy/layout_tests/port/chromium_android.py:
(ChromiumAndroidPort.skipped_layout_tests): Removed. Skip these tests in TestExpectations instead.

LayoutTests:

We used to let chromium_android.py replace all 'LINUX' to 'LINUX ANDROID' in test expectations on Android to automatically inherit all test expectations of chromium-linux.
As a step of upstreaming chromium-android, now we actually update TestExpectations.

In this change, 'LINUX's are replaced to 'LINUX ANDROID', *except* those:
1) already have 'ANDROID',
2) not applicable or not to be tested on Android, e.g. plugins, inspector, non-virtual gpu tests, etc. Instead we add SKIP rules for them.

* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Clean up includes in compositor unit tests
https://bugs.webkit.org/show_bug.cgi?id=93531

Reviewed by Adrienne Walker.

This removes unused includes and updates Platform API headers to use the <public/Web...> style paths.

* tests/CCAnimationTestCommon.cpp:
* tests/CCKeyframedAnimationCurveTest.cpp:
* tests/CCLayerAnimationControllerTest.cpp:
* tests/CCLayerTreeHostCommonTest.cpp:
* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest):
* tests/CCOcclusionTrackerTest.cpp:
* tests/CCTextureUpdateControllerTest.cpp:
* tests/CCThreadedTest.cpp:
* tests/FakeWebGraphicsContext3D.h:
* tests/LayerChromiumTest.cpp:
* tests/LayerRendererChromiumTest.cpp:
* tests/TiledLayerChromiumTest.cpp:
* tests/WebCompositorInputHandlerImplTest.cpp:
* tests/WebLayerTest.cpp:
* tests/WebLayerTreeViewTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rebaseline fast/box-sizing/box-sizing.html and compositing/overflow/clip-descendents.html
https://bugs.webkit.org/show_bug.cgi?id=92904

Unreviewed test expectations update. The IMAGE test was passing on Lion and Mountain Lion.

* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make isTransparentSilverlightBackgroundValue handle all the possible transparent colors
https://bugs.webkit.org/show_bug.cgi?id=93532

Reviewed by Simon Fraser.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::isTransparentSilverlightBackgroundValue):
Check for all the possible transparent colors and assume that the color is opaque otherwise.

(WebKit::NetscapePlugin::initialize):
Pass the lowercase string to isTransparentSilverlightBackgroundValue.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Updating fast/canvas/webgl/gl-teximage.html to prevent valid variations in results from causing test failures.
https://bugs.webkit.org/show_bug.cgi?id=89494

Patch by Jeff Timanus <twiz@chromium.org> on 2012-08-08
Reviewed by Adrienne Walker.

* fast/canvas/webgl/gl-teximage-expected.txt:
* fast/canvas/webgl/gl-teximage.html: Only display the actual percentage of passing pixels when outside of DRT.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: Crash when plug-in initialization fails
https://bugs.webkit.org/show_bug.cgi?id=93534
<rdar://problem/12059786>

Reviewed by Simon Fraser.

Protect the PluginProxy while calling out to functions that could cause it to be destroyed.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::didFailToCreatePluginInternal):

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