[WK2] Authentication dialog is displayed for cross-origin XHR
https://bugs.webkit.org/show_bug.cgi?id=131349

Patch by Youenn Fablet <youenn.fablet@crf.canon.fr> on 2014-09-11
Reviewed by Alexey Proskuryakov.

Source/WebCore:

* WebCore.exp.in: Export of isAllowedToAskUserForCredentials.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::isAllowedToAskUserForCredentials): Replacing clientCredentialPolicy method. Returns true if credentials can be requested to the user.
(WebCore::ResourceLoader::didReceiveAuthenticationChallenge): Updated to use isAllowedToAskUserForCredentials.
* loader/ResourceLoader.h: Removing clientCredentialPolicy method and adding isAllowedToAskUserForCredentials method.

Source/WebKit2:

Precomputing client credential policy in the Web Process before sending the resource load task to the Network Process.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveAuthenticationChallenge): Added an ASSERT to ensure that credential policy is never set to DoNotAskClientForCrossOriginCredentials.
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad): Precomputing client credential policy to handle the case of cross-origin requests.
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest): Added a TODO to check whether redirections need a specific handling.

LayoutTests:

* platform/mac-wk2/TestExpectations: Unskipped tests.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173516 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename activation to be more in line with spec language
https://bugs.webkit.org/show_bug.cgi?id=136721

Reviewed by Michael Saboff.

Somewhat bigger than the last one, but still just a rename.

* CMakeLists.txt:
* JavaScriptCore.order:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CallVariant.h:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::isCaptured):
(JSC::CodeBlock::nameForRegister):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setActivationRegister):
(JSC::CodeBlock::activationRegister):
(JSC::CodeBlock::uncheckedActivationRegister):
(JSC::CodeBlock::needsActivation):
* bytecode/Instruction.h:
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::setActivationRegister):
(JSC::UnlinkedCodeBlock::activationRegister):
(JSC::UnlinkedCodeBlock::hasActivationRegister):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitReturn):
* bytecompiler/BytecodeGenerator.h:
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::scope):
* debugger/DebuggerScope.cpp:
(JSC::DebuggerScope::isFunctionOrEvalScope):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::tryGetActivation):
(JSC::DFG::Graph::tryGetRegisters):
* dfg/DFGGraph.h:
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::lexicalEnvironment):
(JSC::CallFrame::setActivation):
(JSC::CallFrame::activation): Deleted.
* interpreter/CallFrame.h:
* interpreter/Interpreter.cpp:
(JSC::unwindCallFrame):
* interpreter/Register.h:
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_tear_off_lexical_environment):
(JSC::JIT::emit_op_tear_off_arguments):
(JSC::JIT::emit_op_create_lexical_environment):
(JSC::JIT::emit_op_tear_off_activation): Deleted.
(JSC::JIT::emit_op_create_activation): Deleted.
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_tear_off_lexical_environment):
(JSC::JIT::emit_op_tear_off_arguments):
(JSC::JIT::emit_op_create_lexical_environment):
(JSC::JIT::emit_op_tear_off_activation): Deleted.
(JSC::JIT::emit_op_create_activation): Deleted.
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/Arguments.cpp:
(JSC::Arguments::visitChildren):
(JSC::Arguments::tearOff):
(JSC::Arguments::didTearOffActivation):
* runtime/Arguments.h:
(JSC::Arguments::offsetOfActivation):
(JSC::Arguments::argument):
(JSC::Arguments::finishCreation):
* runtime/CommonSlowPaths.cpp:
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::activationStructure):
* runtime/JSLexicalEnvironment.cpp: Renamed from Source/JavaScriptCore/runtime/JSActivation.cpp.
(JSC::JSLexicalEnvironment::visitChildren):
(JSC::JSLexicalEnvironment::symbolTableGet):
(JSC::JSLexicalEnvironment::symbolTablePut):
(JSC::JSLexicalEnvironment::getOwnNonIndexPropertyNames):
(JSC::JSLexicalEnvironment::symbolTablePutWithAttributes):
(JSC::JSLexicalEnvironment::getOwnPropertySlot):
(JSC::JSLexicalEnvironment::put):
(JSC::JSLexicalEnvironment::deleteProperty):
(JSC::JSLexicalEnvironment::toThis):
(JSC::JSLexicalEnvironment::argumentsGetter):
* runtime/JSLexicalEnvironment.h: Renamed from Source/JavaScriptCore/runtime/JSActivation.h.
(JSC::JSLexicalEnvironment::create):
(JSC::JSLexicalEnvironment::createStructure):
(JSC::JSLexicalEnvironment::JSLexicalEnvironment):
(JSC::asActivation):
(JSC::Register::lexicalEnvironment):
(JSC::JSLexicalEnvironment::registersOffset):
(JSC::JSLexicalEnvironment::tearOff):
(JSC::JSLexicalEnvironment::isTornOff):
(JSC::JSLexicalEnvironment::storageOffset):
(JSC::JSLexicalEnvironment::storage):
(JSC::JSLexicalEnvironment::allocationSize):
(JSC::JSLexicalEnvironment::isValidIndex):
(JSC::JSLexicalEnvironment::isValid):
(JSC::JSLexicalEnvironment::registerAt):
* runtime/JSObject.h:
* runtime/JSScope.cpp:
(JSC::abstractAccess):
* runtime/JSScope.h:
(JSC::ResolveOp::ResolveOp):
* runtime/JSSymbolTableObject.cpp:
* runtime/StrictEvalActivation.h:
(JSC::StrictEvalActivation::create):
* runtime/VM.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
More unreviewed gardening. Rebaseline media/encrypted-media/encrypted-media-can-play-type.html

