Skip to content
Permalink
Browse files

Issue warning to devtools when module scripts in use.

  • Loading branch information
jdm committed Dec 12, 2019
1 parent b3b72cb commit 55eb34b8a92a5618ab1bfe4d4cb7f53d872a48b5
Showing with 30 additions and 0 deletions.
  1. +23 −0 components/script/dom/globalscope.rs
  2. +7 −0 components/script/dom/htmlscriptelement.rs
@@ -970,6 +970,29 @@ impl GlobalScope {
self.devtools_chan.as_ref()
}

pub fn issue_page_warning(&self, warning: &str) {
if let Some(ref chan) = self.devtools_chan {
let _ = chan.send(ScriptToDevtoolsControlMsg::ReportPageError(
self.pipeline_id.clone(),
PageError {
type_: "PageError".to_string(),
errorMessage: warning.to_string(),
sourceName: self.get_url().to_string(),
lineText: "".to_string(),
lineNumber: 0,
columnNumber: 0,
category: "script".to_string(),
timeStamp: 0, //TODO
error: false,
warning: true,
exception: true,
strict: false,
private: false,
},
));
}
}

/// Get a sender to the memory profiler thread.
pub fn mem_profiler_chan(&self) -> &profile_mem::ProfilerChan {
&self.mem_profiler_chan
@@ -559,6 +559,10 @@ impl HTMLScriptElement {
"{} is a module script. It should be fixed after #23545 landed.",
url.clone()
);
self.global().issue_page_warning(&format!(
"Module scripts are not supported; {} will not be executed.",
url.clone()
));
},
}
} else {
@@ -578,6 +582,9 @@ impl HTMLScriptElement {
"{} is a module script. It should be fixed after #23545 landed.",
base_url.clone()
);
self.global().issue_page_warning(
"Module scripts are not supported; ignoring inline module script.",
);
return;
}

0 comments on commit 55eb34b

Please sign in to comment.
You can’t perform that action at this time.