diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index b1d88192d3e..f4ad2613e1e 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -1554,9 +1554,13 @@ nsresult HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) if (nsnull != src) { // Use the SRC attribute value to open a blocking stream nsIURL* url = nsnull; - char* spec = src->ToNewCString(); - rv = NS_NewURL(&url, nsnull, spec); - delete spec; + nsAutoString absURL, baseURL;/* XXX */ + nsIURL* docURL = mDocument->GetDocumentURL(); + rv = NS_MakeAbsoluteURL(docURL, baseURL, *src, absURL); + if (NS_OK != rv) { + return rv; + } + rv = NS_NewURL(&url, nsnull, absURL); delete src; if (NS_OK != rv) { return rv; diff --git a/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp index b1d88192d3e..f4ad2613e1e 100644 --- a/layout/html/document/src/nsHTMLContentSink.cpp +++ b/layout/html/document/src/nsHTMLContentSink.cpp @@ -1554,9 +1554,13 @@ nsresult HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) if (nsnull != src) { // Use the SRC attribute value to open a blocking stream nsIURL* url = nsnull; - char* spec = src->ToNewCString(); - rv = NS_NewURL(&url, nsnull, spec); - delete spec; + nsAutoString absURL, baseURL;/* XXX */ + nsIURL* docURL = mDocument->GetDocumentURL(); + rv = NS_MakeAbsoluteURL(docURL, baseURL, *src, absURL); + if (NS_OK != rv) { + return rv; + } + rv = NS_NewURL(&url, nsnull, absURL); delete src; if (NS_OK != rv) { return rv;