This patch enhances existing BytecodeIntrinsic mechanism to accept `@xxx` form,
that will be used to represent bytecode intrinsic constants.
After this change, we can use 2 forms for bytecode intrinsics. (1) Function form (like, @toString(value))
and (2) Constant form (like @undefined).

Bytecode intrinsic constants allow us to easily expose constant values from C++ world.
For example, we can expose ArrayIterationKind flags to JS world without using private global variables.
Exposed constant values are loaded from bytecodes directly through constant registers.
While previously we expose them through private global variables, bytecode intrinsic constants
can be loaded directly from CodeBlock. And later, it will become JSConstant in DFG.

And by using this mechanism, we implement several constants. @undefined, @arrayIterationKindKeyValue etc.

* UserInterface/Controllers/CodeMirrorTokenTrackingController.js:
(WebInspector.CodeMirrorTokenTrackingController.prototype.highlightRange):
The highlighted range could have just gotten removed, in which case the
marker would return undefined. Just bail in such cases.

Towards checking a Web Worker's content security policy against a redirected worker
script load or redirected XHR request for an XHR request initiated from it, we should
support instantiating a ContentSecurityPolicy object without a ScriptExecutionContext.

No functionality was changed. So, no new tests.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Pass |this| as a reference instead of as a pointer.
* page/csp/ContentSecurityPolicy.cpp: Remove extraneous includes ScriptState.h, TextEncoding.h,
and URL.h as they are included by ContentSecurityPolicy.h, FormDataList.h and FormData.h, respectively.
(WebCore::CSPSource::CSPSource): Take a constant reference to a ContentSecurityPolicy instead
of a pointer since we never expected a null pointer.
(WebCore::CSPSource::schemeMatches): Move logic for checking the protocol of source "self"
from here to ContentSecurityPolicy::protocolMatchesSelf() because we may not have a security
origin if ContentSecurityPolicy was initiated without a ScriptExecutionContext object.
(WebCore::CSPSourceList::allowSelf): Added.
(WebCore::CSPSourceList::CSPSourceList): Take a constant reference to a ContentSecurityPolicy
instead of a pointer since we never expected a null pointer. Remove fields from member
initialization list that can be initialized using C++11 in-class initialization syntax.
(WebCore::CSPSourceList::matches): Call ContentSecurityPolicy::urlMatchesSelf() to match the
effective URL against the URL of source "self".
(WebCore::CSPSourceList::parse): Update code as necessary now that m_policy is a reference
instead of a pointer.
(WebCore::CSPSourceList::parseSource): Simplify code by setting internal member fields directly
instead of via member functions.
(WebCore::CSPSourceList::parsePath): Update code as necessary now that m_policy is a reference
instead of a pointer.
(WebCore::CSPDirective::CSPDirective): Take a constant reference to a ContentSecurityPolicy
instead of a pointer since we never expected a null pointer.
(WebCore::CSPDirective::policy): Return a reference to a const ContentSecurityPolicy.
(WebCore::MediaListDirective::MediaListDirective): Take a constant reference to a ContentSecurityPolicy
instead of a pointer since we never expected a null pointer.
(WebCore::MediaListDirective::parse): Update code as necessary now that m_policy is a reference
instead of a pointer.
(WebCore::SourceListDirective::SourceListDirective): Take a constant reference to a ContentSecurityPolicy
instead of a pointer since we never expected a null pointer.
(WebCore::SourceListDirective::allows): Write in terms of CSPSourceList::allowSelf() because we
may not have a security origin to get a URL from if ContentSecurityPolicy was initiated without
a ScriptExecutionContext object.
(WebCore::CSPDirectiveList::reportURIs): Change return type from Vector<URL> to Vector<String>
The caller will convert the strings to URLs with respect to the script execution context.
(WebCore::CSPDirectiveList::parseReportURI): Store the report URI as a string instead of a URL
because we may not have a security origin to compute the absolute URL if ContentSecurityPolicy
was initiated without a ScriptExecutionContext object.
(WebCore::CSPDirectiveList::CSPDirectiveList): Take a reference to a ContentSecurityPolicy
instead of a pointer since we never expected a null pointer. It would be better to take a const
reference to a ContentSecurityPolicy, but ContentSecurityPolicy::applySandboxPolicy() needs to set
state on ContentSecurityPolicy :(
(WebCore::CSPDirectiveList::create): Ditto.
(WebCore::CSPDirectiveList::reportViolation): Update code as necessary now that m_policy is a reference
instead of a pointer.
(WebCore::CSPDirectiveList::checkEvalAndReportViolation): Ditto.
(WebCore::CSPDirectiveList::checkInlineAndReportViolation): Ditto.
(WebCore::CSPDirectiveList::parseDirective): Ditto.
(WebCore::CSPDirectiveList::parseReportURI): Store the report URI as a string instead of a URL
because we may not have a security origin to compute the absolute URL if ContentSecurityPolicy
was initiated without a ScriptExecutionContext object.
(WebCore::CSPDirectiveList::setCSPDirective): Update code as necessary now that m_policy is a reference
instead of a pointer.
(WebCore::CSPDirectiveList::applySandboxPolicy): Ditto.
(WebCore::CSPDirectiveList::parseReflectedXSS): Ditto.
(WebCore::CSPDirectiveList::addDirective): Ditto.
(WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Modified to take the ScriptExecutionObject
as a reference and compute the CSPSource object for "self" and cache the protocol for "self". Removed
field m_overrideInlineStyleAllowed from the member initialization list and used C++11 in-class
initialization syntax to initialize it. Added overloaded constructor that takes a SecurityOrigin object.
We are not making use of this overloaded constructor at this time. We will in a subsequent patch.
(WebCore::ContentSecurityPolicy::didReceiveHeader): Store the eval disabled error message for
the last parsed policy in a member field instead of using it as part of disabling eval execution
on the script execution context because we may not have such a context.
(WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext): Applies the content security
policy eval and sandbox restrictions to the script execution context.
(WebCore::ContentSecurityPolicy::urlMatchesSelf): Match the specified URL against the URL for
source "self".
(WebCore::ContentSecurityPolicy::protocolMatchesSelf): Match the protocol of the specified URL
against the protocol for source "self".
(WebCore::ContentSecurityPolicy::gatherReportURIs): Modified to use the script execution context
to compute the absolute URL for each report URI.
(WebCore::ContentSecurityPolicy::reportViolation): Bail out if we do not have a script execution
context.
(WebCore::ContentSecurityPolicy::logToConsole): Only log to the console if we have a script
execution context.
(WebCore::ContentSecurityPolicy::reportBlockedScriptExecutionToInspector): Only report blocked
script execution to the Web Inspector if we have a script execution context.
(WebCore::CSPSourceList::addSourceSelf): Deleted.
(WebCore::CSPSourceList::addSourceStar): Deleted.
(WebCore::CSPSourceList::addSourceUnsafeInline): Deleted.
(WebCore::CSPSourceList::addSourceUnsafeEval): Deleted.
(WebCore::CSPDirectiveList::gatherReportURIs): Deleted.
(WebCore::ContentSecurityPolicy::securityOrigin): Deleted.
(WebCore::ContentSecurityPolicy::url): Deleted.
(WebCore::ContentSecurityPolicy::completeURL): Deleted.
(WebCore::ContentSecurityPolicy::enforceSandboxFlags): Deleted.
* page/csp/ContentSecurityPolicy.h:
(WebCore::ContentSecurityPolicy::enforceSandboxFlags): Accumulates the parsed sandbox flags. We
will apply the sandbox flags in ContentSecurityPolicy::applyPolicyToScriptExecutionContext().
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate ContentSecurityPolicy.
(WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Move instantiation of
ContentSecurityPolicy from here to constructor.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addTextTrack): Update m_captionDisplayMode when called for the first
time so it is always correct. Set the track's manual selection mode as appropriate.
(WebCore::HTMLMediaElement::captionPreferencesChanged): Set each track's manual selection
mode as appropriate.

On mobile, virtual keyboard represented by ecore_imf module appears on
the top of application layer usually covering bottom part of the screen.
If the web page contains the editable content on the bottom of the page
it will be overlapped by keyboard which prevents user from seeing the
typed text.

Pack MiniBrowser layout into conformant widget to allow EFL to guess
the space that will be required by the keyboard, finally resizing it
to the desired size. As a result, webview gets resized and scrolled
into focused elements which makes the editable elements visible while
typing.

More details about elm_conformant widger can be found at:
https://docs.enlightenment.org/elementary/1.15.0/group__Conformant.html
https://docs.enlightenment.org/elementary/1.15.0/conformant_example.html

object.__lookupGetter__() / object.__lookupSetter__() does not work for native bindings
https://bugs.webkit.org/show_bug.cgi?id=153765
<rdar://problem/24439699>

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Add support for CustomAccessor slots to objectProtoFuncLookupGetter() and
objectProtoFuncLookupSetter() by return getOwnPropertyDescriptor().get / set.
getOwnPropertyDescriptor() now correctly deals with CustomAccessors since
r196001.

* UserInterface/Views/CodeMirrorAdditions.js:
When selectionStart === selectionEnd we were duplicating the
movement mutation by performing it twice on the same object.
After much experimentation, I left in the existing code path
for handling mutation with a selection. It is not perfect,
but it is better then just applying the ch diff.

Update http/tests/security/cross-origin-window-property-access.html that was
introduced in r196001 so that it does not assert on Mac DRT. Mac DRT asserts
that testRunner.waitUntilDone() must be called *BEFORE* calling window.open().

This patch is based on initial work by Joe Pecoraro and Matthew Mirman.

This patch was initially rolled out for breaking chromeexperiments.com,
presumably because our IDL attributes were not marked as [configurable]
at the time. However, since r190104, our IDL attributes are now
configurable. Based on local testing, chromeexperiments.com seems to be
working fine now.

* inspector/InspectorMemoryAgent.h: Added.
* inspector/InspectorMemoryAgent.cpp: Added.
(WebCore::InspectorMemoryAgent::InspectorMemoryAgent):
(WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
(WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorMemoryAgent::startTracking):
(WebCore::InspectorMemoryAgent::stopTracking):
(WebCore::InspectorMemoryAgent::collectSample):
Implement the agent by adding / removing it as a ResourceUsage
observer. When receiving the data forward it to the frontend.

Source/WebInspectorUI:

Use the new "Memory" domain to track page memory size over time.
This allows the timeline to help visualize total process memory
broken down into a few different categories. The timeline graph
allows seeing the total size over time, and you can drill in to
a specific section and get a better breakdown and comparison
of the different categories of memory that we currently track.

Modern IDB: Cursors (still) do not keep their opening request alive.
https://bugs.webkit.org/show_bug.cgi?id=153724

Reviewed by Alex Christensen.

No new tests (All existing tests pass without flakiness).

IDBCursors did not properly keep their JS wrappers alive.
Making them ActiveDOMObjects that keep track of how many requests might be in flight fixes this.
This also makes them actually keep their opening-request live via the opaque-root mechanism.

IDBCursorWithValue also needed to opt in to all of these mechanisms.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::hasPendingActivity): The base IDBCursor always has no pending activity,
to maintain current behavior in LegacyIDB. This weirdness will go away when LegacyIDB does.
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBCursorWithValue.idl:

Rework the "delete" family of functions on the object store to allow for returning a modern IDBRequest.
A lot of this can go away when LegacyIDB does.
* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::deleteFunction):
(WebCore::IDBClient::IDBObjectStore::doDelete):
(WebCore::IDBClient::IDBObjectStore::modernDelete):
* Modules/indexeddb/client/IDBObjectStoreImpl.h:

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::setSource): Setup a ScopeGuard to decrement the cursor's request
count whenever it makes sense to do so.
(WebCore::IDBClient::IDBRequest::dispatchEvent): Clear the ScopeGuard (if it exists) to decrement the count.
(WebCore::IDBClient::IDBRequest::willIterateCursor): Set the ScopeGuard.
(WebCore::IDBClient::IDBRequest::didOpenOrIterateCursor): Clear the ScopeGuard (if it exists) to decrement the count.
* Modules/indexeddb/client/IDBRequestImpl.h:

* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype.shown):
Assume the view has been resized when shown, and update layout.
(WebInspector.OverviewTimelineView.prototype.updateLayoutForResize): Deleted.
No longer needed, handled by the View base class.

* UserInterface/Views/View.js:
(WebInspector.View):
(WebInspector.View.prototype.updateLayout):
Set layout reason.
(WebInspector.View.prototype.needsLayout):
Set layout reason even if an animation frame has already been scheduled,
since the layout reason could have changed.
(WebInspector.View.prototype._layoutSubtree):
Propagate layout reason to subtree, and reset the value when done.
(WebInspector.View.prototype._setLayoutReason):
Helper method for updating the layout reason. Ensures that LayoutReason.Resize
has priority over the default (LayoutReason.Dirty).

Add code to parse the git branches out of the Trac RSS feed https://bugs.webkit.org/show_bug.cgi?id=153624

Reviewed by Daniel Bates.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
(Trac.prototype.commitsOnBranch): Update filter to check for Git branches.
(Trac.prototype._convertCommitInfoElementToObject): Parse Git branches from the Trac RSS feed. Also changed "branchName" to
"branches" and updated the code to work with an array instead of a string.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js:
(MockTrac): Refactored example commits out into a constant, MockTrac.EXAMPLE_TRAC_COMMITS.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-git-trac-rss.xml: Added. Test
fixture that contains XML with a Git branch.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit test to test parsing Git
branches from Trac RSS feed. Also updated code to work with the new MockTrac.EXAMPLE_TRAC_COMMITS constant.