* platform/mac/media/encrypted-media/encrypted-media-can-play-type-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed gardening. Rebaseline tests and remove duplicate entry from TestExpectations.

* platform/mac/TestExpectations:
* platform/mac/media/video-controls-rendering-expected.txt:
* platform/mac/media/video-display-toggle-expected.txt:
* platform/mac/media/video-volume-slider-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173519 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EME] REGRESSION(??): test media/encrypted-media/encrypted-media-v2-syntax.html is failing
https://bugs.webkit.org/show_bug.cgi?id=136723

Source/WebCore:

Reviewed by Eric Carlson.

Update a comment to point to the implemented Working Draft 18 Feburary 2014 version of the spec.

* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::createSession):

LayoutTests:

Update the test to match the implemented Working Draft 18 Feburary 2014 version of the spec.

Reviewed by Eric Carlson.

* media/encrypted-media/encrypted-media-v2-syntax-expected.txt:
* media/encrypted-media/encrypted-media-v2-syntax.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Initial implementation of SVG to OTF font converter
https://bugs.webkit.org/show_bug.cgi?id=136688

Patch by Myles C. Maxfield <mmaxfield@apple.com> <litherum@gmail.com> on 2014-09-11
Reviewed by Darin Adler.

This patch creates a new file and new function which turns an SVG font into an OpenType font.
This function is not very full featured, and as such is never called. However, it works with
fonts that only support simple horizontal basic multilingual plane codepoints. It has only
been tested on OS X, and does not have any automated tests. This patch is only jumping off
point, laying the basic groundwork for a more robust font converter.

The goal of this patch is to eventually allow us to delete the codepath with which we draw
text using SVG fonts. Using a native codepath instead will allow for better performance,
security, and code clarity. In my initial benchmarks, using this converter instead of the
SVG codepath is at least a 100x speed improvement (after running for 4 hours I stepped
away from my machine).

No new tests because the function is not ready to be called (yet!)
Initial implementation of SVG to OTF font converter
https://bugs.webkit.org/show_bug.cgi?id=136688

