Allow the QuickTime plug-in to be replaced by script in an isolated word
https://bugs.webkit.org/show_bug.cgi?id=124900

Reviewed by Dean Jackson.

Source/WebCore: 

Test: plugins/quicktime-plugin-replacement.html

* CMakeLists.txt: Add new Modules path.
* DerivedSources.make: Add new files.
* GNUmakefile.am: Add new Modules path.
* GNUmakefile.list.am: Add new header.
* WebCore.vcxproj/WebCore.vcxproj: Add new header.
* WebCore.vcxproj/WebCoreCommon.props: Add new Modules path.
* WebCore.xcodeproj/project.pbxproj: Add new files.

* Modules/plugins: Added.
* Modules/plugins/PluginReplacement.h: Added. Defines the interface for a plug-in replacement.

Create a replacement for the QuickTime plug-in.
* Modules/plugins/QuickTimePluginReplacement.cpp: Added.
* Modules/plugins/QuickTimePluginReplacement.css: Added.
* Modules/plugins/QuickTimePluginReplacement.h: Added.
* Modules/plugins/QuickTimePluginReplacement.idl: Added.
* Modules/plugins/QuickTimePluginReplacement.js: Added.

Allow plug-in replacement to be enabled at runtime.
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setPluginReplacementEnabled):
(WebCore::RuntimeEnabledFeatures::pluginReplacementEnabled):

* bindings/js/JSDOMBinding.h:
(WebCore::toJS): Add toJS(... const String& ...).

* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginScriptObject): Give a plug-in replacement a first shot at defining the
    script interface.

* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget): Call base class requestObject.

* html/HTMLMediaElement.cpp:
(HTMLMediaElement::fileSize): New, passthrough to media engine.
* html/HTMLMediaElement.h:

* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget): Call base class requestObject.

Moved some logic that was previously used only for creating a plug-in snapshot to the base
class so it can be shared by a plug-in replacement.
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::HTMLPlugInElement): Initialize timer used to swap renderers.
(WebCore::HTMLPlugInElement::createRenderer): Allow plug-in replacement to create the renderer.
(WebCore::HTMLPlugInElement::swapRendererTimerFired): Create a shadow root.
(WebCore::HTMLPlugInElement::setDisplayState): Set the new state, prime the swap renderer 
    timer if necessary.
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Tell the plug-in replacement to
    install itself in the new shadow DOM.
(WebCore::registeredPluginReplacements): Return vector of all registered plug-in replacements.
(WebCore::registerPluginReplacement): Add a plug-in replacement.
(WebCore::pluginReplacementForType): Find a plug-in replacement for a MIME type.
(WebCore::HTMLPlugInElement::requestObject): If there is a plug-in replacement for the MIME type,
    create it and set the display state.
(WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Return the script object for 
    the current plug-in replacement, if any.
* html/HTMLPlugInElement.h:

Move some plug-in snapshot code into the base class.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): No need to initialize timer.
(WebCore::HTMLPlugInImageElement::setDisplayState): Call base class.
(WebCore::HTMLPlugInImageElement::createRenderer): Ditto.
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Ditto.
(WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Remove unnecessary class name.
(WebCore::HTMLPlugInImageElement::requestObject): New.
* html/HTMLPlugInImageElement.h:

* html/HTMLVideoElement.h: Make createRenderer public so the QuickTime plug-in replacement can
    call it.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::fileSize): New.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost): totalBytes returns an unsigned long long.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::fileSize):

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::totalBytes): Return an unsigned long long.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::totalBytes): Ditto.

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): Backup the plug-in replacement runtime setting.
(WebCore::InternalSettings::Backup::restoreTo): Restore it.
(WebCore::InternalSettings::setPluginReplacementEnabled): Set it.
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

LayoutTests: 

* platform/efl/TestExpectations: Skip the new test.
* platform/gtk/TestExpectations: Ditto.
* platform/wincairo/TestExpectations: Ditto.
* plugins/quicktime-plugin-replacement.html: Added.
* plugins/quicktime-plugin-replacement-expected.txt: Added.
* plugins/resources/orange.mov: Replace movie compressed with ancient (and deprecated) 
    animated gif codec with one compressed with H.264 codec.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] The remote inspector does not show the base page.
