Title: [281487] trunk
Revision
281487
Author
commit-qu...@webkit.org
Date
2021-08-23 22:07:32 -0700 (Mon, 23 Aug 2021)

Log Message

Null check scriptExecutionContext
https://bugs.webkit.org/show_bug.cgi?id=229272

Patch by Rob Buis <rb...@igalia.com> on 2021-08-23
Reviewed by Ryosuke Niwa.

Source/WebCore:

Null check scriptExecutionContext in ensureLocalFontFacesForFamilyRegistered.

Tests: fast/text/font-face-set-add-crash.html

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):

LayoutTests:

* fast/text/font-face-set-add-crash-expected.txt: Added.
* fast/text/font-face-set-add-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281486 => 281487)


--- trunk/LayoutTests/ChangeLog	2021-08-24 03:38:06 UTC (rev 281486)
+++ trunk/LayoutTests/ChangeLog	2021-08-24 05:07:32 UTC (rev 281487)
@@ -1,3 +1,13 @@
+2021-08-23  Rob Buis  <rb...@igalia.com>
+
+        Null check scriptExecutionContext
+        https://bugs.webkit.org/show_bug.cgi?id=229272
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/text/font-face-set-add-crash-expected.txt: Added.
+        * fast/text/font-face-set-add-crash.html: Added.
+
 2021-08-23  John Wilander  <wilan...@apple.com>
 
         PCM: Support ephemeral measurement with non-persistent WebCore::PrivateClickMeasurement

Added: trunk/LayoutTests/fast/text/font-face-set-add-crash-expected.txt (0 => 281487)


--- trunk/LayoutTests/fast/text/font-face-set-add-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-face-set-add-crash-expected.txt	2021-08-24 05:07:32 UTC (rev 281487)
@@ -0,0 +1 @@
+Test passes if it does not crash.

Added: trunk/LayoutTests/fast/text/font-face-set-add-crash.html (0 => 281487)


--- trunk/LayoutTests/fast/text/font-face-set-add-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-face-set-add-crash.html	2021-08-24 05:07:32 UTC (rev 281487)
@@ -0,0 +1,19 @@
+<script>
+  if (window.testRunner)
+    window.testRunner.dumpAsText();
+  _onload_ = () => {
+    let div0 = document.createElement('div');
+    let progress0 = document.createElement('progress');
+    div0.appendChild(progress0);
+    let document2 = new Document();
+    document2.appendChild(div0);
+    progress0.cloneNode();
+    let fontFace = new FontFace('a', 'url()');
+    let fontFaceSet = document2.fonts;
+    queueMicrotask(() => {
+      window.GCController?.collect();
+      fontFaceSet.add(fontFace);
+      document.write("Test passes if it does not crash.");
+    });
+  };
+</script>

Modified: trunk/Source/WebCore/ChangeLog (281486 => 281487)


--- trunk/Source/WebCore/ChangeLog	2021-08-24 03:38:06 UTC (rev 281486)
+++ trunk/Source/WebCore/ChangeLog	2021-08-24 05:07:32 UTC (rev 281487)
@@ -1,3 +1,17 @@
+2021-08-23  Rob Buis  <rb...@igalia.com>
+
+        Null check scriptExecutionContext
+        https://bugs.webkit.org/show_bug.cgi?id=229272
+
+        Reviewed by Ryosuke Niwa.
+
+        Null check scriptExecutionContext in ensureLocalFontFacesForFamilyRegistered.
+
+        Tests: fast/text/font-face-set-add-crash.html
+
+        * css/CSSFontFaceSet.cpp:
+        (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
+
 2021-08-23  Alex Christensen  <achristen...@webkit.org>
 
         ThreadSanitizer: data race of WTF::StringImpl in WebCoreNSURLSessionDataTask._metrics instance variable

Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (281486 => 281487)


--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp	2021-08-24 03:38:06 UTC (rev 281486)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp	2021-08-24 05:07:32 UTC (rev 281487)
@@ -109,9 +109,9 @@
     if (m_locallyInstalledFacesLookupTable.contains(familyName))
         return;
 
-    AllowUserInstalledFonts allowUserInstalledFonts = AllowUserInstalledFonts::Yes;
-    if (m_owningFontSelector->scriptExecutionContext())
-        allowUserInstalledFonts = m_owningFontSelector->scriptExecutionContext()->settingsValues().shouldAllowUserInstalledFonts ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No;
+    if (!m_owningFontSelector->scriptExecutionContext())
+        return;
+    AllowUserInstalledFonts allowUserInstalledFonts = m_owningFontSelector->scriptExecutionContext()->settingsValues().shouldAllowUserInstalledFonts ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No;
     Vector<FontSelectionCapabilities> capabilities = m_owningFontSelector->scriptExecutionContext()->fontCache().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);
     if (capabilities.isEmpty())
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to