Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of dom::bindings::global #13596

Merged
merged 66 commits into from Oct 7, 2016
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b745866
Prevent doing use self::FooBinding::{}
nox Sep 26, 2016
5a42bb5
Implement [Inline] interfaces
nox Sep 26, 2016
093b189
Remove workerglobalscope::WorkerGlobalScopeTypeId
nox Sep 26, 2016
fcb59d3
Make reflect_dom_object take a &GlobalScope
nox Sep 27, 2016
38273fe
Introduce GlobalScope::crypto
nox Sep 27, 2016
3e5c0c3
Introduce GlobalScope::get_next_worker_id
nox Sep 27, 2016
d7c2da4
Introduce GlobalScope::live_devtools_updates
nox Sep 27, 2016
14a0b8d
Move console timers to GlobalScope
nox Oct 1, 2016
fe6fca9
Introduce GlobalScope::devtools_chan
nox Oct 1, 2016
bfa7d04
Introduce GlobalScope::mem_profiler_chan
nox Oct 1, 2016
ae3763e
Introduce GlobalScope::time_profiler_chan
nox Oct 1, 2016
f789e73
Introduce GlobalScope::constellation_chan
nox Oct 1, 2016
c6ff767
Introduce GlobalScope::scheduler_chan
nox Oct 1, 2016
27f100b
Introduce GlobalScope::pipeline_id
nox Oct 1, 2016
ae6af51
Introduce Reflectable::global_scope
nox Oct 1, 2016
896d8d4
Make throw_dom_exception take a &GlobalScope
nox Oct 1, 2016
a8c05c6
Make CanvasRenderingContext2d::new take a &GlobalScope
nox Oct 1, 2016
ac5a4ad
Make Promise::new take a &GlobalScope
nox Oct 1, 2016
b3393fb
Make StructuredCloneData::read take a &GlobalScope
nox Oct 1, 2016
20bacbf
Make dispatch_jsval methods take a &GlobalScope
nox Oct 1, 2016
2225260
Make WebGLRenderingContext::new take a &GlobalScope
nox Oct 1, 2016
e036579
Make XMLHttpRequest::new take a &GlobalScope
nox Oct 1, 2016
ac5c4c2
Make Error::to_jsval take a &GlobalScope
nox Oct 1, 2016
5bdc5a4
Use GlobalScope in dispatch_to_listeners
nox Oct 1, 2016
cb02d79
Do not use GlobalRoot in dom::xmlhttprequest
nox Oct 1, 2016
3302a53
Introduce GlobalScope::api_base_url
nox Oct 1, 2016
092504b
Make Console::send_to_devtools take a &GlobalScope
nox Oct 1, 2016
f38159b
Introduce GlobalScope::get_url
nox Oct 2, 2016
99b346a
Make Request::new take a &GlobalScope
nox Oct 2, 2016
2f54022
Remove some duplication in XMLHttpRequest methods
nox Oct 2, 2016
7660103
Introduce GlobalScope::as_window
nox Oct 2, 2016
9183525
Make XMLHttpRequest::new_doc use Reflectable::global_scope
nox Oct 2, 2016
d4fccba
Make bluetooth::result_to_promise take a &GlobalScope
nox Oct 2, 2016
86d2008
Introduce GlobalScope::report_an_error
nox Oct 3, 2016
bad49e4
Introduce GlobalScope::resource_threads
nox Oct 3, 2016
9a48ebb
Make dom::blob::read_file take a &GlobalScope
nox Oct 3, 2016
83feb7d
Make prepare_workerscope_init take a &GlobalScope
nox Oct 3, 2016
de846f2
Make create_scope_things take a &GlobalScope
nox Oct 3, 2016
71236e1
Introduce GlobalScope::core_resource_thread
nox Oct 3, 2016
a7305b7
Introduce GlobalScope::script_chan
nox Oct 3, 2016
1fd4708
Introduce GlobalScope::networking_task_source
nox Oct 3, 2016
19108aa
Pass a &GlobalScope to WebIDL static methods and constructors
nox Oct 3, 2016
9c04eb6
Move JS evaluation functions to GlobalScope
nox Oct 3, 2016
5d89792
Make devtools::handle_evaluate_js take a &GlobalScope
nox Oct 3, 2016
9918014
Move timers to GlobalScope
nox Oct 4, 2016
ca8c6fb
Make RunnableWrapper store an Option<Arc<AtomicBool>>
nox Oct 4, 2016
514819f
Introduce GlobalScope::get_runnable_wrapper
nox Oct 4, 2016
44ca9f3
Make TaskSource::queue take a &GlobalScope
nox Oct 4, 2016
6e3be6d
Introduce GlobalScope::flush_promise_jobs
nox Oct 4, 2016
2ee0730
Make PromiseJobQueue::enqueue take a &GlobalScope
nox Oct 4, 2016
4d9347d
Introduce GlobalScope::enqueue_promise_job
nox Oct 4, 2016
1fed45e
Use global_scope_from_object in Window::global_is_mozbrowser
nox Oct 4, 2016
26455b8
Remove global_root_from_reflector
nox Oct 4, 2016
02d38e7
Make Promise::Reject and Resolve take a &GlobalScope
nox Oct 4, 2016
144dc62
Do not use GlobalRoot in CodegenRust anymore
nox Oct 4, 2016
1f8bb3a
Make Fetch take a &GlobalScope
nox Oct 4, 2016
cdf3ef0
Introduce GlobalScope::new_script_pair
nox Oct 5, 2016
ca15dd5
Introduce GlobalScope::process_event
nox Oct 5, 2016
0a11c48
Make XMLHttpRequest::fetch take a &GlobalScope
nox Oct 5, 2016
e7a1149
Introduce GlobalScope::file_reading_task_source
nox Oct 5, 2016
907781e
Remove Reflectable::global
nox Oct 5, 2016
00e66a7
Make workers' interrupt_callback use GlobalScope
nox Oct 5, 2016
996fd28
Use global_scope_from_context in TestBinding::PromiseNativeHandler
nox Oct 5, 2016
c66cf46
Make the closure in flush_promise_jobs return a Root<GlobalScope>
nox Oct 5, 2016
b6bbd41
Remove GlobalRoot and GlobalRef
nox Oct 5, 2016
d8e92bb
Rename Reflectable::global_scope to global
nox Oct 5, 2016
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Make Console::send_to_devtools take a &GlobalScope

  • Loading branch information
