nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: nightwatchjs/nightwatch
Pull request #2936 (2021-11-02 12:56:50)

update default conf to use w3c driver
### Changes
- update auto-generated nightwatch conf to use `w3c:true`


Patch:
diff --git a/lib/runner/cli/nightwatch.conf.ejs b/lib/runner/cli/nightwatch.conf.ejs
index 41a5e06f..f8e6b7fe 100644
--- a/lib/runner/cli/nightwatch.conf.ejs
+++ b/lib/runner/cli/nightwatch.conf.ejs
@@ -93,8 +93,8 @@ module.exports = {
         'goog:chromeOptions' : {
           // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
           //
-          // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
-          w3c: false,
+          // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
+          w3c: true,
           args: [
             //'--no-sandbox',
             //'--ignore-certificate-errors',
@@ -117,7 +117,7 @@ module.exports = {
       desiredCapabilities : {
         browserName : 'MicrosoftEdge',
         'ms:edgeOptions' : {
-          w3c: false,
+          w3c: true,
           // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
           args: [
             //'--headless'
@@ -208,7 +208,7 @@ module.exports = {
       desiredCapabilities: {
         browserName: 'chrome',
         chromeOptions : {
-          w3c: false
+          w3c: true
         }
       }
     },
@@ -270,7 +270,7 @@ module.exports = {
       desiredCapabilities: {
         browserName: 'chrome',
         chromeOptions : {
-          w3c: false
+          w3c: true
         }
       }
     },


Test patch:
diff --git a/test/src/cli/testCliRunnerGenerate.js b/test/src/cli/testCliRunnerGenerate.js
index d2b0bbf1..9702b568 100644
--- a/test/src/cli/testCliRunnerGenerate.js
+++ b/test/src/cli/testCliRunnerGenerate.js
@@ -76,7 +76,7 @@ describe('Test CLI Runner Generate', function() {
             browserName: 'chrome',
             'goog:chromeOptions': {
               args: [],
-              w3c: false
+              w3c: true
             }
           },
 
@@ -154,7 +154,7 @@ describe('Test CLI Runner Generate', function() {
           desiredCapabilities: {
             browserName: 'chrome',
             chromeOptions: {
-              w3c: false
+              w3c: true
             }
           }
         });
Repository: nightwatchjs/nightwatch
Pull request #3500 (2022-11-28 07:40:03)

fixed bug when setting test status in reporter
fixes bug in https://github.com/nightwatchjs/nightwatch/pull/3494 when setting testcase status in reporter.


Patch:
diff --git a/lib/reporter/results.js b/lib/reporter/results.js
index b83910cf..3235e053 100644
--- a/lib/reporter/results.js
+++ b/lib/reporter/results.js
@@ -110,7 +110,7 @@ module.exports = class Results {
   }
 
   hasFailures() {
-    return this.currentTestResult.errors === 0 && this.currentTestResult.failed === 0;
+    return this.currentTestResult.errors > 0 || this.currentTestResult.failed > 0;
   }
 
   ////////////////////////////////////////////////////////////


Test patch:
diff --git a/test/src/runner/testReporter.js b/test/src/runner/testReporter.js
index 404fed88..9afa89ae 100644
--- a/test/src/runner/testReporter.js
+++ b/test/src/runner/testReporter.js
@@ -250,6 +250,7 @@ describe('testReporter', function() {
             assert.ok(Object.keys(test).includes('status'));
             assert.ok(Object.keys(test).includes('startTimestamp'));
             assert.ok(Object.keys(test).includes('endTimestamp'));
+            assert.strictEqual(test.status, 'pass');
           }
         },
         silent: true,
Repository: nightwatchjs/nightwatch
Pull request #3520 (2022-12-14 08:42:20)

Fix baseUrl error while running tests on Android emulator.
Fixes: #3518



Patch:
diff --git a/lib/core/client.js b/lib/core/client.js
index 505678a4..8e336272 100644
--- a/lib/core/client.js
+++ b/lib/core/client.js
@@ -471,7 +471,7 @@ class NightwatchClient extends EventEmitter {
     let value = this.settings.baseUrl || this.settings.launchUrl || this.settings.launch_url || null;
 
     // For e2e and component testing on android emulator
-    if (!this.settings.desiredCapabilities.real_mobile && this.settings.desiredCapabilities.avd) {         
+    if (value && !this.settings.desiredCapabilities.real_mobile && this.settings.desiredCapabilities.avd) {         
       value = value.replace('localhost', '10.0.2.2').replace('127.0.0.1', '10.0.2.2');
     }
 


Test patch:
diff --git a/test/src/index/testMobileComponent.js b/test/src/index/testMobileComponent.js
index 8fa284fe..cfd1618c 100644
--- a/test/src/index/testMobileComponent.js
+++ b/test/src/index/testMobileComponent.js
@@ -33,4 +33,62 @@ describe('Mobile Component Testing in Android Emulator', function () {
 
     assert.strictEqual(client.api.baseUrl, 'http://10.0.2.2:3000');
   });
-});
\ No newline at end of file
+
+  it('test baseUrl - not defined',  function(){
+    const client = NightwatchClient.client({
+      webdriver: {
+        start_process: true
+      },
+      desiredCapabilities: {
+        avd: 'nightwatch-android-11',
+        real_mobile: false
+      }
+    });
+
+    assert.strictEqual(client.api.baseUrl, null);
+  });
+
+  it('test baseUrl - non local',  function(){
+    const client = NightwatchClient.client({
+      baseUrl: 'https://www.google.com/',
+      webdriver: {
+        start_process: true
+      },
+      desiredCapabilities: {
+        avd: 'nightwatch-android-11',
+        real_mobile: false
+      }
+    });
+
+    assert.strictEqual(client.api.baseUrl, 'https://www.google.com/');
+  });
+
+  it('test baseUrl - real mobile',  function(){
+    const client = NightwatchClient.client({
+      baseUrl: 'http://127.0.0.1:3000',
+      webdriver: {
+        start_process: true
+      },
+      desiredCapabilities: {
+        avd: 'nightwatch-android-11',
+        real_mobile: true
+      }
+    });
+
+    assert.strictEqual(client.api.baseUrl, 'http://127.0.0.1:3000');
+  });
+
+  it('test baseUrl - no mobile',  function(){
+    const client = NightwatchClient.client({
+      baseUrl: 'http://127.0.0.1:3000',
+      webdriver: {
+        start_process: true
+      },
+      desiredCapabilities: {
+        real_mobile: false
+      }
+    });
+
+    assert.strictEqual(client.api.baseUrl, 'http://127.0.0.1:3000');
+  });
+});
Repository: w3c/webidl2.js
Pull request #121 (2017-12-15 06:23:50)

BREAKING CHANGE: remove deprecated iterator operation
https://github.com/heycam/webidl/commit/1bc1e2904d3cd90d7856e184cb4b5f10d26b8d96

Iterator operation is replaced by iterable declaration in 2014.



Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 6a4559b..3771031 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -580,23 +580,8 @@
       }
       ret.idlType = return_type();
       all_ws();
-      if (consume(ID, "iterator")) {
-        all_ws();
-        ret.type = "iterator";
-        if (consume(ID, "object")) {
-          ret.iteratorObject = "object";
-        } else if (consume(OTHER, "=")) {
-          all_ws();
-          var name = consume(ID) || error("No right hand side in iterator");
-          ret.iteratorObject = name.value;
-        }
-        all_ws();
-        consume(OTHER, ";") || error("Unterminated iterator");
-        return ret;
-      } else {
-        operation_rest(ret, store);
-        return ret;
-      }
+      operation_rest(ret, store);
+      return ret;
     };
 
     function static_member(store) {


Test patch:
diff --git a/test/syntax/idl/iterator.widl b/test/invalid/idl/iterator.widl
similarity index 100%
rename from test/syntax/idl/iterator.widl
rename to test/invalid/idl/iterator.widl
diff --git a/test/invalid/json/iterator.json b/test/invalid/json/iterator.json
new file mode 100644
index 0000000..7cc2f94
--- /dev/null
+++ b/test/invalid/json/iterator.json
@@ -0,0 +1,4 @@
+{
+    "message": "Invalid operation",
+    "line": 5
+}
Repository: w3c/webidl2.js
Pull request #145 (2018-04-07 20:49:10)

Fix whitespace handling of implements and includes.
The all_ws() production here might return undefined for certain badly
formed WebIDL (for example, the simple text "foobar;"). Be careful not
to unshift an undefined value onto the tokens array.

kenrussell: Added a test and confirmed that it catches both bugs in whitespace unshifting. Please take another look. Thanks.

marcoscaceres: @saschanaz feel free to merge and release. Otherwise, I can do it tomorrow. 

Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index a2a5cd0..ef047df 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -1021,7 +1021,8 @@
         return ret;
       } else {
         // rollback
-        tokens.unshift(w);
+        if (w)
+          tokens.unshift(w);
         tokens.unshift(target);
       }
     }
@@ -1044,7 +1045,8 @@
         return ret;
       } else {
         // rollback
-        tokens.unshift(w);
+        if (w)
+          tokens.unshift(w);
         tokens.unshift(target);
       }
     }


Test patch:
diff --git a/test/invalid/idl/implements_and_includes_ws.widl b/test/invalid/idl/implements_and_includes_ws.widl
new file mode 100644
index 0000000..6666dae
--- /dev/null
+++ b/test/invalid/idl/implements_and_includes_ws.widl
@@ -0,0 +1,4 @@
+// This hits the unshifting of whitespace in the "implements" and
+// "includes" productions. If there is a bug in that whitespace
+// rollback, the wrong exception will be produced.
+foobar;
diff --git a/test/invalid/json/implements_and_includes_ws.json b/test/invalid/json/implements_and_includes_ws.json
new file mode 100644
index 0000000..ad9fac6
--- /dev/null
+++ b/test/invalid/json/implements_and_includes_ws.json
@@ -0,0 +1,4 @@
+{
+    "message": "Got an error before parsing any named definition: Unrecognised tokens",
+    "line": 4
+}
Repository: w3c/webidl2.js
Pull request #161 (2018-05-17 00:02:04)

fix: prevent tokeniser error when it meets _0
It turns out I was not fully understanding the tokenizer error. The `other` regex was different from the one in the spec and it was causing token stream error. Now `_0` is parsed as: `_` as `other` and `0` as `integer`.


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 22c0251..2ca27b6 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -12,10 +12,10 @@
     "string": /"[^"]*"/y,
     "whitespace": /[\t\n\r ]+/y,
     "comment": /((\/(\/.*|\*([^*]|\*[^\/])*\*\/)[\t\n\r ]*)+)/y,
