[Webkit-unassigned] [Bug 218168] New: iOS safari WebGL memory leak in iframe

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 25 23:25:49 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=218168

            Bug ID: 218168
           Summary: iOS safari WebGL memory leak in iframe
           Product: WebKit
           Version: Safari 14
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebGL
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bjtuwanglei at gmail.com
                CC: dino at apple.com

Created attachment 412291

  --> https://bugs.webkit.org/attachment.cgi?id=412291&action=review

memory leak log

Test environment: iPad6 iOS 14

I have a sample html with a iframe in it.Each time the iframe switch from webgl page to blank,memory leak occurs.Repeat this safari will finally crash and reload.

Safari memory usage can be seen from perfdog(perfdog.wetest.net).Note: filter process to "com.apple.WebKit.WebContent".

Attach is memory leak log pic.

Test iframe page:

<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        * {
            box-sizing: border-box;
        }

        /* Create two equal columns that floats next to each other */
        .column {
            float: left;
            width: 80%;
            padding: 10px;
            height: 600px;
            /* Should be removed. Only for demonstration */
        }

        .column2 {
            float: left;
            width: 20%;
            padding: 10px;
            height: 600px;
            /* Should be removed. Only for demonstration */
        }

        /* Clear floats after the columns */
        .row:after {
            content: "";

            clear: both;
        }
    </style>
</head>

<body>
    <script>
        function htmlToElement(html) {
            var template = document.createElement('template');
            html = html.trim(); // Never return a text node of whitespace as the result
            template.innerHTML = html;
            return template.content.firstChild;
        }

        function createIframeIfNotExists() {
            let iframe = document.getElementById("iframe");
            if (!iframe) {
                const deviceLostHtmlString = `
                    <iframe id="iframe" src="" width="100%" height="100%" title="Iframe Example"></iframe>
                    `;
                iframe = htmlToElement(deviceLostHtmlString);
                document.getElementById("iframe_parent").appendChild(iframe);
            }
            return iframe;
        }

        function toWebgl() {
            createIframeIfNotExists().src = "https://webglsamples.org/aquarium/aquarium.html";
        }
        function toBlank() {
            let iframe = document.getElementById("iframe");
            if (iframe) {
                iframe.src = "about:blank";
                // iframe.contentWindow.document.write('');
                // iframe.contentWindow.document.clear();
                // iframe.parentNode.removeChild(iframe);
            }
        }
        function toGitee() {
            createIframeIfNotExists().src = "https://gitee.com";
        }
    </script>

    <h2>Two Equal Columns</h2>

    <div class="row">
        <div id="iframe_parent" class="column" style="background-color:#aaa;">
            <!-- <iframe id="iframe" src="" width="100%" height="100%" title="Iframe Example"></iframe> -->
        </div>
        <div class="column2" style="background-color:#bbb;">
            <button onclick="toBlank()">about:blank</button>
            <button onclick="toWebgl()">WebGL sample</button>
            <button onclick="toGitee()">gitee</button>
        </div>
    </div>
</body>

</html>

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201026/a126fa3d/attachment-0001.htm>


More information about the webkit-unassigned mailing list