Null deref under PluginView::handlesPageScaleFactor()
https://bugs.webkit.org/show_bug.cgi?id=119231
<rdar://problem/14440207>

Reviewed by Simon Fraser.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::handlesPageScaleFactor):
* WebProcess/Plugins/PluginView.h:
Null-check m_plugin and check m_isInitialized.
Make pageScaleFactor() and handlesPageScaleFactor const.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Moved GLContext.cpp and .h out of cairo directory to be used by non-cairo ports.
https://bugs.webkit.org/show_bug.cgi?id=119223

Reviewed by Kenneth Rohde Christiansen.

* GNUmakefile.list.am:
* PlatformGTK.cmake:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
Changed location of GLContext.cpp and GLContext.h.
* platform/graphics/GLContext.cpp: Copied from WebCore/platform/graphics/cairo/GLContext.cpp.
* platform/graphics/GLContext.h: Copied from WebCore/platform/graphics/cairo/GLContext.h.
* platform/graphics/cairo/GLContext.cpp: Removed.
* platform/graphics/cairo/GLContext.h: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Page count can be incorrect if there is a pending style recalc
https://bugs.webkit.org/show_bug.cgi?id=119232

Reviewed by Beth Dakin.

If style is changed in a way that schedules a style recalc on the Document,
and then Page::pageCount() is called, we may give the wrong answer because
the existing code only checked FrameView::needsLayout(), not whether a style
recale was pending.

Fix by having Page::pageCount() call updateLayoutIgnorePendingStylesheets()
as we do for other properties that require layer, and are exposed to JS
or via API.

* page/Page.cpp:
(WebCore::Page::pageCount):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Some cleanup in PropertySlot
https://bugs.webkit.org/show_bug.cgi?id=119189

Reviewed by Geoff Garen.

PropertySlot represents a property in one of four states - value, getter, custom, or custom-index.
The state is currently tracked redundantly by two mechanisms - the custom getter function (m_getValue)
is set to a special value to indicate the type (other than custom), and the type is also tracked by
an enum - but only if cacheable. Cacheability can typically be determined by the value of m_offset
(this is invalidOffset if not cacheable).

    * Internally, always track the type of the property using an enum value, PropertyType.
    * Use m_offset to indicate cacheable.
    * Keep the external interface (CachedPropertyType) unchanged.
    * Better pack data into the m_data union.

Performance neutral.

* dfg/DFGRepatch.cpp:
(JSC::DFG::tryCacheGetByID):
(JSC::DFG::tryBuildGetByIDList):
    - cachedPropertyType() -> isCacheable*()
* jit/JITPropertyAccess.cpp:
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):
    - cachedPropertyType() -> isCacheable*()
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):
    - cachedPropertyType() -> isCacheable*()
* jit/JITStubs.cpp:
(JSC::tryCacheGetByID):
    - cachedPropertyType() -> isCacheable*()
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
    - cachedPropertyType() -> isCacheable*()
* runtime/PropertySlot.cpp:
(JSC::PropertySlot::functionGetter):
    - refactoring described above.
* runtime/PropertySlot.h:
(JSC::PropertySlot::PropertySlot):
(JSC::PropertySlot::getValue):
(JSC::PropertySlot::isCacheable):
(JSC::PropertySlot::isCacheableValue):
(JSC::PropertySlot::isCacheableGetter):
(JSC::PropertySlot::isCacheableCustom):
(JSC::PropertySlot::cachedOffset):
(JSC::PropertySlot::customGetter):
(JSC::PropertySlot::setValue):
(JSC::PropertySlot::setCustom):
(JSC::PropertySlot::setCacheableCustom):
(JSC::PropertySlot::setCustomIndex):
(JSC::PropertySlot::setGetterSlot):
(JSC::PropertySlot::setCacheableGetterSlot):
(JSC::PropertySlot::setUndefined):
(JSC::PropertySlot::slotBase):
(JSC::PropertySlot::setBase):
    - refactoring described above.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/14528244> Tons of FastMalloc leaks reported by leaks of objects that have already been deallocated

Reviewed by Sam Weinig.

* wtf/FastMalloc.cpp:
(WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Mark objects in the transfer cache as being free.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Gtk] Improve string use in PasteboardGtk
https://bugs.webkit.org/show_bug.cgi?id=119204

Reviewed by Martin Robinson.

Use emptyString() instead of "" and use ASCIILiteral where appropriate.

No behavior change, no new tests needed.

* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::documentFragment):
Use emptyString() instead of "".
(WebCore::Pasteboard::types):
Use ASCIILiteral where appropriate.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Eager stack trace for error objects.
https://bugs.webkit.org/show_bug.cgi?id=118918

Source/JavaScriptCore:

Patch by Chris Curtis <chris_curtis@apple.com> on 2013-07-29
Reviewed by Geoffrey Garen.

Chrome and Firefox give error objects the stack property and we wanted to match
that functionality. This allows developers to see the stack without throwing an object.

* runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::finishCreation):
 For error objects that are not thrown as an exception, we pass the stackTrace in
 as a parameter. This allows the error object to have the stack property.

* interpreter/Interpreter.cpp:
(JSC::stackTraceAsString):
Helper function used to eliminate duplicate code.

(JSC::Interpreter::addStackTraceIfNecessary):
When an error object is created by the user the vm->exceptionStack is not set.
If the user throws this error object later the stack that is in the error object
may not be the correct stack for the throw, so when we set the vm->exception stack,
the stack property on the error object is set as well.

