Skip to content

Commit eb8497d

Browse files
committed
Don't miss out some instances of Selenium IDE editors
1 parent 56f0670 commit eb8497d

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

ide/main/src/content/selenium-ide-loader.js

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,42 @@ SeleniumIDE.Loader.getTopEditor = function() {
3737

3838
SeleniumIDE.Loader.getEditors = function() {
3939
var editors = [];
40-
if (document) {
41-
var sidebarBox = document.getElementById('sidebar-box');
42-
if (sidebarBox && !sidebarBox.hidden) {
43-
var sidebar = document.getElementById('sidebar');
44-
try {
45-
if (sidebar && sidebar.contentDocument) {
46-
if ("chrome://selenium-ide/content/selenium-ide-sidebar.xul" == sidebar.contentDocument.documentURI) {
47-
var sidebarView = sidebar.contentDocument.defaultView;
48-
if (sidebarView && sidebarView.editor) {
49-
editors.push(sidebarView.editor);
50-
}
51-
}
52-
}
53-
} catch (error) {
54-
}
55-
}
40+
var editor = this.getSidebarEditor(document);
41+
if (editor) {
42+
editors.push(editor);
5643
}
5744
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
5845
var editorWindow = wm.getMostRecentWindow('global:selenium-ide');
5946
if (editorWindow && editorWindow.editor) {
6047
editors.push(editorWindow.editor);
6148
}
49+
var mainWindow = wm.getMostRecentWindow("navigator:browser");
50+
editor = this.getSidebarEditor(mainWindow.document);
51+
if (editor) {
52+
editors.push(editor);
53+
}
6254
return editors;
63-
}
55+
};
56+
57+
SeleniumIDE.Loader.getSidebarEditor = function(doc) {
58+
if (doc) {
59+
var sidebarBox = doc.getElementById('sidebar-box');
60+
if (sidebarBox && !sidebarBox.hidden) {
61+
var sidebar = doc.getElementById('sidebar');
62+
try {
63+
if (sidebar && sidebar.contentDocument) {
64+
if ("chrome://selenium-ide/content/selenium-ide-sidebar.xul" == sidebar.contentDocument.documentURI) {
65+
var sidebarView = sidebar.contentDocument.defaultView;
66+
if (sidebarView && sidebarView.editor) {
67+
return sidebarView.editor;
68+
}
69+
}
70+
}
71+
} catch (error) {
72+
}
73+
}
74+
}
75+
};
6476

6577
SeleniumIDE.Loader.reloadRecorder = function(contentWindow, isRootDocument) {
6678
var editors = this.getEditors();

0 commit comments

Comments
 (0)