Bug 254617 - innerHTML serialization should not have a special handling for javascript: URLs
Summary: innerHTML serialization should not have a special handling for javascript: URLs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar, WPTImpact
Depends on:
Blocks:
 
Reported: 2023-03-28 13:54 PDT by Ahmad Saleem
Modified: 2023-03-29 04:36 PDT (History)
1 user (show)

See Also:


Attachments
Partial Patch for Merge - Local Testing (Build) .cpp side (1.32 MB, image/png)
2023-03-28 13:54 PDT, Ahmad Saleem
no flags Details
Partial Merge (.cpp) - MarkupAccumulator.cpp (1.38 MB, image/png)
2023-03-28 13:56 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-03-28 13:54:12 PDT
Created attachment 465640 [details]
Partial Patch for Merge - Local Testing (Build) .cpp side

Hi Team,

While going through Chromium's Monorail, I came across another failing test case:

What steps will reproduce the problem?
(1) Open the following URL
data:text/html;charset=utf-8,<body> <div id=target><a href="javascript:&quot;foobar&quot;">link</a></div> <pre></pre> <script> alert(document.querySelector('div').innerHTML); </script> </body>

What is the expected result?
It should show an alert dialog with:
  <a href="javascript:&quot;foobar&quot;">link</a>


What happens instead?
It shows an alert dialog with:
  <a href='javascript:"foobar"'>link</a>

Chrome Bug - https://bugs.chromium.org/p/chromium/issues/detail?id=927164

Blink Commit - https://chromium.googlesource.com/chromium/src.git/+/a806a0593906b75b9396d3bbd092bdda9161bf4c

WPT Tests Progression - Two subtests of http://wpt.live/html/syntax/serializing-html-fragments/serializing.html

Just wanted to raise so we can fix and get more WPT wins and browser compat wins.

Thanks!
Comment 1 Ahmad Saleem 2023-03-28 13:56:34 PDT
Created attachment 465641 [details]
Partial Merge (.cpp) - MarkupAccumulator.cpp

Actual Patch.
Comment 2 EWS 2023-03-29 04:35:09 PDT
Committed 262267@main (948db072bd94): <https://commits.webkit.org/262267@main>

Reviewed commits have been landed. Closing PR #12075 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-03-29 04:36:17 PDT
<rdar://problem/107362610>