Skip to content

Commit

Permalink
Use onNodeCreated to set crossorigin: anonymous on requirejs scripts (#…
Browse files Browse the repository at this point in the history
…3031)

* Use onNodeCreated to set crossorigin: anonymous on requirejs scripts

* Add comment
  • Loading branch information
johnpryan authored Jul 22, 2024
1 parent 3a61145 commit ed994fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkgs/dartpad_ui/lib/execution/frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ window.onerror = function(message, url, line, column, error) {
};
''');

// Set the crossorigin: anonymous attribute on require.js scripts.
// For example, dart_sdk.js or flutter_web.js.
if (modulesBaseUrl != null) {
script.writeln('''
require.config({
"baseUrl": "$modulesBaseUrl",
"waitSeconds": 60
"waitSeconds": 60,
"onNodeCreated": function(node, config, id, url) { node.setAttribute('crossorigin', 'anonymous'); }
});
''');
}
Expand Down

0 comments on commit ed994fb

Please sign in to comment.