Fix for issue #3238

Moved the Atob and Btoa methods ouside the impl for WorkerMethod trait
and made them publicly accessible from WorkerGlobalScopeMethods via
proxy methods.
This commit is contained in:
Prasoon Shukla 2014-09-16 19:25:43 +05:30
parent aa935c7b02
commit e0f2c9edc1
3 changed files with 88 additions and 70 deletions

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods;
use dom::bindings::error::{ErrorResult, Syntax, Network, FailureUnknown};
use dom::bindings::error::{ErrorResult, Fallible, Syntax, Network, FailureUnknown};
use dom::bindings::trace::Untraceable;
use dom::bindings::global;
use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable};
@ -12,6 +12,7 @@ use dom::console::Console;
use dom::eventtarget::{EventTarget, WorkerGlobalScopeTypeId};
use dom::workerlocation::WorkerLocation;
use dom::workernavigator::WorkerNavigator;
use dom::window::{base64_atob, base64_btoa};
use script_task::ScriptChan;
use servo_net::resource_task::{ResourceTask, load_whole_resource};
@ -136,6 +137,14 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
}
Temporary::new(self.console.get().get_ref().clone())
}
fn Btoa(&self, btoa: DOMString) -> Fallible<DOMString> {
base64_btoa(btoa)
}
fn Atob(&self, atob: DOMString) -> Fallible<DOMString> {
base64_atob(atob)
}
}
impl Reflectable for WorkerGlobalScope {