Colormap is needed to create XWindow and it should be freed when XWindow is destroyed.
Unless Colormap is freed before destroying XWindow, memory leak is suspected.
XFreeColormap therefore is needed on X11Helper.

When scrolling, we throw away UIPDFPageViews, but forget to unhook their delegates.
In some cases (also because their delegate is a raw pointer, not weak), they can call
back into a deleted WKPDFView, causing a crash.

* UIProcess/ios/WKPDFView.mm:
(detachViewForPage):
Add a helper to detach a page view, and unhook its delegates.

(-[WKPDFView _clearPages]):
(-[WKPDFView _revalidateViews]):
Make use of the new helper.

[JSC] IRC can coalesce the frame pointer with a Tmp that is modified
https://bugs.webkit.org/show_bug.cgi?id=153694

Reviewed by Filip Pizlo.

Let's say we have:
Move(FP, Tmp1)
Add64(#1, Tmp1)

If we were to coalesce the Move, we would modify the frame pointer.
Well, that's exactly what was happening with IRC.

Since the epilogue is not know to Air before IRC, the liveness analysis
never discovers that FP is live when Tmp1 is UseDef by Add64. Adding
FP would a be a problem anyway for a bunch of reasons.

I tried two ways to prevent IRC to override IRC:
1) Add an interference edge with FP for all non-duplication Defs.
2) Let coalesce() know about FP and constraint any coalescing with a re-Def.