https://bugs.webkit.org/show_bug.cgi?id=124942

Patch by László Langó <lango@inf.u-szeged.hu> on 2013-11-27
Reviewed by Gyuyoung Kim.

On EFL the remote inspector does not show the base page about
which pages are available for debug. This should be fixed for
further inspector development.

* Source/PlatformEfl.cmake:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make WKProcessGroup work with WKObject wrapping
https://bugs.webkit.org/show_bug.cgi?id=124952

Reviewed by Dan Bernstein.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
Add support for WKProcessGroup.

* UIProcess/API/mac/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
(-[WKProcessGroup dealloc]):
(-[WKProcessGroup API::]):
(-[WKProcessGroup _contextRef]):
(-[WKProcessGroup _geolocationProvider]):
Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline

* UIProcess/API/mac/WKProcessGroupInternal.h: Added.
(WebKit::wrapper):
Add wrapper() helper and declare conformance to the WKObject protocol.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::create):
(WebKit::WebContext::WebContext):
* UIProcess/WebContext.h:
Make the WebContext constructor public (for use with Object::constructInWrapper) and remove unused ProcessModel parameter.

* WebKit2.xcodeproj/project.pbxproj:
Add new file.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add accessors for the WKProcessGroup and WKBrowsingContextGroup on the WKBrowsingContextController
https://bugs.webkit.org/show_bug.cgi?id=124953

Reviewed by Dan Bernstein.

* UIProcess/API/mac/WKBrowsingContextController.h:
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController processGroup]):
(-[WKBrowsingContextController browsingContextGroup]):
Add accessors.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the iOS build.

../WebKit: 

* WebKit.xcodeproj/project.pbxproj:

../WebKit/mac: 

* WebView/WebAllowDenyPolicyListener.h: Added.
* WebView/WebUIDelegatePrivate.h:
Move the WebAllowDenyPolicyListener protocol to its own file.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the iOS build.

* UIProcess/API/ios/WKGeolocationProviderIOS.mm:
* UIProcess/API/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Give the PageClient a chance to handle geolocation permission requests if the UIClient doesn't handle it
https://bugs.webkit.org/show_bug.cgi?id=124955

Reviewed by Dan Bernstein.

Use the new PageClient function to remove the need for WKContentView to take over the WKPageUIClient.

* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
(-[WKContentView _commonInitWithProcessGroup:browsingContextGroup:]):
* UIProcess/API/ios/WKContentViewInternal.h:
* UIProcess/PageClient.h:
(WebKit::PageClient::decidePolicyForGeolocationPermissionRequest):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Infer one-time scopes
https://bugs.webkit.org/show_bug.cgi?id=124812

Source/JavaScriptCore: 

Reviewed by Oliver Hunt.
        
This detects JSActivations that are created only once. The JSActivation pointer is then
baked into the machine code.
        
This takes advantage of the one-time scope inference to reduce the number of
indirections needed to get to a closure variable in case where the scope is only
allocated once. This isn't really a speed-up since in the common case the total number
of instruction bytes needed to load the scope from the stack is about equal to the
number of instruction bytes needed to materialize the absolute address of a scoped
variable. But, this is a necessary prerequisite to
https://bugs.webkit.org/show_bug.cgi?id=124630, so it's probably a good idea anyway.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finalizeUnconditionally):
* bytecode/Instruction.h:
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* bytecode/Watchpoint.h:
(JSC::WatchpointSet::notifyWrite):
(JSC::InlineWatchpointSet::notifyWrite):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitResolveScope):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::scopedVarLoadElimination):
(JSC::DFG::CSEPhase::scopedVarStoreElimination):
(JSC::DFG::CSEPhase::getLocalLoadElimination):
(JSC::DFG::CSEPhase::setLocalStoreElimination):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::tryGetRegisters):
* dfg/DFGGraph.h:
* dfg/DFGNode.h:
(JSC::DFG::Node::varNumber):
(JSC::DFG::Node::hasSymbolTable):
(JSC::DFG::Node::symbolTable):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGWatchpointCollectionPhase.cpp:
(JSC::DFG::WatchpointCollectionPhase::handle):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileGetClosureRegisters):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSActivation.h:
(JSC::JSActivation::create):
* runtime/JSScope.cpp:
(JSC::abstractAccess):
(JSC::JSScope::abstractResolve):
* runtime/JSScope.h:
(JSC::ResolveOp::ResolveOp):
* runtime/JSVariableObject.h:
(JSC::JSVariableObject::registers):
* runtime/SymbolTable.cpp:
(JSC::SymbolTable::SymbolTable):
* runtime/SymbolTable.h:

