Skip to content

Commit

Permalink
Adding support for plugins to provide user extensions that can handle…
Browse files Browse the repository at this point in the history
… webdriver playback. Fixes issue SeleniumHQ#5675
  • Loading branch information
samitbadle committed Sep 9, 2013
1 parent 755fee1 commit de2a1a7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ide/main/src/content/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function API() {
this.version = 0.6;
this.version = 0.7;
this.preferences = SeleniumIDE.Preferences;
this.id = null;
this.code = {
Expand Down Expand Up @@ -39,9 +39,10 @@ API.prototype.addPluginProvidedIdeExtension = function (url) {
*
* @param js_url - url to your bundled extension in the form of chrome://
* @param xml_url - url to your bundled companion xml in the form of chrome://
* @param canHandleWebdriverPlayback - true/false if the extension can handle Webdriver playback. Default false.
*/
API.prototype.addPluginProvidedUserExtension = function (js_url, xml_url) {
this.code.userExtensions.push(js_url + ';' + xml_url);
API.prototype.addPluginProvidedUserExtension = function (js_url, xml_url, canHandleWebdriverPlayback) {
this.code.userExtensions.push(js_url + ';' + xml_url + ';' + (canHandleWebdriverPlayback ? "1" : "0"));
this._save();
};

Expand Down
20 changes: 19 additions & 1 deletion ide/main/src/content/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ function Debugger(editor) {
for (var i = 0; i < plugin.code.length; i++) {
try {
var js_pluginProvided = plugin.code[i].split(";");
ExtensionsLoader.loadSubScript(subScriptLoader, js_pluginProvided[0], self.runner);
if (!(js_pluginProvided.length >= 2 && js_pluginProvided[2] == "1")) {
// Load the user extensions that cannot handle webdriver playback here
ExtensionsLoader.loadSubScript(subScriptLoader, js_pluginProvided[0], self.runner);
}
} catch (error) {
pluginManager.setPluginError(plugin.id, plugin.code[i], error);
break;
Expand All @@ -96,6 +99,21 @@ function Debugger(editor) {
subScriptLoader.loadSubScript('chrome://selenium-ide/content/deferred.js', this.runner);
subScriptLoader.loadSubScript('chrome://selenium-ide/content/webdriver-backed-selenium.js', this.runner);
}
pluginManager.getEnabledUserExtensions().forEach(function (plugin) {
for (var i = 0; i < plugin.code.length; i++) {
try {
var js_pluginProvided = plugin.code[i].split(";");
if (js_pluginProvided.length >= 2 && js_pluginProvided[2] == "1") {
// User extensions that can handle webdriver playback are loaded here, so that they can access webdriver
// playback stuff
ExtensionsLoader.loadSubScript(subScriptLoader, js_pluginProvided[0], self.runner);
}
} catch (error) {
pluginManager.setPluginError(plugin.id, plugin.code[i], error);
break;
}
}
});
subScriptLoader.loadSubScript('chrome://selenium-ide/content/selenium-runner.js', this.runner);

this.editor.infoPanel.logView.setLog(this.runner.LOG);
Expand Down

0 comments on commit de2a1a7

Please sign in to comment.