Skip to content

Commit

Permalink
Implement the HTMLScriptElement.src setter
Browse files Browse the repository at this point in the history
Fixes #1113.
  • Loading branch information
mbrubeck committed Dec 5, 2014
1 parent b8444f9 commit cddc692
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 85 deletions.
8 changes: 4 additions & 4 deletions components/script/dom/htmlscriptelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use encoding::types::{Encoding, DecodeReplace};
use servo_net::resource_task::load_whole_resource;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
use std::cell::Cell;
use string_cache::Atom;
use url::UrlParser;

#[dom_struct]
Expand Down Expand Up @@ -302,10 +303,9 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLScriptElement> {
}

impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
fn Src(self) -> DOMString {
let element: JSRef<Element> = ElementCast::from_ref(self);
element.get_url_attribute(&atom!("src"))
}
make_url_getter!(Src)

make_setter!(SetSrc, "src")

// http://www.whatwg.org/html/#dom-script-text
fn Text(self) -> DOMString {
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/webidls/HTMLScriptElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

// http://www.whatwg.org/html/#htmlscriptelement
interface HTMLScriptElement : HTMLElement {
// attribute DOMString src;
readonly attribute DOMString src;
attribute DOMString src;
// attribute DOMString type;
// attribute DOMString charset;
// attribute boolean async;
Expand Down
3 changes: 0 additions & 3 deletions tests/wpt/metadata/html/dom/interfaces.html.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6090,9 +6090,6 @@
[HTMLScriptElement interface object length]
expected: FAIL
[HTMLScriptElement interface: attribute src]
expected: FAIL
[HTMLScriptElement interface: attribute type]
expected: FAIL
Expand Down
51 changes: 0 additions & 51 deletions tests/wpt/metadata/html/dom/reflection-misc.html.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1386,105 +1386,54 @@
[script.src: setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL

[script.src: IDL set to "" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to "" followed by IDL get]
expected: FAIL

[script.src: IDL set to " foo " followed by getAttribute()]
expected: FAIL

[script.src: IDL set to " foo " followed by IDL get]
expected: FAIL

[script.src: IDL set to "http://site.example/" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to "http://site.example/" followed by IDL get]
expected: FAIL

[script.src: IDL set to "//site.example/path???@#l" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to "//site.example/path???@#l" followed by IDL get]
expected: FAIL

[script.src: IDL set to "\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f " followed by getAttribute()]
expected: FAIL

[script.src: IDL set to "\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f " followed by IDL get]
expected: FAIL

[script.src: IDL set to undefined followed by getAttribute()]
expected: FAIL

[script.src: IDL set to undefined followed by IDL get]
expected: FAIL

[script.src: IDL set to 7 followed by getAttribute()]
expected: FAIL

[script.src: IDL set to 7 followed by IDL get]
expected: FAIL

[script.src: IDL set to 1.5 followed by getAttribute()]
expected: FAIL

[script.src: IDL set to 1.5 followed by IDL get]
expected: FAIL

[script.src: IDL set to true followed by getAttribute()]
expected: FAIL

[script.src: IDL set to true followed by IDL get]
expected: FAIL

[script.src: IDL set to false followed by getAttribute()]
expected: FAIL

[script.src: IDL set to false followed by IDL get]
expected: FAIL

[script.src: IDL set to object "[object Object\]" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL

[script.src: IDL set to NaN followed by getAttribute()]
expected: FAIL

[script.src: IDL set to NaN followed by IDL get]
expected: FAIL

[script.src: IDL set to Infinity followed by getAttribute()]
expected: FAIL

[script.src: IDL set to Infinity followed by IDL get]
expected: FAIL

[script.src: IDL set to -Infinity followed by getAttribute()]
expected: FAIL

[script.src: IDL set to -Infinity followed by IDL get]
expected: FAIL

[script.src: IDL set to "\\0" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to "\\0" followed by IDL get]
expected: FAIL

[script.src: IDL set to null followed by getAttribute()]
expected: FAIL

[script.src: IDL set to null followed by IDL get]
expected: FAIL

[script.src: IDL set to object "test-toString" followed by getAttribute()]
expected: FAIL

[script.src: IDL set to object "test-toString" followed by IDL get]
expected: FAIL

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 comments on commit cddc692

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at mbrubeck@cddc692

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging mbrubeck/servo/script-src = cddc692 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mbrubeck/servo/script-src = cddc692 merged ok, testing candidate = 9050a15

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 9050a15

Please sign in to comment.