The two are within margin of error for performance. The second one was considerably
more complicated. This patch implements the first one.

Some extra note:
-It is very important to not increment the degree of a Tmp when making it interfere
with FP. FP is not a valid color, it is not counted in the "K" colors considered
for coloring. Increasing the degree with the edge to FP would make every stage
pessimistic since there is an extra degree that can never be removed.
-I put "interferenceEdges" and "adjacencyList" in an inconsistent state.
This is intentional, "interferenceEdges" is used to test the existence of an edge,
"adjacencyList" is used to go over all the edges. In this case, we don't want
the edge with FP to be considered when pruning the graph.

* b3/air/AirIteratedRegisterCoalescing.cpp:
One branch could be transformed into an assertion: TmpLiveness is type specific now.
* b3/testb3.cpp:
(JSC::B3::testOverrideFramePointer):
(JSC::B3::run):

Cache the Path instead of creating it every time it is required
https://bugs.webkit.org/show_bug.cgi?id=152939

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-02-01
Reviewed by Darin Adler.

Source/WebCore:

Instead of creating the Path object every time it is required, we should
cache it in an LRU cache. TinyLRUCache returns a reference to the cached
entry so we do not have to pay the cost of copying it either.

* platform/graphics/FloatRoundedRect.h:
(WebCore::operator!=):
Implement the inequality operator for FloatRoundedRect since it is
called by TinyLRUCache.

* rendering/ClipPathOperation.h:
Return a reference to the path in the cache since instead of creating a
new copy.

* rendering/style/BasicShapes.cpp:
(WebCore::SVGPathTranslatedByteStream::SVGPathTranslatedByteStream):
(WebCore::SVGPathTranslatedByteStream::operator==):
(WebCore::SVGPathTranslatedByteStream::operator!=):
(WebCore::SVGPathTranslatedByteStream::isEmpty):
(WebCore::SVGPathTranslatedByteStream::path):
This struct holds an offset and an SVGPathByteStream. It is the key of
the LRU cache for the the translated SVGPathByteStream.

(WebCore::EllipsePathPolicy::isKeyNull):
(WebCore::EllipsePathPolicy::createValueForKey):
(WebCore::RoundedRectPathPolicy::isKeyNull):
(WebCore::RoundedRectPathPolicy::createValueForKey):
(WebCore::PolygonPathPolicy::isKeyNull):
(WebCore::PolygonPathPolicy::createValueForKey):
(WebCore::TranslatedByteStreamPathPolicy::isKeyNull):
(WebCore::TranslatedByteStreamPathPolicy::createValueForKey):
Inherit from the LRU cache policy template, so have a specific name for
the desired path contents and pass this class explicitly to the LRU cache
template.

(WebCore::BasicShapeCircle::path):
(WebCore::BasicShapeEllipse::path):
(WebCore::BasicShapePolygon::path):
(WebCore::BasicShapePath::path):
(WebCore::BasicShapeInset::path):
Get the Path object from the cache; create a new one if it does not exist.

* rendering/style/BasicShapes.h:
Change the prototype of the path() function to return a reference to the
path in the cache instead of a having to copying it.

* svg/SVGPathByteStream.h:
(WebCore::SVGPathByteStream::operator!=):
Implement the inequality operator for SVGPathByteStream because it is
called by TinyLRUCache.

Source/WTF:

If the key type of an LRU cache can't to be strongly tided to a specific
data type; e.g. FloatRect -> Path, we need to be able to pass the policy
type to the TinyLRUCache template instead of just specializing it. This
will make the code more readable and will allow different caches for the
same key type.

Move properties that use custom bindings to the prototype. Whether a
property's bindings code is generated or custom-written should not
impact where the property is located.

No new tests, already covered by existing tests.

* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::getOwnPropertySlot):
Add null-check for staticPropHashTable. HTMLDocument no longer has
any property on the instance so staticPropHashTable is now null.

* bindings/scripts/CodeGeneratorJS.pm:

LayoutTests:

Rebaseline / update existing tests now that properties using custom
bindings are on the prototype, as expected.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
Update the new timeline overview's height before it's shown. Showing the
overview causes the rendering frames graph to do a layout, which requires
the height of the containing view to be a valid value.

Provide a way to add go-to arrow buttons to any grid cell from within a
DataGridNode subclass's implementation of createCellContent.

* UserInterface/Views/DataGrid.js:
New event type, GoToArrowClicked.
(WebInspector.DataGridNode.prototype.createGoToArrowButton.buttonClicked):
(WebInspector.DataGridNode.prototype.createGoToArrowButton):
Adds a go-to arrow button to the cell's content element. Clicking the button
dispatches an event on the DataGrid, with event data containing the
DataGridNode and identifier of the cell containing the arrow button.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/PopoverTracker.js:
(PopoverTracker): Retain a reference to the PopoverTracker so that we can make assertions about it in the unit tests.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js:
(MockTrac): Changing revision 33019 to be on a different branch so that _appendPendingRevisionCount and
_popoverLinesForCommitRange have to traverse commits from different branches.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Changing equal to strictEqual
in unit test for _appendPendingRevisionCount. Also added assertions for Popover in test for
_revisionContentWithPopoverForIteration.

* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::initProtocolHandlerWhitelist): Deleted. Moved into isProtocolWhitelisted.
(WebCore::isProtocolWhitelisted): Changed set to be ASCIICaseInsensitiveHash and
initialized it using a lambda instead of a separate function.
(WebCore::verifyProtocolHandlerScheme): Added a FIXME about some case sensitive
checking of the protocol prefix here.

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::supportsMimeType): Changed set to be
ASCIICaseInsensitiveHash and initialized it using a lambda instead of using
an explict check for empty.
(WebCore::QuickTimePluginReplacement::supportsFileExtension): Ditto.

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::queryKeysAndValues): Use convertToASCIILowercase. The keys here are
going to be all ASCII.
(WebCore::isYouTubeURL): Use equalLettersIgnoringASCIICase instead of lowercasing
the string.
(WebCore::processAndCreateYouTubeURL): Use url.protocolIsInHTTPFamily instead of
listing "http" and then "https" explicitly. Use equalLettersIgnoringASCIICase
instead of lowercasing a string.
(WebCore::YouTubePluginReplacement::youTubeURL): Ditto.

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes): Call convertToASCIILowercase instead of lower
to lowercase an element's tag name. This is a strange way to do things; typically
would be better to use some other function on Element, since tagName goes out of
its way to be capitalized, but some ATK expert can improve this later.

* css/CSSGrammar.y.in: Use the new convertToASCIILowercaseInPlace function rather
than the old lower function. We only need to lowercase the ASCII letters, and it's
also better to have the function have a clearer name.

* css/CSSParser.cpp:
(WebCore::convertToASCIILowercaseInPlace): Renamed from makeLower and made it deal
with only ASCII lowercasing.
(WebCore::CSSParserString::convertToASCIILowercaseInPlace): Renamed from lower.
(WebCore::isUniversalKeyword): Added. Helper for the function below that uses
equalLettersIgnoringASCIICase rather than lowercasing the string.
(WebCore::parseKeywordValue): Use isUniversalKeyword. Also clarified a comment.
(WebCore::CSSParser::parseAttr): Use convertToASCIILowercaseInPlace and delay
String creation until later in the function, using CSSParserString operations more.

* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoElementSelector): Use
convertToASCIILowercaseInPlace by its new name, with its new behavior.

* css/CSSParserValues.h: Tweaked comment and formatting a bit. Replaced the lower
function with the convertToASCIILowercaseInPlace function.

* css/CSSSelector.cpp:
(WebCore::CSSSelector::RareData::parseNth): Rewrote this to avoid the need to
make a lowercased copy of m_argument. Use equalLettersIgnoringASCIICase, and two
calls to find. Also use String::toIntStrict so we don't have to create String
objects for substrings.

* dom/Document.cpp:
(WebCore::isSeparator): Tweaked formatting and removed non-helpful comment.
(WebCore::processArguments): Changed this from a static member function to a non-member
file internal function. Use a std::function instead of a function pointer with a void*
pointer. Rewrote algorithm to simplify it and use StringView instead of String for the
keys and values.
(WebCore::Document::processViewport): Use a lambda instead of a function pointer to
call setViewportFeature, so that function's interface is no longer dictated by
the exact type of the function pointer argument to processArguments.
(WebCore::Document::processFormatDetection): Use a lambda instead of the
setParserFeature function above; use equalLettersIgnoringASCIICase for both the
key and the value, since processArguments no longer lowercases the string.
(WebCore::Document::processArguments): Deleted.

* dom/Document.h: Removed unnecessary declaration of processArguments and
ArgumentsCallback. Both are now private to the cpp file.

* dom/Element.cpp:
(WebCore::makeIdForStyleResolution): Use convertToASCIILowercase. When in quirks mode,
we want to match IDs in an ASCII case-insensitive way not match compatibility caseless.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::isScriptTypeSupported): Remove the use of lower here since
the MIME type registry is now itself ASCII case-insensitive.

* dom/ViewportArguments.cpp:
(WebCore::numericPrefix): Changed to use StringView and take a Document&, rearranged
argument order so Document& comes first.
(WebCore::findSizeValue): Ditto.
(WebCore::findScaleValue): Ditto.
(WebCore::findBooleanValue): Ditto. Also use std::abs instead of fabs, possibly
avoiding a conversion from float to double (not sure it was happening before but it's
definitely not happening now).
(WebCore::setViewportFeature): Changed to put arguments in a more logical order, to take
the ViewportArguments as a reference, not a void*, and to use StringView to avoid forcing
the caller to allocate strings. Also changed to use equalLettersIgnoringASCIICase so we
don't rely on the caller to make the key lowercase for us.
(WebCore::reportViewportWarning): Changed argument types. Added a couple comments about
mistakes in the function.

* dom/ViewportArguments.h: Removed unnecessary declaration of reportViewportWarning,
which is now private to the cpp file. Updated for new arguments to setViewportFeature.

* editing/EditorCommand.cpp:
(WebCore::executeFormatBlock): Use convertToASCIILowercase on the argument, which is
specifying a tag name.

