modern-media-controls script should not be allocated in heap
https://bugs.webkit.org/show_bug.cgi?id=223309
Reviewed by Devin Rousso.
Source/JavaScriptCore:
Add --fail-if-non-ascii flag to ensure that input files do not include non-ASCII characters.
- Scripts/make-js-file-arrays.py:
(main):
Source/WebCore:
Previously, we are concatenating several modern-media-controls scripts into one.
But this causes significant memory overhead (~600KB). Using NSBundle's data still
allocates memory since WTF::String(CFString) allocates heap memory.
Let's use existing mechanism designed for this purpose. We serialize modern-media-controls.js into const C array in
UserAgentScriptData.cpp. UserAgentScript is a mechanism for having user-agent specific script source, and this matches
to our purpose. (for example, UserAgentStyleSheets (CSS version of that) have html.css etc.).
We also InjectedScript_*.js name for these ModernMediaControls.js scripts while this is not directly related to the
heap usage reduction of this patch.
This patch does not do the same thing for CSS of modern-media-controls since this patch's focus is script files first.
- DerivedSources-input.xcfilelist:
- DerivedSources-output.xcfilelist:
- DerivedSources.make:
- Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::quickTimePluginReplacementScript):
- WebCore.xcodeproj/project.pbxproj:
- html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::RenderTheme::mediaControlsScripts):
(WebCore::RenderTheme::mediaControlsScript): Deleted.
- rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::mediaControlsScripts):
(WebCore::RenderThemeAdwaita::mediaControlsScript): Deleted.
- rendering/RenderThemeAdwaita.h:
- rendering/RenderThemeIOS.h:
- rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::purgeCaches):
(WebCore::RenderThemeIOS::mediaControlsScripts):
(WebCore::RenderThemeIOS::mediaControlsScript): Deleted.
- rendering/RenderThemeMac.h:
- rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::purgeCaches):
(WebCore::RenderThemeMac::mediaControlsScripts):
(WebCore::RenderThemeMac::mediaControlsScript): Deleted.
- rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::mediaControlsScripts):
(WebCore::RenderThemeWin::mediaControlsScript): Deleted.
- rendering/RenderThemeWin.h: