Web Inspector: REGRESSION(r266669): DOMBreakpoint.js:106:23: CONSOLE ASSERT ERROR domNode should not change once set
https://bugs.webkit.org/show_bug.cgi?id=217865
Reviewed by Timothy Hatcher.
Source/WebInspectorUI:
* UserInterface/Models/DOMBreakpoint.js:
(WI.DOMBreakpoint.prototype.set domNode):
Adjust the assertion such that `null` is allowed if `_domNode` is already `null`.
* UserInterface/Base/Utilities.js:
(xor): Added.
Global utility function for doing a non-bitwise or that returns `false` if both values are
truthy/falsy and the truthy value if only one is truthy.
LayoutTests:
* inspector/unit-tests/utilities.html: Added.
* inspector/unit-tests/utilities-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@268634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/inspector/unit-tests/utilities.html b/LayoutTests/inspector/unit-tests/utilities.html
new file mode 100644
index 0000000..1aea73f
--- /dev/null
+++ b/LayoutTests/inspector/unit-tests/utilities.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function test()
+{
+ let suite = InspectorTest.createSyncSuite("Utilities");
+
+ suite.addTestCase({
+ name: "xor",
+ test() {
+ InspectorTest.expectEqual(xor(0, undefined), false, "xor should explicitly return false when both values are falsy.");
+ InspectorTest.expectEqual(xor(42, undefined), 42, "xor should return the first value when the second value is falsy.");
+ InspectorTest.expectEqual(xor(undefined, "test"), "test", "xor should return the second value when the first value is falsy.");
+ InspectorTest.expectEqual(xor(42, "test"), false, "xor should explicitly return false when both values are truthy.");
+ },
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onLoad="runTest()">
+</body>
+</html>