* fileapi/Blob.cpp:
(WebCore::Blob::isValidContentType): Removed unnecessary separate loops for
8-bit and 16-bit strings. Content types are short strings and this small optimization is
not worth the additional code complexity.
(WebCore::Blob::normalizedContentType): Use convertToASCIILowercase since valid
content types are guaranteed to be all ASCII.
(WebCore::Blob::isNormalizedContentType): Removed unnecessary separate loops for
8-bit and 16-bit strings. Content types are short strings and this small optimization is
not worth the additional code complexity.

* html/parser/HTMLParserIdioms.h: Removed unneeded include of QualifiedName.h and
WTFString.h. Made sure every function is declared first, even if it's also defined
later in the header in the section for functions templates and inline functions.

* loader/archive/ArchiveFactory.cpp:
(WebCore::ArchiveFactory::registerKnownArchiveMIMETypes): Use auto& for the type of
the set of MIME types here, since it's now using ASCIICaseInsensitiveHash.

* platform/MIMETypeRegistry.cpp: Changed the MIME type sets to use
ASCIICaseInsensitiveHash since MIME type are not case sensitive.
(WebCore::initializeSupportedImageMIMETypes): Use a modern for loop.
(WebCore::initializeSupportedImageMIMETypesForEncoding): Updated for HashSet type change.
(WebCore::initializePDFMIMETypes): Use a modern for loop.
(WebCore::initializeSupportedNonImageMimeTypes): Use a modern for loop.
(WebCore::initializeSupportedMediaMIMETypes): Updated for HashSet type change.
(WebCore::initializeUnsupportedTextMIMETypes): Use a modern for loop.
(WebCore::initializeMIMETypeRegistry): Updated for HashSet type change.
(WebCore::MIMETypeRegistry::getSupportedImageMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): Ditto.
(WebCore::MIMETypeRegistry::getSupportedNonImageMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getPDFMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getPDFAndPostScriptMIMETypes): Ditto.
(WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes): Ditto.
(WebCore::mimeTypeAssociationMap): Use ASCIICaseInsensitiveHash.
(WebCore::MIMETypeRegistry::getNormalizedMIMEType): Use auto to make code tighter.

* platform/MIMETypeRegistry.h: Changed return types of the getMIMETypes functions
to use ASCIICaseInsensitiveHash.

* platform/URL.cpp:
(WebCore::mimeTypeFromDataURL): Use convertToASCIILowercase instead of lower.
Also removed some dead code that tried to handle the case where the data URL
has a comma as one of the first 5 characters: That can't happen since it's a
precondition of this function that the first five characters are "data:".

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
Changed type of HashSet to use ASCIICaseInsensitiveHash.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Removed
an unnecessary line of code to set a local variable to 0 just before it falls
out of scope.
(WebCore::avfMIMETypes): Ditto. Also tightened up the code a bit.
(WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes): Ditto.

