Skip to content

Commit

Permalink
Add explicit "crossorigin" attribute to bundle script tag in bootstrap (
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Eriksson authored and Denis committed Dec 13, 2019
1 parent 53abdfd commit 9fe7fa8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,11 @@ private void appendNpmBundle(Element head, VaadinService service,
Element script = createJavaScriptElement(
"./" + VAADIN_MAPPING + chunks.getString(key),
false);
head.appendChild(
script.attr("type", "module").attr("data-app-id",
context.getUI().getInternals().getAppId()));
head.appendChild(script.attr("type", "module")
.attr("data-app-id",
context.getUI().getInternals().getAppId())
// Fixes basic auth in Safari #6560
.attr("crossorigin", true));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,14 +1097,14 @@ public void index_appended_to_head_in_npm()
+ "build/webcomponentsjs/webcomponents-loader.js\"></script>")));

Assert.assertTrue(
"index.js should be added to head for ES6 browsers. (type module)",
"index.js should be added to head for ES6 browsers. (type module with crossorigin)",
allElements.stream().map(Object::toString)
.anyMatch(element -> element
.equals("<script type=\"module\" src=\"./"
+ VAADIN_MAPPING
+ "build/index-1111.cache.js\" data-app-id=\""
+ testUI.getInternals().getAppId()
+ "\"></script>")));
+ "\" crossorigin></script>")));

Assert.assertTrue(
"index.js should be added to head for ES5 browsers. (deferred and nomodule)",
Expand Down

0 comments on commit 9fe7fa8

Please sign in to comment.