../WebCore: [Windows] Enable CaptionUserPreferencesMediaAF on Windows.
https://bugs.webkit.org/show_bug.cgi?id=118076

Reviewed by Eric Carlson.

* WebCore.vcxproj/WebCore.vcxproj: Enable building the CaptionUserPreferencesMediaAF source file.
* page/CaptionUserPreferencesMediaAF.cpp: Add soft-link commands for CoreText symbols needed in
  the implementation for Windows.
* platform/LocalizedStrings.cpp: Enable Text Track-related strings on Windows.
* platform/LocalizedStrings.h: Ditto.

../WTF: [Windows] Enable CaptionUserPreferenceMediaAF on Windows.
https://bugs.webkit.org/show_bug.cgi?id=118076

Reviewed by Eric Carlson.

* wtf/Platform.h: Enable Media Accessibility Framework in Windows build environments
  that support it.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build correction after r152035.

* page/CaptionUserPreferencesMediaAF.cpp: Don't attempt to include CoreText.h
  if we do not have MediaAccessibility Framework.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Potential use-after-free after neutering AudioBuffer's underlying ArrayBuffer.
https://bugs.webkit.org/show_bug.cgi?id=118040

Reviewed by Filip Pizlo.

Source/WebCore:

Test: webaudio/audiobuffer-neuter.html

When creating an AudioBuffer's backing ArrayBufferView objects, mark them as 'unneuterable',
meaning the underlying data will be copied in a neuter scenario rather than transferred. This
means the underlying assumtions of the webaudio code can continue to assume that the memory
areas owned by the ArrayBufferView will be present until the AudioBuffer is itself destroyed.

In order to not expose the 'unneuterable' behavior to JavaScript, return a fresh Float32Array
wrapper around the ArrayBuffer object, rather than our own.

* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::AudioBuffer): Mark the newly created channels as not neuterable.
(WebCore::AudioBuffer::getChannelData): Return a new Float32Array object rather than a pointer to our own.
* Modules/webaudio/AudioBuffer.h:

Source/WTF:

Add support for 'unneuterable' ArrayBufferViews. Views marked as such will have their underlying
ArrayBuffer objects copied rather than transferred to a new view.

* wtf/ArrayBuffer.cpp:
(WTF::ArrayBuffer::transfer): Check whether the associated views are neuterable, and if not
        clone the ArrayBuffer rather than transferring it.
* wtf/ArrayBuffer.h:
(WTF::ArrayBufferContents::copyTo): Added. Utility function.
* wtf/ArrayBufferView.cpp:
(WTF::ArrayBufferView::ArrayBufferView):
(WTF::ArrayBufferView::neuter):
* wtf/ArrayBufferView.h:
(WTF::ArrayBufferView::setNeuterable):
(WTF::ArrayBufferView::isNeuterable):

LayoutTests:

* webaudio/audiobuffer-neuter.html: Added.
* webaudio/audiobuffer-neuter-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add JSStringCreateWithCharactersNoCopy SPI
https://bugs.webkit.org/show_bug.cgi?id=118074
<rdar://problem/14279905>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* API/JSStringRef.cpp:
(JSStringCreateWithCharactersNoCopy):
Create a new OpaqueJSString, using the newly added StringImpl::createWithoutCopying function.

* API/JSStringRefPrivate.h: Added.
Add a home for the JSStringCreateWithCharactersNoCopy function.

* API/OpaqueJSString.h:
(OpaqueJSString::OpaqueJSString):
Just call isolatedCopy on the passed in string.

* API/tests/testapi.c:
Add an API test for JSStringCreateWithCharactersNoCopy.

* JavaScriptCore.xcodeproj/project.pbxproj:
Add new files.

Source/WTF:

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::createFromLiteral):
Use the new ConstructWithoutCopying constructor, passing DoesHaveTerminatingNullCharacter to it.
Change the other createFromLiteral overload to just call the first.

(WTF::StringImpl::createWithoutCopying):
Add helper functions for creating strings that shouldn't copy their underlying data.

* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl):
Rename the ConstructFromLiteralTag constructor enum to ConstructWithoutCopyingTag. Change the constructor
to take an enum that states whether the string has a terminating null character or not.

(WTF::StringImpl::createFromLiteral):
Call createWithoutCopying.

(WTF::StringImpl::requiresCopy):
Rename this from isASCIILiteral() and make it more generic so it can handle 16-bit strings as well.

(WTF::StringImpl::isolatedCopy):
If this string doesn't have to be copied, just create a new StringImpl object that references the current data.

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