Diff
Modified: trunk/LayoutTests/ChangeLog (280645 => 280646)
--- trunk/LayoutTests/ChangeLog 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/LayoutTests/ChangeLog 2021-08-04 18:39:37 UTC (rev 280646)
@@ -1,3 +1,17 @@
+2021-08-04 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r280630.
+ https://bugs.webkit.org/show_bug.cgi?id=228788
+
+ broke some downstream tests
+
+ Reverted changeset:
+
+ "fast/canvas/canvas-crash.html doesn't test what it intends to
+ on iOS"
+ https://bugs.webkit.org/show_bug.cgi?id=228747
+ https://commits.webkit.org/r280630
+
2021-08-04 Arcady Goldmints-Orlov <[email protected]>
[GLIB] Unreviewed test gardening, update baselines after r280017
Modified: trunk/LayoutTests/fast/canvas/canvas-crash.html (280645 => 280646)
--- trunk/LayoutTests/fast/canvas/canvas-crash.html 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/LayoutTests/fast/canvas/canvas-crash.html 2021-08-04 18:39:37 UTC (rev 280646)
@@ -12,10 +12,6 @@
function canvastest()
{
- if (window.internals) {
- window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);
- window.internals.setMaxCanvasArea(13951 * 11138);
- }
var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138);
ctx.putImageData(ctx.getImageData(1431655766, document.getElementById("a").appendChild(document.createElement("media")).clientWidth, 4096, -1024), 128, -65535, 127, -2147483648, 2147483647, -2147483648);
}
Modified: trunk/LayoutTests/fast/canvas/canvas-skia-excessive-size.html (280645 => 280646)
--- trunk/LayoutTests/fast/canvas/canvas-skia-excessive-size.html 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/LayoutTests/fast/canvas/canvas-skia-excessive-size.html 2021-08-04 18:39:37 UTC (rev 280646)
@@ -11,11 +11,6 @@
if (window.testRunner)
testRunner.dumpAsText();
- if (window.internals) {
- window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);
- window.internals.setMaxCanvasArea(134217728);
- }
-
var canvas = document.getElementById("bigCanvas");
var width = canvas.width;
// We need to perform a context fetch to force allocation of
Added: trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-crash-expected.txt (0 => 280646)
--- trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-crash-expected.txt 2021-08-04 18:39:37 UTC (rev 280646)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: Total canvas memory use exceeds the maximum limit (224 MB).
+CONSOLE MESSAGE: TypeError: null is not an object (evaluating 'ctx.putImageData')
+
Added: trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt (0 => 280646)
--- trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt 2021-08-04 18:39:37 UTC (rev 280646)
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: Total canvas memory use exceeds the maximum limit (224 MB).
+This test checks to see if the browser survives the attempted creation of an excessively large canvas.
+
+Canvas 2d context = null!
+Survived canvas creation attempt. Width = 134217728
+
Modified: trunk/Source/WebCore/ChangeLog (280645 => 280646)
--- trunk/Source/WebCore/ChangeLog 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/ChangeLog 2021-08-04 18:39:37 UTC (rev 280646)
@@ -1,3 +1,17 @@
+2021-08-04 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r280630.
+ https://bugs.webkit.org/show_bug.cgi?id=228788
+
+ broke some downstream tests
+
+ Reverted changeset:
+
+ "fast/canvas/canvas-crash.html doesn't test what it intends to
+ on iOS"
+ https://bugs.webkit.org/show_bug.cgi?id=228747
+ https://commits.webkit.org/r280630
+
2021-08-04 Antti Koivisto <[email protected]>
Use fast malloc for RuleData vectors
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (280645 => 280646)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-08-04 18:39:37 UTC (rev 280646)
@@ -111,9 +111,17 @@
const int defaultWidth = 300;
const int defaultHeight = 150;
-static std::optional<size_t> maxCanvasAreaForTesting;
-static std::optional<size_t> maxActivePixelMemoryForTesting;
+// Firefox limits width/height to 32767 pixels, but slows down dramatically before it
+// reaches that limit. We limit by area instead, giving us larger maximum dimensions,
+// in exchange for a smaller maximum canvas size. The maximum canvas size is in device pixels.
+#if PLATFORM(IOS_FAMILY)
+const unsigned maxCanvasArea = 4096 * 4096;
+#else
+const unsigned maxCanvasArea = 16384 * 16384;
+#endif
+static size_t maxActivePixelMemoryForTesting = 0;
+
HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
, CanvasBase(IntSize(defaultWidth, defaultHeight))
@@ -204,7 +212,7 @@
static inline size_t maxActivePixelMemory()
{
if (maxActivePixelMemoryForTesting)
- return *maxActivePixelMemoryForTesting;
+ return maxActivePixelMemoryForTesting;
static size_t maxPixelMemory;
static std::once_flag onceFlag;
@@ -219,31 +227,11 @@
return maxPixelMemory;
}
-void HTMLCanvasElement::setMaxPixelMemoryForTesting(std::optional<size_t> size)
+void HTMLCanvasElement::setMaxPixelMemoryForTesting(size_t size)
{
maxActivePixelMemoryForTesting = size;
}
-static inline size_t maxCanvasArea()
-{
- if (maxCanvasAreaForTesting)
- return *maxCanvasAreaForTesting;
-
- // Firefox limits width/height to 32767 pixels, but slows down dramatically before it
- // reaches that limit. We limit by area instead, giving us larger maximum dimensions,
- // in exchange for a smaller maximum canvas size. The maximum canvas size is in device pixels.
-#if PLATFORM(IOS_FAMILY)
- return 4096 * 4096;
-#else
- return 16384 * 16384;
-#endif
-}
-
-void HTMLCanvasElement::setMaxCanvasAreaForTesting(std::optional<size_t> size)
-{
- maxCanvasAreaForTesting = size;
-}
-
ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::JSGlobalObject& state, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
{
if (m_context) {
@@ -878,8 +866,8 @@
auto checkedArea = size().area<RecordOverflow>();
- if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea()) {
- auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea(), ").");
+ if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea) {
+ auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea, ").");
document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, message);
return;
}
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (280645 => 280646)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2021-08-04 18:39:37 UTC (rev 280646)
@@ -128,8 +128,7 @@
// It would be better to have the contexts own the buffers.
void setImageBufferAndMarkDirty(RefPtr<ImageBuffer>&&);
- WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(std::optional<size_t>);
- WEBCORE_EXPORT static void setMaxCanvasAreaForTesting(std::optional<size_t>);
+ WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(size_t);
bool needsPreparationForDisplay();
void prepareForDisplay();
Modified: trunk/Source/WebCore/testing/Internals.cpp (280645 => 280646)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-08-04 18:39:37 UTC (rev 280646)
@@ -600,8 +600,7 @@
WebCore::MediaRecorder::setCustomPrivateRecorderCreator(nullptr);
#endif
- HTMLCanvasElement::setMaxPixelMemoryForTesting(std::nullopt);
- HTMLCanvasElement::setMaxCanvasAreaForTesting(std::nullopt);
+ HTMLCanvasElement::setMaxPixelMemoryForTesting(0); // This means use the default value.
DOMWindow::overrideTransientActivationDurationForTesting(std::nullopt);
#if PLATFORM(IOS)
@@ -6010,11 +6009,6 @@
HTMLCanvasElement::setMaxPixelMemoryForTesting(size);
}
-void Internals::setMaxCanvasArea(unsigned size)
-{
- HTMLCanvasElement::setMaxCanvasAreaForTesting(size);
-}
-
int Internals::processIdentifier() const
{
return getCurrentProcessID();
Modified: trunk/Source/WebCore/testing/Internals.h (280645 => 280646)
--- trunk/Source/WebCore/testing/Internals.h 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/testing/Internals.h 2021-08-04 18:39:37 UTC (rev 280646)
@@ -346,7 +346,6 @@
void setUserPreferredAudioCharacteristic(const String&);
void setMaxCanvasPixelMemory(unsigned);
- void setMaxCanvasArea(unsigned);
ExceptionOr<unsigned> wheelEventHandlerCount();
ExceptionOr<unsigned> touchEventHandlerCount();
Modified: trunk/Source/WebCore/testing/Internals.idl (280645 => 280646)
--- trunk/Source/WebCore/testing/Internals.idl 2021-08-04 18:29:51 UTC (rev 280645)
+++ trunk/Source/WebCore/testing/Internals.idl 2021-08-04 18:39:37 UTC (rev 280646)
@@ -937,7 +937,6 @@
undefined markContextAsInsecure();
undefined setMaxCanvasPixelMemory(unsigned long size);
- undefined setMaxCanvasArea(unsigned long size);
[Conditional=VIDEO] readonly attribute NowPlayingState nowPlayingState;