Skip to content

Commit

Permalink
Reformat code, no other change
Browse files Browse the repository at this point in the history
  • Loading branch information
samitbadle committed Apr 18, 2015
1 parent 95e59b0 commit 429a2d9
Showing 1 changed file with 41 additions and 38 deletions.
79 changes: 41 additions & 38 deletions ide/main/src/content/selenium-ide-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,53 @@
// functions to call IDE from browser window.
//

if (!this.SeleniumIDE) this.SeleniumIDE = {};
if (!this.SeleniumIDE) {
this.SeleniumIDE = {};
}

SeleniumIDE.Loader = {};

SeleniumIDE.Loader.openRecorder = function() {
toOpenWindowByType('global:selenium-ide','chrome://selenium-ide/content/selenium-ide.xul');
}
SeleniumIDE.Loader.openRecorder = function () {
toOpenWindowByType('global:selenium-ide', 'chrome://selenium-ide/content/selenium-ide.xul');
};

SeleniumIDE.Loader.getTopEditor = function() {
var editors = this.getEditors();
if (editors.length > 0) {
return editors[0];
} else {
return null;
}
}
SeleniumIDE.Loader.getTopEditor = function () {
var editors = this.getEditors();
if (editors.length > 0) {
return editors[0];
} else {
return null;
}
};

SeleniumIDE.Loader.getEditors = function() {
var editors = [];
SeleniumIDE.Loader.getEditors = function () {
var editors = [];
var editor = this.getSidebarEditor(document);
if (editor) {
if (editor) {
editors.push(editor);
}
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var editorWindow = wm.getMostRecentWindow('global:selenium-ide');
if (editorWindow && editorWindow.editor) {
editors.push(editorWindow.editor);
}
}
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var editorWindow = wm.getMostRecentWindow('global:selenium-ide');
if (editorWindow && editorWindow.editor) {
editors.push(editorWindow.editor);
}
var mainWindow = wm.getMostRecentWindow("navigator:browser");
editor = this.getSidebarEditor(mainWindow.document);
if (editor) {
editors.push(editor);
}
return editors;
return editors;
};

SeleniumIDE.Loader.getSidebarEditor = function(doc) {
SeleniumIDE.Loader.getSidebarEditor = function (doc) {
if (doc) {
var sidebarBox = doc.getElementById('sidebar-box');
if (sidebarBox && !sidebarBox.hidden) {
var sidebar = doc.getElementById('sidebar');
try {
if (sidebar && sidebar.contentDocument) {
if ("chrome://selenium-ide/content/selenium-ide-sidebar.xul" == sidebar.contentDocument.documentURI) {
if ("chrome://selenium-ide/content/selenium-ide-sidebar.xul"
== sidebar.contentDocument.documentURI) {
var sidebarView = sidebar.contentDocument.defaultView;
if (sidebarView && sidebarView.editor) {
return sidebarView.editor;
Expand All @@ -74,19 +77,19 @@ SeleniumIDE.Loader.getSidebarEditor = function(doc) {
}
};

SeleniumIDE.Loader.reloadRecorder = function(contentWindow, isRootDocument) {
var editors = this.getEditors();
for (var i = 0; i < editors.length; i++) {
editors[i].loadRecorderFor(contentWindow, isRootDocument);
}
}
SeleniumIDE.Loader.reloadRecorder = function (contentWindow, isRootDocument) {
var editors = this.getEditors();
for (var i = 0; i < editors.length; i++) {
editors[i].loadRecorderFor(contentWindow, isRootDocument);
}
};

SeleniumIDE.Loader.notifyUnload = function(doc) {
this.getEditors().forEach(function(editor) {
editor.onUnloadDocument(doc);
});
}
SeleniumIDE.Loader.notifyUnload = function (doc) {
this.getEditors().forEach(function (editor) {
editor.onUnloadDocument(doc);
});
};

SeleniumIDE.Loader.getRecorder = function(window) {
return window._Selenium_IDE_Recorder;
}
SeleniumIDE.Loader.getRecorder = function (window) {
return window._Selenium_IDE_Recorder;
};

0 comments on commit 429a2d9

Please sign in to comment.