summaryrefslogtreecommitdiffstats
path: root/dom/base/EventSource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/EventSource.cpp')
-rw-r--r--dom/base/EventSource.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp
index f70db487dd..def3c90ec0 100644
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -568,7 +568,15 @@ nsresult EventSourceImpl::ParseURL(const nsAString& aURL) {
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> srcURI;
- rv = NS_NewURI(getter_AddRefs(srcURI), aURL, nullptr, baseURI);
+ nsCOMPtr<Document> doc =
+ mIsMainThread ? GetEventSource()->GetDocumentIfCurrent() : nullptr;
+ if (doc) {
+ rv = NS_NewURI(getter_AddRefs(srcURI), aURL, doc->GetDocumentCharacterSet(),
+ baseURI);
+ } else {
+ rv = NS_NewURI(getter_AddRefs(srcURI), aURL, nullptr, baseURI);
+ }
+
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_SYNTAX_ERR);
nsAutoString origin;