aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/Cargo.toml8
-rw-r--r--components/script/cors.rs39
-rw-r--r--components/script/document_loader.rs13
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py27
-rw-r--r--components/script/dom/bindings/conversions.rs6
-rw-r--r--components/script/dom/bindings/interface.rs61
-rw-r--r--components/script/dom/bindings/num.rs2
-rw-r--r--components/script/dom/bindings/trace.rs8
-rw-r--r--components/script/dom/bindings/utils.rs13
-rw-r--r--components/script/dom/blob.rs43
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs22
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs4
-rw-r--r--components/script/dom/document.rs38
-rw-r--r--components/script/dom/element.rs298
-rw-r--r--components/script/dom/eventsource.rs2
-rw-r--r--components/script/dom/eventtarget.rs2
-rw-r--r--components/script/dom/htmlanchorelement.rs33
-rw-r--r--components/script/dom/htmlbaseelement.rs4
-rw-r--r--components/script/dom/htmlcollection.rs4
-rw-r--r--components/script/dom/htmlfontelement.rs4
-rw-r--r--components/script/dom/htmlformelement.rs20
-rw-r--r--components/script/dom/htmliframeelement.rs2
-rw-r--r--components/script/dom/htmlimageelement.rs2
-rw-r--r--components/script/dom/htmllinkelement.rs14
-rw-r--r--components/script/dom/htmlscriptelement.rs32
-rw-r--r--components/script/dom/htmltableelement.rs10
-rw-r--r--components/script/dom/htmltablerowelement.rs4
-rw-r--r--components/script/dom/htmltablesectionelement.rs4
-rw-r--r--components/script/dom/macros.rs2
-rw-r--r--components/script/dom/node.rs19
-rw-r--r--components/script/dom/progressevent.rs6
-rw-r--r--components/script/dom/servohtmlparser.rs43
-rw-r--r--components/script/dom/storage.rs6
-rw-r--r--components/script/dom/storageevent.rs8
-rw-r--r--components/script/dom/url.rs30
-rw-r--r--components/script/dom/urlhelper.rs179
-rw-r--r--components/script/dom/urlsearchparams.rs52
-rw-r--r--components/script/dom/webglcontextevent.rs11
-rw-r--r--components/script/dom/webglprogram.rs22
-rw-r--r--components/script/dom/webglrenderingcontext.rs584
-rw-r--r--components/script/dom/webglshader.rs5
-rw-r--r--components/script/dom/webgltexture.rs39
-rw-r--r--components/script/dom/webgluniformlocation.rs3
-rw-r--r--components/script/dom/webidls/Attr.webidl1
-rw-r--r--components/script/dom/webidls/Blob.webidl4
-rw-r--r--components/script/dom/webidls/Bluetooth.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothAdvertisingData.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothCharacteristicProperties.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothDevice.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTServer.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTService.webidl1
-rw-r--r--components/script/dom/webidls/BluetoothUUID.webidl1
-rw-r--r--components/script/dom/webidls/BrowserElement.webidl1
-rw-r--r--components/script/dom/webidls/CSSStyleDeclaration.webidl2
-rw-r--r--components/script/dom/webidls/CanvasGradient.webidl1
-rw-r--r--components/script/dom/webidls/CanvasPattern.webidl1
-rw-r--r--components/script/dom/webidls/CanvasRenderingContext2D.webidl1
-rw-r--r--components/script/dom/webidls/CharacterData.webidl1
-rw-r--r--components/script/dom/webidls/ChildNode.webidl1
-rw-r--r--components/script/dom/webidls/Comment.webidl1
-rw-r--r--components/script/dom/webidls/Console.webidl1
-rw-r--r--components/script/dom/webidls/Crypto.webidl1
-rw-r--r--components/script/dom/webidls/CustomEvent.webidl1
-rw-r--r--components/script/dom/webidls/DOMException.webidl1
-rw-r--r--components/script/dom/webidls/DOMImplementation.webidl1
-rw-r--r--components/script/dom/webidls/DOMPoint.webidl1
-rw-r--r--components/script/dom/webidls/DOMPointReadOnly.webidl1
-rw-r--r--components/script/dom/webidls/DOMQuad.webidl1
-rw-r--r--components/script/dom/webidls/DOMRect.webidl1
-rw-r--r--components/script/dom/webidls/DOMRectList.webidl1
-rw-r--r--components/script/dom/webidls/DOMRectReadOnly.webidl1
-rw-r--r--components/script/dom/webidls/DOMStringMap.webidl1
-rw-r--r--components/script/dom/webidls/DOMTokenList.webidl1
-rw-r--r--components/script/dom/webidls/Document.webidl1
-rw-r--r--components/script/dom/webidls/DocumentFragment.webidl1
-rw-r--r--components/script/dom/webidls/DocumentType.webidl1
-rw-r--r--components/script/dom/webidls/Element.webidl12
-rw-r--r--components/script/dom/webidls/ElementCSSInlineStyle.webidl1
-rw-r--r--components/script/dom/webidls/Event.webidl1
-rw-r--r--components/script/dom/webidls/EventHandler.webidl1
-rw-r--r--components/script/dom/webidls/EventListener.webidl1
-rw-r--r--components/script/dom/webidls/EventSource.webidl1
-rw-r--r--components/script/dom/webidls/EventTarget.webidl1
-rw-r--r--components/script/dom/webidls/File.webidl1
-rw-r--r--components/script/dom/webidls/FileList.webidl1
-rw-r--r--components/script/dom/webidls/FileReader.webidl1
-rw-r--r--components/script/dom/webidls/FocusEvent.webidl1
-rw-r--r--components/script/dom/webidls/ForceTouchEvent.webidl1
-rw-r--r--components/script/dom/webidls/FormData.webidl1
-rw-r--r--components/script/dom/webidls/Function.webidl1
-rw-r--r--components/script/dom/webidls/HTMLAnchorElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLAppletElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLAreaElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLAudioElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLBRElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLBaseElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLBodyElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLButtonElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLCanvasElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLCollection.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDListElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDataElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDataListElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDetailsElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDialogElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDirectoryElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLDivElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLEmbedElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFieldSetElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFontElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFormControlsCollection.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFormElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFrameElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLFrameSetElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLHRElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLHeadElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLHeadingElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLHtmlElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl1
-rw-r--r--components/script/dom/webidls/HTMLIFrameElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLImageElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLInputElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLLIElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLLabelElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLLegendElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLLinkElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLMapElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLMediaElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLMetaElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLMeterElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLModElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLOListElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLObjectElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLOptGroupElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLOptionElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLOutputElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLParagraphElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLParamElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLPreElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLProgressElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLQuoteElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLScriptElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLSelectElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLSourceElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLSpanElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLStyleElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableCaptionElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableCellElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableColElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableDataCellElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableHeaderCellElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableRowElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTableSectionElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTemplateElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTextAreaElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTimeElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTitleElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLTrackElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLUListElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLUnknownElement.webidl1
-rw-r--r--components/script/dom/webidls/HTMLVideoElement.webidl1
-rw-r--r--components/script/dom/webidls/ImageData.webidl1
-rw-r--r--components/script/dom/webidls/KeyboardEvent.webidl1
-rw-r--r--components/script/dom/webidls/Location.webidl1
-rw-r--r--components/script/dom/webidls/MessageEvent.webidl1
-rw-r--r--components/script/dom/webidls/MimeType.webidl1
-rw-r--r--components/script/dom/webidls/MimeTypeArray.webidl1
-rw-r--r--components/script/dom/webidls/MouseEvent.webidl1
-rw-r--r--components/script/dom/webidls/Navigator.webidl1
-rw-r--r--components/script/dom/webidls/Node.webidl5
-rw-r--r--components/script/dom/webidls/NodeFilter.webidl1
-rw-r--r--components/script/dom/webidls/NodeIterator.webidl1
-rw-r--r--components/script/dom/webidls/NodeList.webidl1
-rw-r--r--components/script/dom/webidls/NonElementParentNode.webidl1
-rw-r--r--components/script/dom/webidls/ParentNode.webidl1
-rw-r--r--components/script/dom/webidls/Performance.webidl1
-rw-r--r--components/script/dom/webidls/PerformanceTiming.webidl1
-rw-r--r--components/script/dom/webidls/Plugin.webidl1
-rw-r--r--components/script/dom/webidls/PluginArray.webidl1
-rw-r--r--components/script/dom/webidls/ProcessingInstruction.webidl1
-rw-r--r--components/script/dom/webidls/ProgressEvent.webidl1
-rw-r--r--components/script/dom/webidls/RadioNodeList.webidl1
-rw-r--r--components/script/dom/webidls/Range.webidl1
-rw-r--r--components/script/dom/webidls/Screen.webidl1
-rw-r--r--components/script/dom/webidls/ServoHTMLParser.webidl1
-rw-r--r--components/script/dom/webidls/ServoXMLParser.webidl1
-rw-r--r--components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl1
-rw-r--r--components/script/dom/webidls/Storage.webidl1
-rw-r--r--components/script/dom/webidls/StorageEvent.webidl1
-rw-r--r--components/script/dom/webidls/StyleSheet.webidl1
-rw-r--r--components/script/dom/webidls/StyleSheetList.webidl1
-rw-r--r--components/script/dom/webidls/TestBindingProxy.webidl1
-rw-r--r--components/script/dom/webidls/Text.webidl1
-rw-r--r--components/script/dom/webidls/TextDecoder.webidl1
-rw-r--r--components/script/dom/webidls/TextEncoder.webidl1
-rw-r--r--components/script/dom/webidls/Touch.webidl1
-rw-r--r--components/script/dom/webidls/TouchEvent.webidl1
-rw-r--r--components/script/dom/webidls/TouchList.webidl1
-rw-r--r--components/script/dom/webidls/TreeWalker.webidl1
-rw-r--r--components/script/dom/webidls/UIEvent.webidl1
-rw-r--r--components/script/dom/webidls/URLSearchParams.webidl1
-rw-r--r--components/script/dom/webidls/ValidityState.webidl1
-rw-r--r--components/script/dom/webidls/WebGLContextEvent.webidl1
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl16
-rw-r--r--components/script/dom/webidls/Window.webidl1
-rw-r--r--components/script/dom/webidls/Worker.webidl1
-rw-r--r--components/script/dom/webidls/WorkerLocation.webidl1
-rw-r--r--components/script/dom/webidls/WorkerNavigator.webidl1
-rw-r--r--components/script/dom/webidls/XMLDocument.webidl1
-rw-r--r--components/script/dom/webidls/XMLHttpRequest.webidl1
-rw-r--r--components/script/dom/webidls/XMLHttpRequestEventTarget.webidl1
-rw-r--r--components/script/dom/webidls/XMLHttpRequestUpload.webidl1
-rw-r--r--components/script/dom/websocket.rs4
-rw-r--r--components/script/dom/window.rs62
-rw-r--r--components/script/dom/worker.rs2
-rw-r--r--components/script/dom/workerglobalscope.rs4
-rw-r--r--components/script/dom/xmlhttprequest.rs70
-rw-r--r--components/script/layout_interface.rs19
-rw-r--r--components/script/lib.rs3
-rw-r--r--components/script/origin.rs23
-rw-r--r--components/script/script_runtime.rs119
-rw-r--r--components/script/script_thread.rs108
-rw-r--r--components/script/timers.rs2
227 files changed, 1457 insertions, 894 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index 9fda41e036f..de8f2ce0f35 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -74,11 +74,11 @@ fnv = "1.0"
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
-hyper = { version = "0.8", features = [ "serde-serialization" ] }
+hyper = { version = "0.9", features = [ "serde-serialization" ] }
image = "0.9"
libc = "0.2"
log = "0.3.5"
-num = "0.1.24"
+num-traits = "0.1.32"
offscreen_gl_context = "0.1.2"
rand = "0.3"
phf = "0.7.13"
@@ -94,6 +94,6 @@ smallvec = "0.1"
string_cache = {version = "0.2.12", features = ["heap_size", "unstable"]}
time = "0.1.12"
unicase = "1.0"
-url = {version = "0.5.7", features = ["heap_size"]}
+url = {version = "1.0.0", features = ["heap_size"]}
uuid = { version = "0.2", features = ["v4"] }
-websocket = "0.16.1"
+websocket = "0.17"
diff --git a/components/script/cors.rs b/components/script/cors.rs
index da8c3db68ca..7635f2b5738 100644
--- a/components/script/cors.rs
+++ b/components/script/cors.rs
@@ -18,7 +18,7 @@ use hyper::header::{HeaderView, Headers};
use hyper::method::Method;
use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::status::StatusClass::Success;
-use net_traits::{AsyncResponseListener, Metadata, ResponseAction};
+use net_traits::{AsyncResponseListener, Metadata, NetworkError, ResponseAction};
use network_listener::{NetworkListener, PreInvoke};
use script_runtime::ScriptChan;
use std::ascii::AsciiExt;
@@ -26,7 +26,7 @@ use std::borrow::ToOwned;
use std::sync::{Arc, Mutex};
use time::{self, Timespec, now};
use unicase::UniCase;
-use url::{SchemeData, Url};
+use url::Url;
use util::thread::spawn_named;
/// Interface for network listeners concerned with CORS checks. Proper network requests
@@ -67,14 +67,13 @@ impl CORSRequest {
headers: Headers,
same_origin_data_url_flag: bool)
-> Result<Option<CORSRequest>, ()> {
- if referer.scheme == destination.scheme && referer.host() == destination.host() &&
- referer.port() == destination.port() {
+ if referer.origin() == destination.origin() {
return Ok(None); // Not cross-origin, proceed with a normal fetch
}
- match &*destination.scheme {
+ match destination.scheme() {
// As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), about URLs can be fetched
// the same as a basic request.
- "about" if destination.path() == Some(&["blank".to_owned()]) => Ok(None),
+ "about" if destination.path() == "blank" => Ok(None),
// As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), data URLs can be fetched
// the same as a basic request if the request's method is GET and the
// same-origin data-URL flag is set.
@@ -98,11 +97,9 @@ impl CORSRequest {
method: Method,
headers: Headers)
-> CORSRequest {
- if let SchemeData::Relative(ref mut data) = referer.scheme_data {
- data.path = vec![];
- }
- referer.fragment = None;
- referer.query = None;
+ referer.set_fragment(None);
+ referer.set_query(None);
+ referer.set_path("");
CORSRequest {
origin: referer,
destination: destination,
@@ -124,13 +121,15 @@ impl CORSRequest {
// This is shoe-horning the CORSReponse stuff into the rest of the async network
// framework right now. It would be worth redesigning http_fetch to do this properly.
impl AsyncResponseListener for CORSContext {
- fn headers_available(&mut self, _metadata: Metadata) {
+ fn headers_available(&mut self, _metadata: Result<Metadata, NetworkError>) {
+
}
fn data_available(&mut self, _payload: Vec<u8>) {
+
}
- fn response_complete(&mut self, _status: Result<(), String>) {
+ fn response_complete(&mut self, _status: Result<(), NetworkError>) {
let response = self.response.take().unwrap();
self.listener.response_available(response);
}
@@ -402,8 +401,10 @@ impl CORSCache {
self.cleanup();
// Credentials are not yet implemented here
self.0.iter_mut().find(|e| {
- e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
- e.origin.port() == request.origin.port() && e.url == request.destination &&
+ e.origin.scheme() == request.origin.scheme() &&
+ e.origin.host_str() == request.origin.host_str() &&
+ e.origin.port() == request.origin.port() &&
+ e.url == request.destination &&
e.header_or_method.match_header(header_name)
})
}
@@ -428,8 +429,10 @@ impl CORSCache {
self.cleanup();
// Credentials are not yet implemented here
self.0.iter_mut().find(|e| {
- e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
- e.origin.port() == request.origin.port() && e.url == request.destination &&
+ e.origin.scheme() == request.origin.scheme() &&
+ e.origin.host_str() == request.origin.host_str() &&
+ e.origin.port() == request.origin.port() &&
+ e.url == request.destination &&
e.header_or_method.match_method(method)
})
}
@@ -482,7 +485,7 @@ fn is_simple_method(m: &Method) -> bool {
pub fn allow_cross_origin_request(req: &CORSRequest, headers: &Headers) -> bool {
match headers.get::<AccessControlAllowOrigin>() {
Some(&AccessControlAllowOrigin::Any) => true, // Not always true, depends on credentials mode
- Some(&AccessControlAllowOrigin::Value(ref url)) => req.origin.serialize() == *url,
+ Some(&AccessControlAllowOrigin::Value(ref url)) => req.origin.as_str() == *url,
Some(&AccessControlAllowOrigin::Null) |
None => false,
}
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index b702c6b30ed..5c835226a22 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -127,16 +127,21 @@ impl DocumentLoader {
/// Create a new pending network request, which can be initiated at some point in
/// the future.
- pub fn prepare_async_load(&mut self, load: LoadType) -> PendingAsyncLoad {
+ pub fn prepare_async_load(&mut self, load: LoadType, referrer: &Document) -> PendingAsyncLoad {
let context = load.to_load_context();
let url = load.url().clone();
self.add_blocking_load(load);
- PendingAsyncLoad::new(context, (*self.resource_thread).clone(), url, self.pipeline)
+ PendingAsyncLoad::new(context,
+ (*self.resource_thread).clone(),
+ url,
+ self.pipeline,
+ referrer.get_referrer_policy(),
+ Some(referrer.url().clone()))
}
/// Create and initiate a new network request.
- pub fn load_async(&mut self, load: LoadType, listener: AsyncResponseTarget) {
- let pending = self.prepare_async_load(load);
+ pub fn load_async(&mut self, load: LoadType, listener: AsyncResponseTarget, referrer: &Document) {
+ let pending = self.prepare_async_load(load, referrer);
pending.load_async(listener)
}
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 74dff1cce9f..1ef2e0a4eb9 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1897,20 +1897,24 @@ class CGInterfaceObjectJSClass(CGThing):
def define(self):
if self.descriptor.interface.ctor():
- constructor = CONSTRUCT_HOOK_NAME
+ constructorBehavior = "InterfaceConstructorBehavior::call(%s)" % CONSTRUCT_HOOK_NAME
else:
- constructor = "throwing_constructor"
+ constructorBehavior = "InterfaceConstructorBehavior::throw()"
name = self.descriptor.interface.identifier.name
args = {
- "constructor": constructor,
+ "constructorBehavior": constructorBehavior,
"id": name,
"representation": str_to_const_array("function %s() {\\n [native code]\\n}" % name),
"depth": self.descriptor.prototypeDepth
}
return """\
-static InterfaceObjectClass: NonCallbackInterfaceObjectClass =
- NonCallbackInterfaceObjectClass::new(%(constructor)s, %(representation)s,
- PrototypeList::ID::%(id)s, %(depth)s);
+static InterfaceObjectClass: NonCallbackInterfaceObjectClass = unsafe {
+ NonCallbackInterfaceObjectClass::new(
+ %(constructorBehavior)s,
+ %(representation)s,
+ PrototypeList::ID::%(id)s,
+ %(depth)s)
+};
""" % args
@@ -2449,10 +2453,8 @@ if <*mut JSObject>::needs_post_barrier(prototype.ptr) {
if self.descriptor.interface.hasInterfaceObject():
properties["name"] = str_to_const_array(name)
if self.descriptor.interface.ctor():
- properties["constructor"] = CONSTRUCT_HOOK_NAME
properties["length"] = methodLength(self.descriptor.interface.ctor())
else:
- properties["constructor"] = "throwing_constructor"
properties["length"] = 0
if self.descriptor.interface.parent:
parentName = toBindingNamespace(self.descriptor.getParentName())
@@ -5400,9 +5402,9 @@ class CGBindingRoot(CGThing):
'js::rust::{GCMethods, define_methods, define_properties}',
'dom::bindings',
'dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector}',
- 'dom::bindings::interface::{NonCallbackInterfaceObjectClass, create_callback_interface_object}',
- 'dom::bindings::interface::{create_interface_prototype_object, create_named_constructors}',
- 'dom::bindings::interface::{create_noncallback_interface_object}',
+ 'dom::bindings::interface::{InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass}',
+ 'dom::bindings::interface::{create_callback_interface_object, create_interface_prototype_object}',
+ 'dom::bindings::interface::{create_named_constructors, create_noncallback_interface_object}',
'dom::bindings::interface::{ConstantSpec, NonNullJSNative}',
'dom::bindings::interface::ConstantVal::{IntVal, UintVal}',
'dom::bindings::js::{JS, Root, RootedReference}',
@@ -5416,8 +5418,7 @@ class CGBindingRoot(CGThing):
'dom::bindings::utils::{generic_method, generic_setter, get_array_index_from_id}',
'dom::bindings::utils::{get_dictionary_property, get_property_on_prototype}',
'dom::bindings::utils::{get_proto_or_iface_array, has_property_on_prototype}',
- 'dom::bindings::utils::{is_platform_object, resolve_global, set_dictionary_property}',
- 'dom::bindings::utils::{throwing_constructor, trace_global}',
+ 'dom::bindings::utils::{is_platform_object, resolve_global, set_dictionary_property, trace_global}',
'dom::bindings::trace::{JSTraceable, RootedTraceable}',
'dom::bindings::callback::{CallbackContainer,CallbackInterface,CallbackFunction}',
'dom::bindings::callback::{CallSetup,ExceptionHandling}',
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 6db0d08af4d..baeb0a1f92b 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -53,7 +53,7 @@ use js::jsapi::{Type};
use js::jsval::{ObjectValue, StringValue};
use js::rust::ToString;
use libc;
-use num::Float;
+use num_traits::Float;
use std::{ptr, mem, slice};
pub use util::non_geckolib::{StringificationBehavior, jsstring_to_str};
use util::str::DOMString;
@@ -253,12 +253,12 @@ pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<&'static DOMClass, ()>
let clasp = JS_GetClass(obj);
if is_dom_class(&*clasp) {
- debug!("plain old dom object");
+ trace!("plain old dom object");
let domjsclass: *const DOMJSClass = clasp as *const DOMJSClass;
return Ok(&(&*domjsclass).dom_class);
}
if is_dom_proxy(obj) {
- debug!("proxy dom object");
+ trace!("proxy dom object");
let dom_class: *const DOMClass = GetProxyHandlerExtra(obj) as *const DOMClass;
return Ok(&*dom_class);
}
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs
index 7db3c6e17c4..f41941f08b0 100644
--- a/components/script/dom/bindings/interface.rs
+++ b/components/script/dom/bindings/interface.rs
@@ -7,10 +7,11 @@
use dom::bindings::codegen::PrototypeList;
use dom::bindings::conversions::get_dom_class;
use dom::bindings::utils::get_proto_or_iface_array;
+use js::error::throw_type_error;
use js::glue::UncheckedUnwrapObject;
use js::jsapi::{Class, ClassExtension, ClassSpec, GetGlobalForObjectCrossCompartment};
use js::jsapi::{HandleObject, HandleValue, JSClass, JSContext, JSFunctionSpec};
-use js::jsapi::{JSPropertySpec, JSString, JS_DefineProperty1, JS_DefineProperty2};
+use js::jsapi::{JSNative, JSPropertySpec, JSString, JS_DefineProperty1, JS_DefineProperty2};
use js::jsapi::{JS_DefineProperty4, JS_GetClass, JS_GetFunctionObject, JS_GetPrototype};
use js::jsapi::{JS_InternString, JS_LinkConstructorAndPrototype, JS_NewFunction, JS_NewObject};
use js::jsapi::{JS_NewObjectWithUniqueType, JS_NewStringCopyZ, JS_DefineProperty};
@@ -93,10 +94,6 @@ unsafe extern "C" fn fun_to_string_hook(cx: *mut JSContext,
ret
}
-/// A constructor class hook.
-pub type ConstructorClassHook =
- unsafe extern "C" fn(cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool;
-
/// The class of a non-callback interface object.
#[derive(Copy, Clone)]
pub struct NonCallbackInterfaceObjectClass {
@@ -114,8 +111,8 @@ unsafe impl Sync for NonCallbackInterfaceObjectClass {}
impl NonCallbackInterfaceObjectClass {
/// Create a new `NonCallbackInterfaceObjectClass` structure.
- pub const fn new(
- constructor: ConstructorClassHook,
+ pub const unsafe fn new(
+ constructor_behavior: InterfaceConstructorBehavior,
string_rep: &'static [u8],
proto_id: PrototypeList::ID,
proto_depth: u16)
@@ -132,8 +129,8 @@ impl NonCallbackInterfaceObjectClass {
resolve: None,
convert: None,
finalize: None,
- call: Some(constructor),
- construct: Some(constructor),
+ call: constructor_behavior.call,
+ construct: constructor_behavior.construct,
hasInstance: Some(has_instance_hook),
trace: None,
spec: ClassSpec {
@@ -183,6 +180,34 @@ impl NonCallbackInterfaceObjectClass {
}
}
+/// A constructor class hook.
+pub type ConstructorClassHook =
+ unsafe extern "C" fn(cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool;
+
+/// The constructor behavior of a non-callback interface object.
+pub struct InterfaceConstructorBehavior {
+ call: JSNative,
+ construct: JSNative,
+}
+
+impl InterfaceConstructorBehavior {
+ /// An interface constructor that unconditionally throws a type error.
+ pub const fn throw() -> InterfaceConstructorBehavior {
+ InterfaceConstructorBehavior {
+ call: Some(invalid_constructor),
+ construct: Some(invalid_constructor),
+ }
+ }
+
+ /// An interface constructor that calls a native Rust function.
+ pub const fn call(hook: ConstructorClassHook) -> InterfaceConstructorBehavior {
+ InterfaceConstructorBehavior {
+ call: Some(non_new_constructor),
+ construct: Some(hook),
+ }
+ }
+}
+
/// Create and define the interface object of a callback interface.
pub unsafe fn create_callback_interface_object(
cx: *mut JSContext,
@@ -380,3 +405,21 @@ unsafe fn define_on_global_object(
0,
None, None));
}
+
+unsafe extern "C" fn invalid_constructor(
+ cx: *mut JSContext,
+ _argc: libc::c_uint,
+ _vp: *mut JSVal)
+ -> bool {
+ throw_type_error(cx, "Illegal constructor.");
+ false
+}
+
+unsafe extern "C" fn non_new_constructor(
+ cx: *mut JSContext,
+ _argc: libc::c_uint,
+ _vp: *mut JSVal)
+ -> bool {
+ throw_type_error(cx, "This constructor needs to be called with `new`.");
+ false
+}
diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs
index 972f90389d1..fde24d08421 100644
--- a/components/script/dom/bindings/num.rs
+++ b/components/script/dom/bindings/num.rs
@@ -4,7 +4,7 @@
//! The `Finite<T>` struct.
-use num::Float;
+use num_traits::Float;
use std::ops::Deref;
/// Encapsulates the IDL restricted float type.
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 50c3fbf682f..7cbfc19ac44 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -56,12 +56,12 @@ use js::rust::Runtime;
use layout_interface::{LayoutChan, LayoutRPC};
use libc;
use msg::constellation_msg::ConstellationChan;
-use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
-use net_traits::Metadata;
+use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WindowSizeType, ReferrerPolicy};
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::response::HttpsState;
use net_traits::storage_thread::StorageType;
+use net_traits::{Metadata, NetworkError};
use offscreen_gl_context::GLLimits;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
@@ -287,13 +287,14 @@ no_jsmanaged_fields!(Size2D<T>);
no_jsmanaged_fields!(Arc<T>);
no_jsmanaged_fields!(Image, ImageMetadata, ImageCacheChan, ImageCacheThread);
no_jsmanaged_fields!(Metadata);
+no_jsmanaged_fields!(NetworkError);
no_jsmanaged_fields!(Atom, Namespace, QualName);
no_jsmanaged_fields!(Trusted<T: Reflectable>);
no_jsmanaged_fields!(PropertyDeclarationBlock);
no_jsmanaged_fields!(HashSet<T>);
// These three are interdependent, if you plan to put jsmanaged data
// in one of these make sure it is propagated properly to containing structs
-no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId);
+no_jsmanaged_fields!(SubpageId, WindowSizeData, WindowSizeType, PipelineId);
no_jsmanaged_fields!(TimerEventId, TimerSource);
no_jsmanaged_fields!(WorkerId);
no_jsmanaged_fields!(QuirksMode);
@@ -324,6 +325,7 @@ no_jsmanaged_fields!(ElementSnapshot);
no_jsmanaged_fields!(HttpsState);
no_jsmanaged_fields!(SharedRt);
no_jsmanaged_fields!(TouchpadPressurePhase);
+no_jsmanaged_fields!(ReferrerPolicy);
impl JSTraceable for ConstellationChan<ScriptMsg> {
#[inline]
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 2b4e5ee5ae0..9302bb40a09 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -16,7 +16,6 @@ use dom::browsingcontext;
use dom::window;
use heapsize::HeapSizeOf;
use js;
-use js::error::throw_type_error;
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
use js::glue::{GetCrossCompartmentWrapper, WrapperNew};
use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO, RUST_JSID_IS_INT, RUST_JSID_IS_STRING};
@@ -35,7 +34,7 @@ use js::jsval::{JSVal};
use js::jsval::{PrivateValue, UndefinedValue};
use js::rust::{GCMethods, ToString};
use js::{JS_CALLEE};
-use libc::{self, c_uint};
+use libc;
use std::default::Default;
use std::ffi::CString;
use std::os::raw::c_void;
@@ -123,16 +122,6 @@ pub fn get_proto_or_iface_array(global: *mut JSObject) -> *mut ProtoOrIfaceArray
}
}
-/// A throwing constructor, for those interfaces that have neither
-/// `NoInterfaceObject` nor `Constructor`.
-pub unsafe extern "C" fn throwing_constructor(cx: *mut JSContext,
- _argc: c_uint,
- _vp: *mut JSVal)
- -> bool {
- throw_type_error(cx, "Illegal constructor.");
- false
-}
-
/// An array of *mut JSObject of size PROTO_OR_IFACE_LENGTH.
pub type ProtoOrIfaceArray = [*mut JSObject; PROTO_OR_IFACE_LENGTH];
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index 9c23b8f6da0..49fc47e8a68 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -12,7 +12,7 @@ use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::trace::JSTraceable;
use encoding::all::UTF_8;
use encoding::types::{EncoderTrap, Encoding};
-use num::ToPrimitive;
+use num_traits::ToPrimitive;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
@@ -117,29 +117,28 @@ impl Blob {
}
// https://w3c.github.io/FileAPI/#constructorBlob
- pub fn Constructor(global: GlobalRef) -> Fallible<Root<Blob>> {
- Ok(Blob::new(global, Vec::new(), ""))
- }
-
- // https://w3c.github.io/FileAPI/#constructorBlob
- pub fn Constructor_(global: GlobalRef,
- blobParts: Vec<BlobOrString>,
- blobPropertyBag: &BlobBinding::BlobPropertyBag)
- -> Fallible<Root<Blob>> {
+ pub fn Constructor(global: GlobalRef,
+ blobParts: Option<Vec<BlobOrString>>,
+ blobPropertyBag: &BlobBinding::BlobPropertyBag)
+ -> Fallible<Root<Blob>> {
// TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView
- let bytes: Vec<u8> = blobParts.iter()
- .flat_map(|bPart| {
- match bPart {
- &BlobOrString::String(ref s) => {
- UTF_8.encode(s, EncoderTrap::Replace).unwrap()
- },
- &BlobOrString::Blob(ref b) => {
- b.get_data().get_bytes().to_vec()
- },
- }
- })
- .collect();
+ let bytes: Vec<u8> = match blobParts {
+ None => Vec::new(),
+ Some(blobs) => {
+ blobs.iter().flat_map(|bPart| {
+ match bPart {
+ &BlobOrString::String(ref s) => {
+ UTF_8.encode(s, EncoderTrap::Replace).unwrap()
+ },
+ &BlobOrString::Blob(ref b) => {
+ b.get_data().get_bytes().to_vec()
+ },
+ }
+ })
+ .collect()
+ }
+ };
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
&*blobPropertyBag.type_
} else {
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 492b98f0edf..36c042b4d75 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -39,7 +39,7 @@ use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::image::base::PixelFormat;
use net_traits::image_cache_thread::ImageResponse;
-use num::{Float, ToPrimitive};
+use num_traits::{Float, ToPrimitive};
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
use std::str::FromStr;
@@ -486,11 +486,29 @@ impl CanvasRenderingContext2D {
match color {
Ok(CSSColor::RGBA(rgba)) => Ok(rgba),
Ok(CSSColor::CurrentColor) => {
+ // TODO: https://github.com/whatwg/html/issues/1099
+ // Reconsider how to calculate currentColor in a display:none canvas
+
// TODO: will need to check that the context bitmap mode is fixed
// once we implement CanvasProxy
let window = window_from_node(&*self.canvas);
+
let style = window.GetComputedStyle(&*self.canvas.upcast(), None);
- self.parse_color(&style.GetPropertyValue(DOMString::from("color")))
+
+ let element_not_rendered =
+ !self.canvas.upcast::<Node>().is_in_doc() ||
+ style.GetPropertyValue(DOMString::from("display")) == "none";
+
+ if element_not_rendered {
+ Ok(RGBA {
+ red: 0.0,
+ green: 0.0,
+ blue: 0.0,
+ alpha: 1.0,
+ })
+ } else {
+ self.parse_color(&style.GetPropertyValue(DOMString::from("color")))
+ }
},
_ => Err(())
}
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 1b2d18b18b3..bd8d1bdfd2d 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -218,7 +218,7 @@ impl DedicatedWorkerGlobalScope {
parent_sender: Box<ScriptChan + Send>,
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>) {
- let serialized_worker_url = worker_url.serialize();
+ let serialized_worker_url = worker_url.to_string();
spawn_named(format!("WebWorker for {}", serialized_worker_url), move || {
thread_state::initialize(SCRIPT | IN_WORKER);
@@ -240,7 +240,7 @@ impl DedicatedWorkerGlobalScope {
}
};
- let runtime = new_rt_and_cx();
+ let runtime = unsafe { new_rt_and_cx() };
*main_thread_rt.lock().unwrap() = Some(SharedRt::new(&runtime));
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index d87e80b7acc..7d25e484aa3 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -68,8 +68,10 @@ use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node};
use dom::nodeiterator::NodeIterator;
use dom::nodelist::NodeList;
use dom::processinginstruction::ProcessingInstruction;
+use dom::progressevent::ProgressEvent;
use dom::range::Range;
use dom::servohtmlparser::{ParserRoot, ParserRef, MutNullableParserField};
+use dom::storageevent::StorageEvent;
use dom::stylesheetlist::StyleSheetList;
use dom::text::Text;
use dom::touch::Touch;
@@ -77,6 +79,7 @@ use dom::touchevent::TouchEvent;
use dom::touchlist::TouchList;
use dom::treewalker::TreeWalker;
use dom::uievent::UIEvent;
+use dom::webglcontextevent::WebGLContextEvent;
use dom::window::{ReflowReason, Window};
use encoding::EncodingRef;
use encoding::all::UTF_8;
@@ -88,12 +91,12 @@ use js::jsapi::{JSContext, JSObject, JSRuntime};
use layout_interface::{LayoutChan, Msg, ReflowQueryType};
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState};
-use msg::constellation_msg::{PipelineId, SubpageId};
+use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId};
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::CookieSource::NonHTTP;
use net_traits::response::HttpsState;
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
-use num::ToPrimitive;
+use num_traits::ToPrimitive;
use origin::Origin;
use script_runtime::ScriptChan;
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable};
@@ -226,6 +229,8 @@ pub struct Document {
touchpad_pressure_phase: Cell<TouchpadPressurePhase>,
/// The document's origin.
origin: Origin,
+ /// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states
+ referrer_policy: Option<ReferrerPolicy>,
}
#[derive(JSTraceable, HeapSizeOf)]
@@ -515,7 +520,7 @@ impl Document {
self.GetDocumentElement()
} else {
// Step 3 & 4
- String::from_utf8(percent_decode(fragid.as_bytes())).ok()
+ percent_decode(fragid.as_bytes()).decode_utf8().ok()
// Step 5
.and_then(|decoded_fragid| self.get_element_by_id(&Atom::from(decoded_fragid)))
// Step 6
@@ -1326,12 +1331,12 @@ impl Document {
pub fn prepare_async_load(&self, load: LoadType) -> PendingAsyncLoad {
let mut loader = self.loader.borrow_mut();
- loader.prepare_async_load(load)
+ loader.prepare_async_load(load, self)
}
pub fn load_async(&self, load: LoadType, listener: AsyncResponseTarget) {
let mut loader = self.loader.borrow_mut();
- loader.load_async(load, listener)
+ loader.load_async(load, listener, self)
}
pub fn finish_load(&self, load: LoadType) {
@@ -1585,7 +1590,7 @@ impl LayoutDocumentHelpers for LayoutJS<Document> {
/// https://url.spec.whatwg.org/#network-scheme
fn url_has_network_scheme(url: &Url) -> bool {
- match &*url.scheme {
+ match url.scheme() {
"ftp" | "http" | "https" => true,
_ => false,
}
@@ -1684,6 +1689,8 @@ impl Document {
https_state: Cell::new(HttpsState::None),
touchpad_pressure_phase: Cell::new(TouchpadPressurePhase::BeforeClick),
origin: origin,
+ //TODO - setting this for now so no Referer header set
+ referrer_policy: Some(ReferrerPolicy::NoReferrer),
}
}
@@ -1812,6 +1819,11 @@ impl Document {
snapshot.attrs = Some(attrs);
}
}
+
+ //TODO - for now, returns no-referrer for all until reading in the value
+ pub fn get_referrer_policy(&self) -> Option<ReferrerPolicy> {
+ return self.referrer_policy.clone();
+ }
}
@@ -1844,7 +1856,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-url
fn URL(&self) -> DOMString {
- DOMString::from(self.url().serialize())
+ DOMString::from(self.url().as_str())
}
// https://html.spec.whatwg.org/multipage/#dom-document-activeelement
@@ -1886,7 +1898,7 @@ impl DocumentMethods for Document {
if let Some(host) = self.origin.host() {
// Step 4.
- DOMString::from(host.serialize())
+ DOMString::from(host.to_string())
} else {
// Step 3.
DOMString::new()
@@ -2154,9 +2166,9 @@ impl DocumentMethods for Document {
Ok(Root::upcast(MouseEvent::new_uninitialized(&self.window))),
"customevent" =>
Ok(Root::upcast(CustomEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
- "htmlevents" | "events" | "event" =>
+ "htmlevents" | "events" | "event" | "svgevents" =>
Ok(Event::new_uninitialized(GlobalRef::Window(&self.window))),
- "keyboardevent" | "keyevents" =>
+ "keyboardevent" =>
Ok(Root::upcast(KeyboardEvent::new_uninitialized(&self.window))),
"messageevent" =>
Ok(Root::upcast(MessageEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
@@ -2168,6 +2180,12 @@ impl DocumentMethods for Document {
&TouchList::new(&self.window, &[]),
)
)),
+ "webglcontextevent" =>
+ Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
+ "storageevent" =>
+ Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, self.URL()))),
+ "progressevent" =>
+ Ok(Root::upcast(ProgressEvent::new_uninitialized(&self.window))),
_ =>
Err(Error::NotSupported),
}
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index e14e1af0d97..d5151dc7dfd 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -19,6 +19,8 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
+use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
+use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::global::GlobalRef;
@@ -39,6 +41,7 @@ use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlbodyelement::{HTMLBodyElement, HTMLBodyElementLayoutHelpers};
use dom::htmlbuttonelement::HTMLButtonElement;
use dom::htmlcollection::HTMLCollection;
+use dom::htmlelement::HTMLElement;
use dom::htmlfieldsetelement::HTMLFieldSetElement;
use dom::htmlfontelement::{HTMLFontElement, HTMLFontElementLayoutHelpers};
use dom::htmlhrelement::{HTMLHRElement, HTMLHRLayoutHelpers};
@@ -86,7 +89,7 @@ use string_cache::{Atom, Namespace, QualName};
use style::element_state::*;
use style::error_reporting::ParseErrorReporter;
use style::properties::DeclaredValue;
-use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size};
+use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::values::CSSFloat;
@@ -164,6 +167,35 @@ impl Element {
document,
ElementBinding::Wrap)
}
+
+ // https://drafts.csswg.org/cssom-view/#css-layout-box
+ // Elements that have a computed value of the display property
+ // that is table-column or table-column-group
+ // FIXME: Currently, it is assumed to be true always
+ fn has_css_layout_box(&self) -> bool {
+ true
+ }
+
+ // https://drafts.csswg.org/cssom-view/#potentially-scrollable
+ fn potentially_scrollable(&self) -> bool {
+ self.has_css_layout_box() &&
+ !self.overflow_x_is_visible() &&
+ !self.overflow_y_is_visible()
+ }
+
+ // used value of overflow-x is "visible"
+ fn overflow_x_is_visible(&self) -> bool {
+ let window = window_from_node(self);
+ let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
+ overflow_pair.x == overflow_x::computed_value::T::visible
+ }
+
+ // used value of overflow-y is "visible"
+ fn overflow_y_is_visible(&self) -> bool {
+ let window = window_from_node(self);
+ let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
+ overflow_pair.y != overflow_x::computed_value::T::visible
+ }
}
#[allow(unsafe_code)]
@@ -1081,7 +1113,7 @@ impl Element {
// https://html.spec.whatwg.org/multipage/#reflect
// XXXManishearth this doesn't handle `javascript:` urls properly
match base.join(&url) {
- Ok(parsed) => DOMString::from(parsed.serialize()),
+ Ok(parsed) => DOMString::from(parsed.into_string()),
Err(_) => DOMString::from(""),
}
}
@@ -1196,6 +1228,49 @@ impl Element {
_ => Err(Error::Syntax)
}
}
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scroll
+ pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) {
+
+ // Step 1.2 or 2.3
+ let x = if x_.is_finite() { x_ } else { 0.0f64 };
+ let y = if y_.is_finite() { y_ } else { 0.0f64 };
+
+ let node = self.upcast::<Node>();
+
+ // Step 3
+ let doc = node.owner_doc();
+
+ // Step 4
+ if !doc.is_fully_active() {
+ return;
+ }
+
+ // Step 5
+ let win = doc.DefaultView();
+
+ // Step 7
+ if *self.root_element() == *self {
+ if doc.quirks_mode() != Quirks {
+ win.scroll(x, y, behavior);
+ }
+
+ return;
+ }
+
+ // Step 9
+ if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
+ doc.quirks_mode() == Quirks &&
+ !self.potentially_scrollable() {
+ win.scroll(x, y, behavior);
+ return;
+ }
+
+ // Step 10 (TODO)
+
+ // Step 11
+ win.scroll_node(node.to_trusted_node_address(), x, y, behavior);
+ }
}
impl ElementMethods for Element {
@@ -1260,6 +1335,11 @@ impl ElementMethods for Element {
self.attr_list.or_init(|| NamedNodeMap::new(&window_from_node(self), self))
}
+ // https://dom.spec.whatwg.org/#dom-element-hasattributes
+ fn HasAttributes(&self) -> bool {
+ !self.attrs.borrow().is_empty()
+ }
+
// https://dom.spec.whatwg.org/#dom-element-getattributenames
fn GetAttributeNames(&self) -> Vec<DOMString> {
self.attrs.borrow().iter().map(|attr| attr.Name()).collect()
@@ -1452,6 +1532,220 @@ impl ElementMethods for Element {
rect.size.height.to_f64_px())
}
+ // https://drafts.csswg.org/cssom-view/#dom-element-scroll
+ fn Scroll(&self, options: &ScrollToOptions) {
+ // Step 1
+ let left = options.left.unwrap_or(self.ScrollLeft());
+ let top = options.top.unwrap_or(self.ScrollTop());
+ self.scroll(left, top, options.parent.behavior);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scroll
+ fn Scroll_(&self, x: f64, y: f64) {
+ self.scroll(x, y, ScrollBehavior::Auto);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrollto
+ fn ScrollTo(&self, options: &ScrollToOptions) {
+ self.Scroll(options);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrollto
+ fn ScrollTo_(&self, x: f64, y: f64) {
+ self.Scroll_(x, y);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrollby
+ fn ScrollBy(&self, options: &ScrollToOptions) {
+ // Step 2
+ let delta_left = options.left.unwrap_or(0.0f64);
+ let delta_top = options.top.unwrap_or(0.0f64);
+ let left = self.ScrollLeft();
+ let top = self.ScrollTop();
+ self.scroll(left + delta_left, top + delta_top,
+ options.parent.behavior);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrollby
+ fn ScrollBy_(&self, x: f64, y: f64) {
+ let left = self.ScrollLeft();
+ let top = self.ScrollTop();
+ self.scroll(left + x, top + y, ScrollBehavior::Auto);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrolltop
+ fn ScrollTop(&self) -> f64 {
+ let node = self.upcast::<Node>();
+
+ // Step 1
+ let doc = node.owner_doc();
+
+ // Step 2
+ if !doc.is_fully_active() {
+ return 0.0;
+ }
+
+ // Step 3
+ let win = doc.DefaultView();
+
+ // Step 5
+ if *self.root_element() == *self {
+ if doc.quirks_mode() == Quirks {
+ return 0.0;
+ }
+
+ // Step 6
+ return win.ScrollY() as f64;
+ }
+
+ // Step 7
+ if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
+ doc.quirks_mode() == Quirks &&
+ !self.potentially_scrollable() {
+ return win.ScrollY() as f64;
+ }
+
+
+ // Step 8
+ if !self.has_css_layout_box() {
+ return 0.0;
+ }
+
+ // Step 9
+ let point = node.scroll_offset();
+ return point.y.abs() as f64;
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrolltop
+ fn SetScrollTop(&self, y_: f64) {
+ let behavior = ScrollBehavior::Auto;
+
+ // Step 1, 2
+ let y = if y_.is_finite() { y_ } else { 0.0f64 };
+
+ let node = self.upcast::<Node>();
+
+ // Step 3
+ let doc = node.owner_doc();
+
+ // Step 4
+ if !doc.is_fully_active() {
+ return;
+ }
+
+ // Step 5
+ let win = doc.DefaultView();
+
+ // Step 7
+ if *self.root_element() == *self {
+ if doc.quirks_mode() != Quirks {
+ win.scroll(win.ScrollX() as f64, y, behavior);
+ }
+
+ return;
+ }
+
+ // Step 9
+ if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
+ doc.quirks_mode() == Quirks &&
+ !self.potentially_scrollable() {
+ win.scroll(win.ScrollX() as f64, y, behavior);
+ return;
+ }
+
+ // Step 10 (TODO)
+
+ // Step 11
+ win.scroll_node(node.to_trusted_node_address(), self.ScrollLeft(), y, behavior);
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrolltop
+ fn ScrollLeft(&self) -> f64 {
+ let node = self.upcast::<Node>();
+
+ // Step 1
+ let doc = node.owner_doc();
+
+ // Step 2
+ if !doc.is_fully_active() {
+ return 0.0;
+ }
+
+ // Step 3
+ let win = doc.DefaultView();
+
+ // Step 5
+ if *self.root_element() == *self {
+ if doc.quirks_mode() != Quirks {
+ // Step 6
+ return win.ScrollX() as f64;
+ }
+
+ return 0.0;
+ }
+
+ // Step 7
+ if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
+ doc.quirks_mode() == Quirks &&
+ !self.potentially_scrollable() {
+ return win.ScrollX() as f64;
+ }
+
+
+ // Step 8
+ if !self.has_css_layout_box() {
+ return 0.0;
+ }
+
+ // Step 9
+ let point = node.scroll_offset();
+ return point.x.abs() as f64;
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scrollleft
+ fn SetScrollLeft(&self, x_: f64) {
+ let behavior = ScrollBehavior::Auto;
+
+ // Step 1, 2
+ let x = if x_.is_finite() { x_ } else { 0.0f64 };
+
+ let node = self.upcast::<Node>();
+
+ // Step 3
+ let doc = node.owner_doc();
+
+ // Step 4
+ if !doc.is_fully_active() {
+ return;
+ }
+
+ // Step 5
+ let win = doc.DefaultView();
+
+ // Step 7
+ if *self.root_element() == *self {
+ if doc.quirks_mode() == Quirks {
+ return;
+ }
+
+ win.scroll(x, win.ScrollY() as f64, behavior);
+ return;
+ }
+
+ // Step 9
+ if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
+ doc.quirks_mode() == Quirks &&
+ !self.potentially_scrollable() {
+ win.scroll(x, win.ScrollY() as f64, behavior);
+ return;
+ }
+
+ // Step 10 (TODO)
+
+ // Step 11
+ win.scroll_node(node.to_trusted_node_address(), x, self.ScrollTop(), behavior);
+ }
+
// https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth
fn ScrollWidth(&self) -> i32 {
self.upcast::<Node>().scroll_area().size.width
diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs
index e340e888377..40103e30f76 100644
--- a/components/script/dom/eventsource.rs
+++ b/components/script/dom/eventsource.rs
@@ -82,7 +82,7 @@ impl EventSourceMethods for EventSource {
// https://html.spec.whatwg.org/multipage/#dom-eventsource-url
fn Url(&self) -> DOMString {
- DOMString::from(self.url.serialize())
+ DOMString::from(self.url.as_str())
}
// https://html.spec.whatwg.org/multipage/#dom-eventsource-withcredentials
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 409fdbd436d..0b8325cf30d 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -397,7 +397,7 @@ impl EventTarget {
// Step 1.6
let window = document.window();
- let url_serialized = CString::new(handler.url.serialize()).unwrap();
+ let url_serialized = CString::new(handler.url.to_string()).unwrap();
let name = CString::new(&**ty).unwrap();
static mut ARG_NAMES: [*const c_char; 1] = [b"event\0" as *const u8 as *const c_char];
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index 16f47315b76..43ff211dfce 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -25,10 +25,10 @@ use dom::mouseevent::MouseEvent;
use dom::node::{Node, document_from_node, window_from_node};
use dom::urlhelper::UrlHelper;
use dom::virtualmethods::VirtualMethods;
-use num::ToPrimitive;
+use num_traits::ToPrimitive;
use std::default::Default;
use string_cache::Atom;
-use url::{Url, UrlParser};
+use url::Url;
use util::str::DOMString;
#[dom_struct]
@@ -63,9 +63,7 @@ impl HTMLAnchorElement {
let attribute = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href"));
*self.url.borrow_mut() = attribute.and_then(|attribute| {
let document = document_from_node(self);
- let mut parser = UrlParser::new();
- parser.base_url(document.url());
- parser.parse(&attribute.value()).ok()
+ document.url().join(&attribute.value()).ok()
});
}
@@ -74,8 +72,7 @@ impl HTMLAnchorElement {
// Step 1.
match *self.url.borrow() {
None => return,
- Some(ref url) if url.scheme == "blob" &&
- url.non_relative_scheme_data().is_some() => return,
+ Some(ref url) if url.scheme() == "blob" && url.cannot_be_a_base() => return,
_ => (),
}
@@ -86,7 +83,7 @@ impl HTMLAnchorElement {
// https://html.spec.whatwg.org/multipage/#update-href
fn update_href(&self) {
self.upcast::<Element>().set_string_attribute(&atom!("href"),
- self.url.borrow().as_ref().unwrap().serialize().into());
+ self.url.borrow().as_ref().unwrap().as_str().into());
}
}
@@ -167,7 +164,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.scheme == "javascript" { return; }
+ if url.scheme() == "javascript" { return; }
// Steps 4-5.
UrlHelper::SetHash(url, value);
// Step 6.
@@ -201,7 +198,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.non_relative_scheme_data().is_some() {
+ if url.cannot_be_a_base() {
return;
}
// Step 4.
@@ -233,7 +230,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.non_relative_scheme_data().is_some() {
+ if url.cannot_be_a_base() {
return;
}
// Step 4.
@@ -258,7 +255,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
}
},
// Step 5.
- Some(ref url) => url.serialize(),
+ Some(ref url) => url.as_str().to_owned(),
})
}
@@ -289,7 +286,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.host().is_none() || url.non_relative_scheme_data().is_some() {
+ if url.host().is_none() || url.cannot_be_a_base() {
return;
}
// Step 4.
@@ -319,7 +316,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.non_relative_scheme_data().is_some() { return; }
+ if url.cannot_be_a_base() { return; }
// Step 5.
UrlHelper::SetPathname(url, value);
// Step 6.
@@ -348,8 +345,8 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
if url.host().is_none() ||
- url.non_relative_scheme_data().is_some() ||
- url.scheme == "file" {
+ url.cannot_be_a_base() ||
+ url.scheme() == "file" {
return;
}
// Step 4.
@@ -435,7 +432,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
// Step 3.
if let Some(url) = self.url.borrow_mut().as_mut() {
- if url.host().is_none() || url.non_relative_scheme_data().is_some() {
+ if url.host().is_none() || url.cannot_be_a_base() {
return;
}
@@ -535,7 +532,7 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
};
// Step 7.
- debug!("following hyperlink to {}", url.serialize());
+ debug!("following hyperlink to {}", url);
let window = document.window();
window.load_url(url);
}
diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs
index 241c209c7a8..7656520e283 100644
--- a/components/script/dom/htmlbaseelement.rs
+++ b/components/script/dom/htmlbaseelement.rs
@@ -68,7 +68,7 @@ impl HTMLBaseElementMethods for HTMLBaseElement {
// Step 1.
if !self.upcast::<Element>().has_attribute(&atom!("href")) {
- return DOMString::from(document.base_url().serialize());
+ return DOMString::from(document.base_url().as_str());
}
// Step 2.
@@ -81,7 +81,7 @@ impl HTMLBaseElementMethods for HTMLBaseElement {
let url_record = fallback_base_url.join(&*url);
// Step 5, 6.
- DOMString::from(url_record.ok().map_or("".to_owned(), |record| record.serialize()))
+ DOMString::from(url_record.as_ref().map(|url| url.as_str()).unwrap_or(""))
}
// https://html.spec.whatwg.org/multipage/#dom-base-href
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index a7bf82ae50e..b1f1771dd07 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -161,8 +161,8 @@ impl HTMLCollection {
}
impl CollectionFilter for TagNameNSFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
- ((self.qname.ns == Namespace(atom!("*"))) || (self.qname.ns == *elem.namespace()))
- && ((self.qname.local == atom!("*")) || (self.qname.local == *elem.local_name()))
+ ((self.qname.ns == Namespace(atom!("*"))) || (self.qname.ns == *elem.namespace())) &&
+ ((self.qname.local == atom!("*")) || (self.qname.local == *elem.local_name()))
}
}
let filter = TagNameNSFilter {
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index ae274411040..d898a5840b2 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -15,7 +15,7 @@ use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
use style::values::specified;
-use util::str::{DOMString, WHITESPACE, read_numbers};
+use util::str::{DOMString, HTML_SPACE_CHARACTERS, read_numbers};
#[dom_struct]
pub struct HTMLFontElement {
@@ -124,7 +124,7 @@ pub fn parse_legacy_font_size(mut input: &str) -> Option<&'static str> {
// Steps 1 & 2 are not relevant
// Step 3
- input = input.trim_matches(WHITESPACE);
+ input = input.trim_matches(HTML_SPACE_CHARACTERS);
enum ParseMode {
RelativePlus,
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 3e7421de443..13c7a1200c6 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -44,7 +44,7 @@ use std::cell::Cell;
use std::sync::mpsc::Sender;
use string_cache::Atom;
use task_source::dom_manipulation::DOMManipulationTask;
-use url::form_urlencoded::serialize;
+use url::form_urlencoded;
use util::str::DOMString;
#[derive(JSTraceable, PartialEq, Clone, Copy, HeapSizeOf)]
@@ -244,8 +244,8 @@ impl HTMLFormElement {
let base = doc.url();
// TODO: Handle browsing contexts
// Step 4
- if submit_method_flag == SubmittedFrom::NotFromFormSubmitMethod
- && !submitter.no_validate(self)
+ if submit_method_flag == SubmittedFrom::NotFromFormSubmitMethod &&
+ !submitter.no_validate(self)
{
if self.interactive_validation().is_err() {
// TODO: Implement event handlers on all form control elements
@@ -269,7 +269,7 @@ impl HTMLFormElement {
let mut action = submitter.action();
// Step 8
if action.is_empty() {
- action = DOMString::from(base.serialize());
+ action = DOMString::from(base.as_str());
}
// Step 9-11
let action_components = match base.join(&action) {
@@ -277,20 +277,21 @@ impl HTMLFormElement {
Err(_) => return
};
// Step 12-15
- let _action = action_components.serialize();
- let scheme = action_components.scheme.clone();
+ let scheme = action_components.scheme().to_owned();
let enctype = submitter.enctype();
let method = submitter.method();
let _target = submitter.target();
// TODO: Handle browsing contexts, partially loaded documents (step 16-17)
- let mut load_data = LoadData::new(action_components);
+ let mut load_data = LoadData::new(action_components, doc.get_referrer_policy(), Some(doc.url().clone()));
let parsed_data = match enctype {
FormEncType::UrlEncoded => {
let mime: mime::Mime = "application/x-www-form-urlencoded".parse().unwrap();
load_data.headers.set(ContentType(mime));
- serialize(form_data.iter().map(|d| (&*d.name, &*d.value)))
+ form_urlencoded::Serializer::new(String::new())
+ .extend_pairs(form_data.into_iter().map(|field| (field.name, field.value)))
+ .finish()
}
_ => "".to_owned() // TODO: Add serializers for the other encoding types
};
@@ -302,7 +303,8 @@ impl HTMLFormElement {
(_, FormMethod::FormDialog) => return, // Unimplemented
// https://html.spec.whatwg.org/multipage/#submit-mutate-action
("http", FormMethod::FormGet) | ("https", FormMethod::FormGet) => {
- load_data.url.query = Some(parsed_data);
+ // FIXME(SimonSapin): use url.query_pairs_mut() here.
+ load_data.url.set_query(Some(&*parsed_data));
self.plan_to_navigate(load_data, &win);
}
// https://html.spec.whatwg.org/multipage/#submit-body
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index fc339664833..a9d5471d468 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ToJSValConvertible};
-use dom::bindings::error::{Error, ErrorResult, Fallible};
+use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, LayoutJS};
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index c0a9e960385..a02546afddc 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -316,7 +316,7 @@ impl HTMLImageElementMethods for HTMLImageElement {
fn CurrentSrc(&self) -> DOMString {
let ref url = self.current_request.borrow().url;
match *url {
- Some(ref url) => DOMString::from(url.serialize()),
+ Some(ref url) => DOMString::from(url.as_str()),
None => DOMString::from(""),
}
}
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 1b058b4c671..a971a90ecbf 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -8,7 +8,6 @@ use dom::attr::{Attr, AttrValue};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
-use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{RootedReference};
@@ -25,7 +24,7 @@ use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use layout_interface::{LayoutChan, Msg};
use msg::constellation_msg::ConstellationChan;
-use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
+use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError};
use network_listener::{NetworkListener, PreInvoke};
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
use std::ascii::AsciiExt;
@@ -272,8 +271,8 @@ struct StylesheetContext {
impl PreInvoke for StylesheetContext {}
impl AsyncResponseListener for StylesheetContext {
- fn headers_available(&mut self, metadata: Metadata) {
- self.metadata = Some(metadata);
+ fn headers_available(&mut self, metadata: Result<Metadata, NetworkError>) {
+ self.metadata = metadata.ok();
}
fn data_available(&mut self, payload: Vec<u8>) {
@@ -281,9 +280,12 @@ impl AsyncResponseListener for StylesheetContext {
self.data.append(&mut payload);
}
- fn response_complete(&mut self, _status: Result<(), String>) {
+ fn response_complete(&mut self, _status: Result<(), NetworkError>) {
let data = mem::replace(&mut self.data, vec!());
- let metadata = self.metadata.take().unwrap();
+ let metadata = match self.metadata.take() {
+ Some(meta) => meta,
+ None => return,
+ };
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
let environment_encoding = UTF_8 as EncodingRef;
let protocol_encoding_label = metadata.charset.as_ref().map(|s| &**s);
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index b5a6a473dd3..76402db7a70 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -33,7 +33,7 @@ use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::jsapi::RootedValue;
use js::jsval::UndefinedValue;
-use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
+use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError};
use network_listener::{NetworkListener, PreInvoke};
use script_runtime::ScriptChan;
use script_thread::MainThreadScriptChan;
@@ -124,7 +124,7 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[
#[derive(HeapSizeOf, JSTraceable)]
pub enum ScriptOrigin {
Internal(DOMString, Url),
- External(Result<(Metadata, Vec<u8>), String>),
+ External(Result<(Metadata, Vec<u8>), NetworkError>),
}
/// The context required for asynchronously loading an external script source.
@@ -138,23 +138,25 @@ struct ScriptContext {
/// The initial URL requested.
url: Url,
/// Indicates whether the request failed, and why
- status: Result<(), String>
+ status: Result<(), NetworkError>
}
impl AsyncResponseListener for ScriptContext {
- fn headers_available(&mut self, metadata: Metadata) {
- let status_code = match metadata.status {
- Some(RawStatus(c, _)) => c,
- _ => 0
- };
+ fn headers_available(&mut self, metadata: Result<Metadata, NetworkError>) {
+ self.metadata = metadata.ok();
+
+ let status_code = self.metadata.as_ref().and_then(|m| {
+ match m.status {
+ Some(RawStatus(c, _)) => Some(c),
+ _ => None,
+ }
+ }).unwrap_or(0);
self.status = match status_code {
- 0 => Err("No http status code received".to_owned()),
+ 0 => Err(NetworkError::Internal("No http status code received".to_owned())),
200...299 => Ok(()), // HTTP ok status codes
- _ => Err(format!("HTTP error code {}", status_code))
+ _ => Err(NetworkError::Internal(format!("HTTP error code {}", status_code)))
};
-
- self.metadata = Some(metadata);
}
fn data_available(&mut self, payload: Vec<u8>) {
@@ -164,7 +166,7 @@ impl AsyncResponseListener for ScriptContext {
}
}
- fn response_complete(&mut self, status: Result<(), String>) {
+ fn response_complete(&mut self, status: Result<(), NetworkError>) {
let load = status.and(self.status.clone()).map(|_| {
let data = mem::replace(&mut self.data, vec!());
let metadata = self.metadata.take().unwrap();
@@ -398,7 +400,7 @@ impl HTMLScriptElement {
let (source, external, url) = match load {
// Step 2.a.
ScriptOrigin::External(Err(e)) => {
- error!("error loading script {}", e);
+ error!("error loading script {:?}", e);
self.dispatch_error_event();
return;
}
@@ -446,7 +448,7 @@ impl HTMLScriptElement {
let window = window_from_node(self);
let mut rval = RootedValue::new(window.get_cx(), UndefinedValue());
window.evaluate_script_on_global_with_result(&*source,
- &*url.serialize(),
+ url.as_str(),
rval.handle_mut());
// Step 2.b.7.
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index 4b5cd44773d..5ad77e9e8b4 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -132,8 +132,8 @@ impl HTMLTableElementMethods for HTMLTableElement {
impl CollectionFilter for TableRowFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
- elem.is::<HTMLTableRowElement>()
- && (root.is_parent_of(elem.upcast())
+ elem.is::<HTMLTableRowElement>() &&
+ (root.is_parent_of(elem.upcast())
|| self.sections.iter().any(|ref section| section.is_parent_of(elem.upcast())))
}
}
@@ -250,9 +250,9 @@ impl HTMLTableElementMethods for HTMLTableElement {
struct TBodiesFilter;
impl CollectionFilter for TBodiesFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
- elem.is::<HTMLTableSectionElement>()
- && elem.local_name() == &atom!("tbody")
- && elem.upcast::<Node>().GetParentNode().r() == Some(root)
+ elem.is::<HTMLTableSectionElement>() &&
+ elem.local_name() == &atom!("tbody") &&
+ elem.upcast::<Node>().GetParentNode().r() == Some(root)
}
}
diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs
index bb83e00b0db..2969102984d 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -29,8 +29,8 @@ use util::str::DOMString;
struct CellsFilter;
impl CollectionFilter for CellsFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
- (elem.is::<HTMLTableHeaderCellElement>() || elem.is::<HTMLTableDataCellElement>())
- && elem.upcast::<Node>().GetParentNode().r() == Some(root)
+ (elem.is::<HTMLTableHeaderCellElement>() || elem.is::<HTMLTableDataCellElement>()) &&
+ elem.upcast::<Node>().GetParentNode().r() == Some(root)
}
}
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index e51caa9f30e..fc737aed9ea 100644
--- a/components/script/dom/htmltablesectionelement.rs
+++ b/components/script/dom/htmltablesectionelement.rs
@@ -44,8 +44,8 @@ impl HTMLTableSectionElement {
struct RowsFilter;
impl CollectionFilter for RowsFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
- elem.is::<HTMLTableRowElement>()
- && elem.upcast::<Node>().GetParentNode().r() == Some(root)
+ elem.is::<HTMLTableRowElement>() &&
+ elem.upcast::<Node>().GetParentNode().r() == Some(root)
}
}
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs
index d3c157cf134..fa3fd87e004 100644
--- a/components/script/dom/macros.rs
+++ b/components/script/dom/macros.rs
@@ -99,7 +99,7 @@ macro_rules! make_url_or_base_getter(
let url = element.get_url_attribute(&atom!($htmlname));
if url.is_empty() {
let window = window_from_node(self);
- DOMString::from(window.get_url().serialize())
+ DOMString::from(window.get_url().into_string())
} else {
url
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 1e71966e4e7..0f2209c00ea 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -614,6 +614,12 @@ impl Node {
}
}
+ pub fn scroll_offset(&self) -> Point2D<f32> {
+ let document = self.owner_doc();
+ let window = document.window();
+ window.scroll_offset_query(self.to_trusted_node_address())
+ }
+
// https://dom.spec.whatwg.org/#dom-childnode-before
pub fn before(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
// Step 1.
@@ -1852,6 +1858,11 @@ impl NodeMethods for Node {
}
}
+ // https://dom.spec.whatwg.org/#dom-node-rootnode
+ fn RootNode(&self) -> Root<Node> {
+ self.inclusive_ancestors().last().unwrap()
+ }
+
// https://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Root<Node>> {
self.parent_node.get()
@@ -2219,6 +2230,14 @@ impl NodeMethods for Node {
}
}
+ // https://dom.spec.whatwg.org/#dom-node-issamenode
+ fn IsSameNode(&self, otherNode: Option<&Node>) -> bool {
+ match otherNode {
+ Some(node) => self == node,
+ None => false,
+ }
+ }
+
// https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
fn CompareDocumentPosition(&self, other: &Node) -> u16 {
if self == other {
diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs
index 215bcdd3db4..4a3d3f3da7d 100644
--- a/components/script/dom/progressevent.rs
+++ b/components/script/dom/progressevent.rs
@@ -11,6 +11,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
+use dom::window::Window;
use string_cache::Atom;
use util::str::DOMString;
@@ -31,6 +32,11 @@ impl ProgressEvent {
total: total
}
}
+ pub fn new_uninitialized(window: &Window) -> Root<ProgressEvent> {
+ reflect_dom_object(box ProgressEvent::new_inherited(false, 0, 0),
+ GlobalRef::Window(window),
+ ProgressEventBinding::Wrap)
+ }
pub fn new(global: GlobalRef, type_: Atom,
can_bubble: EventBubbles, cancelable: EventCancelable,
length_computable: bool, loaded: u64, total: u64) -> Root<ProgressEvent> {
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index 2312ac96795..25fbff24d28 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -26,7 +26,7 @@ use hyper::header::ContentType;
use hyper::mime::{Mime, SubLevel, TopLevel};
use js::jsapi::JSTracer;
use msg::constellation_msg::{PipelineId, SubpageId};
-use net_traits::{AsyncResponseListener, Metadata};
+use net_traits::{AsyncResponseListener, Metadata, NetworkError};
use network_listener::PreInvoke;
use parse::Parser;
use script_runtime::ScriptChan;
@@ -36,6 +36,7 @@ use std::cell::UnsafeCell;
use std::default::Default;
use std::ptr;
use url::Url;
+use util::resource_files::read_resource_file;
#[must_root]
#[derive(JSTraceable, HeapSizeOf)]
@@ -239,12 +240,23 @@ impl ParserContext {
}
impl AsyncResponseListener for ParserContext {
- fn headers_available(&mut self, metadata: Metadata) {
- let content_type = metadata.content_type.clone();
-
- let parser = ScriptThread::page_fetch_complete(self.id.clone(), self.subpage.clone(),
- metadata);
- let parser = match parser {
+ fn headers_available(&mut self, meta_result: Result<Metadata, NetworkError>) {
+ let mut is_ssl_error = false;
+ let metadata = match meta_result {
+ Ok(meta) => Some(meta),
+ Err(NetworkError::SslValidation(url)) => {
+ is_ssl_error = true;
+ let mut meta = Metadata::default(url);
+ let mime: Option<Mime> = "text/html".parse().ok();
+ meta.set_content_type(mime.as_ref());
+ Some(meta)
+ },
+ Err(_) => None,
+ };
+ let content_type = metadata.clone().and_then(|meta| meta.content_type);
+ let parser = match ScriptThread::page_fetch_complete(self.id.clone(),
+ self.subpage.clone(),
+ metadata) {
Some(parser) => parser,
None => return,
};
@@ -262,8 +274,7 @@ impl AsyncResponseListener for ParserContext {
match content_type {
Some(ContentType(Mime(TopLevel::Image, _, _))) => {
self.is_synthesized_document = true;
- let page = format!("<html><body><img src='{}' /></body></html>",
- self.url.serialize());
+ let page = format!("<html><body><img src='{}' /></body></html>", self.url);
parser.pending_input().borrow_mut().push(page);
parser.parse_sync();
},
@@ -274,7 +285,15 @@ impl AsyncResponseListener for ParserContext {
parser.parse_sync();
parser.set_plaintext_state();
},
- Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, _))) => {}, // Handle text/html
+ Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, _))) => { // Handle text/html
+ if is_ssl_error {
+ self.is_synthesized_document = true;
+ let page_bytes = read_resource_file("badcert.html").unwrap();
+ let page = String::from_utf8(page_bytes).unwrap();
+ parser.pending_input().borrow_mut().push(page);
+ parser.parse_sync();
+ }
+ },
Some(ContentType(Mime(TopLevel::Text, SubLevel::Xml, _))) => {}, // Handle text/xml
Some(ContentType(Mime(toplevel, sublevel, _))) => {
if toplevel.as_str() == "application" && sublevel.as_str() == "xhtml+xml" {
@@ -308,7 +327,7 @@ impl AsyncResponseListener for ParserContext {
}
}
- fn response_complete(&mut self, status: Result<(), String>) {
+ fn response_complete(&mut self, status: Result<(), NetworkError>) {
let parser = match self.parser.as_ref() {
Some(parser) => parser.root(),
None => return,
@@ -316,7 +335,7 @@ impl AsyncResponseListener for ParserContext {
parser.r().document().finish_load(LoadType::PageSource(self.url.clone()));
if let Err(err) = status {
- debug!("Failed to load page URL {}, error: {}", self.url.serialize(), err);
+ debug!("Failed to load page URL {}, error: {:?}", self.url, err);
// TODO(Savago): we should send a notification to callers #5463.
}
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index dae8d73e7a3..76e7c6a29f6 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -129,7 +129,11 @@ impl StorageMethods for Storage {
let (sender, receiver) = ipc::channel().unwrap();
self.get_storage_thread().send(StorageThreadMsg::Keys(sender, self.get_url(), self.storage_type)).unwrap();
- receiver.recv().unwrap().iter().cloned().map(DOMString::from).collect() // FIXME: inefficient?
+ receiver.recv()
+ .unwrap()
+ .into_iter()
+ .map(DOMString::from)
+ .collect()
}
// check-tidy: no specs after this line
diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs
index 7d1f7520c4a..e3317a34b49 100644
--- a/components/script/dom/storageevent.rs
+++ b/components/script/dom/storageevent.rs
@@ -12,6 +12,7 @@ use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::storage::Storage;
+use dom::window::Window;
use string_cache::Atom;
use util::str::DOMString;
@@ -42,6 +43,13 @@ impl StorageEvent {
}
}
+ pub fn new_uninitialized(window: &Window,
+ url: DOMString) -> Root<StorageEvent> {
+ reflect_dom_object(box StorageEvent::new_inherited(None, None, None, url, None),
+ GlobalRef::Window(window),
+ StorageEventBinding::Wrap)
+ }
+
pub fn new(global: GlobalRef,
type_: Atom,
bubbles: EventBubbles,
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs
index 6438e258543..f2ba7082e0f 100644
--- a/components/script/dom/url.rs
+++ b/components/script/dom/url.rs
@@ -13,7 +13,7 @@ use dom::urlhelper::UrlHelper;
use dom::urlsearchparams::URLSearchParams;
use std::borrow::ToOwned;
use std::default::Default;
-use url::{Host, Url, UrlParser};
+use url::{Host, Url};
use util::str::DOMString;
// https://url.spec.whatwg.org/#url
@@ -42,8 +42,13 @@ impl URL {
global, URLBinding::Wrap)
}
- pub fn set_query(&self, query: String) {
- self.url.borrow_mut().query = Some(query);
+ pub fn query_pairs(&self) -> Vec<(String, String)> {
+ self.url.borrow().query_pairs().into_owned().collect()
+ }
+
+ pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
+ let mut url = self.url.borrow_mut();
+ url.query_pairs_mut().clear().extend_pairs(pairs);
}
}
@@ -68,17 +73,11 @@ impl URL {
}
};
// Step 3.
- let parsed_url = {
- let mut parser = UrlParser::new();
- if let Some(parsed_base) = parsed_base.as_ref() {
- parser.base_url(parsed_base);
- }
- match parser.parse(&url.0) {
- Ok(url) => url,
- Err(error) => {
- // Step 4.
- return Err(Error::Type(format!("could not parse URL: {}", error)));
- }
+ let parsed_url = match Url::options().base_url(parsed_base.as_ref()).parse(&url.0) {
+ Ok(url) => url,
+ Err(error) => {
+ // Step 4.
+ return Err(Error::Type(format!("could not parse URL: {}", error)));
}
};
// Step 5: Skip (see step 8 below).
@@ -145,6 +144,7 @@ impl URLMethods for URL {
match Url::parse(&value.0) {
Ok(url) => {
*self.url.borrow_mut() = url;
+ self.search_params.set(None); // To be re-initialized in the SearchParams getter.
Ok(())
},
Err(error) => {
@@ -207,7 +207,7 @@ impl URLMethods for URL {
fn SetSearch(&self, value: USVString) {
UrlHelper::SetSearch(&mut self.url.borrow_mut(), value);
if let Some(search_params) = self.search_params.get() {
- search_params.set_list(self.url.borrow().query_pairs().unwrap_or_else(|| vec![]));
+ search_params.set_list(self.url.borrow().query_pairs().into_owned().collect());
}
}
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index ab0a0c5f8c0..68e4219f996 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -4,166 +4,31 @@
use dom::bindings::str::USVString;
use std::borrow::ToOwned;
-use std::fmt::Write;
-use url::urlutils::{UrlUtils, UrlUtilsWrapper};
-use url::{Origin, SchemeData, Url, UrlParser};
+use url::{Url, quirks};
#[derive(HeapSizeOf)]
pub struct UrlHelper;
impl UrlHelper {
- pub fn Hash(url: &Url) -> USVString {
- USVString(match url.fragment {
- None => "".to_owned(),
- Some(ref hash) if hash.is_empty() => "".to_owned(),
- Some(ref hash) => format!("#{}", hash)
- })
- }
-
- pub fn SetHash(url: &mut Url, value: USVString) {
- url.fragment = Some(String::new());
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_fragment(&value.0);
- }
-
- pub fn Host(url: &Url) -> USVString {
- USVString(match url.scheme_data {
- SchemeData::NonRelative(..) => "".to_owned(),
- SchemeData::Relative(ref scheme_data) => {
- let mut host = scheme_data.host.serialize();
- if let Some(port) = scheme_data.port {
- write!(host, ":{}", port).unwrap();
- }
- host
- },
- })
- }
-
- pub fn SetHost(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_host(&value.0);
- }
-
- pub fn Origin(url: &Url) -> USVString {
- USVString(match url.origin() {
- Origin::UID(_) => {
- // https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin
- // If the origin in question is not a scheme/host/port tuple,
- // then return the literal string "null" and abort these steps.
- "null".to_owned()
- },
- Origin::Tuple(protocol, host, _) => {
- let mut origin =
- format!(
- "{protocol}://{host}",
- protocol = protocol,
- host = host
- );
- if let Some(port) =
- // https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin
- // only append the port # to the serialized origin if the port is different from
- // the default port for the protocol. If url.scheme_data.port is None, that
- // indicates that the port is a default port
- url.relative_scheme_data().and_then(|scheme| scheme.port) {
- write!(origin, ":{}", port).unwrap();
- };
- origin
- }
- })
- }
-
- pub fn Hostname(url: &Url) -> USVString {
- USVString(url.serialize_host().unwrap_or_else(|| "".to_owned()))
- }
-
- pub fn SetHostname(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_host_and_port(&value.0);
- }
-
- pub fn Href(url: &Url) -> USVString {
- USVString(url.serialize())
- }
-
- pub fn Password(url: &Url) -> USVString {
- USVString(url.password().unwrap_or("").to_owned())
- }
-
- pub fn SetPassword(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_password(&value.0);
- }
-
- pub fn Pathname(url: &Url) -> USVString {
- USVString(match url.scheme_data {
- SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
- SchemeData::Relative(..) => url.serialize_path().unwrap()
- })
- }
-
- pub fn SetPathname(url: &mut Url, value: USVString) {
- if let Some(path) = url.path_mut() {
- path.clear();
- }
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_path(&value.0);
- }
-
- pub fn Port(url: &Url) -> USVString {
- USVString(match url.port() {
- None => "".to_owned(),
- Some(port) => port.to_string(),
- })
- }
-
- pub fn SetPort(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_port(&value.0);
- }
-
- pub fn Protocol(url: &Url) -> USVString {
- USVString(format!("{}:", url.scheme.clone()))
- }
-
- pub fn SetProtocol(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_scheme(&value.0);
- }
-
- // https://html.spec.whatwg.org/multipage/#same-origin
- pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
- if urlA.host() != urlB.host() {
- return false
- }
- if urlA.scheme != urlB.scheme {
- return false
- }
- if urlA.port() != urlB.port() {
- return false
- }
- true
- }
-
- pub fn Search(url: &Url) -> USVString {
- USVString(match url.query {
- None => "".to_owned(),
- Some(ref query) if query.is_empty() => "".to_owned(),
- Some(ref query) => format!("?{}", query)
- })
- }
-
- pub fn SetSearch(url: &mut Url, value: USVString) {
- url.query = Some(String::new());
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_query(&value.0);
- }
-
- pub fn Username(url: &Url) -> USVString {
- USVString(url.username().unwrap_or("").to_owned())
- }
-
- pub fn SetUsername(url: &mut Url, value: USVString) {
- let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
- let _ = wrapper.set_username(&value.0);
- }
+ pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool { urlA.origin() == urlB.origin() }
+ pub fn Origin(url: &Url) -> USVString { USVString(quirks::origin(url)) }
+ pub fn Href(url: &Url) -> USVString { USVString(quirks::href(url).to_owned()) }
+ pub fn Hash(url: &Url) -> USVString { USVString(quirks::hash(url).to_owned()) }
+ pub fn Host(url: &Url) -> USVString { USVString(quirks::host(url).to_owned()) }
+ pub fn Port(url: &Url) -> USVString { USVString(quirks::port(url).to_owned()) }
+ pub fn Search(url: &Url) -> USVString { USVString(quirks::search(url).to_owned()) }
+ pub fn Hostname(url: &Url) -> USVString { USVString(quirks::hostname(url).to_owned()) }
+ pub fn Password(url: &Url) -> USVString { USVString(quirks::password(url).to_owned()) }
+ pub fn Pathname(url: &Url) -> USVString { USVString(quirks::pathname(url).to_owned()) }
+ pub fn Protocol(url: &Url) -> USVString { USVString(quirks::protocol(url).to_owned()) }
+ pub fn Username(url: &Url) -> USVString { USVString(quirks::username(url).to_owned()) }
+ pub fn SetHash(url: &mut Url, value: USVString) { quirks::set_hash(url, &value.0) }
+ pub fn SetHost(url: &mut Url, value: USVString) { let _ = quirks::set_host(url, &value.0); }
+ pub fn SetPort(url: &mut Url, value: USVString) { let _ = quirks::set_port(url, &value.0); }
+ pub fn SetSearch(url: &mut Url, value: USVString) { quirks::set_search(url, &value.0) }
+ pub fn SetPathname(url: &mut Url, value: USVString) { quirks::set_pathname(url, &value.0) }
+ pub fn SetHostname(url: &mut Url, value: USVString) { let _ = quirks::set_hostname(url, &value.0); }
+ pub fn SetPassword(url: &mut Url, value: USVString) { let _ = quirks::set_password(url, &value.0); }
+ pub fn SetProtocol(url: &mut Url, value: USVString) { let _ = quirks::set_protocol(url, &value.0); }
+ pub fn SetUsername(url: &mut Url, value: USVString) { let _ = quirks::set_username(url, &value.0); }
}
diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs
index bb7b1cb910c..800cd10db88 100644
--- a/components/script/dom/urlsearchparams.rs
+++ b/components/script/dom/urlsearchparams.rs
@@ -14,7 +14,7 @@ use dom::bindings::str::USVString;
use dom::bindings::weakref::MutableWeakRef;
use dom::url::URL;
use encoding::types::EncodingRef;
-use url::form_urlencoded::{parse, serialize_with_encoding};
+use url::form_urlencoded;
use util::str::DOMString;
// https://url.spec.whatwg.org/#interface-urlsearchparams
@@ -31,7 +31,7 @@ impl URLSearchParams {
fn new_inherited(url: Option<&URL>) -> URLSearchParams {
URLSearchParams {
reflector_: Reflector::new(),
- list: DOMRefCell::new(vec![]),
+ list: DOMRefCell::new(url.map_or(Vec::new(), |url| url.query_pairs())),
url: MutableWeakRef::new(url),
}
}
@@ -49,7 +49,8 @@ impl URLSearchParams {
match init {
Some(USVStringOrURLSearchParams::USVString(init)) => {
// Step 2.
- *query.list.borrow_mut() = parse(init.0.as_bytes());
+ *query.list.borrow_mut() = form_urlencoded::parse(init.0.as_bytes())
+ .into_owned().collect();
},
Some(USVStringOrURLSearchParams::URLSearchParams(init)) => {
// Step 3.
@@ -110,26 +111,28 @@ impl URLSearchParamsMethods for URLSearchParams {
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
fn Set(&self, name: USVString, value: USVString) {
- // Step 1.
- let mut list = self.list.borrow_mut();
- let mut index = None;
- let mut i = 0;
- list.retain(|&(ref k, _)| {
- if index.is_none() {
- if k == &name.0 {
- index = Some(i);
+ {
+ // Step 1.
+ let mut list = self.list.borrow_mut();
+ let mut index = None;
+ let mut i = 0;
+ list.retain(|&(ref k, _)| {
+ if index.is_none() {
+ if k == &name.0 {
+ index = Some(i);
+ } else {
+ i += 1;
+ }
+ true
} else {
- i += 1;
+ k != &name.0
}
- true
- } else {
- k != &name.0
- }
- });
- match index {
- Some(index) => list[index].1 = value.0,
- None => list.push((name.0, value.0)), // Step 2.
- };
+ });
+ match index {
+ Some(index) => list[index].1 = value.0,
+ None => list.push((name.0, value.0)), // Step 2.
+ };
+ } // Un-borrow self.list
// Step 3.
self.update_steps();
}
@@ -145,7 +148,10 @@ impl URLSearchParams {
// https://url.spec.whatwg.org/#concept-urlencoded-serializer
pub fn serialize(&self, encoding: Option<EncodingRef>) -> String {
let list = self.list.borrow();
- serialize_with_encoding(list.iter(), encoding)
+ form_urlencoded::Serializer::new(String::new())
+ .encoding_override(encoding)
+ .extend_pairs(&*list)
+ .finish()
}
}
@@ -154,7 +160,7 @@ impl URLSearchParams {
// https://url.spec.whatwg.org/#concept-urlsearchparams-update
fn update_steps(&self) {
if let Some(url) = self.url.root() {
- url.set_query(self.serialize(None));
+ url.set_query_pairs(&self.list.borrow())
}
}
}
diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs
index ac93727eb7c..fa785146499 100644
--- a/components/script/dom/webglcontextevent.rs
+++ b/components/script/dom/webglcontextevent.rs
@@ -41,6 +41,17 @@ impl WebGLContextEvent {
}
}
+ pub fn new_uninitialized(global_ref: GlobalRef) -> Root<WebGLContextEvent> {
+ // according to https://www.khronos.org/registry/webgl/specs/1.0/#5.15 this is
+ // additional information or the empty string if no additional information is
+ // available.
+ let status_message = DOMString::new();
+ reflect_dom_object(
+ box WebGLContextEvent::new_inherited(status_message),
+ global_ref,
+ WebGLContextEventBinding::Wrap)
+ }
+
pub fn new(global: GlobalRef,
type_: Atom,
bubbles: EventBubbles,
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 0458e2ae2ca..6cc122cf459 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -23,6 +23,7 @@ pub struct WebGLProgram {
webgl_object: WebGLObject,
id: u32,
is_deleted: Cell<bool>,
+ linked: Cell<bool>,
fragment_shader: MutNullableHeap<JS<WebGLShader>>,
vertex_shader: MutNullableHeap<JS<WebGLShader>>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
@@ -35,6 +36,7 @@ impl WebGLProgram {
webgl_object: WebGLObject::new_inherited(),
id: id,
is_deleted: Cell::new(false),
+ linked: Cell::new(false),
fragment_shader: Default::default(),
vertex_shader: Default::default(),
renderer: renderer,
@@ -71,19 +73,27 @@ impl WebGLProgram {
/// glLinkProgram
pub fn link(&self) {
- self.renderer.send(CanvasMsg::WebGL(WebGLCommand::LinkProgram(self.id))).unwrap();
- }
+ self.linked.set(false);
- /// glUseProgram
- pub fn use_program(&self) -> WebGLResult<()> {
match self.fragment_shader.get() {
Some(ref shader) if shader.successfully_compiled() => {},
- _ => return Err(WebGLError::InvalidOperation),
+ _ => return,
}
match self.vertex_shader.get() {
Some(ref shader) if shader.successfully_compiled() => {},
- _ => return Err(WebGLError::InvalidOperation),
+ _ => return,
+ }
+
+ self.linked.set(true);
+
+ self.renderer.send(CanvasMsg::WebGL(WebGLCommand::LinkProgram(self.id))).unwrap();
+ }
+
+ /// glUseProgram
+ pub fn use_program(&self) -> WebGLResult<()> {
+ if !self.linked.get() {
+ return Err(WebGLError::InvalidOperation);
}
self.renderer.send(CanvasMsg::WebGL(WebGLCommand::UseProgram(self.id))).unwrap();
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 5f1b0589af4..7e48ba60d34 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas_traits::{CanvasCommonMsg, CanvasMsg};
-use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{WebGLRenderingContextMethods};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
-use dom::bindings::conversions::{ToJSValConvertible, array_buffer_view_to_vec_checked, array_buffer_view_to_vec};
+use dom::bindings::conversions::{ToJSValConvertible, array_buffer_view_data_checked};
+use dom::bindings::conversions::{array_buffer_view_to_vec_checked, array_buffer_view_to_vec};
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
@@ -67,45 +67,6 @@ bitflags! {
}
}
-pub enum UniformType {
- Int,
- IntVec2,
- IntVec3,
- IntVec4,
- Float,
- FloatVec2,
- FloatVec3,
- FloatVec4,
-}
-
-impl UniformType {
- fn element_count(&self) -> usize {
- match *self {
- UniformType::Int => 1,
- UniformType::IntVec2 => 2,
- UniformType::IntVec3 => 3,
- UniformType::IntVec4 => 4,
- UniformType::Float => 1,
- UniformType::FloatVec2 => 2,
- UniformType::FloatVec3 => 3,
- UniformType::FloatVec4 => 4,
- }
- }
-
- fn as_gl_constant(&self) -> u32 {
- match *self {
- UniformType::Int => constants::INT,
- UniformType::IntVec2 => constants::INT_VEC2,
- UniformType::IntVec3 => constants::INT_VEC3,
- UniformType::IntVec4 => constants::INT_VEC4,
- UniformType::Float => constants::FLOAT,
- UniformType::FloatVec2 => constants::FLOAT_VEC2,
- UniformType::FloatVec3 => constants::FLOAT_VEC3,
- UniformType::FloatVec4 => constants::FLOAT_VEC4,
- }
- }
-}
-
#[dom_struct]
pub struct WebGLRenderingContext {
reflector_: Reflector,
@@ -219,21 +180,29 @@ impl WebGLRenderingContext {
.unwrap();
}
+ fn validate_stencil_actions(&self, action: u32) -> bool {
+ match action {
+ 0 | constants::KEEP | constants::REPLACE | constants::INCR | constants::DECR |
+ constants::INVERT | constants::INCR_WRAP | constants::DECR_WRAP => true,
+ _ => false,
+ }
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml
// https://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-2.10.4
fn validate_uniform_parameters<T>(&self,
- uniform: Option<&WebGLUniformLocation>,
- type_: UniformType,
- data: Option<&[T]>) -> bool {
+ uniform: Option<&WebGLUniformLocation>,
+ uniform_type: UniformSetterType,
+ data: Option<&[T]>) -> bool {
let uniform = match uniform {
Some(uniform) => uniform,
None => return false,
};
let program = self.current_program.get();
- let program = match program {
- Some(ref program) if program.id() == uniform.program_id() => program,
+ match program {
+ Some(ref program) if program.id() == uniform.program_id() => {},
_ => {
self.webgl_error(InvalidOperation);
return false;
@@ -248,28 +217,200 @@ impl WebGLRenderingContext {
},
};
- // TODO(autrilla): Don't request this every time, cache it
- let active_uniform = match program.get_active_uniform(
- uniform.id() as u32) {
- Ok(active_uniform) => active_uniform,
- Err(_) => {
- self.webgl_error(InvalidOperation);
+ // TODO(emilio): Get more complex uniform info from ANGLE, and use it to
+ // properly validate that the uniform setter type is compatible with the
+ // uniform type, and that the uniform size matches.
+ if data.len() % uniform_type.element_count() != 0 {
+ self.webgl_error(InvalidOperation);
+ return false;
+ }
+
+ true
+ }
+
+ fn validate_tex_image_parameters(&self,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ width: i32,
+ height: i32,
+ border: i32,
+ format: u32,
+ data_type: u32) -> bool {
+ // GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D,
+ // GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+ // GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ // GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.
+ let texture = match target {
+ constants::TEXTURE_2D
+ => self.bound_texture_2d.get(),
+ constants::TEXTURE_CUBE_MAP_POSITIVE_X |
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_X |
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Y |
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Y |
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Z |
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Z
+ => self.bound_texture_cube_map.get(),
+ _ => {
+ self.webgl_error(InvalidEnum);
return false;
},
};
- if data.len() % type_.element_count() != 0 ||
- (data.len() / type_.element_count() > active_uniform.Size() as usize) {
- self.webgl_error(InvalidOperation);
+ // If an attempt is made to call this function with no
+ // WebGLTexture bound, an INVALID_OPERATION error is generated.
+ if texture.is_none() {
+ self.webgl_error(InvalidOperation);
+ return false;
+ }
+
+ // GL_INVALID_ENUM is generated if data_type is not an accepted value.
+ match data_type {
+ constants::UNSIGNED_BYTE |
+ constants::UNSIGNED_SHORT_4_4_4_4 |
+ constants::UNSIGNED_SHORT_5_5_5_1 |
+ constants::UNSIGNED_SHORT_5_6_5 => {},
+ _ => {
+ self.webgl_error(InvalidEnum);
return false;
+ },
+ }
+
+
+ // TODO(emilio): GL_INVALID_VALUE may be generated if
+ // level is greater than log_2(max), where max is
+ // the returned value of GL_MAX_TEXTURE_SIZE when
+ // target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE
+ // when target is not GL_TEXTURE_2D.
+ let is_cubic = target != constants::TEXTURE_2D;
+
+ // GL_INVALID_VALUE is generated if target is one of the
+ // six cube map 2D image targets and the width and height
+ // parameters are not equal.
+ if is_cubic && width != height {
+ self.webgl_error(InvalidValue);
+ return false;
}
- if type_.as_gl_constant() != active_uniform.Type() {
+ // GL_INVALID_VALUE is generated if internal_format is not an
+ // accepted format.
+ match internal_format {
+ constants::DEPTH_COMPONENT |
+ constants::ALPHA |
+ constants::RGB |
+ constants::RGBA |
+ constants::LUMINANCE |
+ constants::LUMINANCE_ALPHA => {},
+
+ _ => {
+ self.webgl_error(InvalidValue);
+ return false;
+ },
+ }
+
+ // GL_INVALID_OPERATION is generated if format does not
+ // match internal_format.
+ if format != internal_format {
self.webgl_error(InvalidOperation);
return false;
}
- return true;
+ // GL_INVALID_VALUE is generated if level is less than 0.
+ //
+ // GL_INVALID_VALUE is generated if width or height is less than 0
+ // or greater than GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or
+ // GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.
+ //
+ // TODO(emilio): Check limits
+ if width < 0 || height < 0 || level < 0 {
+ self.webgl_error(InvalidValue);
+ return false;
+ }
+
+ // GL_INVALID_VALUE is generated if level is greater than zero and the
+ // texture is not power of two.
+ if level > 0 &&
+ (!(width as u32).is_power_of_two() ||
+ !(height as u32).is_power_of_two()) {
+ self.webgl_error(InvalidValue);
+ return false;
+ }
+
+ // GL_INVALID_VALUE is generated if border is not 0.
+ if border != 0 {
+ self.webgl_error(InvalidValue);
+ return false;
+ }
+
+ // GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_SHORT_4_4_4_4 or
+ // GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA.
+ //
+ // GL_INVALID_OPERATION is generated if type is
+ // GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB.
+ match data_type {
+ constants::UNSIGNED_SHORT_4_4_4_4 |
+ constants::UNSIGNED_SHORT_5_5_5_1 if format != constants::RGBA => {
+ self.webgl_error(InvalidOperation);
+ return false;
+ },
+ constants::UNSIGNED_SHORT_5_6_5 if format != constants::RGB => {
+ self.webgl_error(InvalidOperation);
+ return false;
+ },
+ _ => {},
+ }
+
+ true
+ }
+
+ fn tex_image_2d(&self,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ width: i32,
+ height: i32,
+ border: i32,
+ format: u32,
+ data_type: u32,
+ pixels: Vec<u8>) { // NB: pixels should NOT be premultipied
+ // This should be validated before reaching this function
+ debug_assert!(self.validate_tex_image_parameters(target, level,
+ internal_format,
+ width, height,
+ border, format,
+ data_type));
+
+ let slot = match target {
+ constants::TEXTURE_2D
+ => self.bound_texture_2d.get(),
+ _ => self.bound_texture_cube_map.get(),
+ };
+
+ let texture = slot.as_ref().expect("No bound texture found after validation");
+
+ if format == constants::RGBA &&
+ data_type == constants::UNSIGNED_BYTE &&
+ self.texture_unpacking_settings.get().contains(PREMULTIPLY_ALPHA) {
+ // TODO(emilio): premultiply here.
+ }
+
+ // TODO(emilio): Flip Y axis if necessary here
+
+ // TexImage2D depth is always equal to 1
+ handle_potential_webgl_error!(self, texture.initialize(target,
+ width as u32,
+ height as u32, 1,
+ internal_format,
+ level as u32));
+
+
+ // TODO(emilio): Invert axis, convert colorspace, premultiply alpha if requested
+ let msg = WebGLCommand::TexImage2D(target, level, internal_format as i32,
+ width, height, format, data_type, pixels);
+
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(msg))
+ .unwrap()
}
}
@@ -483,6 +624,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Err(e) => return self.webgl_error(e),
}
} else {
+ slot.set(None);
// Unbind the current buffer
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::BindBuffer(target, 0)))
@@ -526,7 +668,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let slot = match target {
constants::TEXTURE_2D => &self.bound_texture_2d,
constants::TEXTURE_CUBE_MAP => &self.bound_texture_cube_map,
-
_ => return self.webgl_error(InvalidEnum),
};
@@ -566,20 +707,24 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
_ => return self.webgl_error(InvalidEnum),
};
+
let bound_buffer = match bound_buffer {
Some(bound_buffer) => bound_buffer,
None => return self.webgl_error(InvalidValue),
};
+
match usage {
constants::STREAM_DRAW |
constants::STATIC_DRAW |
constants::DYNAMIC_DRAW => (),
_ => return self.webgl_error(InvalidEnum),
}
+
let data = match data {
Some(data) => data,
None => return self.webgl_error(InvalidValue),
};
+
if let Some(data_vec) = array_buffer_view_to_vec::<u8>(data) {
handle_potential_webgl_error!(self, bound_buffer.buffer_data(target, &data_vec, usage));
} else {
@@ -1082,6 +1227,82 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilFunc(&self, func: u32, ref_: i32, mask: u32) {
+ match func {
+ constants::NEVER | constants::LESS | constants::EQUAL | constants::LEQUAL |
+ constants::GREATER | constants::NOTEQUAL | constants::GEQUAL | constants::ALWAYS =>
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilFunc(func, ref_, mask)))
+ .unwrap(),
+ _ => self.webgl_error(InvalidEnum),
+ }
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilFuncSeparate(&self, face: u32, func: u32, ref_: i32, mask: u32) {
+ match face {
+ constants::FRONT | constants::BACK | constants::FRONT_AND_BACK => (),
+ _ => return self.webgl_error(InvalidEnum),
+ }
+
+ match func {
+ constants::NEVER | constants::LESS | constants::EQUAL | constants::LEQUAL |
+ constants::GREATER | constants::NOTEQUAL | constants::GEQUAL | constants::ALWAYS =>
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilFuncSeparate(face, func, ref_, mask)))
+ .unwrap(),
+ _ => self.webgl_error(InvalidEnum),
+ }
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilMask(&self, mask: u32) {
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilMask(mask)))
+ .unwrap()
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilMaskSeparate(&self, face: u32, mask: u32) {
+ match face {
+ constants::FRONT | constants::BACK | constants::FRONT_AND_BACK =>
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilMaskSeparate(face, mask)))
+ .unwrap(),
+ _ => return self.webgl_error(InvalidEnum),
+ }
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilOp(&self, fail: u32, zfail: u32, zpass: u32) {
+ if self.validate_stencil_actions(fail) && self.validate_stencil_actions(zfail) &&
+ self.validate_stencil_actions(zpass) {
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilOp(fail, zfail, zpass)))
+ .unwrap()
+ } else {
+ self.webgl_error(InvalidEnum)
+ }
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilOpSeparate(&self, face: u32, fail: u32, zfail: u32, zpass: u32) {
+ match face {
+ constants::FRONT | constants::BACK | constants::FRONT_AND_BACK => (),
+ _ => return self.webgl_error(InvalidEnum),
+ }
+
+ if self.validate_stencil_actions(fail) && self.validate_stencil_actions(zfail) &&
+ self.validate_stencil_actions(zpass) {
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::StencilOpSeparate(face, fail, zfail, zpass)))
+ .unwrap()
+ } else {
+ self.webgl_error(InvalidEnum)
+ }
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn LinkProgram(&self, program: Option<&WebGLProgram>) {
if let Some(program) = program {
@@ -1109,7 +1330,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform1f(&self,
uniform: Option<&WebGLUniformLocation>,
val: f32) {
- if self.validate_uniform_parameters(uniform, UniformType::Float, Some(&[val])) {
+ if self.validate_uniform_parameters(uniform, UniformSetterType::Float, Some(&[val])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform1f(uniform.unwrap().id(), val)))
.unwrap()
@@ -1120,7 +1341,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform1i(&self,
uniform: Option<&WebGLUniformLocation>,
val: i32) {
- if self.validate_uniform_parameters(uniform, UniformType::Int, Some(&[val])) {
+ if self.validate_uniform_parameters(uniform, UniformSetterType::Int, Some(&[val])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform1i(uniform.unwrap().id(), val)))
.unwrap()
@@ -1133,7 +1354,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<i32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::Int, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform, UniformSetterType::Int, data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform1iv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1146,7 +1367,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<f32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::Float, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform, UniformSetterType::Float, data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform1fv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1157,7 +1378,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform2f(&self,
uniform: Option<&WebGLUniformLocation>,
x: f32, y: f32) {
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec2, Some(&[x, y])) {
+ if self.validate_uniform_parameters(uniform, UniformSetterType::FloatVec2, Some(&[x, y])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform2f(uniform.unwrap().id(), x, y)))
.unwrap()
@@ -1170,7 +1391,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<f32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec2, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::FloatVec2,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform2fv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1181,7 +1404,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform2i(&self,
uniform: Option<&WebGLUniformLocation>,
x: i32, y: i32) {
- if self.validate_uniform_parameters(uniform, UniformType::IntVec2, Some(&[x, y])) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec2,
+ Some(&[x, y])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform2i(uniform.unwrap().id(), x, y)))
.unwrap()
@@ -1194,7 +1419,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<i32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::IntVec2, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec2,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform2iv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1205,7 +1432,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform3f(&self,
uniform: Option<&WebGLUniformLocation>,
x: f32, y: f32, z: f32) {
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec3, Some(&[x, y, z])) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::FloatVec3,
+ Some(&[x, y, z])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform3f(uniform.unwrap().id(), x, y, z)))
.unwrap()
@@ -1218,7 +1447,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<f32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec3, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::FloatVec3,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform3fv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1229,7 +1460,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform3i(&self,
uniform: Option<&WebGLUniformLocation>,
x: i32, y: i32, z: i32) {
- if self.validate_uniform_parameters(uniform, UniformType::IntVec3, Some(&[x, y, z])) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec3,
+ Some(&[x, y, z])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform3i(uniform.unwrap().id(), x, y, z)))
.unwrap()
@@ -1242,7 +1475,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<i32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::IntVec3, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec3,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform3iv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1253,7 +1488,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform4i(&self,
uniform: Option<&WebGLUniformLocation>,
x: i32, y: i32, z: i32, w: i32) {
- if self.validate_uniform_parameters(uniform, UniformType::IntVec4, Some(&[x, y, z, w])) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec4,
+ Some(&[x, y, z, w])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform4i(uniform.unwrap().id(), x, y, z, w)))
.unwrap()
@@ -1267,7 +1504,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<i32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::IntVec4, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::IntVec4,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform4iv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1278,7 +1517,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn Uniform4f(&self,
uniform: Option<&WebGLUniformLocation>,
x: f32, y: f32, z: f32, w: f32) {
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec4, Some(&[x, y, z, w])) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::FloatVec4,
+ Some(&[x, y, z, w])) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform4f(uniform.unwrap().id(), x, y, z, w)))
.unwrap()
@@ -1291,7 +1532,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
uniform: Option<&WebGLUniformLocation>,
data: Option<*mut JSObject>) {
let data_vec = data.and_then(|d| array_buffer_view_to_vec::<f32>(d));
- if self.validate_uniform_parameters(uniform, UniformType::FloatVec4, data_vec.as_ref().map(Vec::as_slice)) {
+ if self.validate_uniform_parameters(uniform,
+ UniformSetterType::FloatVec4,
+ data_vec.as_ref().map(Vec::as_slice)) {
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::Uniform4fv(uniform.unwrap().id(), data_vec.unwrap())))
.unwrap()
@@ -1400,28 +1643,112 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}
+ #[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn TexImage2D(&self,
+ _cx: *mut JSContext,
target: u32,
level: i32,
internal_format: u32,
+ width: i32,
+ height: i32,
+ border: i32,
format: u32,
data_type: u32,
- source: Option<ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement>) {
- let texture = match target {
- constants::TEXTURE_2D => self.bound_texture_2d.get(),
- constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get(),
- _ => return self.webgl_error(InvalidEnum),
+ data: Option<*mut JSObject>) {
+ if !self.validate_tex_image_parameters(target,
+ level,
+ internal_format,
+ width, height,
+ border,
+ format,
+ data_type) {
+ return; // Error handled in validate()
+ }
+
+ // TODO(emilio, #10693): Add type-safe wrappers to validations
+ let (element_size, components_per_element) = match data_type {
+ constants::UNSIGNED_BYTE => (1, 1),
+ constants::UNSIGNED_SHORT_5_6_5 => (2, 3),
+ constants::UNSIGNED_SHORT_5_5_5_1 |
+ constants::UNSIGNED_SHORT_4_4_4_4 => (2, 4),
+ _ => unreachable!(), // previously validated
};
- if texture.is_none() {
+
+ let components = match format {
+ constants::DEPTH_COMPONENT => 1,
+ constants::ALPHA => 1,
+ constants::LUMINANCE => 1,
+ constants::LUMINANCE_ALPHA => 2,
+ constants::RGB => 3,
+ constants::RGBA => 4,
+ _ => unreachable!(), // previously validated
+ };
+
+ // If data is non-null, the type of pixels must match the type of the
+ // data to be read.
+ // If it is UNSIGNED_BYTE, a Uint8Array must be supplied;
+ // if it is UNSIGNED_SHORT_5_6_5, UNSIGNED_SHORT_4_4_4_4,
+ // or UNSIGNED_SHORT_5_5_5_1, a Uint16Array must be supplied.
+ // If the types do not match, an INVALID_OPERATION error is generated.
+ let received_size = if let Some(data) = data {
+ if unsafe { array_buffer_view_data_checked::<u16>(data).is_some() } {
+ 2
+ } else if unsafe { array_buffer_view_data_checked::<u8>(data).is_some() } {
+ 1
+ } else {
+ return self.webgl_error(InvalidOperation);
+ }
+ } else {
+ element_size
+ };
+
+ if received_size != element_size {
return self.webgl_error(InvalidOperation);
}
- // TODO(emilio): Validate more parameters
+
+ // NOTE: width and height are positive or zero due to validate()
+ let expected_byte_length = width * height * element_size * components / components_per_element;
+
+
+ // If data is null, a buffer of sufficient size
+ // initialized to 0 is passed.
+ let buff = if let Some(data) = data {
+ array_buffer_view_to_vec::<u8>(data)
+ .expect("Can't reach here without being an ArrayBufferView!")
+ } else {
+ vec![0u8; expected_byte_length as usize]
+ };
+
+ if buff.len() != expected_byte_length as usize {
+ return self.webgl_error(InvalidOperation);
+ }
+
+ self.tex_image_2d(target, level,
+ internal_format,
+ width, height, border,
+ format, data_type, buff)
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexImage2D_(&self,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ format: u32,
+ data_type: u32,
+ source: Option<ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement>) {
let source = match source {
Some(s) => s,
None => return,
};
+
+ // NOTE: Getting the pixels probably can be short-circuited if some
+ // parameter is invalid.
+ //
+ // Nontheless, since it's the error case, I'm not totally sure the
+ // complexity is worth it.
let (pixels, size) = match source {
ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement::ImageData(image_data) => {
let global = self.global();
@@ -1443,7 +1770,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
};
let size = Size2D::new(img.width as i32, img.height as i32);
- // TODO(emilio): Validate that the format argument is coherent with the image.
+
+ // TODO(emilio): Validate that the format argument
+ // is coherent with the image.
+ //
// RGB8 should be easy to support too
let mut data = match img.format {
PixelFormat::RGBA8 => img.bytes.to_vec(),
@@ -1454,8 +1784,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
(data, size)
},
- // TODO(emilio): Getting canvas data is implemented in CanvasRenderingContext2D, but
- // we need to refactor it moving it to `HTMLCanvasElement` and supporting WebGLContext
+ // TODO(emilio): Getting canvas data is implemented in CanvasRenderingContext2D,
+ // but we need to refactor it moving it to `HTMLCanvasElement` and support
+ // WebGLContext (probably via GetPixels()).
ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement::HTMLCanvasElement(canvas) => {
let canvas = canvas.r();
if let Some((mut data, size)) = canvas.fetch_all_data() {
@@ -1469,25 +1800,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
=> unimplemented!(),
};
- if size.width < 0 || size.height < 0 || level < 0 {
- self.webgl_error(WebGLError::InvalidOperation);
+ // NB: Border must be zero
+ if !self.validate_tex_image_parameters(target, level, internal_format,
+ size.width, size.height, 0,
+ format, data_type) {
+ return; // Error handled in validate()
}
- // TODO(emilio): Invert axis, convert colorspace, premultiply alpha if requested
- let msg = WebGLCommand::TexImage2D(target, level, internal_format as i32,
- size.width, size.height,
- format, data_type, pixels);
-
- // depth is always 1 when coming from html elements
- handle_potential_webgl_error!(self, texture.unwrap().initialize(size.width as u32,
- size.height as u32,
- 1,
- internal_format,
- level as u32));
-
- self.ipc_renderer
- .send(CanvasMsg::WebGL(msg))
- .unwrap()
+ self.tex_image_2d(target, level,
+ internal_format,
+ size.width, size.height, 0,
+ format, data_type, pixels)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
@@ -1512,3 +1835,62 @@ impl LayoutCanvasWebGLRenderingContextHelpers for LayoutJS<WebGLRenderingContext
(*self.unsafe_get()).ipc_renderer.clone()
}
}
+
+#[derive(Debug, PartialEq)]
+pub enum UniformSetterType {
+ Int,
+ IntVec2,
+ IntVec3,
+ IntVec4,
+ Float,
+ FloatVec2,
+ FloatVec3,
+ FloatVec4,
+}
+
+impl UniformSetterType {
+ pub fn element_count(&self) -> usize {
+ match *self {
+ UniformSetterType::Int => 1,
+ UniformSetterType::IntVec2 => 2,
+ UniformSetterType::IntVec3 => 3,
+ UniformSetterType::IntVec4 => 4,
+ UniformSetterType::Float => 1,
+ UniformSetterType::FloatVec2 => 2,
+ UniformSetterType::FloatVec3 => 3,
+ UniformSetterType::FloatVec4 => 4,
+ }
+ }
+
+ pub fn is_compatible_with(&self, gl_type: u32) -> bool {
+ gl_type == self.as_gl_constant() || match *self {
+ // Sampler uniform variables have an index value (the index of the
+ // texture), and as such they have to be set as ints
+ UniformSetterType::Int => gl_type == constants::SAMPLER_2D ||
+ gl_type == constants::SAMPLER_CUBE,
+ // Don't ask me why, but it seems we must allow setting bool
+ // uniforms with uniform1f.
+ //
+ // See the WebGL conformance test
+ // conformance/uniforms/gl-uniform-bool.html
+ UniformSetterType::Float => gl_type == constants::BOOL,
+ UniformSetterType::FloatVec2 => gl_type == constants::BOOL_VEC2,
+ UniformSetterType::FloatVec3 => gl_type == constants::BOOL_VEC3,
+ UniformSetterType::FloatVec4 => gl_type == constants::BOOL_VEC4,
+ _ => false,
+ }
+ }
+
+ fn as_gl_constant(&self) -> u32 {
+ match *self {
+ UniformSetterType::Int => constants::INT,
+ UniformSetterType::IntVec2 => constants::INT_VEC2,
+ UniformSetterType::IntVec3 => constants::INT_VEC3,
+ UniformSetterType::IntVec4 => constants::INT_VEC4,
+ UniformSetterType::Float => constants::FLOAT,
+ UniformSetterType::FloatVec2 => constants::FLOAT_VEC2,
+ UniformSetterType::FloatVec3 => constants::FLOAT_VEC3,
+ UniformSetterType::FloatVec4 => constants::FLOAT_VEC4,
+ }
+ }
+}
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index 495417065d7..eb930a69f13 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -116,6 +116,11 @@ impl WebGLShader {
}
*self.info_log.borrow_mut() = Some(validator.info_log());
+ // TODO(emilio): More data (like uniform data) should be collected
+ // here to properly validate uniforms.
+ //
+ // This requires a more complex interface with ANGLE, using C++
+ // bindings and being extremely cautious about destructing things.
}
}
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs
index 5bb7d5ff734..e92435ce304 100644
--- a/components/script/dom/webgltexture.rs
+++ b/components/script/dom/webgltexture.rs
@@ -33,7 +33,6 @@ pub struct WebGLTexture {
/// The target to which this texture was bound the first time
target: Cell<Option<u32>>,
is_deleted: Cell<bool>,
- is_initialized: Cell<bool>,
/// Stores information about mipmap levels and cubemap faces.
#[ignore_heap_size_of = "Arrays are cumbersome"]
image_info_array: DOMRefCell<[ImageInfo; MAX_LEVEL_COUNT * MAX_FACE_COUNT]>,
@@ -51,7 +50,6 @@ impl WebGLTexture {
id: id,
target: Cell::new(None),
is_deleted: Cell::new(false),
- is_initialized: Cell::new(false),
face_count: Cell::new(0),
base_mipmap_level: 0,
image_info_array: DOMRefCell::new([ImageInfo::new(); MAX_LEVEL_COUNT * MAX_FACE_COUNT]),
@@ -105,7 +103,13 @@ impl WebGLTexture {
Ok(())
}
- pub fn initialize(&self, width: u32, height: u32, depth: u32, internal_format: u32, level: u32) -> WebGLResult<()> {
+ pub fn initialize(&self,
+ target: u32,
+ width: u32,
+ height: u32,
+ depth: u32,
+ internal_format: u32,
+ level: u32) -> WebGLResult<()> {
let image_info = ImageInfo {
width: width,
height: height,
@@ -113,10 +117,18 @@ impl WebGLTexture {
internal_format: Some(internal_format),
is_initialized: true,
};
- self.set_image_infos_at_level(level, image_info);
- self.is_initialized.set(true);
+ let face = match target {
+ constants::TEXTURE_2D | constants::TEXTURE_CUBE_MAP_POSITIVE_X => 0,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_X => 1,
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Y => 2,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Y => 3,
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Z => 4,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Z => 5,
+ _ => unreachable!(),
+ };
+ self.set_image_infos_at_level_and_face(level, face, image_info);
Ok(())
}
@@ -130,12 +142,12 @@ impl WebGLTexture {
};
let base_image_info = self.base_image_info().unwrap();
-
if !base_image_info.is_initialized() {
return Err(WebGLError::InvalidOperation);
}
- if target == constants::TEXTURE_CUBE_MAP && !self.is_cube_complete() {
+ let is_cubic = target == constants::TEXTURE_CUBE_MAP;
+ if is_cubic && !self.is_cube_complete() {
return Err(WebGLError::InvalidOperation);
}
@@ -262,6 +274,8 @@ impl WebGLTexture {
}
fn is_cube_complete(&self) -> bool {
+ debug_assert!(self.face_count.get() == 6);
+
let image_info = self.base_image_info().unwrap();
if !image_info.is_defined() {
return false;
@@ -294,11 +308,16 @@ impl WebGLTexture {
fn set_image_infos_at_level(&self, level: u32, image_info: ImageInfo) {
for face in 0..self.face_count.get() {
- let pos = (level * self.face_count.get() as u32) + face as u32;
- self.image_info_array.borrow_mut()[pos as usize] = image_info;
+ self.set_image_infos_at_level_and_face(level, face, image_info);
}
}
+ fn set_image_infos_at_level_and_face(&self, level: u32, face: u8, image_info: ImageInfo) {
+ debug_assert!(face < self.face_count.get());
+ let pos = (level * self.face_count.get() as u32) + face as u32;
+ self.image_info_array.borrow_mut()[pos as usize] = image_info;
+ }
+
fn base_image_info(&self) -> Option<ImageInfo> {
assert!((self.base_mipmap_level as usize) < MAX_LEVEL_COUNT);
@@ -341,7 +360,7 @@ impl ImageInfo {
}
fn is_defined(&self) -> bool {
- !self.internal_format.is_none()
+ self.internal_format.is_some()
}
fn get_max_mimap_levels(&self) -> u32 {
diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs
index 43244ec4a33..2f8e3331cd2 100644
--- a/components/script/dom/webgluniformlocation.rs
+++ b/components/script/dom/webgluniformlocation.rs
@@ -28,10 +28,7 @@ impl WebGLUniformLocation {
reflect_dom_object(
box WebGLUniformLocation::new_inherited(id, program_id), global, WebGLUniformLocationBinding::Wrap)
}
-}
-
-impl WebGLUniformLocation {
pub fn id(&self) -> i32 {
self.id
}
diff --git a/components/script/dom/webidls/Attr.webidl b/components/script/dom/webidls/Attr.webidl
index 171715205bc..79449804081 100644
--- a/components/script/dom/webidls/Attr.webidl
+++ b/components/script/dom/webidls/Attr.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Blob.webidl b/components/script/dom/webidls/Blob.webidl
index bad890fafdc..f0e3413d086 100644
--- a/components/script/dom/webidls/Blob.webidl
+++ b/components/script/dom/webidls/Blob.webidl
@@ -1,11 +1,9 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob
-[Constructor,
- Constructor(sequence<(/*ArrayBuffer or ArrayBufferView or */Blob or DOMString)> blobParts,
+[Constructor(optional sequence<(/*ArrayBuffer or ArrayBufferView or */Blob or DOMString)> blobParts,
optional BlobPropertyBag options),
Exposed=Window/*,Worker*/]
interface Blob {
diff --git a/components/script/dom/webidls/Bluetooth.webidl b/components/script/dom/webidls/Bluetooth.webidl
index 3ff1c91efab..e2a7bb57130 100644
--- a/components/script/dom/webidls/Bluetooth.webidl
+++ b/components/script/dom/webidls/Bluetooth.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothAdvertisingData.webidl b/components/script/dom/webidls/BluetoothAdvertisingData.webidl
index 914b57bfc7e..e49024df669 100644
--- a/components/script/dom/webidls/BluetoothAdvertisingData.webidl
+++ b/components/script/dom/webidls/BluetoothAdvertisingData.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl b/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl
index bd6366b1681..9e7e2bb3831 100644
--- a/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl
+++ b/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothDevice.webidl b/components/script/dom/webidls/BluetoothDevice.webidl
index bb055c1c177..1c0c56cd1e7 100644
--- a/components/script/dom/webidls/BluetoothDevice.webidl
+++ b/components/script/dom/webidls/BluetoothDevice.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
index 411cd04baa7..2648d0bf654 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl b/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
index eb5b056f211..dc367a5fe8e 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
index ebeb933bdb9..8d360a7b31a 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
index a02af691a60..63ae0e090a5 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BluetoothUUID.webidl b/components/script/dom/webidls/BluetoothUUID.webidl
index 497be0a0fbc..00421cde65a 100644
--- a/components/script/dom/webidls/BluetoothUUID.webidl
+++ b/components/script/dom/webidls/BluetoothUUID.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/BrowserElement.webidl b/components/script/dom/webidls/BrowserElement.webidl
index 6e658a1b5b7..a244f9575a7 100644
--- a/components/script/dom/webidls/BrowserElement.webidl
+++ b/components/script/dom/webidls/BrowserElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl
index 10cf77ccc83..567167024ee 100644
--- a/components/script/dom/webidls/CSSStyleDeclaration.webidl
+++ b/components/script/dom/webidls/CSSStyleDeclaration.webidl
@@ -310,5 +310,7 @@ partial interface CSSStyleDeclaration {
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString flexDirection;
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString flex-direction;
+ [SetterThrows, TreatNullAs=EmptyString] attribute DOMString flexBasis;
+ [SetterThrows, TreatNullAs=EmptyString] attribute DOMString flex-basis;
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString order;
};
diff --git a/components/script/dom/webidls/CanvasGradient.webidl b/components/script/dom/webidls/CanvasGradient.webidl
index bcafae2927b..cbfa3cd690a 100644
--- a/components/script/dom/webidls/CanvasGradient.webidl
+++ b/components/script/dom/webidls/CanvasGradient.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/CanvasPattern.webidl b/components/script/dom/webidls/CanvasPattern.webidl
index a1ddf8982c0..3ef2f583b91 100644
--- a/components/script/dom/webidls/CanvasPattern.webidl
+++ b/components/script/dom/webidls/CanvasPattern.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
index acd589e280f..771b72e49fe 100644
--- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl
+++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/CharacterData.webidl b/components/script/dom/webidls/CharacterData.webidl
index a7be1295aeb..bd092dfec09 100644
--- a/components/script/dom/webidls/CharacterData.webidl
+++ b/components/script/dom/webidls/CharacterData.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ChildNode.webidl b/components/script/dom/webidls/ChildNode.webidl
index bf52c4d90b5..1506ec17c21 100644
--- a/components/script/dom/webidls/ChildNode.webidl
+++ b/components/script/dom/webidls/ChildNode.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Comment.webidl b/components/script/dom/webidls/Comment.webidl
index cd18988a8ac..d49897f8862 100644
--- a/components/script/dom/webidls/Comment.webidl
+++ b/components/script/dom/webidls/Comment.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Console.webidl b/components/script/dom/webidls/Console.webidl
index 0f09b710377..5d873fed6d7 100644
--- a/components/script/dom/webidls/Console.webidl
+++ b/components/script/dom/webidls/Console.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Crypto.webidl b/components/script/dom/webidls/Crypto.webidl
index d0d7c4303d7..d8d05ead60b 100644
--- a/components/script/dom/webidls/Crypto.webidl
+++ b/components/script/dom/webidls/Crypto.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/CustomEvent.webidl b/components/script/dom/webidls/CustomEvent.webidl
index 1fa0f50b7e8..9430fc81e2c 100644
--- a/components/script/dom/webidls/CustomEvent.webidl
+++ b/components/script/dom/webidls/CustomEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMException.webidl b/components/script/dom/webidls/DOMException.webidl
index 4e1620aa13b..90168f3755b 100644
--- a/components/script/dom/webidls/DOMException.webidl
+++ b/components/script/dom/webidls/DOMException.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMImplementation.webidl b/components/script/dom/webidls/DOMImplementation.webidl
index 3adb5f1048e..4a29a3ef72b 100644
--- a/components/script/dom/webidls/DOMImplementation.webidl
+++ b/components/script/dom/webidls/DOMImplementation.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMPoint.webidl b/components/script/dom/webidls/DOMPoint.webidl
index b8fc78d571f..64daf13c08c 100644
--- a/components/script/dom/webidls/DOMPoint.webidl
+++ b/components/script/dom/webidls/DOMPoint.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMPointReadOnly.webidl b/components/script/dom/webidls/DOMPointReadOnly.webidl
index 021d129f132..94a21f4a1cd 100644
--- a/components/script/dom/webidls/DOMPointReadOnly.webidl
+++ b/components/script/dom/webidls/DOMPointReadOnly.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMQuad.webidl b/components/script/dom/webidls/DOMQuad.webidl
index 0f3f11fac41..bca0ec99edc 100644
--- a/components/script/dom/webidls/DOMQuad.webidl
+++ b/components/script/dom/webidls/DOMQuad.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMRect.webidl b/components/script/dom/webidls/DOMRect.webidl
index 9ea5933c3f9..8469f11a1fd 100644
--- a/components/script/dom/webidls/DOMRect.webidl
+++ b/components/script/dom/webidls/DOMRect.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMRectList.webidl b/components/script/dom/webidls/DOMRectList.webidl
index 064014e9abe..9d67ec40cc8 100644
--- a/components/script/dom/webidls/DOMRectList.webidl
+++ b/components/script/dom/webidls/DOMRectList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMRectReadOnly.webidl b/components/script/dom/webidls/DOMRectReadOnly.webidl
index 937ed4eb478..11d9186bd36 100644
--- a/components/script/dom/webidls/DOMRectReadOnly.webidl
+++ b/components/script/dom/webidls/DOMRectReadOnly.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMStringMap.webidl b/components/script/dom/webidls/DOMStringMap.webidl
index b74e8227f21..f9801a45174 100644
--- a/components/script/dom/webidls/DOMStringMap.webidl
+++ b/components/script/dom/webidls/DOMStringMap.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DOMTokenList.webidl b/components/script/dom/webidls/DOMTokenList.webidl
index 21be3590c0a..1b50c34c918 100644
--- a/components/script/dom/webidls/DOMTokenList.webidl
+++ b/components/script/dom/webidls/DOMTokenList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl
index 1d12bc7aabb..b211fe7be58 100644
--- a/components/script/dom/webidls/Document.webidl
+++ b/components/script/dom/webidls/Document.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DocumentFragment.webidl b/components/script/dom/webidls/DocumentFragment.webidl
index eb2b7d6696d..7573dd9f22b 100644
--- a/components/script/dom/webidls/DocumentFragment.webidl
+++ b/components/script/dom/webidls/DocumentFragment.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/DocumentType.webidl b/components/script/dom/webidls/DocumentType.webidl
index b864d3a6496..1f7b0b83599 100644
--- a/components/script/dom/webidls/DocumentType.webidl
+++ b/components/script/dom/webidls/DocumentType.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Element.webidl b/components/script/dom/webidls/Element.webidl
index 9bc5ff64597..bec84acc8ce 100644
--- a/components/script/dom/webidls/Element.webidl
+++ b/components/script/dom/webidls/Element.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -36,6 +35,8 @@ interface Element : Node {
[Pure]
sequence<DOMString> getAttributeNames();
[Pure]
+ boolean hasAttributes();
+ [Pure]
DOMString? getAttribute(DOMString name);
[Pure]
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
@@ -81,6 +82,15 @@ partial interface Element {
DOMRectList getClientRects();
DOMRect getBoundingClientRect();
+ void scroll(optional ScrollToOptions options);
+ void scroll(unrestricted double x, unrestricted double y);
+
+ void scrollTo(optional ScrollToOptions options);
+ void scrollTo(unrestricted double x, unrestricted double y);
+ void scrollBy(optional ScrollToOptions options);
+ void scrollBy(unrestricted double x, unrestricted double y);
+ attribute unrestricted double scrollTop;
+ attribute unrestricted double scrollLeft;
readonly attribute long scrollWidth;
readonly attribute long scrollHeight;
diff --git a/components/script/dom/webidls/ElementCSSInlineStyle.webidl b/components/script/dom/webidls/ElementCSSInlineStyle.webidl
index bf7a7b92b9e..4431e7ab778 100644
--- a/components/script/dom/webidls/ElementCSSInlineStyle.webidl
+++ b/components/script/dom/webidls/ElementCSSInlineStyle.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Event.webidl b/components/script/dom/webidls/Event.webidl
index 47690b7c67f..05f4b7b5898 100644
--- a/components/script/dom/webidls/Event.webidl
+++ b/components/script/dom/webidls/Event.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl
index 318b81403c4..f001f0d184d 100644
--- a/components/script/dom/webidls/EventHandler.webidl
+++ b/components/script/dom/webidls/EventHandler.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/EventListener.webidl b/components/script/dom/webidls/EventListener.webidl
index d05f69fed1f..9f37b80687c 100644
--- a/components/script/dom/webidls/EventListener.webidl
+++ b/components/script/dom/webidls/EventListener.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/EventSource.webidl b/components/script/dom/webidls/EventSource.webidl
index 2d6717d5af9..cfe4848dbc3 100644
--- a/components/script/dom/webidls/EventSource.webidl
+++ b/components/script/dom/webidls/EventSource.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/EventTarget.webidl b/components/script/dom/webidls/EventTarget.webidl
index 403b1287fe4..39a65374c30 100644
--- a/components/script/dom/webidls/EventTarget.webidl
+++ b/components/script/dom/webidls/EventTarget.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/File.webidl b/components/script/dom/webidls/File.webidl
index 362d4fa251d..7c0d4be7c29 100644
--- a/components/script/dom/webidls/File.webidl
+++ b/components/script/dom/webidls/File.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/FileList.webidl b/components/script/dom/webidls/FileList.webidl
index aa1f9791427..d176e79e06f 100644
--- a/components/script/dom/webidls/FileList.webidl
+++ b/components/script/dom/webidls/FileList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/FileReader.webidl b/components/script/dom/webidls/FileReader.webidl
index 9f2b70c78a9..2b111ef7ab6 100644
--- a/components/script/dom/webidls/FileReader.webidl
+++ b/components/script/dom/webidls/FileReader.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/FocusEvent.webidl b/components/script/dom/webidls/FocusEvent.webidl
index 0c6cf6e6bfb..42e560b72b4 100644
--- a/components/script/dom/webidls/FocusEvent.webidl
+++ b/components/script/dom/webidls/FocusEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ForceTouchEvent.webidl b/components/script/dom/webidls/ForceTouchEvent.webidl
index a5f8ceef9a4..4c184214cae 100644
--- a/components/script/dom/webidls/ForceTouchEvent.webidl
+++ b/components/script/dom/webidls/ForceTouchEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/FormData.webidl b/components/script/dom/webidls/FormData.webidl
index da8a0ca8dde..2e4348ace1e 100644
--- a/components/script/dom/webidls/FormData.webidl
+++ b/components/script/dom/webidls/FormData.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Function.webidl b/components/script/dom/webidls/Function.webidl
index 1706b1c57ca..08513dfadf3 100644
--- a/components/script/dom/webidls/Function.webidl
+++ b/components/script/dom/webidls/Function.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLAnchorElement.webidl b/components/script/dom/webidls/HTMLAnchorElement.webidl
index bfca9b31b7d..daf739ac0b5 100644
--- a/components/script/dom/webidls/HTMLAnchorElement.webidl
+++ b/components/script/dom/webidls/HTMLAnchorElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLAppletElement.webidl b/components/script/dom/webidls/HTMLAppletElement.webidl
index 40300a645c6..9cfeb4183df 100644
--- a/components/script/dom/webidls/HTMLAppletElement.webidl
+++ b/components/script/dom/webidls/HTMLAppletElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLAreaElement.webidl b/components/script/dom/webidls/HTMLAreaElement.webidl
index a6568bd0b6b..6f1a6891518 100644
--- a/components/script/dom/webidls/HTMLAreaElement.webidl
+++ b/components/script/dom/webidls/HTMLAreaElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLAudioElement.webidl b/components/script/dom/webidls/HTMLAudioElement.webidl
index 5161af1a0e0..09ad8a7cdb3 100644
--- a/components/script/dom/webidls/HTMLAudioElement.webidl
+++ b/components/script/dom/webidls/HTMLAudioElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLBRElement.webidl b/components/script/dom/webidls/HTMLBRElement.webidl
index b1770270986..ab277396bdd 100644
--- a/components/script/dom/webidls/HTMLBRElement.webidl
+++ b/components/script/dom/webidls/HTMLBRElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLBaseElement.webidl b/components/script/dom/webidls/HTMLBaseElement.webidl
index 549a6df1004..a13be544cb9 100644
--- a/components/script/dom/webidls/HTMLBaseElement.webidl
+++ b/components/script/dom/webidls/HTMLBaseElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLBodyElement.webidl b/components/script/dom/webidls/HTMLBodyElement.webidl
index 36a7a99f996..36c6f4d64e3 100644
--- a/components/script/dom/webidls/HTMLBodyElement.webidl
+++ b/components/script/dom/webidls/HTMLBodyElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLButtonElement.webidl b/components/script/dom/webidls/HTMLButtonElement.webidl
index f928031d5cd..7f663fd305f 100644
--- a/components/script/dom/webidls/HTMLButtonElement.webidl
+++ b/components/script/dom/webidls/HTMLButtonElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLCanvasElement.webidl b/components/script/dom/webidls/HTMLCanvasElement.webidl
index d427f32ade1..fbb53016605 100644
--- a/components/script/dom/webidls/HTMLCanvasElement.webidl
+++ b/components/script/dom/webidls/HTMLCanvasElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLCollection.webidl b/components/script/dom/webidls/HTMLCollection.webidl
index 350a553ff0b..79f82046652 100644
--- a/components/script/dom/webidls/HTMLCollection.webidl
+++ b/components/script/dom/webidls/HTMLCollection.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDListElement.webidl b/components/script/dom/webidls/HTMLDListElement.webidl
index e64c3d41782..b6275107db5 100644
--- a/components/script/dom/webidls/HTMLDListElement.webidl
+++ b/components/script/dom/webidls/HTMLDListElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDataElement.webidl b/components/script/dom/webidls/HTMLDataElement.webidl
index 879a26325c9..be932250678 100644
--- a/components/script/dom/webidls/HTMLDataElement.webidl
+++ b/components/script/dom/webidls/HTMLDataElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDataListElement.webidl b/components/script/dom/webidls/HTMLDataListElement.webidl
index 2324d760d45..b8673b21c77 100644
--- a/components/script/dom/webidls/HTMLDataListElement.webidl
+++ b/components/script/dom/webidls/HTMLDataListElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDetailsElement.webidl b/components/script/dom/webidls/HTMLDetailsElement.webidl
index 062444d8312..811465c1c02 100644
--- a/components/script/dom/webidls/HTMLDetailsElement.webidl
+++ b/components/script/dom/webidls/HTMLDetailsElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDialogElement.webidl b/components/script/dom/webidls/HTMLDialogElement.webidl
index 9910914e287..78a14e1e2a0 100644
--- a/components/script/dom/webidls/HTMLDialogElement.webidl
+++ b/components/script/dom/webidls/HTMLDialogElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDirectoryElement.webidl b/components/script/dom/webidls/HTMLDirectoryElement.webidl
index d2ee8f11fa7..5df65cd90c2 100644
--- a/components/script/dom/webidls/HTMLDirectoryElement.webidl
+++ b/components/script/dom/webidls/HTMLDirectoryElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLDivElement.webidl b/components/script/dom/webidls/HTMLDivElement.webidl
index cd86d9e9330..46ee67ee0e5 100644
--- a/components/script/dom/webidls/HTMLDivElement.webidl
+++ b/components/script/dom/webidls/HTMLDivElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLElement.webidl b/components/script/dom/webidls/HTMLElement.webidl
index 8b2e01ea7c6..9778985dd40 100644
--- a/components/script/dom/webidls/HTMLElement.webidl
+++ b/components/script/dom/webidls/HTMLElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLEmbedElement.webidl b/components/script/dom/webidls/HTMLEmbedElement.webidl
index 3610a87e588..26fa4c3ea5a 100644
--- a/components/script/dom/webidls/HTMLEmbedElement.webidl
+++ b/components/script/dom/webidls/HTMLEmbedElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFieldSetElement.webidl b/components/script/dom/webidls/HTMLFieldSetElement.webidl
index 1a009b523dd..d041cdd612f 100644
--- a/components/script/dom/webidls/HTMLFieldSetElement.webidl
+++ b/components/script/dom/webidls/HTMLFieldSetElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFontElement.webidl b/components/script/dom/webidls/HTMLFontElement.webidl
index aa6d7167156..74db3f45057 100644
--- a/components/script/dom/webidls/HTMLFontElement.webidl
+++ b/components/script/dom/webidls/HTMLFontElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFormControlsCollection.webidl b/components/script/dom/webidls/HTMLFormControlsCollection.webidl
index c2ff68c72fa..a010b771c64 100644
--- a/components/script/dom/webidls/HTMLFormControlsCollection.webidl
+++ b/components/script/dom/webidls/HTMLFormControlsCollection.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFormElement.webidl b/components/script/dom/webidls/HTMLFormElement.webidl
index eebe0b52c62..a56b83235b6 100644
--- a/components/script/dom/webidls/HTMLFormElement.webidl
+++ b/components/script/dom/webidls/HTMLFormElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFrameElement.webidl b/components/script/dom/webidls/HTMLFrameElement.webidl
index 10c5bf49cfd..ecac61f6860 100644
--- a/components/script/dom/webidls/HTMLFrameElement.webidl
+++ b/components/script/dom/webidls/HTMLFrameElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLFrameSetElement.webidl b/components/script/dom/webidls/HTMLFrameSetElement.webidl
index 87ea131d978..f35de93e545 100644
--- a/components/script/dom/webidls/HTMLFrameSetElement.webidl
+++ b/components/script/dom/webidls/HTMLFrameSetElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLHRElement.webidl b/components/script/dom/webidls/HTMLHRElement.webidl
index e3ba6113748..56e2f6ae19b 100644
--- a/components/script/dom/webidls/HTMLHRElement.webidl
+++ b/components/script/dom/webidls/HTMLHRElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLHeadElement.webidl b/components/script/dom/webidls/HTMLHeadElement.webidl
index a2115d55281..18e2b351d64 100644
--- a/components/script/dom/webidls/HTMLHeadElement.webidl
+++ b/components/script/dom/webidls/HTMLHeadElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLHeadingElement.webidl b/components/script/dom/webidls/HTMLHeadingElement.webidl
index 3997997db75..2c47d6fa10f 100644
--- a/components/script/dom/webidls/HTMLHeadingElement.webidl
+++ b/components/script/dom/webidls/HTMLHeadingElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLHtmlElement.webidl b/components/script/dom/webidls/HTMLHtmlElement.webidl
index c505aa8aff9..ed409b1b84c 100644
--- a/components/script/dom/webidls/HTMLHtmlElement.webidl
+++ b/components/script/dom/webidls/HTMLHtmlElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl
index 0efcea09710..7d12915eac5 100644
--- a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl
+++ b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLIFrameElement.webidl b/components/script/dom/webidls/HTMLIFrameElement.webidl
index 4f4a42fddff..52c11f238ae 100644
--- a/components/script/dom/webidls/HTMLIFrameElement.webidl
+++ b/components/script/dom/webidls/HTMLIFrameElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLImageElement.webidl b/components/script/dom/webidls/HTMLImageElement.webidl
index 69bd2f7d4c1..88e0dae8d3b 100644
--- a/components/script/dom/webidls/HTMLImageElement.webidl
+++ b/components/script/dom/webidls/HTMLImageElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl
index 66907c5cd23..48ec3c0ac7b 100644
--- a/components/script/dom/webidls/HTMLInputElement.webidl
+++ b/components/script/dom/webidls/HTMLInputElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLLIElement.webidl b/components/script/dom/webidls/HTMLLIElement.webidl
index 50dfb947ad1..a2fcd9cc7d3 100644
--- a/components/script/dom/webidls/HTMLLIElement.webidl
+++ b/components/script/dom/webidls/HTMLLIElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLLabelElement.webidl b/components/script/dom/webidls/HTMLLabelElement.webidl
index 22659c26e76..8acb1f312c8 100644
--- a/components/script/dom/webidls/HTMLLabelElement.webidl
+++ b/components/script/dom/webidls/HTMLLabelElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLLegendElement.webidl b/components/script/dom/webidls/HTMLLegendElement.webidl
index 0fa9227975b..c137d6db66a 100644
--- a/components/script/dom/webidls/HTMLLegendElement.webidl
+++ b/components/script/dom/webidls/HTMLLegendElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLLinkElement.webidl b/components/script/dom/webidls/HTMLLinkElement.webidl
index 79b658d1c69..1bcf2e727f2 100644
--- a/components/script/dom/webidls/HTMLLinkElement.webidl
+++ b/components/script/dom/webidls/HTMLLinkElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLMapElement.webidl b/components/script/dom/webidls/HTMLMapElement.webidl
index f4c5be4ddc1..5e21b52916e 100644
--- a/components/script/dom/webidls/HTMLMapElement.webidl
+++ b/components/script/dom/webidls/HTMLMapElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLMediaElement.webidl b/components/script/dom/webidls/HTMLMediaElement.webidl
index b7da37495f8..277178732c7 100644
--- a/components/script/dom/webidls/HTMLMediaElement.webidl
+++ b/components/script/dom/webidls/HTMLMediaElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLMetaElement.webidl b/components/script/dom/webidls/HTMLMetaElement.webidl
index e179b47f964..20afc297a20 100644
--- a/components/script/dom/webidls/HTMLMetaElement.webidl
+++ b/components/script/dom/webidls/HTMLMetaElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLMeterElement.webidl b/components/script/dom/webidls/HTMLMeterElement.webidl
index 29f6ed89205..c6abe4aef46 100644
--- a/components/script/dom/webidls/HTMLMeterElement.webidl
+++ b/components/script/dom/webidls/HTMLMeterElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLModElement.webidl b/components/script/dom/webidls/HTMLModElement.webidl
index 0406920b951..beda6f97dcc 100644
--- a/components/script/dom/webidls/HTMLModElement.webidl
+++ b/components/script/dom/webidls/HTMLModElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLOListElement.webidl b/components/script/dom/webidls/HTMLOListElement.webidl
index d65c35d8a02..02dc3d1146f 100644
--- a/components/script/dom/webidls/HTMLOListElement.webidl
+++ b/components/script/dom/webidls/HTMLOListElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLObjectElement.webidl b/components/script/dom/webidls/HTMLObjectElement.webidl
index 5feb3c721b0..ce1d0ff1f8c 100644
--- a/components/script/dom/webidls/HTMLObjectElement.webidl
+++ b/components/script/dom/webidls/HTMLObjectElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLOptGroupElement.webidl b/components/script/dom/webidls/HTMLOptGroupElement.webidl
index dd3880a67f6..a81df036a4d 100644
--- a/components/script/dom/webidls/HTMLOptGroupElement.webidl
+++ b/components/script/dom/webidls/HTMLOptGroupElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLOptionElement.webidl b/components/script/dom/webidls/HTMLOptionElement.webidl
index 79627a56eef..fb0f68bf772 100644
--- a/components/script/dom/webidls/HTMLOptionElement.webidl
+++ b/components/script/dom/webidls/HTMLOptionElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLOutputElement.webidl b/components/script/dom/webidls/HTMLOutputElement.webidl
index aa85afd7b8d..9506d56df65 100644
--- a/components/script/dom/webidls/HTMLOutputElement.webidl
+++ b/components/script/dom/webidls/HTMLOutputElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLParagraphElement.webidl b/components/script/dom/webidls/HTMLParagraphElement.webidl
index 1ce3452ad79..a96c6dc6f81 100644
--- a/components/script/dom/webidls/HTMLParagraphElement.webidl
+++ b/components/script/dom/webidls/HTMLParagraphElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLParamElement.webidl b/components/script/dom/webidls/HTMLParamElement.webidl
index 8a6fca427ca..9648c9f87ce 100644
--- a/components/script/dom/webidls/HTMLParamElement.webidl
+++ b/components/script/dom/webidls/HTMLParamElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLPreElement.webidl b/components/script/dom/webidls/HTMLPreElement.webidl
index 0e01f90ead6..ea0df151020 100644
--- a/components/script/dom/webidls/HTMLPreElement.webidl
+++ b/components/script/dom/webidls/HTMLPreElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLProgressElement.webidl b/components/script/dom/webidls/HTMLProgressElement.webidl
index 3b4b0f4032f..cf69566ecdd 100644
--- a/components/script/dom/webidls/HTMLProgressElement.webidl
+++ b/components/script/dom/webidls/HTMLProgressElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLQuoteElement.webidl b/components/script/dom/webidls/HTMLQuoteElement.webidl
index 0af1e086776..e546f151d49 100644
--- a/components/script/dom/webidls/HTMLQuoteElement.webidl
+++ b/components/script/dom/webidls/HTMLQuoteElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLScriptElement.webidl b/components/script/dom/webidls/HTMLScriptElement.webidl
index 8bd588a232b..004ab90e3ed 100644
--- a/components/script/dom/webidls/HTMLScriptElement.webidl
+++ b/components/script/dom/webidls/HTMLScriptElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLSelectElement.webidl b/components/script/dom/webidls/HTMLSelectElement.webidl
index 599cb9f74de..ba84d183a72 100644
--- a/components/script/dom/webidls/HTMLSelectElement.webidl
+++ b/components/script/dom/webidls/HTMLSelectElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLSourceElement.webidl b/components/script/dom/webidls/HTMLSourceElement.webidl
index 8f53e4fde9e..738a545713a 100644
--- a/components/script/dom/webidls/HTMLSourceElement.webidl
+++ b/components/script/dom/webidls/HTMLSourceElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLSpanElement.webidl b/components/script/dom/webidls/HTMLSpanElement.webidl
index e64a69778e0..a74967536a1 100644
--- a/components/script/dom/webidls/HTMLSpanElement.webidl
+++ b/components/script/dom/webidls/HTMLSpanElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLStyleElement.webidl b/components/script/dom/webidls/HTMLStyleElement.webidl
index e683ab7a9fa..dd766f41d22 100644
--- a/components/script/dom/webidls/HTMLStyleElement.webidl
+++ b/components/script/dom/webidls/HTMLStyleElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableCaptionElement.webidl b/components/script/dom/webidls/HTMLTableCaptionElement.webidl
index 1b8cdc5a239..b405d23ed40 100644
--- a/components/script/dom/webidls/HTMLTableCaptionElement.webidl
+++ b/components/script/dom/webidls/HTMLTableCaptionElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableCellElement.webidl b/components/script/dom/webidls/HTMLTableCellElement.webidl
index c1ee341749b..bbb04109d09 100644
--- a/components/script/dom/webidls/HTMLTableCellElement.webidl
+++ b/components/script/dom/webidls/HTMLTableCellElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableColElement.webidl b/components/script/dom/webidls/HTMLTableColElement.webidl
index c8257cfa117..69188251443 100644
--- a/components/script/dom/webidls/HTMLTableColElement.webidl
+++ b/components/script/dom/webidls/HTMLTableColElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableDataCellElement.webidl b/components/script/dom/webidls/HTMLTableDataCellElement.webidl
index a4de0d2669a..208ed76d692 100644
--- a/components/script/dom/webidls/HTMLTableDataCellElement.webidl
+++ b/components/script/dom/webidls/HTMLTableDataCellElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableElement.webidl b/components/script/dom/webidls/HTMLTableElement.webidl
index dacd0da7aa2..596f5abd188 100644
--- a/components/script/dom/webidls/HTMLTableElement.webidl
+++ b/components/script/dom/webidls/HTMLTableElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableHeaderCellElement.webidl b/components/script/dom/webidls/HTMLTableHeaderCellElement.webidl
index 669e356588d..9bf8f1fc950 100644
--- a/components/script/dom/webidls/HTMLTableHeaderCellElement.webidl
+++ b/components/script/dom/webidls/HTMLTableHeaderCellElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableRowElement.webidl b/components/script/dom/webidls/HTMLTableRowElement.webidl
index fe6c93e6be5..9d4b0655cad 100644
--- a/components/script/dom/webidls/HTMLTableRowElement.webidl
+++ b/components/script/dom/webidls/HTMLTableRowElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTableSectionElement.webidl b/components/script/dom/webidls/HTMLTableSectionElement.webidl
index 483fe197229..979d8030ffd 100644
--- a/components/script/dom/webidls/HTMLTableSectionElement.webidl
+++ b/components/script/dom/webidls/HTMLTableSectionElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTemplateElement.webidl b/components/script/dom/webidls/HTMLTemplateElement.webidl
index 4f1cc2c27d0..b3383de69d2 100644
--- a/components/script/dom/webidls/HTMLTemplateElement.webidl
+++ b/components/script/dom/webidls/HTMLTemplateElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl
index e5e2cabdb78..f92e662c354 100644
--- a/components/script/dom/webidls/HTMLTextAreaElement.webidl
+++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTimeElement.webidl b/components/script/dom/webidls/HTMLTimeElement.webidl
index f989f25fcdf..21f9dcf090e 100644
--- a/components/script/dom/webidls/HTMLTimeElement.webidl
+++ b/components/script/dom/webidls/HTMLTimeElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTitleElement.webidl b/components/script/dom/webidls/HTMLTitleElement.webidl
index 31302ea307f..10373be7e4b 100644
--- a/components/script/dom/webidls/HTMLTitleElement.webidl
+++ b/components/script/dom/webidls/HTMLTitleElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLTrackElement.webidl b/components/script/dom/webidls/HTMLTrackElement.webidl
index a55e54a7061..55733235321 100644
--- a/components/script/dom/webidls/HTMLTrackElement.webidl
+++ b/components/script/dom/webidls/HTMLTrackElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLUListElement.webidl b/components/script/dom/webidls/HTMLUListElement.webidl
index ad94cc0cefe..91a79c7f925 100644
--- a/components/script/dom/webidls/HTMLUListElement.webidl
+++ b/components/script/dom/webidls/HTMLUListElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLUnknownElement.webidl b/components/script/dom/webidls/HTMLUnknownElement.webidl
index 2db9f565ed2..acf5a47a996 100644
--- a/components/script/dom/webidls/HTMLUnknownElement.webidl
+++ b/components/script/dom/webidls/HTMLUnknownElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/HTMLVideoElement.webidl b/components/script/dom/webidls/HTMLVideoElement.webidl
index 787b0977a91..5e7c9cb9fce 100644
--- a/components/script/dom/webidls/HTMLVideoElement.webidl
+++ b/components/script/dom/webidls/HTMLVideoElement.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ImageData.webidl b/components/script/dom/webidls/ImageData.webidl
index 23d722434ac..bd4f6317a5e 100644
--- a/components/script/dom/webidls/ImageData.webidl
+++ b/components/script/dom/webidls/ImageData.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/KeyboardEvent.webidl b/components/script/dom/webidls/KeyboardEvent.webidl
index 3520d509ec6..a9027ededcd 100644
--- a/components/script/dom/webidls/KeyboardEvent.webidl
+++ b/components/script/dom/webidls/KeyboardEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Location.webidl b/components/script/dom/webidls/Location.webidl
index 0593581d98c..43e52d62a0e 100644
--- a/components/script/dom/webidls/Location.webidl
+++ b/components/script/dom/webidls/Location.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/MessageEvent.webidl b/components/script/dom/webidls/MessageEvent.webidl
index 0db3861205a..99985ae04ea 100644
--- a/components/script/dom/webidls/MessageEvent.webidl
+++ b/components/script/dom/webidls/MessageEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/MimeType.webidl b/components/script/dom/webidls/MimeType.webidl
index 9972134f7c8..6ba91f8a924 100644
--- a/components/script/dom/webidls/MimeType.webidl
+++ b/components/script/dom/webidls/MimeType.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/MimeTypeArray.webidl b/components/script/dom/webidls/MimeTypeArray.webidl
index 6a4d8f1aa4e..ef29b54ed84 100644
--- a/components/script/dom/webidls/MimeTypeArray.webidl
+++ b/components/script/dom/webidls/MimeTypeArray.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/MouseEvent.webidl b/components/script/dom/webidls/MouseEvent.webidl
index f9be1e64ed0..c156a66629b 100644
--- a/components/script/dom/webidls/MouseEvent.webidl
+++ b/components/script/dom/webidls/MouseEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Navigator.webidl b/components/script/dom/webidls/Navigator.webidl
index b793af7a6f5..4d9ead9f7f9 100644
--- a/components/script/dom/webidls/Navigator.webidl
+++ b/components/script/dom/webidls/Navigator.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl
index 871e865e03a..f727fa98660 100644
--- a/components/script/dom/webidls/Node.webidl
+++ b/components/script/dom/webidls/Node.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -32,6 +31,8 @@ interface Node : EventTarget {
[Pure]
readonly attribute Document? ownerDocument;
[Pure]
+ readonly attribute Node rootNode;
+ [Pure]
readonly attribute Node? parentNode;
[Pure]
readonly attribute Element? parentElement;
@@ -57,6 +58,8 @@ interface Node : EventTarget {
Node cloneNode(optional boolean deep = false);
[Pure]
boolean isEqualNode(Node? node);
+ [Pure]
+ boolean isSameNode(Node? otherNode); // historical alias of ===
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
diff --git a/components/script/dom/webidls/NodeFilter.webidl b/components/script/dom/webidls/NodeFilter.webidl
index 213380c89c0..79d059e393e 100644
--- a/components/script/dom/webidls/NodeFilter.webidl
+++ b/components/script/dom/webidls/NodeFilter.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/NodeIterator.webidl b/components/script/dom/webidls/NodeIterator.webidl
index bcf969d6d48..636e7ed2943 100644
--- a/components/script/dom/webidls/NodeIterator.webidl
+++ b/components/script/dom/webidls/NodeIterator.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/NodeList.webidl b/components/script/dom/webidls/NodeList.webidl
index 413a7154606..4c9eee8c181 100644
--- a/components/script/dom/webidls/NodeList.webidl
+++ b/components/script/dom/webidls/NodeList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/NonElementParentNode.webidl b/components/script/dom/webidls/NonElementParentNode.webidl
index 769ee06955d..cf7c8ac8c70 100644
--- a/components/script/dom/webidls/NonElementParentNode.webidl
+++ b/components/script/dom/webidls/NonElementParentNode.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ParentNode.webidl b/components/script/dom/webidls/ParentNode.webidl
index 73d7075971b..678b3aeafa5 100644
--- a/components/script/dom/webidls/ParentNode.webidl
+++ b/components/script/dom/webidls/ParentNode.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Performance.webidl b/components/script/dom/webidls/Performance.webidl
index 4ec04b46f76..e7b24f9a55c 100644
--- a/components/script/dom/webidls/Performance.webidl
+++ b/components/script/dom/webidls/Performance.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/PerformanceTiming.webidl b/components/script/dom/webidls/PerformanceTiming.webidl
index 7a2fdaebec0..0fd4b827cab 100644
--- a/components/script/dom/webidls/PerformanceTiming.webidl
+++ b/components/script/dom/webidls/PerformanceTiming.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Plugin.webidl b/components/script/dom/webidls/Plugin.webidl
index 4fb172d45b9..bc743f72313 100644
--- a/components/script/dom/webidls/Plugin.webidl
+++ b/components/script/dom/webidls/Plugin.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/PluginArray.webidl b/components/script/dom/webidls/PluginArray.webidl
index f2fde35fc4f..226ee8d4448 100644
--- a/components/script/dom/webidls/PluginArray.webidl
+++ b/components/script/dom/webidls/PluginArray.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ProcessingInstruction.webidl b/components/script/dom/webidls/ProcessingInstruction.webidl
index cd6a14f3dc0..734d43ebe5a 100644
--- a/components/script/dom/webidls/ProcessingInstruction.webidl
+++ b/components/script/dom/webidls/ProcessingInstruction.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ProgressEvent.webidl b/components/script/dom/webidls/ProgressEvent.webidl
index a0e86c26ae6..35f2c75024e 100644
--- a/components/script/dom/webidls/ProgressEvent.webidl
+++ b/components/script/dom/webidls/ProgressEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/RadioNodeList.webidl b/components/script/dom/webidls/RadioNodeList.webidl
index 9ab1d7ea5f0..7168ea34551 100644
--- a/components/script/dom/webidls/RadioNodeList.webidl
+++ b/components/script/dom/webidls/RadioNodeList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Range.webidl b/components/script/dom/webidls/Range.webidl
index 4c7413e3456..1b49656378e 100644
--- a/components/script/dom/webidls/Range.webidl
+++ b/components/script/dom/webidls/Range.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Screen.webidl b/components/script/dom/webidls/Screen.webidl
index 3065c113b96..18551a1e7a7 100644
--- a/components/script/dom/webidls/Screen.webidl
+++ b/components/script/dom/webidls/Screen.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ServoHTMLParser.webidl b/components/script/dom/webidls/ServoHTMLParser.webidl
index c90b28a1376..c7d9fe71642 100644
--- a/components/script/dom/webidls/ServoHTMLParser.webidl
+++ b/components/script/dom/webidls/ServoHTMLParser.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ServoXMLParser.webidl b/components/script/dom/webidls/ServoXMLParser.webidl
index 0b5a20addd3..9658919884c 100644
--- a/components/script/dom/webidls/ServoXMLParser.webidl
+++ b/components/script/dom/webidls/ServoXMLParser.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl b/components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl
index eb852604ed1..c7b67c551f9 100644
--- a/components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl
+++ b/components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Storage.webidl b/components/script/dom/webidls/Storage.webidl
index a2dc1b08818..acf3b29af5e 100644
--- a/components/script/dom/webidls/Storage.webidl
+++ b/components/script/dom/webidls/Storage.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/StorageEvent.webidl b/components/script/dom/webidls/StorageEvent.webidl
index 884d8d2f88b..4671587d0ee 100644
--- a/components/script/dom/webidls/StorageEvent.webidl
+++ b/components/script/dom/webidls/StorageEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/StyleSheet.webidl b/components/script/dom/webidls/StyleSheet.webidl
index fdb4e875ce2..c7299e87835 100644
--- a/components/script/dom/webidls/StyleSheet.webidl
+++ b/components/script/dom/webidls/StyleSheet.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/StyleSheetList.webidl b/components/script/dom/webidls/StyleSheetList.webidl
index e743653fde3..d3f9372f5b9 100644
--- a/components/script/dom/webidls/StyleSheetList.webidl
+++ b/components/script/dom/webidls/StyleSheetList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TestBindingProxy.webidl b/components/script/dom/webidls/TestBindingProxy.webidl
index e5f2937bf5a..121ea1a3da8 100644
--- a/components/script/dom/webidls/TestBindingProxy.webidl
+++ b/components/script/dom/webidls/TestBindingProxy.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Text.webidl b/components/script/dom/webidls/Text.webidl
index d9df25539d8..515d9939806 100644
--- a/components/script/dom/webidls/Text.webidl
+++ b/components/script/dom/webidls/Text.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TextDecoder.webidl b/components/script/dom/webidls/TextDecoder.webidl
index 4ec66f07d7a..f1ebec221b6 100644
--- a/components/script/dom/webidls/TextDecoder.webidl
+++ b/components/script/dom/webidls/TextDecoder.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TextEncoder.webidl b/components/script/dom/webidls/TextEncoder.webidl
index 697f7ca9146..b3f9df5f5f1 100644
--- a/components/script/dom/webidls/TextEncoder.webidl
+++ b/components/script/dom/webidls/TextEncoder.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Touch.webidl b/components/script/dom/webidls/Touch.webidl
index 9805121446e..5f54dea37a1 100644
--- a/components/script/dom/webidls/Touch.webidl
+++ b/components/script/dom/webidls/Touch.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TouchEvent.webidl b/components/script/dom/webidls/TouchEvent.webidl
index b291c23be16..62d5a48bc2f 100644
--- a/components/script/dom/webidls/TouchEvent.webidl
+++ b/components/script/dom/webidls/TouchEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TouchList.webidl b/components/script/dom/webidls/TouchList.webidl
index f75cc4c9530..22e4646ebfb 100644
--- a/components/script/dom/webidls/TouchList.webidl
+++ b/components/script/dom/webidls/TouchList.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/TreeWalker.webidl b/components/script/dom/webidls/TreeWalker.webidl
index c05f86dcdc8..049f79bdd11 100644
--- a/components/script/dom/webidls/TreeWalker.webidl
+++ b/components/script/dom/webidls/TreeWalker.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/UIEvent.webidl b/components/script/dom/webidls/UIEvent.webidl
index 4f5caeaad14..d1019981b89 100644
--- a/components/script/dom/webidls/UIEvent.webidl
+++ b/components/script/dom/webidls/UIEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/URLSearchParams.webidl b/components/script/dom/webidls/URLSearchParams.webidl
index e0266ca6246..1d3efe2871f 100644
--- a/components/script/dom/webidls/URLSearchParams.webidl
+++ b/components/script/dom/webidls/URLSearchParams.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/ValidityState.webidl b/components/script/dom/webidls/ValidityState.webidl
index 7ed0167b010..e959e972a7f 100644
--- a/components/script/dom/webidls/ValidityState.webidl
+++ b/components/script/dom/webidls/ValidityState.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/WebGLContextEvent.webidl b/components/script/dom/webidls/WebGLContextEvent.webidl
index 91946a0bfcb..6a699754d2c 100644
--- a/components/script/dom/webidls/WebGLContextEvent.webidl
+++ b/components/script/dom/webidls/WebGLContextEvent.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index 6c36844f313..4b29660b190 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -622,16 +622,20 @@ interface WebGLRenderingContextBase
void shaderSource(WebGLShader? shader, DOMString source);
- //void stencilFunc(GLenum func, GLint ref, GLuint mask);
- //void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- //void stencilMask(GLuint mask);
- //void stencilMaskSeparate(GLenum face, GLuint mask);
- //void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- //void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+ void stencilFunc(GLenum func, GLint ref, GLuint mask);
+ void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+ void stencilMask(GLuint mask);
+ void stencilMaskSeparate(GLenum face, GLuint mask);
+ void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+ void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
//void texImage2D(GLenum target, GLint level, GLenum internalformat,
// GLsizei width, GLsizei height, GLint border, GLenum format,
// GLenum type, ArrayBufferView? pixels);
+ // FIXME: SM interface arguments
+ void texImage2D(GLenum target, GLint level, GLenum internalformat,
+ GLsizei width, GLsizei height, GLint border, GLenum format,
+ GLenum type, optional object data);
void texImage2D(GLenum target, GLint level, GLenum internalformat,
GLenum format, GLenum type, TexImageSource? source); // May throw DOMException
diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl
index 21ac6bf31a8..8f3cbedcc8e 100644
--- a/components/script/dom/webidls/Window.webidl
+++ b/components/script/dom/webidls/Window.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/Worker.webidl b/components/script/dom/webidls/Worker.webidl
index 5331d6fdc36..e8164771094 100644
--- a/components/script/dom/webidls/Worker.webidl
+++ b/components/script/dom/webidls/Worker.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/WorkerLocation.webidl b/components/script/dom/webidls/WorkerLocation.webidl
index 598e210de44..3c58d24bd02 100644
--- a/components/script/dom/webidls/WorkerLocation.webidl
+++ b/components/script/dom/webidls/WorkerLocation.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/WorkerNavigator.webidl b/components/script/dom/webidls/WorkerNavigator.webidl
index c44edbfe58a..0a85ee75caa 100644
--- a/components/script/dom/webidls/WorkerNavigator.webidl
+++ b/components/script/dom/webidls/WorkerNavigator.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/XMLDocument.webidl b/components/script/dom/webidls/XMLDocument.webidl
index de40dd87b9d..150267dd62a 100644
--- a/components/script/dom/webidls/XMLDocument.webidl
+++ b/components/script/dom/webidls/XMLDocument.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/XMLHttpRequest.webidl b/components/script/dom/webidls/XMLHttpRequest.webidl
index b67e112c573..e2263a5a28b 100644
--- a/components/script/dom/webidls/XMLHttpRequest.webidl
+++ b/components/script/dom/webidls/XMLHttpRequest.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl b/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl
index 7756d9dd623..2c93fe95968 100644
--- a/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl
+++ b/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/webidls/XMLHttpRequestUpload.webidl b/components/script/dom/webidls/XMLHttpRequestUpload.webidl
index 8c21dbaea4a..5512703b467 100644
--- a/components/script/dom/webidls/XMLHttpRequestUpload.webidl
+++ b/components/script/dom/webidls/XMLHttpRequestUpload.webidl
@@ -1,4 +1,3 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index e92c7abbcab..08d24e2fbe2 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -210,7 +210,7 @@ impl WebSocket {
// Step 2: Disallow https -> ws connections.
// Step 3: Potentially block access to some ports.
- let port: u16 = resource_url.port_or_default().unwrap();
+ let port: u16 = resource_url.port_or_known_default().unwrap();
if BLOCKED_PORTS_LIST.iter().any(|&p| p == port) {
return Err(Error::Security);
@@ -356,7 +356,7 @@ impl WebSocketMethods for WebSocket {
// https://html.spec.whatwg.org/multipage/#dom-websocket-url
fn Url(&self) -> DOMString {
- DOMString::from(self.url.serialize())
+ DOMString::from(self.url.as_str())
}
// https://html.spec.whatwg.org/multipage/#dom-websocket-readystate
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 8a3affefe06..05115de0c58 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -43,12 +43,13 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse};
use libc;
-use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData};
+use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId};
+use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::ResourceThread;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::storage_thread::{StorageThread, StorageType};
-use num::traits::ToPrimitive;
+use num_traits::ToPrimitive;
use page::Page;
use profile_traits::mem;
use reporter::CSSErrorReporter;
@@ -74,6 +75,7 @@ use std::sync::{Arc, Mutex};
use string_cache::Atom;
use style::context::ReflowGoal;
use style::error_reporting::ParseErrorReporter;
+use style::properties::longhands::{overflow_x};
use style::selector_impl::PseudoElement;
use task_source::TaskSource;
use task_source::dom_manipulation::{DOMManipulationTaskSource, DOMManipulationTask};
@@ -180,7 +182,7 @@ pub struct Window {
next_subpage_id: Cell<SubpageId>,
/// Pending resize event, if any.
- resize_event: Cell<Option<WindowSizeData>>,
+ resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>,
/// Pipeline id associated with this page.
id: PipelineId,
@@ -911,11 +913,13 @@ impl Window {
//TODO Step 11
//let document = self.Document();
// Step 12
- self.perform_a_scroll(x.to_f32().unwrap_or(0.0f32), y.to_f32().unwrap_or(0.0f32), behavior, None);
+ self.perform_a_scroll(x.to_f32().unwrap_or(0.0f32), y.to_f32().unwrap_or(0.0f32),
+ LayerId::null(), behavior, None);
}
/// https://drafts.csswg.org/cssom-view/#perform-a-scroll
- pub fn perform_a_scroll(&self, x: f32, y: f32, behavior: ScrollBehavior, element: Option<&Element>) {
+ pub fn perform_a_scroll(&self, x: f32, y: f32, layer_id: LayerId,
+ behavior: ScrollBehavior, element: Option<&Element>) {
//TODO Step 1
let point = Point2D::new(x, y);
let smooth = match behavior {
@@ -934,7 +938,7 @@ impl Window {
self.current_viewport.set(Rect::new(Point2D::new(Au::from_f32_px(x), Au::from_f32_px(y)), size));
self.compositor.send(ScriptToCompositorMsg::ScrollFragmentPoint(
- self.pipeline(), LayerId::null(), point, smooth)).unwrap()
+ self.pipeline(), layer_id, point, smooth)).unwrap()
}
pub fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
@@ -1122,6 +1126,40 @@ impl Window {
self.layout_rpc.node_scroll_area().client_rect
}
+ pub fn overflow_query(&self, node: TrustedNodeAddress) -> Point2D<overflow_x::computed_value::T> {
+ self.reflow(ReflowGoal::ForScriptQuery,
+ ReflowQueryType::NodeOverflowQuery(node),
+ ReflowReason::Query);
+ self.layout_rpc.node_overflow().0.unwrap()
+ }
+
+ pub fn scroll_offset_query(&self, node: TrustedNodeAddress) -> Point2D<f32> {
+ self.reflow(ReflowGoal::ForScriptQuery,
+ ReflowQueryType::NodeLayerIdQuery(node),
+ ReflowReason::Query);
+ let layer_id = self.layout_rpc.node_layer_id().layer_id;
+ let pipeline_id = self.id;
+
+ let (send, recv) = ipc::channel::<Point2D<f32>>().unwrap();
+ self.compositor.send(ScriptToCompositorMsg::GetScrollOffset(pipeline_id, layer_id, send)).unwrap();
+ recv.recv().unwrap_or(Point2D::zero())
+ }
+
+ // https://drafts.csswg.org/cssom-view/#dom-element-scroll
+ pub fn scroll_node(&self, node: TrustedNodeAddress,
+ x_: f64, y_: f64, behavior: ScrollBehavior) {
+
+ self.reflow(ReflowGoal::ForScriptQuery,
+ ReflowQueryType::NodeLayerIdQuery(node),
+ ReflowReason::Query);
+
+ let layer_id = self.layout_rpc.node_layer_id().layer_id;
+
+ // Step 12
+ self.perform_a_scroll(x_.to_f32().unwrap_or(0.0f32), y_.to_f32().unwrap_or(0.0f32),
+ layer_id, behavior, None);
+ }
+
pub fn resolved_style_query(&self,
element: TrustedNodeAddress,
pseudo: Option<PseudoElement>,
@@ -1161,8 +1199,10 @@ impl Window {
/// Commence a new URL load which will either replace this window or scroll to a fragment.
pub fn load_url(&self, url: Url) {
+ let doc = self.Document();
self.main_thread_script_chan().send(
- MainThreadScriptMsg::Navigate(self.id, LoadData::new(url))).unwrap();
+ MainThreadScriptMsg::Navigate(self.id,
+ LoadData::new(url, doc.get_referrer_policy(), Some(doc.url().clone())))).unwrap();
}
pub fn handle_fire_timer(&self, timer_id: TimerEventId) {
@@ -1243,11 +1283,11 @@ impl Window {
self.pending_reflow_count.set(self.pending_reflow_count.get() + 1);
}
- pub fn set_resize_event(&self, event: WindowSizeData) {
- self.resize_event.set(Some(event));
+ pub fn set_resize_event(&self, event: WindowSizeData, event_type: WindowSizeType) {
+ self.resize_event.set(Some((event, event_type)));
}
- pub fn steal_resize_event(&self) -> Option<WindowSizeData> {
+ pub fn steal_resize_event(&self) -> Option<(WindowSizeData, WindowSizeType)> {
let event = self.resize_event.get();
self.resize_event.set(None);
event
@@ -1476,6 +1516,8 @@ fn debug_reflow_events(id: PipelineId, goal: &ReflowGoal, query_type: &ReflowQue
ReflowQueryType::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
ReflowQueryType::HitTestQuery(_n, _o) => "\tHitTestQuery",
ReflowQueryType::NodeGeometryQuery(_n) => "\tNodeGeometryQuery",
+ ReflowQueryType::NodeLayerIdQuery(_n) => "\tNodeLayerIdQuery",
+ ReflowQueryType::NodeOverflowQuery(_n) => "\tNodeOverFlowQuery",
ReflowQueryType::NodeScrollGeometryQuery(_n) => "\tNodeScrollGeometryQuery",
ReflowQueryType::ResolvedStyleQuery(_, _, _) => "\tResolvedStyleQuery",
ReflowQueryType::OffsetParentQuery(_n) => "\tOffsetParentQuery",
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index f6cf53b801e..0f0d06d488f 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -69,7 +69,7 @@ impl Worker {
// https://html.spec.whatwg.org/multipage/#dom-worker
pub fn Constructor(global: GlobalRef, script_url: DOMString) -> Fallible<Root<Worker>> {
// Step 2-4.
- let worker_url = match global.get_url().join(&script_url) {
+ let worker_url = match global.api_base_url().join(&script_url) {
Ok(url) => url,
Err(_) => return Err(Error::Syntax),
};
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index a0a73c0d993..dc097cd602c 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -225,7 +225,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
};
match self.runtime.evaluate_script(
- self.reflector().get_jsobject(), source, url.serialize(), 1) {
+ self.reflector().get_jsobject(), source, url.to_string(), 1) {
Ok(_) => (),
Err(_) => {
println!("evaluate_script failed");
@@ -317,7 +317,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
impl WorkerGlobalScope {
pub fn execute_script(&self, source: DOMString) {
match self.runtime.evaluate_script(
- self.reflector().get_jsobject(), String::from(source), self.worker_url.serialize(), 1) {
+ self.reflector().get_jsobject(), String::from(source), self.worker_url.to_string(), 1) {
Ok(_) => (),
Err(_) => {
if self.is_closing() {
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 8d6716201af..9f74e694ac6 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -45,7 +45,7 @@ use js::jsapi::JS_ClearPendingException;
use js::jsapi::{JSContext, JS_ParseJSON, RootedValue};
use js::jsval::{JSVal, NullValue, UndefinedValue};
use net_traits::ControlMsg::Load;
-use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
+use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError};
use net_traits::{LoadConsumer, LoadContext, LoadData, ResourceCORSData, ResourceThread};
use network_listener::{NetworkListener, PreInvoke};
use parse::html::{ParseContext, parse_html};
@@ -60,8 +60,7 @@ use std::sync::{Arc, Mutex};
use string_cache::Atom;
use time;
use timers::{OneshotTimerCallback, OneshotTimerHandle};
-use url::Url;
-use url::percent_encoding::{utf8_percent_encode, USERNAME_ENCODE_SET, PASSWORD_ENCODE_SET};
+use url::{Url, Position};
use util::prefs;
use util::str::DOMString;
@@ -254,7 +253,7 @@ impl XMLHttpRequest {
resource_thread: ResourceThread,
load_data: LoadData) {
impl AsyncResponseListener for XHRContext {
- fn headers_available(&mut self, metadata: Metadata) {
+ fn headers_available(&mut self, metadata: Result<Metadata, NetworkError>) {
let xhr = self.xhr.root();
let rv = xhr.process_headers_available(self.cors_request.clone(),
self.gen_id,
@@ -269,7 +268,7 @@ impl XMLHttpRequest {
self.xhr.root().process_data_available(self.gen_id, self.buf.borrow().clone());
}
- fn response_complete(&mut self, status: Result<(), String>) {
+ fn response_complete(&mut self, status: Result<(), NetworkError>) {
let rv = self.xhr.root().process_response_complete(self.gen_id, status);
*self.sync_status.borrow_mut() = Some(rv);
}
@@ -360,23 +359,17 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 9
if parsed_url.host().is_some() {
- if let Some(scheme_data) = parsed_url.relative_scheme_data_mut() {
- if let Some(user_str) = username {
- scheme_data.username = utf8_percent_encode(&user_str.0, USERNAME_ENCODE_SET);
-
- // ensure that the password is mutated when a username is provided
- scheme_data.password = password.map(|pass_str| {
- utf8_percent_encode(&pass_str.0, PASSWORD_ENCODE_SET)
- });
- }
+ if let Some(user_str) = username {
+ parsed_url.set_username(&user_str.0).unwrap();
+ let password = password.as_ref().map(|pass_str| &*pass_str.0);
+ parsed_url.set_password(password).unwrap();
}
}
// Step 10
if !async {
// FIXME: This should only happen if the global environment is a document environment
- if self.timeout.get() != 0 || self.with_credentials.get() ||
- self.response_type.get() != XMLHttpRequestResponseType::_empty {
+ if self.timeout.get() != 0 || self.response_type.get() != XMLHttpRequestResponseType::_empty {
return Err(Error::InvalidAccess)
}
}
@@ -513,8 +506,6 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 2
_ if self.send_flag.get() => Err(Error::InvalidState),
// Step 3
- _ if self.sync_in_window() => Err(Error::InvalidAccess),
- // Step 4
_ => {
self.with_credentials.set(with_credentials);
Ok(())
@@ -582,10 +573,13 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 5
let global = self.global();
let pipeline_id = global.r().pipeline();
+ //TODO - set referrer_policy/referrer_url in load_data
let mut load_data =
LoadData::new(LoadContext::Browsing,
self.request_url.borrow().clone().unwrap(),
- Some(pipeline_id));
+ Some(pipeline_id),
+ None,
+ None);
if load_data.url.origin().ne(&global.r().get_url().origin()) {
load_data.credentials_flag = self.WithCredentials();
}
@@ -628,24 +622,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
true);
match cors_request {
Ok(None) => {
- let mut buf = String::new();
- buf.push_str(&referer_url.scheme);
- buf.push_str("://");
-
- if let Some(ref h) = referer_url.serialize_host() {
- buf.push_str(h);
- }
-
- if let Some(ref p) = referer_url.port().as_ref() {
- buf.push_str(":");
- buf.push_str(&p.to_string());
- }
-
- if let Some(ref h) = referer_url.serialize_path() {
- buf.push_str(h);
- }
-
- self.request_headers.borrow_mut().set_raw("Referer".to_owned(), vec![buf.into_bytes()]);
+ let bytes = referer_url[..Position::AfterPath].as_bytes().to_vec();
+ self.request_headers.borrow_mut().set_raw("Referer".to_owned(), vec![bytes]);
},
Ok(Some(ref req)) => self.insert_trusted_header("origin".to_owned(),
req.origin.to_string()),
@@ -870,7 +848,15 @@ impl XMLHttpRequest {
}
fn process_headers_available(&self, cors_request: Option<CORSRequest>,
- gen_id: GenerationId, metadata: Metadata) -> Result<(), Error> {
+ gen_id: GenerationId, metadata: Result<Metadata, NetworkError>)
+ -> Result<(), Error> {
+ let metadata = match metadata {
+ Ok(meta) => meta,
+ Err(_) => {
+ self.process_partial_response(XHRProgress::Errored(gen_id, Error::Network));
+ return Err(Error::Network);
+ },
+ };
let bypass_cross_origin_check = {
// We want to be able to do cross-origin requests in browser.html.
@@ -901,12 +887,10 @@ impl XMLHttpRequest {
debug!("Bypassing cross origin check");
}
- *self.response_url.borrow_mut() = metadata.final_url.serialize_no_fragment();
+ *self.response_url.borrow_mut() = metadata.final_url[..Position::AfterQuery].to_owned();
// XXXManishearth Clear cache entries in case of a network error
- self.process_partial_response(XHRProgress::HeadersReceived(gen_id,
- metadata.headers,
- metadata.status));
+ self.process_partial_response(XHRProgress::HeadersReceived(gen_id, metadata.headers, metadata.status));
Ok(())
}
@@ -914,7 +898,7 @@ impl XMLHttpRequest {
self.process_partial_response(XHRProgress::Loading(gen_id, ByteString::new(payload)));
}
- fn process_response_complete(&self, gen_id: GenerationId, status: Result<(), String>)
+ fn process_response_complete(&self, gen_id: GenerationId, status: Result<(), NetworkError>)
-> ErrorResult {
match status {
Ok(()) => {
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 07d8ac47edc..2a9598fcc8b 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -12,7 +12,7 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use gfx_traits::{Epoch, LayerId};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
-use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
+use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use msg::constellation_msg::{WindowSizeData};
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem::ReportsChan;
@@ -23,7 +23,7 @@ use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, channel};
use string_cache::Atom;
use style::context::ReflowGoal;
-use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left};
+use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x};
use style::selector_impl::PseudoElement;
use style::servo::Stylesheet;
use url::Url;
@@ -104,8 +104,12 @@ pub trait LayoutRPC {
fn content_boxes(&self) -> ContentBoxesResponse;
/// Requests the geometry of this node. Used by APIs such as `clientTop`.
fn node_geometry(&self) -> NodeGeometryResponse;
+ /// Requests the overflow-x and overflow-y of this node. Used by `scrollTop` etc.
+ fn node_overflow(&self) -> NodeOverflowResponse;
/// Requests the scroll geometry of this node. Used by APIs such as `scrollTop`.
fn node_scroll_area(&self) -> NodeGeometryResponse;
+ /// Requests the layer id of this node. Used by APIs such as `scrollTop`
+ fn node_layer_id(&self) -> NodeLayerIdResponse;
/// Requests the node containing the point of interest
fn hit_test(&self) -> HitTestResponse;
/// Query layout for the resolved value of a given CSS property
@@ -136,6 +140,8 @@ impl MarginStyleResponse {
}
}
+pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>);
+
pub struct ContentBoxResponse(pub Rect<Au>);
pub struct ContentBoxesResponse(pub Vec<Rect<Au>>);
pub struct HitTestResponse {
@@ -144,6 +150,11 @@ pub struct HitTestResponse {
pub struct NodeGeometryResponse {
pub client_rect: Rect<i32>,
}
+
+pub struct NodeLayerIdResponse {
+ pub layer_id: LayerId,
+}
+
pub struct ResolvedStyleResponse(pub Option<String>);
#[derive(Clone)]
@@ -167,8 +178,10 @@ pub enum ReflowQueryType {
NoQuery,
ContentBoxQuery(TrustedNodeAddress),
ContentBoxesQuery(TrustedNodeAddress),
+ NodeOverflowQuery(TrustedNodeAddress),
HitTestQuery(Point2D<f32>, bool),
NodeGeometryQuery(TrustedNodeAddress),
+ NodeLayerIdQuery(TrustedNodeAddress),
NodeScrollGeometryQuery(TrustedNodeAddress),
ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, Atom),
OffsetParentQuery(TrustedNodeAddress),
@@ -250,7 +263,7 @@ pub struct NewLayoutThreadInfo {
pub layout_pair: OpaqueScriptLayoutChannel,
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
pub constellation_chan: ConstellationChan<ConstellationMsg>,
- pub failure: Failure,
+ pub panic_chan: ConstellationChan<PanicMsg>,
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,
diff --git a/components/script/lib.rs b/components/script/lib.rs
index e525a62b70d..0748ae954a6 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -30,6 +30,7 @@
extern crate angle;
extern crate app_units;
+#[allow(unused_extern_crates)]
#[macro_use]
extern crate bitflags;
extern crate canvas;
@@ -53,7 +54,7 @@ extern crate libc;
extern crate log;
extern crate msg;
extern crate net_traits;
-extern crate num;
+extern crate num_traits;
extern crate offscreen_gl_context;
extern crate phf;
#[macro_use]
diff --git a/components/script/origin.rs b/components/script/origin.rs
index 096ffbbd6fb..97e03162679 100644
--- a/components/script/origin.rs
+++ b/components/script/origin.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::cell::RefCell;
+use ref_filter_map::ref_filter_map;
+use std::cell::{RefCell, Ref};
use std::rc::Rc;
-use url::{OpaqueOrigin, Origin as UrlOrigin};
+use url::Origin as UrlOrigin;
use url::{Url, Host};
/// A representation of an [origin](https://html.spec.whatwg.org/multipage/#origin-2).
@@ -21,9 +22,8 @@ no_jsmanaged_fields!(Origin);
impl Origin {
/// Create a new origin comprising a unique, opaque identifier.
pub fn opaque_identifier() -> Origin {
- let opaque = UrlOrigin::UID(OpaqueOrigin::new());
Origin {
- inner: Rc::new(RefCell::new(opaque)),
+ inner: Rc::new(RefCell::new(UrlOrigin::new_opaque())),
}
}
@@ -40,18 +40,15 @@ impl Origin {
/// Does this origin represent a host/scheme/port tuple?
pub fn is_scheme_host_port_tuple(&self) -> bool {
- match *self.inner.borrow() {
- UrlOrigin::Tuple(..) => true,
- UrlOrigin::UID(..) => false,
- }
+ self.inner.borrow().is_tuple()
}
/// Return the host associated with this origin.
- pub fn host(&self) -> Option<Host> {
- match *self.inner.borrow() {
- UrlOrigin::Tuple(_, ref host, _) => Some(host.clone()),
- UrlOrigin::UID(..) => None,
- }
+ pub fn host(&self) -> Option<Ref<Host<String>>> {
+ ref_filter_map(self.inner.borrow(), |origin| match *origin {
+ UrlOrigin::Tuple(_, ref host, _) => Some(host),
+ UrlOrigin::Opaque(..) => None,
+ })
}
/// https://html.spec.whatwg.org/multipage/#same-origin
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 6147fc8bd2b..c14fa1cf021 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -95,37 +95,30 @@ impl<'a> Drop for StackRootTLS<'a> {
}
#[allow(unsafe_code)]
-pub fn new_rt_and_cx() -> Runtime {
+pub unsafe fn new_rt_and_cx() -> Runtime {
LiveDOMReferences::initialize();
let runtime = Runtime::new();
- unsafe {
- JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_rust_roots), ptr::null_mut());
- JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_refcounted_objects), ptr::null_mut());
- }
+ JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_rust_roots), ptr::null_mut());
+ JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_refcounted_objects), ptr::null_mut());
// Needed for debug assertions about whether GC is running.
if cfg!(debug_assertions) {
- unsafe {
- JS_SetGCCallback(runtime.rt(), Some(debug_gc_callback), ptr::null_mut());
- }
+ JS_SetGCCallback(runtime.rt(), Some(debug_gc_callback), ptr::null_mut());
}
+
if opts::get().gc_profile {
- unsafe {
- SetGCSliceCallback(runtime.rt(), Some(gc_slice_callback));
- }
+ SetGCSliceCallback(runtime.rt(), Some(gc_slice_callback));
}
- unsafe {
- unsafe extern "C" fn empty_wrapper_callback(_: *mut JSContext, _: *mut JSObject) -> bool { true }
- SetDOMCallbacks(runtime.rt(), &DOM_CALLBACKS);
- SetPreserveWrapperCallback(runtime.rt(), Some(empty_wrapper_callback));
- // Pre barriers aren't working correctly at the moment
- DisableIncrementalGC(runtime.rt());
- }
+ unsafe extern "C" fn empty_wrapper_callback(_: *mut JSContext, _: *mut JSObject) -> bool { true }
+ SetDOMCallbacks(runtime.rt(), &DOM_CALLBACKS);
+ SetPreserveWrapperCallback(runtime.rt(), Some(empty_wrapper_callback));
+ // Pre barriers aren't working correctly at the moment
+ DisableIncrementalGC(runtime.rt());
// Enable or disable the JITs.
- let rt_opts = unsafe { &mut *RuntimeOptionsRef(runtime.rt()) };
+ let rt_opts = &mut *RuntimeOptionsRef(runtime.rt());
if let Some(val) = get_pref("js.baseline.enabled").as_boolean() {
rt_opts.set_baseline_(val);
}
@@ -144,10 +137,10 @@ pub fn new_rt_and_cx() -> Runtime {
rt_opts.set_nativeRegExp_(val);
}
if let Some(val) = get_pref("js.parallel_parsing.enabled").as_boolean() {
- unsafe { JS_SetParallelParsingEnabled(runtime.rt(), val); }
+ JS_SetParallelParsingEnabled(runtime.rt(), val);
}
if let Some(val) = get_pref("js.offthread_compilation_enabled").as_boolean() {
- unsafe { JS_SetOffthreadIonCompilationEnabled(runtime.rt(), val); }
+ JS_SetOffthreadIonCompilationEnabled(runtime.rt(), val);
}
if let Some(val) = get_pref("js.baseline.unsafe_eager_compilation.enabled").as_boolean() {
let trigger: i32 = if val {
@@ -155,11 +148,9 @@ pub fn new_rt_and_cx() -> Runtime {
} else {
-1
};
- unsafe {
- JS_SetGlobalJitCompilerOption(runtime.rt(),
- JSJitCompilerOption::JSJITCOMPILER_BASELINE_WARMUP_TRIGGER,
- trigger as u32);
- }
+ JS_SetGlobalJitCompilerOption(runtime.rt(),
+ JSJitCompilerOption::JSJITCOMPILER_BASELINE_WARMUP_TRIGGER,
+ trigger as u32);
}
if let Some(val) = get_pref("js.ion.unsafe_eager_compilation.enabled").as_boolean() {
let trigger: i64 = if val {
@@ -167,11 +158,9 @@ pub fn new_rt_and_cx() -> Runtime {
} else {
-1
};
- unsafe {
- JS_SetGlobalJitCompilerOption(runtime.rt(),
- JSJitCompilerOption::JSJITCOMPILER_ION_WARMUP_TRIGGER,
- trigger as u32);
- }
+ JS_SetGlobalJitCompilerOption(runtime.rt(),
+ JSJitCompilerOption::JSJITCOMPILER_ION_WARMUP_TRIGGER,
+ trigger as u32);
}
// TODO: handle js.discard_system_source.enabled
// TODO: handle js.asyncstack.enabled (needs new Spidermonkey)
@@ -182,9 +171,7 @@ pub fn new_rt_and_cx() -> Runtime {
}
// TODO: handle js.shared_memory.enabled
if let Some(val) = get_pref("js.mem.high_water_mark").as_i64() {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_MALLOC_BYTES, val as u32 * 1024 * 1024);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_MALLOC_BYTES, val as u32 * 1024 * 1024);
}
if let Some(val) = get_pref("js.mem.max").as_i64() {
let max = if val <= 0 || val >= 0x1000 {
@@ -192,9 +179,7 @@ pub fn new_rt_and_cx() -> Runtime {
} else {
val * 1024 * 1024
};
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_BYTES, max as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_BYTES, max as u32);
}
// NOTE: This is disabled above, so enabling it here will do nothing for now.
if let Some(val) = get_pref("js.mem.gc.incremental.enabled").as_boolean() {
@@ -210,101 +195,71 @@ pub fn new_rt_and_cx() -> Runtime {
} else {
JSGCMode::JSGC_MODE_GLOBAL
};
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MODE, mode as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MODE, mode as u32);
}
if let Some(val) = get_pref("js.mem.gc.incremental.slice_ms").as_i64() {
if val >= 0 && val < 100000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_SLICE_TIME_BUDGET, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_SLICE_TIME_BUDGET, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.compacting.enabled").as_boolean() {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_COMPACTING_ENABLED, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_COMPACTING_ENABLED, val as u32);
}
if let Some(val) = get_pref("js.mem.gc.high_frequency_time_limit_ms").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_TIME_LIMIT, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_TIME_LIMIT, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.dynamic_mark_slice.enabled").as_boolean() {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DYNAMIC_MARK_SLICE, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DYNAMIC_MARK_SLICE, val as u32);
}
// TODO: handle js.mem.gc.refresh_frame_slices.enabled
if let Some(val) = get_pref("js.mem.gc.dynamic_heap_growth.enabled").as_boolean() {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DYNAMIC_HEAP_GROWTH, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DYNAMIC_HEAP_GROWTH, val as u32);
}
if let Some(val) = get_pref("js.mem.gc.low_frequency_heap_growth").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_LOW_FREQUENCY_HEAP_GROWTH, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_LOW_FREQUENCY_HEAP_GROWTH, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.high_frequency_heap_growth_min").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.high_frequency_heap_growth_max").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.high_frequency_low_limit_mb").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_LOW_LIMIT, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_LOW_LIMIT, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.high_frequency_high_limit_mb").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HIGH_LIMIT, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_HIGH_FREQUENCY_HIGH_LIMIT, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.allocation_threshold_mb").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_ALLOCATION_THRESHOLD, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_ALLOCATION_THRESHOLD, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.decommit_threshold_mb").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DECOMMIT_THRESHOLD, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_DECOMMIT_THRESHOLD, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.empty_chunk_count_min").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MIN_EMPTY_CHUNK_COUNT, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MIN_EMPTY_CHUNK_COUNT, val as u32);
}
}
if let Some(val) = get_pref("js.mem.gc.empty_chunk_count_max").as_i64() {
if val >= 0 && val < 10000 {
- unsafe {
- JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_EMPTY_CHUNK_COUNT, val as u32);
- }
+ JS_SetGCParameter(runtime.rt(), JSGCParamKey::JSGC_MAX_EMPTY_CHUNK_COUNT, val as u32);
}
}
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 5f2ecd095ba..d21a0f6ce0d 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -61,7 +61,7 @@ use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ScriptLayoutChan};
use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{ConstellationChan, LoadData};
use msg::constellation_msg::{PipelineId, PipelineNamespace};
-use msg::constellation_msg::{SubpageId, WindowSizeData};
+use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
@@ -100,7 +100,7 @@ use task_source::history_traversal::HistoryTraversalTaskSource;
use task_source::networking::NetworkingTaskSource;
use task_source::user_interaction::UserInteractionTaskSource;
use time::Tm;
-use url::Url;
+use url::{Url, Position};
use util::opts;
use util::str::DOMString;
use util::thread;
@@ -389,7 +389,7 @@ pub struct ScriptThread {
content_process_shutdown_chan: IpcSender<()>,
}
-/// In the event of thread failure, all data on the stack runs its destructor. However, there
+/// In the event of thread panic, all data on the stack runs its destructor. However, there
/// are no reachable, owning pointers to the DOM memory, so it never gets freed by default
/// when the script thread fails. The ScriptMemoryFailsafe uses the destructor bomb pattern
/// to forcibly tear down the JS compartments for pages associated with the failing ScriptThread.
@@ -442,11 +442,11 @@ impl ScriptThreadFactory for ScriptThread {
state: InitialScriptState,
layout_chan: &OpaqueScriptLayoutChannel,
load_data: LoadData) {
- let ConstellationChan(const_chan) = state.constellation_chan.clone();
+ let ConstellationChan(panic_chan) = state.panic_chan.clone();
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
- let failure_info = state.failure_info.clone();
- thread::spawn_named_with_send_on_failure(format!("ScriptThread {:?}", state.id),
+ let pipeline_id = state.id;
+ thread::spawn_named_with_send_on_panic(format!("ScriptThread {:?}", state.id),
thread_state::SCRIPT,
move || {
PipelineNamespace::install(state.pipeline_namespace_id);
@@ -481,7 +481,7 @@ impl ScriptThreadFactory for ScriptThread {
// This must always be the very last operation performed before the thread completes
failsafe.neuter();
- }, failure_info, const_chan);
+ }, Some(pipeline_id), panic_chan);
}
}
@@ -492,7 +492,7 @@ pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
}
impl ScriptThread {
- pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
+ pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Option<Metadata>)
-> Option<ParserRoot> {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.borrow().unwrap() };
@@ -521,7 +521,7 @@ impl ScriptThread {
port: Receiver<MainThreadScriptMsg>,
chan: Sender<MainThreadScriptMsg>)
-> ScriptThread {
- let runtime = new_rt_and_cx();
+ let runtime = unsafe { new_rt_and_cx() };
unsafe {
JS_SetWrapObjectCallbacks(runtime.rt(),
@@ -635,8 +635,8 @@ impl ScriptThread {
}
}
- for (id, size) in resizes {
- self.handle_event(id, ResizeEvent(size));
+ for (id, (size, size_type)) in resizes {
+ self.handle_event(id, ResizeEvent(size, size_type));
}
// Store new resizes, and gather all other events.
@@ -689,9 +689,9 @@ impl ScriptThread {
self.handle_new_layout(new_layout_info);
})
}
- FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
+ FromConstellation(ConstellationControlMsg::Resize(id, size, size_type)) => {
self.profile_event(ScriptThreadEventCategory::Resize, || {
- self.handle_resize(id, size);
+ self.handle_resize(id, size, size_type);
})
}
FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
@@ -1020,10 +1020,10 @@ impl ScriptThread {
}
}
- fn handle_resize(&self, id: PipelineId, size: WindowSizeData) {
+ fn handle_resize(&self, id: PipelineId, size: WindowSizeData, size_type: WindowSizeType) {
if let Some(ref page) = self.find_subpage(id) {
let window = page.window();
- window.set_resize_event(size);
+ window.set_resize_event(size, size_type);
return;
}
let mut loads = self.incomplete_loads.borrow_mut();
@@ -1061,7 +1061,7 @@ impl ScriptThread {
subpage_id,
load_data,
paint_chan,
- failure,
+ panic_chan,
pipeline_port,
layout_shutdown_chan,
content_process_shutdown_chan,
@@ -1079,7 +1079,7 @@ impl ScriptThread {
layout_pair: layout_pair,
pipeline_port: pipeline_port,
constellation_chan: self.layout_to_constellation_chan.clone(),
- failure: failure,
+ panic_chan: panic_chan,
paint_chan: paint_chan,
script_chan: self.control_chan.clone(),
image_cache_thread: self.image_cache_thread.clone(),
@@ -1132,8 +1132,7 @@ impl ScriptThread {
if let Some(root_page) = self.page.borrow().as_ref() {
for it_page in root_page.iter() {
- let current_url = it_page.document().url().serialize();
- urls.push(current_url.clone());
+ let current_url = it_page.document().url().to_string();
for child in it_page.document().upcast::<Node>().traverse_preorder() {
dom_tree_size += heap_size_of_self_and_children(&*child);
@@ -1145,7 +1144,8 @@ impl ScriptThread {
path: path![format!("url({})", current_url), "dom-tree"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: dom_tree_size,
- })
+ });
+ urls.push(current_url);
}
}
let path_seg = format!("url({})", urls.join(", "));
@@ -1280,7 +1280,7 @@ impl ScriptThread {
/// We have received notification that the response associated with a load has completed.
/// Kick off the document and frame tree creation process using the result.
fn handle_page_fetch_complete(&self, id: PipelineId, subpage: Option<SubpageId>,
- metadata: Metadata) -> Option<ParserRoot> {
+ metadata: Option<Metadata>) -> Option<ParserRoot> {
let idx = self.incomplete_loads.borrow().iter().position(|load| {
load.pipeline_id == id && load.parent_info.map(|info| info.1) == subpage
});
@@ -1289,7 +1289,7 @@ impl ScriptThread {
match idx {
Some(idx) => {
let load = self.incomplete_loads.borrow_mut().remove(idx);
- Some(self.load(metadata, load))
+ metadata.map(|meta| self.load(meta, load))
}
None => {
assert!(self.closed_pipelines.borrow().contains(&id));
@@ -1387,7 +1387,7 @@ impl ScriptThread {
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone())).unwrap();
}
- debug!("ScriptThread: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
+ debug!("ScriptThread: loading {} on page {:?}", incomplete.url, incomplete.pipeline_id);
let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id)| {
// The root page may not exist yet, if the parent of this frame
@@ -1554,30 +1554,22 @@ impl ScriptThread {
// Notify devtools that a new script global exists.
self.notify_devtools(document.Title(), final_url.clone(), (page.pipeline(), None));
- let is_javascript = incomplete.url.scheme == "javascript";
+ let is_javascript = incomplete.url.scheme() == "javascript";
let parse_input = if is_javascript {
- use url::percent_encoding::percent_decode_to;
+ use url::percent_encoding::percent_decode;
// Turn javascript: URL into JS code to eval, according to the steps in
// https://html.spec.whatwg.org/multipage/#javascript-protocol
let _ar = JSAutoRequest::new(self.get_cx());
- let mut script_source_bytes = Vec::new();
- // Start with the scheme data of the parsed URL (5.), while percent-decoding (8.)
- percent_decode_to(incomplete.url.non_relative_scheme_data().unwrap().as_bytes(),
- &mut script_source_bytes);
- // Append question mark and query component, if any (6.), while percent-decoding (8.)
- if let Some(ref query) = incomplete.url.query {
- script_source_bytes.push(b'?');
- percent_decode_to(query.as_bytes(), &mut script_source_bytes);
- }
- // Append number sign and fragment component if any (7.), while percent-decoding (8.)
- if let Some(ref fragment) = incomplete.url.fragment {
- script_source_bytes.push(b'#');
- percent_decode_to(fragment.as_bytes(), &mut script_source_bytes);
- }
- // UTF-8 decode (9.)
- let script_source = String::from_utf8_lossy(&script_source_bytes);
+ // This slice of the URL’s serialization is equivalent to (5.) to (7.):
+ // Start with the scheme data of the parsed URL;
+ // append question mark and query component, if any;
+ // append number sign and fragment component if any.
+ let encoded = &incomplete.url[Position::BeforePath..];
+
+ // Percent-decode (8.) and UTF-8 decode (9.)
+ let script_source = percent_decode(encoded.as_bytes()).decode_utf8_lossy();
// Script source is ready to be evaluated (11.)
unsafe {
@@ -1670,8 +1662,8 @@ impl ScriptThread {
}
match event {
- ResizeEvent(new_size) => {
- self.handle_resize_event(pipeline_id, new_size);
+ ResizeEvent(new_size, size_type) => {
+ self.handle_resize_event(pipeline_id, new_size, size_type);
}
MouseButtonEvent(event_type, button, point) => {
@@ -1706,7 +1698,7 @@ impl ScriptThread {
.and_then(|href| {
let value = href.value();
let url = document.url();
- url.join(&value).map(|url| url.serialize()).ok()
+ url.join(&value).map(|url| url.to_string()).ok()
});
let event = ConstellationMsg::NodeStatus(status);
@@ -1795,14 +1787,14 @@ impl ScriptThread {
// Step 8.
{
let nurl = &load_data.url;
- if let Some(ref fragment) = nurl.fragment {
+ if let Some(fragment) = nurl.fragment() {
let page = get_page(&self.root_page(), pipeline_id);
let document = page.document();
let document = document.r();
let url = document.url();
- if url.scheme == nurl.scheme && url.scheme_data == nurl.scheme_data &&
- url.query == nurl.query && load_data.method == Method::Get {
- match document.find_fragment_node(&*fragment) {
+ if &url[..Position::AfterQuery] == &nurl[..Position::AfterQuery] &&
+ load_data.method == Method::Get {
+ match document.find_fragment_node(fragment) {
Some(ref node) => {
self.scroll_fragment_point(pipeline_id, node.r());
}
@@ -1831,7 +1823,7 @@ impl ScriptThread {
}
}
- fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData) {
+ fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData, size_type: WindowSizeType) {
let page = get_page(&self.root_page(), pipeline_id);
let window = page.window();
window.set_window_size(new_size);
@@ -1849,11 +1841,13 @@ impl ScriptThread {
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
- let uievent = UIEvent::new(window.r(),
- DOMString::from("resize"), EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable, Some(window.r()),
- 0i32);
- uievent.upcast::<Event>().fire(window.upcast());
+ if size_type == WindowSizeType::Resize {
+ let uievent = UIEvent::new(window.r(),
+ DOMString::from("resize"), EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable, Some(window.r()),
+ 0i32);
+ uievent.upcast::<Event>().fire(window.upcast());
+ }
}
/// Initiate a non-blocking fetch for a specified resource. Stores the InProgressLoad
@@ -1879,7 +1873,7 @@ impl ScriptThread {
sender: action_sender,
};
- if load_data.url.scheme == "javascript" {
+ if load_data.url.scheme() == "javascript" {
load_data.url = Url::parse("about:blank").unwrap();
}
@@ -1893,6 +1887,8 @@ impl ScriptThread {
cors: None,
pipeline_id: Some(id),
credentials_flag: true,
+ referrer_policy: load_data.referrer_policy,
+ referrer_url: load_data.referrer_url,
}, LoadConsumer::Listener(response_target), None)).unwrap();
self.incomplete_loads.borrow_mut().push(incomplete);
@@ -1926,7 +1922,7 @@ impl ScriptThread {
// https://html.spec.whatwg.org/multipage/#the-end steps 3-4.
document.process_deferred_scripts();
- window.set_fragment_name(final_url.fragment.clone());
+ window.set_fragment_name(final_url.fragment().map(str::to_owned));
}
fn handle_css_error_reporting(&self, pipeline_id: PipelineId, filename: String,
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 7816106c9d7..473b2fc030c 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -15,7 +15,7 @@ use heapsize::HeapSizeOf;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, Heap, RootedValue};
use js::jsval::{JSVal, UndefinedValue};
-use num::traits::Saturating;
+use num_traits::Saturating;
use script_traits::{MsDuration, precise_time_ms};
use script_traits::{TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
use std::cell::Cell;