Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js (92971 => 92972)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js 2011-08-12 17:33:09 UTC (rev 92971)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js 2011-08-12 17:34:12 UTC (rev 92972)
@@ -219,4 +219,19 @@
});
};
+// Based on http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/resources/shared/js/cr/ui.js
+base.extends = function(base, prototype)
+{
+ var extended = function() {
+ var element = typeof base == 'string' ? document.createElement(base) : base.call(this);
+ extended.prototype.__proto__ = element.__proto__;
+ element.__proto__ = extended.prototype;
+ element.init && element.init.apply(element, arguments);
+ return element;
+ }
+
+ extended.prototype = prototype;
+ return extended;
+}
+
})();
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js (92971 => 92972)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js 2011-08-12 17:33:09 UTC (rev 92971)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js 2011-08-12 17:34:12 UTC (rev 92972)
@@ -216,4 +216,78 @@
});
});
+test("extends", 17, function() {
+
+ var LikeDiv = base.extends("div", {
+ init: function() {
+ this.textContent = "awesome";
+ },
+ method: function(msg) {
+ return 42;
+ }
+ });
+
+ var LikeLikeDiv = base.extends(LikeDiv, {
+ init: function() {
+ this.className = "like";
+ }
+ });
+
+ var LikeP = base.extends("p", {
+ init: function(content) {
+ this.textContent = content
+ }
+ });
+
+ var LikeProgress = base.extends("progress", {
+ init: function() {
+ this.max = 100;
+ this.value = 10;
+ }
+ });
+
+ var LikeLikeProgress = base.extends(LikeProgress, {
+ completed: function() {
+ this.value = 100;
+ }
+ });
+
+ document.body.appendChild(new LikeDiv());
+ equals(document.body.lastChild.tagName, "DIV");
+ equals(document.body.lastChild.innerHTML, "awesome");
+ equals(document.body.lastChild.method(), 42);
+ document.body.removeChild(document.body.lastChild);
+
+ document.body.appendChild(new LikeLikeDiv());
+ equals(document.body.lastChild.tagName, "DIV");
+ equals(document.body.lastChild.innerHTML, "awesome");
+ equals(document.body.lastChild.method(), 42);
+ equals(document.body.lastChild.className, "like");
+ document.body.removeChild(document.body.lastChild);
+
+ document.body.appendChild(new LikeP("super"));
+ equals(document.body.lastChild.tagName, "P");
+ equals(document.body.lastChild.innerHTML, "super");
+ raises(function() {
+ document.body.lastChild.method();
+ });
+ document.body.removeChild(document.body.lastChild);
+
+ document.body.appendChild(new LikeProgress());
+ equals(document.body.lastChild.tagName, "PROGRESS");
+ equals(document.body.lastChild.position, 0.1);
+ equals(document.body.lastChild.innerHTML, "");
+ raises(function() {
+ document.body.lastChild.method();
+ });
+ document.body.removeChild(document.body.lastChild);
+
+ document.body.appendChild(new LikeLikeProgress());
+ equals(document.body.lastChild.tagName, "PROGRESS");
+ equals(document.body.lastChild.position, 0.1);
+ document.body.lastChild.completed();
+ equals(document.body.lastChild.position, 1);
+ document.body.removeChild(document.body.lastChild);
+});
+
})();
Modified: trunk/Tools/ChangeLog (92971 => 92972)
--- trunk/Tools/ChangeLog 2011-08-12 17:33:09 UTC (rev 92971)
+++ trunk/Tools/ChangeLog 2011-08-12 17:34:12 UTC (rev 92972)
@@ -1,3 +1,13 @@
+2011-08-11 Dimitri Glazkov <[email protected]>
+
+ Add a way to extend DOM objects in garden-o-matic.
+ https://bugs.webkit.org/show_bug.cgi?id=66096
+
+ Reviewed by Adam Barth.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js: Added base.extends.
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js: Added tests.
+
2011-08-11 MORITA Hajime <[email protected]>
[Chromium][DRT] editing/spelling/spelling-backspace-between-lines.html fails