Closed Bug 1624068 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 22374 - Disable @import in replace() and replaceSync()

Categories

(Core :: DOM: CSS Object Model, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 22374 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/22374
Details from upstream follow.

Mason Freed <masonfreed@chromium.org> wrote:

Disable @import in replace() and replaceSync()

The CSSWG resolved [1] that "@import doesn't parse in constructable
stylesheets and as a result throw syntax errors". We have a comment [2]
requesting clarification, but the working assumption is:

  • calling replace() with text that includes @import will ignore the
    @import, and issue a console warning.
  • calling replaceSync() with text that includes @import will ignore
    the @import, and issue a console warning.
  • calling insertRule() on any stylesheet with an @import rule will
    throw a SyntaxError.

Prior to this CL, the behavior of Chromium was:

  • calling replace() with text that includes @import would work. The
    returned Promise would resolve once all @imports were loaded. Any
    invalid @import rules would cause a NetworkError to be thrown.
  • calling replaceSync() with text that includes @import would throw
    a "NotAllowed" exception.
  • calling insertRule() with an @import rule would throw a SyntaxError
    for constructed stylesheets only. No exception would be thrown for
    document.styleSheets.

The Intent to Remove for this change is at [3].

[1] https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-597733392
[2] https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-600410089
[3] https://groups.google.com/a/chromium.org/g/blink-dev/c/RKG8oxp22RY/m/fdFnG1rGCgAJ

Bug: 1055943
Change-Id: I0a8444289b137b4c2880be5231696bb526331107
Reviewed-on: https://chromium-review.googlesource.com/2106996
WPT-Export-Revision: 0745ddeb55ee62b064e7dddc28a9ce1ac7387eee

Component: web-platform-tests → DOM: CSS Object Model
Product: Testing → Core
Test result changes from PR not available.
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c21642a6b4d4 [wpt PR 22374] - Disable @import in replace() and replaceSync(), a=testonly https://hg.mozilla.org/integration/autoland/rev/1c9c302fa1a7 [wpt PR 22374] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.