LayoutTests: 

Reviewed by Oliver Hunt.

* js/regress/infer-one-time-closure-expected.txt: Added.
* js/regress/infer-one-time-closure-ten-vars-expected.txt: Added.
* js/regress/infer-one-time-closure-ten-vars.html: Added.
* js/regress/infer-one-time-closure-two-vars-expected.txt: Added.
* js/regress/infer-one-time-closure-two-vars.html: Added.
* js/regress/infer-one-time-closure.html: Added.
* js/regress/infer-one-time-deep-closure-expected.txt: Added.
* js/regress/infer-one-time-deep-closure.html: Added.
* js/regress/script-tests/infer-one-time-closure-ten-vars.js: Added.
* js/regress/script-tests/infer-one-time-closure-two-vars.js: Added.
* js/regress/script-tests/infer-one-time-closure.js: Added.
* js/regress/script-tests/infer-one-time-deep-closure.js: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a bunch of early exits and local optimizations to the x86 assembler.
https://bugs.webkit.org/show_bug.cgi?id=124904

Reviewed by Filip Pizlo.

* assembler/MacroAssemblerX86.h:
(JSC::MacroAssemblerX86::add32):
(JSC::MacroAssemblerX86::add64):
(JSC::MacroAssemblerX86::or32):
* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::add32):
(JSC::MacroAssemblerX86Common::or32):
* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::add32):
(JSC::MacroAssemblerX86_64::or32):
(JSC::MacroAssemblerX86_64::add64):
(JSC::MacroAssemblerX86_64::or64):
(JSC::MacroAssemblerX86_64::xor64):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Typo fix after r159834 to fix 32 bit builds.

Patch by Peter Gal <galpeter@inf.u-szeged.hu> on 2013-11-28
Reviewed by Csaba Osztrogonác.

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Support custom types for drag and drop data
https://bugs.webkit.org/show_bug.cgi?id=124659

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2013-11-27
Reviewed by Martin Robinson.

Source/WebCore:

Covered by fast/events/drag-customData.html.

* platform/gtk/DataObjectGtk.cpp:
(WebCore::DataObjectGtk::unknownTypes): returns a hash map with all custom types set.
(WebCore::DataObjectGtk::clearAllExceptFilenames): clear custom types.
* platform/gtk/DataObjectGtk.h:
(WebCore::DataObjectGtk::hasUnknownTypeData): returns whether custom types are set.
(WebCore::DataObjectGtk::unknownTypeData): returns the data for a custom type.
(WebCore::DataObjectGtk::setUnknownTypeData): sets the data for a custom type.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::writeString): handle unknown types as custom.
(WebCore::Pasteboard::writePasteboard): ditto.
(WebCore::Pasteboard::hasData): also check for custom types.
(WebCore::Pasteboard::types): also obtain the list of custom types.
(WebCore::Pasteboard::readString): handle unknown types as custom.
* platform/gtk/PasteboardHelper.cpp:
(WebCore::initGdkAtoms): new unknown atom.
(WebCore::PasteboardHelper::PasteboardHelper): add custom type to the list of targets.
(WebCore::PasteboardHelper::fillSelectionData): turns any custom types' data into a GVariant, which
is in turn serialized to a single string for GtkSelectionData to hold.
(WebCore::PasteboardHelper::targetListForDataObject): add custom data to the target list if any is
set.
(WebCore::PasteboardHelper::fillDataObjectFromDropData): retrieve the custom types and their data
from the serialized GVariant string held by GtkSelectionData.
(WebCore::PasteboardHelper::dropAtomsForContext): handle custom types.

Source/WebKit2:

* Shared/gtk/ArgumentCodersGtk.cpp:
(CoreIPC::encodeDataObject): encode the unknown types data.
(CoreIPC::decodeDataObject): decode the unknown types data.

LayoutTests:

* platform/gtk/TestExpectations: remove failure expectation for test that now passes.

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