Skip to content

Commit ed994fb

Browse files
authored
Use onNodeCreated to set crossorigin: anonymous on requirejs scripts (#3031)
* Use onNodeCreated to set crossorigin: anonymous on requirejs scripts * Add comment
1 parent 3a61145 commit ed994fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkgs/dartpad_ui/lib/execution/frame.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,14 @@ window.onerror = function(message, url, line, column, error) {
8888
};
8989
''');
9090

91+
// Set the crossorigin: anonymous attribute on require.js scripts.
92+
// For example, dart_sdk.js or flutter_web.js.
9193
if (modulesBaseUrl != null) {
9294
script.writeln('''
9395
require.config({
9496
"baseUrl": "$modulesBaseUrl",
95-
"waitSeconds": 60
97+
"waitSeconds": 60,
98+
"onNodeCreated": function(node, config, id, url) { node.setAttribute('crossorigin', 'anonymous'); }
9699
});
97100
''');
98101
}

0 commit comments

Comments
 (0)