如何停止浏览器(Chrome)在32位窗口上加载图像时崩溃

时间:2019-04-26 10:37:16

标签: javascript google-chrome browser crash chromium

在image标记中,当在image src属性上设置base64时,浏览器崩溃, -操作系统:-32位窗口。 -版本:-6.1(Windows 7,Windows Server 2008 R2) -Chrome版本:-73.0.3683.103

要获取base64文本文件,请在Visual Studio中执行以下c#代码

 var bytImageData = File.ReadAllBytes(fileWithPath + ".png");
                    string strBase64ImageData = Convert.ToBase64String(bytImageData, 0, bytImageData.Length);
                    File.WriteAllText(fileWithPath + ".txt", strBase64ImageData);

Javascript代码

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>        
    <script>
        $(document).ready(function () {
            load();           
        });

        var _imageByteStream;       
        function load() {
            $("#scream").attr("src", "");
            $("#performanceText").val($("#performanceText").val() + '\n' + "Before image load :" + window.performance.memory.usedJSHeapSize);

            $.ajax({

                url: "Content/Images/ImageStream" + $("#imageSize").val().replace('MB', '') + ".txt",
                dataType: "TEXT",
                contentType: 'application/json',
                async: false,
                success: function (response) {
                    _imageByteStream = response;
                }
            });

            $("#scream").attr("src", "data:image/png;base64," + _imageByteStream);
            $("#performanceText").val($("#performanceText").val() + '\n' + "After image load :" + window.performance.memory.usedJSHeapSize);
            _imageByteStream = null;
        }


    </script>
</head>
<body>
    <div>
        <table>
            <tr>
                <td>
                    <div style="width:400px;height:300px;"><img id="scream" alt="The Scream" width="400" height="300" /></div>
                </td>
                <td>
                    <div style="width:400px;height:300px;">
                        <textarea style="width:280px;height:300px;" id="performanceText"></textarea>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <select style="margin-top:10px;" id="imageSize">                      
                        <option>50MB</option>
                        <option>57MB</option>                      
                    </select>
                </td>                
            </tr>
            <tr>
                <td><button style="margin-top:10px;" onclick="load()">Load</button></td>                
            </tr>
        </table>
    </div>
</body>
</html>

如何复制:

  1. 从下拉菜单中选择50 MB。单击加载按钮。
  2. 渲染图像后,从下拉列表中选择57 MB。单击加载按钮。
  3. 重复步骤1和2,直到浏览器崩溃。
  4. 大多数情况下,3-4个重复浏览器崩溃。

0 个答案:

没有答案