-    "other": /[^\t\n\r 0-9A-Z_a-z]/y
+    "other": /[^\t\n\r 0-9A-Za-z]/y
   };
 
-  const namedTerminals = [
+  const nonRegexTerminals = [
     "Infinity",
     "NaN",
     "attribute",
@@ -87,16 +87,15 @@
       } else if (/[A-Z_a-z]/.test(nextChar)) {
         result = attemptTokenMatch("identifier");
         const token = tokens[tokens.length - 1];
-        if (result !== -1 && namedTerminals.includes(token.value)) {
+        if (result !== -1 && nonRegexTerminals.includes(token.value)) {
           token.type = token.value;
         }
       } else if (nextChar === '"') {
         result = attemptTokenMatch("string");
-        if (result === -1) {
-          // '"' can also match "other".
-          result = attemptTokenMatch("other");
-        }
-      } else {
+      }
+      
+      // other as the last try
+      if (result === -1) {
         result = attemptTokenMatch("other");
       }
       if (result === -1) {


Test patch:
diff --git a/test/invalid/json/id-underscored-number.json b/test/invalid/json/id-underscored-number.json
index c49f3f5..419ed94 100644
--- a/test/invalid/json/id-underscored-number.json
+++ b/test/invalid/json/id-underscored-number.json
@@ -1,3 +1,4 @@
 {
-    "message": "Token stream not progressing"
+    "message": "Got an error before parsing any named definition: No name for interface",
+    "line": 1
 }
Repository: w3c/webidl2.js
Pull request #170 (2018-05-24 02:58:20)

fix: write inherit readonly attribute in proper order
https://heycam.github.io/webidl/#prod-ReadWriteAttribute

```
ReadWriteAttribute ::
    inherit ReadOnly AttributeRest
    AttributeRest
```

`inherit readonly`, not `readonly inherit` 😁

This only affects the currently unexposed writer so IMO no need for a version bump.

marcoscaceres: Not related to this pr, but super weird these inherited attributes... 

Patch:
diff --git a/lib/writer.js b/lib/writer.js
index c6f5d0b..95c2d32 100644
--- a/lib/writer.js
+++ b/lib/writer.js
@@ -87,8 +87,8 @@
       let ret = extended_attributes(it.extAttrs);
       if (it["static"]) ret += "static ";
       if (it.stringifier) ret += "stringifier ";
-      if (it.readonly) ret += "readonly ";
       if (it.inherit) ret += "inherit ";
+      if (it.readonly) ret += "readonly ";
       ret += `attribute ${type(it.idlType)} ${it.escapedName};`;
       return ret;
     };


Test patch:
diff --git a/test/syntax/idl/inherits-getter.widl b/test/syntax/idl/inherits-getter.widl
index 558e811..435b3ab 100644
--- a/test/syntax/idl/inherits-getter.widl
+++ b/test/syntax/idl/inherits-getter.widl
@@ -13,4 +13,10 @@ interface Person : Animal {
   // Its getter behavior is inherited from Animal, and need not be specified
   // the description of Person.
   inherit attribute DOMString name;
-};
\ No newline at end of file
+};
+
+interface Ghost : Person {
+
+  // An attribute that only inherits the getter behavior
+  inherit readonly attribute DOMString name;
+};
diff --git a/test/syntax/json/inherits-getter.json b/test/syntax/json/inherits-getter.json
index a70d735..2569e4e 100644
--- a/test/syntax/json/inherits-getter.json
+++ b/test/syntax/json/inherits-getter.json
@@ -73,5 +73,33 @@
         ],
         "inheritance": "Animal",
         "extAttrs": []