* platform/graphics/mac/MediaPlayerPrivateQTKit.h: Ditto.
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::shouldRejectMIMEType): Made this non-case-sensitive by using startsWith
and the "false" argument. Later change this to startsWithIgnoringASCIICase or
startsWithLettersIgnoringASCIICase.
(WebCore::addFileTypesToCache): Use ASCIICaseInsensitiveHash. ALso rewrote to
tighten up the code a bit and use modern Objective-C for loops.
(WebCore::mimeCommonTypesCache): Use ASCIICaseInsensitiveHash.
(WebCore::mimeModernTypesCache): Ditto.
(WebCore::concatenateHashSets): Ditto.
(WebCore::MediaPlayerPrivateQTKit::getSupportedTypes): Ditto.
(WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Initialied
track type set using lambda, but left it case sensitive.

* WebView/WebHTMLRepresentation.mm:
(newArrayWithStrings): Updated to use HashSet<String, ASCIICaseInsensitiveHash>
and also to use a modern for loop.

Source/WTF:

* wtf/text/StringView.h: Added toIntStrict. Not thrilled about the name of this
function, but generally it seems likely to be useful more often than toInt.
And it's needed for one call site in WebCore that was using String::lower.

CSP: Use the served CSP header for dedicated workers
https://bugs.webkit.org/show_bug.cgi?id=153157
<rdar://problem/24383254>
And
https://bugs.webkit.org/show_bug.cgi?id=153156
<rdar://problem/24383246>

Implement support for respecting Content Security Policy (CSP) HTTP headers included in the
HTTP response for a Web Worker's script as per section Workers of the CSP 2.0 spec,
<https://w3c.github.io/webappsec-csp/2/#processing-model-workers> (29 August 2015).

Currently a Web Worker always inherits the CSP of its owner document. Instead a web worker
will inherit the CSP of its owner document only if its script is incapable of defining a
content security policy (i.e. its origin is a globally unique identifier). Otherwise, the
CSP HTTP headers delivered with the script will be used to define the CSP for the worker.

* CMakeLists.txt: Add file ContentSecurityPolicyResponseHeaders.cpp.
* WebCore.vcxproj/WebCore.vcxproj: Add files ContentSecurityPolicyResponseHeaders.{cpp, h}.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* dom/Document.cpp:
(WebCore::Document::processHttpEquiv): Update code to use enum class ContentSecurityPolicyHeaderType.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument): Extract logic to collect Content Security Policy HTTP headers
into class ContentSecurityPolicyResponseHeaders and make use of it here.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::headerType): Modified to use enum class ContentSecurityPolicyHeaderType.
(WebCore::CSPDirectiveList::CSPDirectiveList): Ditto.
(WebCore::CSPDirectiveList::create): Ditto.
(WebCore::ContentSecurityPolicy::responseHeaders): Creates and returns a ContentSecurityPolicyResponseHeaders
object with the parsed CSP policy headers.
(WebCore::ContentSecurityPolicy::didReceiveHeaders): Processed the CSP policy headers represented by the
specified ContentSecurityPolicyResponseHeaders object.
(WebCore::ContentSecurityPolicy::deprecatedHeader): Deleted.
(WebCore::ContentSecurityPolicy::deprecatedHeaderType): Deleted.
* page/csp/ContentSecurityPolicy.h: Defines a class that represents a collection of CSP policy headers.
This class has two purposes:
- It extracts the CSP policy headers from a HTTP response (ResourceResponse object). We make use of
this functionality in both FrameLoader::didBeginDocument() and Worker::didReceiveResponse().
- It serves as a memento that externalizes the internal CSP policy details of an instance of
ContentSecurityPolicy. We make use of this memento functionality to support inheriting the
CSP policy of the worker's owner document in a thread-safe manner. You can create and restore
a memento using ContentSecurityPolicy::responseHeaders() and ContentSecurityPolicy::didReceiveHeaders(), respectively.
* page/csp/ContentSecurityPolicyResponseHeaders.cpp: Added.
(WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): Extracts the
CSP HTTP headers from a ResourceResponse object.
(WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy): Make a copy of this object that is
safe to pass to another thread.
* page/csp/ContentSecurityPolicyResponseHeaders.h: Added.
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::create): Modified to use class ContentSecurityPolicyResponseHeaders.
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::create): Ditto.
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread): Ditto.
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Ditto.
* workers/DedicatedWorkerThread.h:
* workers/Worker.cpp:
(WebCore::Worker::didReceiveResponse): Create a ContentSecurityPolicyResponseHeaders if the origin of
the worker's script is capable of providing a CSP. Otherwise, we will inherit the CSP of the worker's owner
document in Worker::notifyFinished().
(WebCore::Worker::notifyFinished): Pass the appropriate CSP response headers to WorkerMessagingProxy::startWorkerGlobalScope().
* workers/Worker.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Renamed; formerly named applyContentSecurityPolicyFromString().
Modified to take a ContentSecurityPolicyResponseHeaders and apply it to the ContentSecurityPolicy object associated with the worker.
(WebCore::WorkerGlobalScope::applyContentSecurityPolicyFromString): Deleted.
* workers/WorkerGlobalScope.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Pass the worker's ContentSecurityPolicyResponseHeaders object.
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData): Added field m_contentSecurityPolicyResponseHeaders to store
the CSP response headers to be applied to the worker's ContentSecurityPolicy object.
(WebCore::WorkerThread::WorkerThread): Modified to use ContentSecurityPolicyResponseHeaders.
(WebCore::WorkerThread::workerThread): Pass the ContentSecurityPolicyResponseHeaders object from the start up data struct
to DedicatedWorkerThread::createWorkerGlobalScope().
* workers/WorkerThread.h:

LayoutTests:

Add new tests to ensure we block eval() in blob-, file-URL workers and block XHR in a file-URL worker.

Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
https://bugs.webkit.org/show_bug.cgi?id=153715

Reviewed by Gyuyoung Kim.

Source/WebCore:

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::computedAttributesForElement): Use convertToASCIILowercase to fold
ASCII case when searching for fonts by name.

* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::platformLazyInit): Use convertToASCIIUppercase to make
the HTTP version string canonical. Not sure why it's needed at all, but the letters
we might be uppercasing are "HTTP", so no need to handle non-ASCII.
* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformLazyInit): Ditto.

* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::operator<<): Use convertToASCIIUppercase when writing the spread
method type into a text stream. The method types are all ASCII.

