Bug 1139560 - <img>.currentSrc should be not be nullable. r=jst
--- a/dom/tests/mochitest/general/test_img_mutations.html
+++ b/dom/tests/mochitest/general/test_img_mutations.html
@@ -64,17 +64,17 @@
info("test 1");
img.src = testPNG50;
is(img.currentSrc, testPNG50, "Should have synchronously selected source");
img.src = "non_existent_image.404";
ok(img.currentSrc.endsWith("non_existent_image.404"), "Should have synchronously selected source");
img.removeAttribute("src");
- is(img.currentSrc, null, "Should have dropped currentSrc");
+ is(img.currentSrc, '', "Should have dropped currentSrc");
// Load another image while previous load is still pending
img.src = testPNG200;
is(img.currentSrc, testPNG200, "Should have synchronously selected source");
// No events should have fired synchronously, now we should get just one load (and no 404 error)
expectEvents(1, 0, nextTest);
});
--- a/dom/tests/mochitest/general/test_picture_mutations.html
+++ b/dom/tests/mochitest/general/test_picture_mutations.html
@@ -60,17 +60,17 @@
}
}
// Setup image outside the tree dom, make sure it loads
tests.push(function() {
info("test 1");
img.srcset = testPNG100;
img.src = testPNG50;
- is(img.currentSrc, null, "Should not have synchronously selected source");
+ is(img.currentSrc, '', "Should not have synchronously selected source");
// No events should have fired synchronously, now we should get just one load (and no 404 error)
expectEvents(1, 0, nextTest);
});
// Binding to an empty picture should trigger an event, even if source doesn't change
tests.push(function() {
info("test 2");
--- a/dom/webidl/HTMLImageElement.webidl
+++ b/dom/webidl/HTMLImageElement.webidl
@@ -57,17 +57,17 @@ partial interface HTMLImageElement {
};
// [Update me: not in whatwg spec yet]
// http://picture.responsiveimages.org/#the-img-element
partial interface HTMLImageElement {
[SetterThrows, Pref="dom.image.picture.enabled"]
attribute DOMString sizes;
[Pref="dom.image.srcset.enabled"]
- readonly attribute DOMString? currentSrc;
+ readonly attribute DOMString currentSrc;
};
// Mozilla extensions.
partial interface HTMLImageElement {
attribute DOMString lowsrc;
// These attributes are offsets from the closest view (to mimic
// NS4's "offset-from-layer" behavior).