+    },
+    {
+        "type": "interface",
+        "name": "Ghost",
+        "partial": false,
+        "members": [
+            {
+                "type": "attribute",
+                "static": false,
+                "stringifier": false,
+                "inherit": true,
+                "readonly": true,
+                "idlType": {
+                    "type": "attribute-type",
+                    "sequence": false,
+                    "generic": null,
+                    "nullable": false,
+                    "union": false,
+                    "idlType": "DOMString",
+                    "extAttrs": []
+                },
+                "name": "name",
+                "escapedName": "name",
+                "extAttrs": []
+            }
+        ],
+        "inheritance": "Person",
+        "extAttrs": []
     }
 ]
Repository: w3c/webidl2.js
Pull request #187 (2018-06-04 12:08:40)

fix: prevent empty iterable declaration
```webidl
interface X {
  iterable<>; // should be illegal
};
```

Fixes a mistake. 🤣


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index b14d0e1..4217816 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -692,7 +692,7 @@
       if (ret.type !== 'maplike' && ret.type !== 'setlike')
         delete ret.readonly;
       if (consume("<")) {
-        ret.idlType = [type_with_extended_attributes()] || error(`Error parsing ${ittype} declaration`);
+        ret.idlType = [type_with_extended_attributes() || error(`Error parsing ${ittype} declaration`)];
         if (secondTypeAllowed) {
           if (consume(",")) {
             ret.idlType.push(type_with_extended_attributes());


Test patch:
diff --git a/test/invalid/idl/iterable-empty.widl b/test/invalid/idl/iterable-empty.widl
new file mode 100644
index 0000000..01664a3
--- /dev/null
+++ b/test/invalid/idl/iterable-empty.widl
@@ -0,0 +1,3 @@
+interface X {
+    iterable<>;
+};
diff --git a/test/invalid/json/iterable-empty.json b/test/invalid/json/iterable-empty.json
new file mode 100644
index 0000000..779f585
--- /dev/null
+++ b/test/invalid/json/iterable-empty.json
@@ -0,0 +1,4 @@
+{
+    "message": "Got an error during or right after parsing `interface X`: Error parsing iterable declaration",
+    "line": 2
+}
Repository: w3c/webidl2.js
Pull request #224 (2018-07-19 12:06:09)

fix(lib/webidl): disallow multiple special keywords
Following heycam/webidl#562.


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 37ab279..46043d8 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -762,12 +762,11 @@
 
     function operation({ regular = false } = {}) {
       const ret = Object.assign({}, EMPTY_OPERATION, { body: {} });
-      while (!regular) {
+      if (!regular) {
         const special = consume("getter", "setter", "deleter");
-        if (!special) {
-          break;
+        if (special) {
+          ret[special.type] = { trivia: special.trivia };
         }
-        ret[special.type] = { trivia: special.trivia };
       }
       ret.body.idlType = return_type() || error("Missing return type");
       operation_rest(ret);


Test patch:
diff --git a/test/invalid/idl/operation-too-special.widl b/test/invalid/idl/operation-too-special.widl
new file mode 100644
index 0000000..c2294ff
--- /dev/null
+++ b/test/invalid/idl/operation-too-special.widl
@@ -0,0 +1,3 @@
+interface Ako {
+    getter setter void maki();
+};
diff --git a/test/invalid/json/operation-too-special.json b/test/invalid/json/operation-too-special.json
new file mode 100644
index 0000000..eaa3ddc
--- /dev/null
+++ b/test/invalid/json/operation-too-special.json
@@ -0,0 +1,4 @@
+{
+    "message": "Got an error during or right after parsing `interface Ako`: Missing return type",
+    "line": 2
+}
Repository: w3c/webidl2.js
Pull request #258 (2019-01-31 12:58:34)

fix(lib/webidl2): restore enum value string form in error
Modifying token object causes side effect 😄


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 7236e94..3dd7c40 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -1111,12 +1111,14 @@
           error("No comma between enum values");
         }
         const val = consume(STR) || error("Unexpected value in enum");
-        val.type = "enum-value";
-        val.value = val.value.slice(1, -1);
-        val.separator = untyped_consume(",") || null;
-
-        ret.values.push(val);
-        value_expected = !!val.separator;
+        const separator = untyped_consume(",") || null;
+        ret.values.push({
+          type: "enum-value",
+          value: val.value.slice(1, -1),
+          trivia: val.trivia,
+          separator
+        });
+        value_expected = !!separator;
       }
     }
 


Test patch:
diff --git a/test/invalid/baseline/enum-wo-comma.txt b/test/invalid/baseline/enum-wo-comma.txt
index 3e4856b..069b67d 100644
--- a/test/invalid/baseline/enum-wo-comma.txt
+++ b/test/invalid/baseline/enum-wo-comma.txt
@@ -1,3 +1,3 @@
 Syntax error at line 1, since `enum NoComma`:
-enum NoComma { value1 "value2" };
-                      ^ No comma between enum values
+enum NoComma { "value1" "value2" };
+                        ^ No comma between enum values
Repository: w3c/webidl2.js
Pull request #286 (2019-03-15 13:19:47)

fix(lib/webidl2): disallow empty generic type
A funny bug 🤣


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 327c4f5..772dcd0 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -481,14 +481,18 @@
       const open = consume("<") || error(`No opening bracket after ${name.type}`);
       ret.generic.trivia.open = open.trivia;
       switch (name.type) {
-        case "Promise":
+        case "Promise": {
           if (probe("[")) error("Promise type cannot have extended attribute");
-          ret.idlType = [return_type(typeName)];
+          const subtype = return_type(typeName) || error("Missing Promise subtype");
+          ret.idlType = [subtype];
           break;
+        }
         case "sequence":
-        case "FrozenArray":
-          ret.idlType = [type_with_extended_attributes(typeName)];
+        case "FrozenArray": {
+          const subtype = type_with_extended_attributes(typeName) || error(`Missing ${name.type} subtype`);
+          ret.idlType = [subtype];
           break;
+        }
         case "record": {
           if (probe("[")) error("Record key cannot have extended attribute");
           ret.idlType = [];


Test patch:
diff --git a/test/invalid/baseline/frozenarray-empty.txt b/test/invalid/baseline/frozenarray-empty.txt
new file mode 100644
index 0000000..f6ce295
--- /dev/null
+++ b/test/invalid/baseline/frozenarray-empty.txt
@@ -0,0 +1,3 @@
+Syntax error at line 1:
+typedef FrozenArray<> empty;
+                    ^ Missing FrozenArray subtype
diff --git a/test/invalid/baseline/promise-empty.txt b/test/invalid/baseline/promise-empty.txt
new file mode 100644
index 0000000..414842e
--- /dev/null
+++ b/test/invalid/baseline/promise-empty.txt
@@ -0,0 +1,3 @@
+Syntax error at line 1:
+typedef Promise<> empty;
+                ^ Missing Promise subtype
diff --git a/test/invalid/baseline/sequence-empty.txt b/test/invalid/baseline/sequence-empty.txt
new file mode 100644
index 0000000..08215a9
--- /dev/null
+++ b/test/invalid/baseline/sequence-empty.txt
@@ -0,0 +1,3 @@
+Syntax error at line 1:
+typedef sequence<> empty;
+                 ^ Missing sequence subtype
diff --git a/test/invalid/idl/frozenarray-empty.widl b/test/invalid/idl/frozenarray-empty.widl
new file mode 100644
index 0000000..2095a98
--- /dev/null
+++ b/test/invalid/idl/frozenarray-empty.widl
@@ -0,0 +1,1 @@
+typedef FrozenArray<> empty;
diff --git a/test/invalid/idl/promise-empty.widl b/test/invalid/idl/promise-empty.widl
new file mode 100644
index 0000000..731d844
--- /dev/null
+++ b/test/invalid/idl/promise-empty.widl
@@ -0,0 +1,1 @@
+typedef Promise<> empty;
diff --git a/test/invalid/idl/sequence-empty.widl b/test/invalid/idl/sequence-empty.widl
new file mode 100644
index 0000000..b5b2278
--- /dev/null
+++ b/test/invalid/idl/sequence-empty.widl
@@ -0,0 +1,1 @@
+typedef sequence<> empty;