* WebCore.xcodeproj/project.pbxproj: Add new file.
* svg/SVGPathBuilder.h: Single function. Takes a SVGFontElement and returns a byte
* svg/SVGToOTFFontConversion.cpp: Added.
(WebCore::write32): Write a big-endian Int32.
(WebCore::write16): Write a big-endian Int16.
(WebCore::overwrite32): Overwrite an existing Int32 in a vector (instead of appending)
(WebCore::SVGToOTFFontConverter::GlyphData::GlyphData): Internal class to hold state during
function calls.
(WebCore::roundDownToPowerOfTwo):
(WebCore::SVGToOTFFontConverter::appendCMAPTable): See function name.
(WebCore::SVGToOTFFontConverter::appendHEADTable): Ditto.
(WebCore::clampTo): Used to clamp data types to fit into other data types.
(WebCore::SVGToOTFFontConverter::appendHHEATable): See function name.
(WebCore::SVGToOTFFontConverter::appendHMTXTable): Ditto.
(WebCore::SVGToOTFFontConverter::appendMAXPTable): Ditto.
(WebCore::SVGToOTFFontConverter::appendNAMETable): Ditto.
(WebCore::SVGToOTFFontConverter::appendOS2Table): Ditto.
(WebCore::SVGToOTFFontConverter::appendPOSTTable): Ditto.
(WebCore::isValidStringForCFF): The CFF font format only allows strings with particular
characters in them.
(WebCore::appendCFFValidString): Append a string assuming it's valid to append.
(WebCore::SVGToOTFFontConverter::appendCFFTable): See function name.
(WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto.
(WebCore::writeCFFEncodedNumber): CFF has this wacky encoding scheme for encoding and
decoding numbers.
(WebCore::CFFBuilder::CFFBuilder): Subclass of SVGPathBuilder, which is used for building
CFF CharStrings (which are glyph path representations).
(WebCore::CFFBuilder::updateForConstituentPoint): Invoked for every point in a path, does
things like updates glyph bounding box information.
(WebCore::CFFBuilder::boundingBox): Getter.
(WebCore::transcodeGlyphPaths): SVG path data string -> CFF CharString
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Generate internal state ahead of
time before generating any tables.
(WebCore::isFourByteAligned):
(WebCore::calculateChecksum): OTF files have checksums.
(WebCore::SVGToOTFFontConverter::appendTable): Invoked for each entry in the table of
contents of the OTF font.
(WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): Write out the tables.
(WebCore::convertSVGToOTFFont): Entry point.
* svg/SVGToOTFFontConversion.h: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: DOM Tree search highlights are not appearing
https://bugs.webkit.org/show_bug.cgi?id=136662

Reviewed by Timothy Hatcher.

When performing a search within the DOMTreeContentView all
search results should immediately highlight. When moving
between search results, emphasize the current with a bouncy.
Remember to remove the highlights when the search is changed
or cleared.

* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype.performSearch.searchResultsReady):
(WebInspector.DOMTreeContentView.prototype.searchCleared):
Shor or hide highlights when searches change.

(WebInspector.DOMTreeContentView.prototype.revealResult):
(WebInspector.DOMTreeContentView.prototype._revealSearchResult):
Emphasize the highlight when moving to a new current result.

(WebInspector.DOMTreeContentView.prototype._showSearchHighlights):
(WebInspector.DOMTreeContentView.prototype._hideSearchHighlights):
On each affected DOMTreeElement show or hide search highlights.

* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype.emphasizeSearchHighlight.animationEnded):
(WebInspector.DOMTreeElement.prototype.emphasizeSearchHighlight):
Give a brief bouncy-highlight when told to emphasize the search highlight.

(WebInspector.DOMTreeElement.prototype.updateTitle):
Remove unused and unnecessary style class on each row.

(WebInspector.DOMTreeElement.prototype._highlightSearchResults):
Update the stale code to use new function names and accessors.

* UserInterface/Views/DOMTreeOutline.css:
(.dom-tree-outline .search-highlight):
Styles for the search highlight match search highlights in the sidebar.

* UserInterface/Views/Main.css:
(.bouncy-highlight):
* UserInterface/Views/TextEditor.css:
Move bouncy-highlight to Main.css.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support rubber-banding in sub-frames
https://bugs.webkit.org/show_bug.cgi?id=136726
-and corresponding-
rdar://problem/10011924

Reviewed by Tim Horton.

Source/WebCore:

Set the appropriate scroll elasticity for all frames! As long as its enabled, sub-
frames want an elasticity of ScrollElasticityAutomatic, which will allow for 
latching. 
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):

Account for rubber-banding in sub-frames.
(WebCore::FrameView::isScrollableOrRubberbandable):
(WebCore::FrameView::hasScrollableOrRubberbandableAncestor):

This patch also re-names rubberBandingForOverflowScrollEnabled to 
rubberBandingForSubScrollableRegionsEnabled
* page/Settings.in:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::overhangAmount):
(WebCore::RenderLayer::setHasHorizontalScrollbar):
(WebCore::RenderLayer::setHasVerticalScrollbar):

Source/WebKit/mac:

rubberBandingForOverflowScrollEnabled is re-named to
rubberBandingForSubScrollableRegionsEnabled
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

LayoutTests:

* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:



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