Forum Discussion

liaozichao's avatar
liaozichao
Copper Contributor
May 28, 2023

Empty fontFamily of a div causes browser crash with STATUS_BREAKPOINT.

Problem Description:

If a div is created in HTML and its fontFamily is set to an empty string, the browser crashes when rendering this div.

We have internally tested and found that this browser issue can be reproduced from version 1774.42 and above.

The following is a demo code:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

</head>

<body>

    <script>

        const _mustExistDefaultFont = 'Arial'

        const font = ''

        const testClick = (text = '', font = '') => {

            const el = document.getElementById('testFont')

         

             el.style.fontFamily = `'${font}'`;

            console.log('click');

        }

    </script>

    <button onclick="testClick()">测量</button>

    <div id="testFont"></div>



</body>

</html>

 

2 Replies

  • liaozichao's avatar
    liaozichao
    Copper Contributor
    The problem seems to be the garbled characters in the content of the <div id="testFont"></div> tag. I tried changing the content to input a space directly or use , and both worked without issues.

Resources