Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Bug 491200 - Mozmill should not use anonymous functions. r=hskupin
Browse files Browse the repository at this point in the history
  • Loading branch information
gilles-leblanc authored and whimboo committed Apr 4, 2014
1 parent 7447404 commit 15c0dc9
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 175 deletions.
2 changes: 1 addition & 1 deletion jsbridge/jsbridge/extension/components/jsbridge.js
Expand Up @@ -58,7 +58,7 @@ JSBridge.prototype = {

var self = this;
var startCallback = {
notify: function (timer) {
notify: function sc_notify(timer) {
try {
// Try to start the JSBridge server via a socket. If we fail we
// will try as long as we do not run into a JSBridgeTimeout and
Expand Down
2 changes: 1 addition & 1 deletion mozmill/mozmill/extension/components/handlers.js
Expand Up @@ -61,7 +61,7 @@ var ConsoleObserver = {
errorRegEx : /\[.*(Error|Exception).*(chrome|resource):\/\/(mozmill|jsbridge).*/i,
externalFileRegEx : /.*\.js -> file:\/\/\/.*/,

observe: function (aSubject, aTopic, aData) {
observe: function CO_observe(aSubject, aTopic, aData) {
var msg = aSubject.message;

// If the message is not related to one of our extensions forget about it
Expand Down
8 changes: 4 additions & 4 deletions mozmill/mozmill/extension/content/test/test.js
Expand Up @@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */

var drop = function (event) {
function drop(event) {
var item = document.getElementById("item1");
item.parentNode.removeChild(item);
}

var dragStart = function (event) {
function dragStart(event) {
event.dataTransfer.setData("text/test-type", "test data");
}

var dragOver = function (event) {
function dragOver(event) {
event.preventDefault();
}

var dragEnter = function (event) {
function dragEnter(event) {
event.preventDefault();
}
114 changes: 58 additions & 56 deletions mozmill/mozmill/extension/resource/driver/controller.js

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions mozmill/mozmill/extension/resource/driver/elementslib.js
Expand Up @@ -20,7 +20,7 @@ var withs = {}; Cu.import('resource://mozmill/stdlib/withs.js', withs);
var dom = {}; Cu.import('resource://mozmill/stdlib/dom.js', dom);
var objects = {}; Cu.import('resource://mozmill/stdlib/objects.js', objects);

var countQuotes = function (str) {
function countQuotes(str) {
var count = 0;
var i = 0;

Expand All @@ -43,7 +43,7 @@ var countQuotes = function (str) {
* Takes a lookup string as input and returns
* a list of each node in the string
*/
var smartSplit = function (str) {
function smartSplit(str) {
// Ensure we have an even number of quotes
if (countQuotes(str) % 2 != 0) {
throw new Error ("Invalid Lookup Expression");
Expand Down Expand Up @@ -102,7 +102,7 @@ function nodeSearch(doc, func, string) {
var element = null;

//inline function to recursively find the element in the DOM, cross frame.
var search = function (win, func, string) {
function search(win, func, string) {
if (win == null) {
return;
}
Expand Down Expand Up @@ -180,7 +180,7 @@ function Link(_document, linkName) {
}

this.getNodeForDocument = function (linkName) {
var getText = function (el) {
function getText(el) {
var text = "";

if (el.nodeType == 3) { //textNode
Expand Down Expand Up @@ -291,7 +291,7 @@ function Name(_document, nName) {
};


var _returnResult = function (results) {
function _returnResult(results) {
if (results.length == 0) {
return null
}
Expand All @@ -302,7 +302,7 @@ var _returnResult = function (results) {
}
}

var _forChildren = function (element, name, value) {
function _forChildren(element, name, value) {
var results = [];
var nodes = [e for each (e in element.childNodes) if (e)]

Expand All @@ -316,7 +316,7 @@ var _forChildren = function (element, name, value) {
return results;
}

var _forAnonChildren = function (_document, element, name, value) {
function _forAnonChildren(_document, element, name, value) {
var results = [];
var nodes = [e for each (e in _document.getAnoymousNodes(element)) if (e)];

Expand All @@ -330,15 +330,15 @@ var _forAnonChildren = function (_document, element, name, value) {
return results;
}

var _byID = function (_document, parent, value) {
function _byID(_document, parent, value) {
return _returnResult(_forChildren(parent, 'id', value));
}

var _byName = function (_document, parent, value) {
function _byName(_document, parent, value) {
return _returnResult(_forChildren(parent, 'tagName', value));
}

var _byAttrib = function (parent, attributes) {
function _byAttrib(parent, attributes) {
var results = [];
var nodes = parent.childNodes;

Expand Down Expand Up @@ -366,7 +366,7 @@ var _byAttrib = function (parent, attributes) {
return _returnResult(results)
}

var _byAnonAttrib = function (_document, parent, attributes) {
function _byAnonAttrib(_document, parent, attributes) {
var results = [];

if (objects.getLength(attributes) == 1) {
Expand Down Expand Up @@ -410,23 +410,23 @@ var _byAnonAttrib = function (_document, parent, attributes) {
return _returnResult(results)
}

var _byIndex = function (_document, parent, i) {
function _byIndex(_document, parent, i) {
if (parent instanceof Array) {
return parent[i];
}

return parent.childNodes[i];
}

var _anonByName = function (_document, parent, value) {
function _anonByName(_document, parent, value) {
return _returnResult(_forAnonChildren(_document, parent, 'tagName', value));
}

var _anonByAttrib = function (_document, parent, value) {
function _anonByAttrib(_document, parent, value) {
return _byAnonAttrib(_document, parent, value);
}

var _anonByIndex = function (_document, parent, i) {
function _anonByIndex(_document, parent, i) {
return _document.getAnonymousNodes(parent)[i];
}

Expand Down Expand Up @@ -455,7 +455,7 @@ function Lookup(_document, expression) {
*
* @returns {Object} Node found by the given expression
*/
var reduceLookup = function (parentNode, exp) {
function reduceLookup(parentNode, exp) {
// Abort in case the parent node was not found
if (!parentNode) {
return false;
Expand Down

0 comments on commit 15c0dc9

Please sign in to comment.