* runtime/ErrorConstructor.cpp:
(JSC::constructWithErrorConstructor):
(JSC::callErrorConstructor):
* runtime/NativeErrorConstructor.cpp:
(JSC::constructWithNativeErrorConstructor):
(JSC::callNativeErrorConstructor):
These functions indicate that the user created an error object. For all error objects
that the user explicitly creates, the topCallFrame is at a new frame created to
handle the user's call. In this case though, the error object needs the caller's
frame to create the stack trace correctly.

* interpreter/Interpreter.h:
* runtime/ErrorInstance.h:
(JSC::ErrorInstance::create):

LayoutTests:

Patch by Chris Curtis <chris_curtis@apple.com> on 2013-07-29
Reviewed by Geoffrey Garen.

Added tests to ensure that the stack property was present at creation for all
error Objects. This test will fail without this patch.

* fast/js/script-tests/stack-at-creation-for-error-objects.js: Added.
(checkStack):
* fast/js/stack-at-creation-for-error-objects-expected.txt: Added.
* fast/js/stack-at-creation-for-error-objects.html: Added.

* inspector/console/console-format-expected.txt:
* inspector/console/console-format.html:
This test was modified by removing the error object from being evaluated. Prior to this patch
error objects did not have the stack property, so the stack information was not being
displayed. The stack trace includes a file path specific to the machine that is running
the test. The results would have differed from one computer to the next. There
is not an easy way to capture the error object to treat it differently. By removing
the error object there is no need to add extra code to treat it differently.
Also there are other tests inside inspector/console that test the  stack trace,
so the testing suite does not lose error testing by removing it.

The .stack property was added to the error objects at creation time.
* fast/js/exception-properties-expected.txt:
* fast/js/script-tests/exception-properties.js:

The column numbers are modified in the following test. When error objects are explicitly
invoked, the column number points to the beginning "(" instead of end ")".
Functionality between browsers do not match either. Firefox does not output column
numbers. Chrome points columns numbers to the beginning of the "new" call.

* fast/js/line-column-numbers-expected.txt:
* fast/js/stack-trace-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[wk2] Flush the WebProcess’ implicit transaction when using endDeferringViewInWindowChangesSync
https://bugs.webkit.org/show_bug.cgi?id=119225
<rdar://problem/14568841>

Reviewed by Simon Fraser.

Tell CoreAnimation to flush the implicit transaction before replying
when using endDeferringViewInWindowChangesSync, as that method's contract
is that the WebProcess is totally ready to be in-window when it returns.

* UIProcess/API/mac/WKView.mm:
(-[WKView endDeferringViewInWindowChanges]):
Adopt viewInWindowStateDidChange.

(-[WKView endDeferringViewInWindowChangesSync]):
Adopt viewInWindowStateDidChange, asking it to send a reply only if we're going to wait for one.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewInWindowStateDidChange):
(WebKit::WebPageProxy::viewStateDidChange):
Pull viewInWindowStateDidChange out of viewStateDidChange.
Request a reply from SetIsInWindow if we're told to.

* UIProcess/WebPageProxy.h: Add WantsReplyOrNot and viewInWindowStateDidChange.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didUpdateInWindowStateTimerFired):
Don't build this version on Mac, we'll have a WebPageMac version.

(WebKit::WebPage::setIsInWindow):
Only start the timer to send the didUpdateInWindowState reply if we're asked to.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Add an argument to the SetIsInWindow message for whether the WebProcess
should inform the UIProcess when SetIsInWindow completes or not.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::didUpdateInWindowStateTimerFired):
Tell CA to flush the implicit transaction before telling the UIProcess that
we're finished moving in-window.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Fix make distcheck.

Source/JavaScriptCore:

* GNUmakefile.list.am: Add missing files to compilation.
* bytecode/CodeBlock.cpp: Add a ENABLE(FTL_JIT) #if block to
include FTL header files not included in the compilation.
* dfg/DFGDriver.cpp: Ditto.
* dfg/DFGPlan.cpp: Ditto.

Source/ThirdParty/ANGLE:

* GNUmakefile.am: Add missing header files to compilation.

Source/WebCore:

* GNUmakefile.list.am: Add missing header file to compilation.

Source/WebKit2:

* GNUmakefile.list.am: Add missing header file to compilation.

Source/WTF:

* GNUmakefile.list.am: Add missing files to compilation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESION(r151091) ASSERTION FAILED: m_readableData || m_writableData
https://bugs.webkit.org/show_bug.cgi?id=119142

Reviewed by Jocelyn Turcotte.

Remove invalid assert.

Covered by existing tests.

* platform/qt/PasteboardQt.cpp:
(WebCore::Pasteboard::readData):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: iframes with composited contents are not transparent in WK1
https://bugs.webkit.org/show_bug.cgi?id=76478

Unskip these tests since the root cause has been fixed long ago already.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Mark compositing/patterns tests as passing for mac-wk2
https://bugs.webkit.org/show_bug.cgi?id=119246

These tests run fine on WK2.

* platform/mac-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][Win] Extend disabling of whole-program-optimizations to MSVC 2012
https://bugs.webkit.org/show_bug.cgi?id=119238

Reviewed by Jocelyn Turcotte.

As suggested in https://bugreports.qt-project.org/browse/QTBUG-20556,
the WebKit build with MSVC 2012 is affected by the same size
limitations.

* WebCore.pri:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] can-read-in-dragstart-event.html and can-read-in-copy-and-cut-events.html fail
https://bugs.webkit.org/show_bug.cgi?id=113094

The test can-read-in-copy-and-cut-events.html now passes on mac-wk2.

* platform/mac/TestExpectations:

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