Project

General

Profile

« Previous | Next » 

Revision 96efcc33

Added by koszko over 1 year ago

improve script blocking in non-HTML documents (XML)

View differences:

test/haketilo_test/unit/utils.py
228 228
        return driver.execute_script(
229 229
            '''
230 230
            document.haketilo_scripts_allowed = false;
231
            const script = document.createElement("script");
231
            const html_ns = "http://www.w3.org/1999/xhtml";
232
            const script = document.createElementNS(html_ns, "script");
232 233
            script.innerHTML = "document.haketilo_scripts_allowed = true;";
233 234
            if (arguments[0])
234 235
                script.setAttribute("nonce", arguments[0]);
235
            document.head.append(script);
236
            (document.head || document.documentElement).append(script);
236 237
            return document.haketilo_scripts_allowed;
237 238
            ''',
238 239
            nonce)

Also available in: Unified diff