nox committed Oct 6, 2016
commit 092504b4e3c10593730e3c625f98863651b9cc91
@@ -4,23 +4,23 @@

use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg};
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope;
use dom::workerglobalscope::WorkerGlobalScope;

// https://developer.mozilla.org/en-US/docs/Web/API/Console
pub struct Console(());

impl Console {
fn send_to_devtools(global: GlobalRef, level: LogLevel, message: DOMString) {
let global_scope = global.as_global_scope();
if let Some(chan) = global_scope.devtools_chan() {
fn send_to_devtools(global: &GlobalScope, level: LogLevel, message: DOMString) {
if let Some(chan) = global.devtools_chan() {
let console_message = prepare_message(level, message);
let worker_id = if let GlobalRef::Worker(worker) = global {
Some(worker.get_worker_id())
} else {
None
};
let worker_id = global.downcast::<WorkerGlobalScope>().map(|worker| {
worker.get_worker_id()
});
let devtools_message = ScriptToDevtoolsControlMsg::ConsoleAPI(
global_scope.pipeline_id(),
global.pipeline_id(),
console_message,
worker_id);
chan.send(devtools_message).unwrap();
@@ -33,39 +33,39 @@ impl Console {
pub fn Log(global: GlobalRef, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Log, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Log, message);
}
}

// https://developer.mozilla.org/en-US/docs/Web/API/Console
pub fn Debug(global: GlobalRef, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Debug, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Debug, message);
}
}

// https://developer.mozilla.org/en-US/docs/Web/API/Console/info
pub fn Info(global: GlobalRef, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Info, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Info, message);
}
}

// https://developer.mozilla.org/en-US/docs/Web/API/Console/warn
pub fn Warn(global: GlobalRef, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Warn, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Warn, message);
}
}

// https://developer.mozilla.org/en-US/docs/Web/API/Console/error
pub fn Error(global: GlobalRef, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Error, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Error, message);
}
}

@@ -74,7 +74,7 @@ impl Console {
if !condition {
let message = message.unwrap_or_else(|| DOMString::from("no message"));
println!("Assertion failed: {}", message);
Self::send_to_devtools(global, LogLevel::Error, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Error, message);
}
}

@@ -83,7 +83,7 @@ impl Console {
if let Ok(()) = global.as_global_scope().time(label.clone()) {
let message = DOMString::from(format!("{}: timer started", label));
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Log, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Log, message);
}
}

@@ -94,7 +94,7 @@ impl Console {
format!("{}: {}ms", label, delta)
);
println!("{}", message);
Self::send_to_devtools(global, LogLevel::Log, message);
Self::send_to_devtools(global.as_global_scope(), LogLevel::Log, message);
};
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.