* platform/graphics/FontCascade.cpp:
(WebCore::keysMatch): Rename from operator== since this operation is not
equality. Changed to equalIgnoringASCIICase and did a little streamlining.
(WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
better memory use.
(WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
a hash more efficient by eliminating the overhead of building a vector and
even possible heap allocation and deallocation.
(WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.

* platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
for font family names. These names should use ASCII case insensitive matching;
there is no need for non-ASCII case folding.

* platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
HTTP header field names. These names are all ASCII.

* rendering/style/RenderStyle.cpp:
(WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
to compute a hash. Use ASCIICaseInsensitiveHash.

Source/WebKit/win:

* WebCoreStatistics.cpp:
(WebCoreStatistics::memoryStatistics): Use ASCIICaseInsensitiveHash for field names.
These names are all ASCII.

* WebURLResponse.cpp:
(WebURLResponse::allHeaderFields): Use ASCIICaseInsensitiveHash for HTTP header
field names. These names are all ASCII.

Source/WebKit2:

* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: Use ASCIICaseInsensitiveHash
for MIME types. MIME types are all ASCII.

* UIProcess/Plugins/PlugInAutoStartProvider.h: Use ASCIICaseInsensitiveHash for
origins. Origin strings should use ASCII case insensitive matching and should not
fold non-ASCII case.

* WebProcess/WebPage/WebPage.h: Use ASCIICaseInsensitiveHash for MIME types.
MIME types are all ASCII.

* wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash.
(WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower.
(WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase.
Also added some assertions.

* wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file,
since it's no longer needed by CaseFoldingHash. Moved it up before its first use.
(WTF::equalCompatibilityCaseless): Fixed typo in the name of this function.
(WTF::equalCompatibiltyCaselessNonNull): Deleted.

If we save $gp to $s4 in pichdr, then in some cases, we were
overwriting $s4 before LLInt's pushCalleeSaves() is called (as pichdr
is at the very beginning of a function). Now we save $gp to $s4 at the
end of pushCalleeSaves().

* offlineasm/mips.rb:
* llint/LowLevelInterpreter.asm:
Move the saving of $gp to $s4 from pichdr to pushCalleeSaves(). Take
the opportunity to only save $s4 as we never use the other callee
saved registers.

GCController is not available in Worker environments, explaining probably why garbage-collection-2.html is not crashing at all.
Inlining half of the tests in garbage-collection-2.html (runned in window) to compare with garbage-collection-1.html.

* platform/FileSystem.cpp:
(WebCore::shouldEscapeUChar): Return true for some surrogate-pair situations.
(WebCore::encodeForFileName): Pass along the previous and next characters, as well,
and do a two byte escaping for some characters.

* platform/graphics/FontCache.cpp: Reworked FontPlatformDataCacheKey struct:
Made it a conventional struct with non-prefixed data members names. Removed
the "==" operator since it was appropriate for hash table lookup but wasn't
a true equality operator. Tightened the implementations of the constructors.
(WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.
(WebCore::FontPlatformDataCacheKeyHash::equal): Do the equality check here,
not using the == operator. And use equalIgnoringASCIICase.
(WebCore::FontPlatformDataCacheKeyTraits::isEmptyValue): Added this entire
traits struct so we check empty values in a more efficient way.
(WebCore::FontCache::getCachedFontPlatformData): Added comments and tweaked
style in this function.

* platform/graphics/FontCascade.cpp:
(WebCore::keysMatch): Rename from operator== since this operation is not
equality. Changed to equalIgnoringASCIICase and did a little streamlining.
(WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
better memory use.
(WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
a hash more efficient by eliminating the overhead of building a vector and
even possible heap allocation and deallocation.
(WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.

* platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
for font family names. These names should use ASCII case insensitive matching;
there is no need for non-ASCII case folding.

* platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
HTTP header field names. These names are all ASCII.

* rendering/style/RenderStyle.cpp:
(WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
to compute a hash. Use ASCIICaseInsensitiveHash.

Source/WebKit/win:

* WebCoreStatistics.cpp:
(WebCoreStatistics::memoryStatistics): Use ASCIICaseInsensitiveHash for field names.
These names are all ASCII.

* WebURLResponse.cpp:
(WebURLResponse::allHeaderFields): Use ASCIICaseInsensitiveHash for HTTP header
field names. These names are all ASCII.

Source/WebKit2:

* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: Use ASCIICaseInsensitiveHash
for MIME types. MIME types are all ASCII.

* UIProcess/Plugins/PlugInAutoStartProvider.h: Use ASCIICaseInsensitiveHash for
origins. Origin strings should use ASCII case insensitive matching and should not
fold non-ASCII case.

* WebProcess/WebPage/WebPage.h: Use ASCIICaseInsensitiveHash for MIME types.
MIME types are all ASCII.

* wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash.
(WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower.
(WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase.
Also added some assertions.

* wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file,
since it's no longer needed by CaseFoldingHash. Moved it up before its first use.
(WTF::equalCompatibilityCaseless): Fixed typo in the name of this function.
(WTF::equalCompatibiltyCaselessNonNull): Deleted.

* UserInterface/Views/TreeOutline.css:
(.tree-outline:not(.hide-disclosure-buttons) .item:not(.parent) > .icon):
(.tree-outline:not(.hide-disclosure-buttons) .item:not(.parent) .icon): Deleted.
This would apply to all .icon elements contained within a non-parent item,
which is not the desired effect. Instead, this should only apply to only the
.icon element of that particular non-parent item.

as per the Web IDL specification:
https://heycam.github.io/webidl/#interface-prototype-object

In WebKit, it is currently not writable. It is writable in Firefox.

This patch was first landed in r190085 but was rolled out for causing
crashes: <rdar://problem/22825602>. The issue was that even though we
marked constructor as writable, we failed to generate a setter for it.
This patch addresses the issue and the crash in <rdar://problem/22825602>
no longer occurs after this change. A regression test is also added for
this crash.