ASSERTION FAILED: m_heap->vm()->currentThreadIsHoldingAPILock() in inspector-protocol/*.
<https://webkit.org/b/129364>

Reviewed by Alexey Proskuryakov.

InjectedScriptModule::ensureInjected() needs an APIEntryShim.

* inspector/InjectedScriptModule.cpp:
(Inspector::InjectedScriptModule::ensureInjected):
- Added the needed but missing APIEntryShim.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164717 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r162947): Document::topDocument() returns an incorrect reference for cached Documents
https://bugs.webkit.org/show_bug.cgi?id=128175

Reviewed by Antti Koivisto.

* dom/Document.cpp:
(WebCore::Document::topDocument): Fall back to pre-r162947 way of determining the top document
when the Document is in page cache or is in the middle of having its render tree destroyed.
In the first case, the determined top document is actually the document currently loaded in the
Frame to which the cached document is still connected, which is obviously not desired. In the
second case the top document is similarly incorrectly deduced, leading to non-deletion of the
proper top document's AXObjectCache. Because of this AccessibilityRenderObjects are not detached
which results in assertions in RenderObject destructor where the objects are found to be still
flagged as in use by the AX cache.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Check default getComputedStyle() return values for grid properties
https://bugs.webkit.org/show_bug.cgi?id=129092

Reviewed by Darin Adler.

Added checks for several CSS Grid Layout properties. According to
the specs, the ones we have implemented so far should be all of
them "auto" but grid-template-{rows|columns}, grid-auto-flow and
grid-template-areas that should be "none" by default.

* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/resources/property-names.js:
* svg/css/getComputedStyle-basic-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pipe experimental image controls menu up to WebKit2
https://bugs.webkit.org/show_bug.cgi?id=129339

Reviewed by Simon Fraser.

Source/WebCore:

Handle events for the image control, starting down the context menu code path if appropriate:
* html/shadow/mac/ImageControlsRootElementMac.cpp:
(WebCore::ImageControlsRootElementMac::defaultEventHandler):
* html/shadow/mac/ImageControlsRootElementMac.h:

Add a class to hold a HitTestResult and addition info about the current ContextMenu invocation:
* page/ContextMenuContext.cpp: Added.
(WebCore::ContextMenuContext::ContextMenuContext):
* page/ContextMenuContext.h: Added.
(WebCore::ContextMenuContext::hitTestResult):
(WebCore::ContextMenuContext::isImageControl):

Update ContextMenuController to work with ContextMenuContext instead of HitTestResult directly:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenu):
(WebCore::ContextMenuController::createContextMenu):
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::addInspectElementItem):
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
(WebCore::ContextMenuController::showImageControlsMenu):
* page/ContextMenuController.h:
(WebCore::ContextMenuController::contextMenu):
(WebCore::ContextMenuController::setContextMenuContext):
(WebCore::ContextMenuController::context):
(WebCore::ContextMenuController::hitTestResult):

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

Add a WebKit object to represent the data from a ContextMenuContext object that can be shared via IPC:
* Shared/ContextMenuContextData.cpp: Added.
(WebKit::ContextMenuContextData::ContextMenuContextData):
(WebKit::ContextMenuContextData::encode):
(WebKit::ContextMenuContextData::decode):
* Shared/ContextMenuContextData.h: Added.
(WebKit::ContextMenuContextData::webHitTestResultData):
(WebKit::ContextMenuContextData::isImageControl):

Update the rest of WK2 to use this object instead of WebHitTestResult::Data directly:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showContextMenu):
(WebKit::WebPageProxy::internalShowContextMenu): Also make an ENABLE(IMAGE_CONTROLS) change here.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::show):

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Remove some erroneously captured blocks
https://bugs.webkit.org/show_bug.cgi?id=129362

Reviewed by Sam Weinig.

Remove unused captured Objective-C block variables (capturing these doesn't work anyway).

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ENABLE_PROMISES is improperly specified as ENABLE_PROMISE in Features.pm
https://bugs.webkit.org/show_bug.cgi?id=129377

Reviewed by Csaba Osztrogonác.

* Scripts/webkitperl/FeatureList.pm: Properly specify the promises feature as ENABLE_PROMISES.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for OS X after r164720.

* page/ContextMenuContext.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix builds that don't define IMAGE_CONTROLS.

* page/ContextMenuContext.cpp:
(WebCore::ContextMenuContext::ContextMenuContext):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of WKViewIOS.mm
https://bugs.webkit.org/show_bug.cgi?id=129378

Reviewed by Simon Fraser.

* UIProcess/API/Cocoa/WKView.h:
* UIProcess/API/ios/WKViewIOS.mm: Removed.
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Create SessionID value-style class for session IDs.
https://bugs.webkit.org/show_bug.cgi?id=129141

Source/WebCore:

Patch by Martin Hock <mhock@apple.com> on 2014-02-26
Reviewed by Sam Weinig.

* GNUmakefile.list.am:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/Page.cpp: Add SessionID member.
(WebCore::Page::Page):
(WebCore::Page::sessionID): Retrieve sessionID or use settings if not set.
* page/Page.h:
(WebCore::Page::isSessionIDSet):
(WebCore::Page::setSessionID):
* page/SessionID.h: Session ID class consisting solely of its uint64_t session ID.
(WebCore::SessionID::SessionID):
(WebCore::SessionID::isValid): Not empty.
(WebCore::SessionID::isEphemeral):
(WebCore::SessionID::sessionID):
(WebCore::SessionID::operator==): Value-based equality.
(WebCore::SessionID::operator!=):
(WebCore::SessionID::emptySessionID): Zero value also used for HashTraits emptyValue.
(WebCore::SessionID::defaultSessionID):
(WebCore::SessionID::legacyPrivateSessionID):
* page/SessionIDHash.h:
(WTF::SessionIDHash::hash): Just the casted session ID (low order bytes)
(WTF::SessionIDHash::equal):
(WTF::HashTraits<WebCore::SessionID>::emptyValue): Equal to emptySessionID.
(WTF::HashTraits<WebCore::SessionID>::constructDeletedValue): -1 value.
(WTF::HashTraits<WebCore::SessionID>::isDeletedValue):

Source/WebKit2:

The below changes deal solely with mechanical changes to use the SessionID value class instead of uint64_t except where noted.

Patch by Martin Hock <mhock@apple.com> on 2014-02-26
Reviewed by Sam Weinig.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::storageSession):
(WebKit::NetworkConnectionToWebProcess::startDownload):
(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
(WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
(WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
(WebKit::NetworkConnectionToWebProcess::getRawCookies):
(WebKit::NetworkConnectionToWebProcess::deleteCookie):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::ensurePrivateBrowsingSession):
(WebKit::NetworkProcess::destroyPrivateBrowsingSession):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/RemoteNetworkingContext.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
* NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
* Shared/Network/NetworkResourceLoadParameters.h:
* Shared/SessionTracker.cpp:
(WebKit::staticSessionMap):
(WebKit::storageSessionToID):
(WebKit::SessionTracker::sessionMap):
(WebKit::SessionTracker::session):
(WebKit::SessionTracker::sessionID):
(WebKit::SessionTracker::setSession):
(WebKit::SessionTracker::destroySession):
* Shared/SessionTracker.h: Move code to SessionID class.
* Shared/WebCoreArgumentCoders.cpp: Add encode and decode for SessionID.
(IPC::ArgumentCoder<SessionID>::encode):
(IPC::ArgumentCoder<SessionID>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/CookieStorageShim.mm:
(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
* UIProcess/APISession.cpp:
(API::generateID):
(API::Session::defaultSession):
(API::Session::legacyPrivateSession):
(API::Session::Session):
(API::Session::isEphemeral):
(API::Session::getID):
* UIProcess/APISession.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setAnyPageGroupMightHavePrivateBrowsingEnabled):
(WebKit::WebContext::createNewWebProcess):
* UIProcess/WebContext.h:
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::sessionID):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::loadResourceSynchronously):
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::storageSession):
* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::storageSession):
* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
* WebProcess/WebPage/WebPage.cpp: Move sessionID to Page to allow WebCore to access it.
(WebKit::WebPage::WebPage):
(WebKit::WebPage::sessionID):
(WebKit::WebPage::isUsingEphemeralSession):
(WebKit::WebPage::setSessionID):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensurePrivateBrowsingSession):
(WebKit::WebProcess::destroyPrivateBrowsingSession):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
runscript: line 42: /bin/ls: Argument list too long
https://bugs.webkit.org/show_bug.cgi?id=129376

Reviewed by Michael Saboff.

The "test_script_*" can expand to more things than can be passed as arguments on the command line.
We should use find instead, which generates the list of files rather than expanding them all on
the command line and spitting them back out.

* Scripts/jsc-stress-test-helpers/shell-runner.sh:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FastMalloc should use vm_page_shift intead of PAGE_SHIFT.
https://bugs.webkit.org/show_bug.cgi?id=129370

Reviewed by Geoff Garen.

Previously we used PAGE_SHIFT to initialize kPageShift.
Since this was a constant, it could be used to calculate other
contants used in the code. Some of these values are used in the
definition of certain data structures (specifiying the length of
some array members).

Make kPageShift & dependent properties variables setup during
initialization. Add upper bound values (K_PAGE_SHIFT_MAX,
K_NUM_CLASSES_MAX) for use in cases where we need a constant.

* wtf/FastMalloc.cpp:
(WTF::InitSizeClasses):
    - initialize kPageShift, kNumClasses, kPageSize, kMaxValidPages.
(WTF::pages):
    - added ASSERT.
(WTF::AllocationSize):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::FreeBytes):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::init):
    - COMPILE_ASSERT -> ASSERT
(WTF::TCMalloc_PageHeap::scavenge):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::Carve):
    - added ASSERT.
(WTF::mergeDecommittedStates):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::ReturnedBytes):
    - added ASSERT.
(WTF::PagesToMB):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::GrowHeap):
    - added ASSERT.
(WTF::TCMalloc_PageHeap::ReleaseFreeList):
    - kNumClasses -> K_NUM_CLASSES_MAX
(WTF::TCMalloc_ThreadCache::enumerateFreeObjects):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::Init):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::ReleaseToSpans):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::InsertRange):
    - added ASSERT.
(WTF::TCMalloc_Central_FreeList::Populate):
    - added ASSERT.
(WTF::TCMalloc_ThreadCache::Init):
    - added ASSERT.
(WTF::TCMalloc_ThreadCache::Cleanup):
    - added ASSERT.
(WTF::TCMalloc_ThreadCache::Scavenge):
    - added ASSERT.
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
    - added ASSERT.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the iOS build by wrapping some context menu stuff in #if ENABLE(CONTEXT_MENUS)

* UIProcess/WebPageProxy.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Remove console.profiles from window.console API
https://bugs.webkit.org/show_bug.cgi?id=116883

Reviewed by Timothy Hatcher.

Source/WebCore:

console.profiles has been removed or never implemented by other
browsers. We should remove it as well. However, since tests
rely on it, keep it as window.internals.consoleProfiles.

* WebCore.exp.in:
* page/Console.idl:
* testing/Internals.cpp:
(WebCore::Internals::consoleProfiles):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

LayoutTests:

* fast/profiler/resources/profiler-test-JS-resources.js:
(printHeavyProfilesDataWithoutTime):
(printProfilesDataWithoutTime):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix MiniBrowser/WebKitTestRunner link errors; WKView still
needs to be exported while these tools are using it.

* UIProcess/API/Cocoa/WKView.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Auto generate bytecode information for bytecode parser and LLInt
https://bugs.webkit.org/show_bug.cgi?id=129181

Reviewed by Mark Lam.

Source/JavaScriptCore: 

Added new bytecode/BytecodeList.json that contains a list of bytecodes and related
helpers.  It also includes bytecode length and other information used to generate files.
Added a new generator, generate-bytecode-files that generates Bytecodes.h and InitBytecodes.asm
in DerivedSources/JavaScriptCore/.

Added the generation of these files to the "DerivedSource" build step.
Slighty changed the build order, since the Bytecodes.h file is needed by
JSCLLIntOffsetsExtractor.  Moved the offline assembly to a separate step since it needs
to be run after JSCLLIntOffsetsExtractor.

Made related changes to OPCODE macros and their use.

* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.am:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.vcxproj/copy-files.cmd:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/BytecodeList.json: Added.
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* generate-bytecode-files: Added.
* llint/LLIntCLoop.cpp:
(JSC::LLInt::CLoop::initialize):
* llint/LLIntCLoop.h:
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntOpcode.h:
* llint/LowLevelInterpreter.asm:

Source/WebKit: 

Added ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} to WebKit_INCLUDE_DIRECTORIES due to new
generated Bytecodes.h include file.

* CMakeLists.txt:

Source/WebKit2: 

Added ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} to WebKit2_INCLUDE_DIRECTORIES due to new
generated Bytecodes.h include file.

* CMakeLists.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164732 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix: ContextMenuContextData.* should not be in the Copy Files
phase.

* WebKit2.xcodeproj/project.pbxproj:

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