message: Added pure function to check for a varName and to throw an exception if one is not provided. Updated `store` functions that require a varName to use this function. Fixes a bug where the commands hang when no varName argument is provided
diff: @@ -461,7 +461,14 @@ Selenium.prototype.doAssertElementNotPresent = function(locator) {
  }
  };
  +function throwIfNoVarNameProvided(varName) {
  + if (!varName) {
  + throw new Error("No variable name provided.");
  + }
  +}
  +
  Selenium.prototype.doStore = function(value, varName) {
  + throwIfNoVarNameProvided(varName);
  return browser.runtime.sendMessage({ "storeStr": value, "storeVar": varName });
  };
  @@ -470,29 +477,31 @@ Selenium.prototype.doStoreEval = function() {
  };
  Selenium.prototype.doStoreText = function(locator, varName) {
  - if (!varName) {
  - throw new Error("No variable name provided.");
  - }
  + throwIfNoVarNameProvided(varName);
  let element = this.browserbot.findElement(locator);
  return browser.runtime.sendMessage({ "storeStr": bot.dom.getVisibleText(element), "storeVar": varName });
  };
  Selenium.prototype.doStoreValue = function(locator, varName) {
  + throwIfNoVarNameProvided(varName);
  let element = this.browserbot.findElement(locator);
  return browser.runtime.sendMessage({ "storeStr": element.value.trim(), "storeVar": varName });
  };
  Selenium.prototype.doStoreTitle = function(value, varName) {
  + throwIfNoVarNameProvided(varName);
  let doc = selenium.browserbot.getDocument();
  return browser.runtime.sendMessage({ "storeStr": value || doc.title, "storeVar": varName });
  };
  Selenium.prototype.doStoreXpathCount = function(xpath, varName) {
  + throwIfNoVarNameProvided(varName);
  let count = this.browserbot.evaluateXPathCount(xpath, this.browserbot.getDocument());
  return browser.runtime.sendMessage({ "storeStr": `${count}` || "0", "storeVar": varName });
  };
  Selenium.prototype.doStoreAttribute = function(locator, varName) {
  + throwIfNoVarNameProvided(varName);
  let attributeValue = this.browserbot.findAttribute(locator);
  return browser.runtime.sendMessage({ "storeStr": attributeValue, "storeVar": varName });
  };
  