selenium-webdriver 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.js +64 -48
- data/chrome/src/extension/content_script.js +253 -132
- data/chrome/src/extension/manifest-nonwin.json +1 -1
- data/chrome/src/extension/manifest-win.json +1 -1
- data/chrome/src/extension/utils.js +8 -8
- data/chrome/src/rb/lib/selenium/webdriver/chrome.rb +9 -0
- data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +38 -280
- data/chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb +119 -117
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +36 -26
- data/common/src/js/abstractcommandprocessor.js +9 -11
- data/common/src/js/command.js +159 -83
- data/common/src/js/core/RemoteRunner.html +2 -2
- data/common/src/js/core/TestRunner-splash.html +3 -3
- data/common/src/js/core/TestRunner.html +5 -17
- data/common/src/js/core/scripts/htmlutils.js +4208 -2506
- data/common/src/js/core/scripts/selenium-api.js +2 -2
- data/common/src/js/core/scripts/selenium-browserbot.js +66 -58
- data/common/src/js/core/scripts/selenium-version.js +1 -1
- data/common/src/js/localcommandprocessor.js +5 -19
- data/common/src/js/testcase.js +2 -0
- data/common/src/js/webdriver.js +63 -93
- data/common/src/js/webelement.js +40 -42
- data/common/src/rb/lib/selenium/webdriver.rb +23 -14
- data/common/src/rb/lib/selenium/webdriver/bridge_helper.rb +8 -35
- data/common/src/rb/lib/selenium/webdriver/child_process.rb +2 -0
- data/common/src/rb/lib/selenium/webdriver/core_ext/dir.rb +1 -0
- data/common/src/rb/lib/selenium/webdriver/core_ext/string.rb +5 -0
- data/common/src/rb/lib/selenium/webdriver/driver.rb +20 -15
- data/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb +7 -2
- data/common/src/rb/lib/selenium/webdriver/element.rb +11 -2
- data/common/src/rb/lib/selenium/webdriver/error.rb +9 -5
- data/common/src/rb/lib/selenium/webdriver/keys.rb +1 -2
- data/common/src/rb/lib/selenium/webdriver/navigation.rb +16 -0
- data/common/src/rb/lib/selenium/webdriver/options.rb +32 -0
- data/common/src/rb/lib/selenium/webdriver/platform.rb +17 -1
- data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
- data/firefox/src/extension/components/dispatcher.js +492 -0
- data/firefox/src/extension/components/driver-component.js +4 -1
- data/firefox/src/extension/components/errorcode.js +70 -0
- data/firefox/src/extension/components/firefoxDriver.js +173 -154
- data/firefox/src/extension/components/nsCommandProcessor.js +171 -132
- data/firefox/src/extension/components/promptService.js +5 -5
- data/firefox/src/extension/components/request.js +219 -0
- data/firefox/src/extension/components/response.js +276 -0
- data/firefox/src/extension/components/session.js +281 -0
- data/firefox/src/extension/components/sessionstore.js +226 -0
- data/firefox/src/extension/components/socketListener.js +350 -100
- data/firefox/src/extension/components/utils.js +166 -98
- data/firefox/src/extension/components/webdriverserver.js +9 -5
- data/firefox/src/extension/components/wrappedElement.js +189 -166
- data/firefox/src/extension/install.rdf +1 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +2 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +39 -33
- data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +7 -421
- data/firefox/src/rb/lib/selenium/webdriver/firefox/extension_connection.rb +7 -64
- data/firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb +2 -3
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +54 -10
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profiles_ini.rb +2 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/util.rb +6 -0
- data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie.rb +2 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie/bridge.rb +38 -13
- data/jobbie/src/rb/lib/selenium/webdriver/ie/lib.rb +9 -2
- data/jobbie/src/rb/lib/selenium/webdriver/ie/util.rb +5 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote.rb +2 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb +42 -38
- data/remote/client/src/rb/lib/selenium/webdriver/remote/commands.rb +56 -47
- data/remote/client/src/rb/lib/selenium/webdriver/remote/default_http_client.rb +26 -26
- data/remote/client/src/rb/lib/selenium/webdriver/remote/patron_http_client.rb +58 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote/response.rb +10 -12
- data/remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb +2 -17
- metadata +44 -23
- data/common/src/js/context.js +0 -58
- data/firefox/src/extension/components/context.js +0 -37
@@ -0,0 +1,281 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2007-2010 WebDriver committers
|
3
|
+
Copyright 2007-2010 Google Inc.
|
4
|
+
Portions copyright 2007 ThoughtWorks, Inc
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Logs a message to the console service.
|
21
|
+
* @param {string} message The message to log.
|
22
|
+
*/
|
23
|
+
function log(message) {
|
24
|
+
Components.classes['@mozilla.org/consoleservice;1'].
|
25
|
+
getService(Components.interfaces.nsIConsoleService).
|
26
|
+
logStringMessage(message);
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* An active FirefoxDriver session.
|
32
|
+
* @constructor
|
33
|
+
*/
|
34
|
+
function wdSession() {
|
35
|
+
/**
|
36
|
+
* A wrapped self-reference for XPConnect.
|
37
|
+
* @type {wdSession}
|
38
|
+
*/
|
39
|
+
this.wrappedJSObject = this;
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
/**
|
44
|
+
* This component's ID.
|
45
|
+
* @type {nsIJSID}
|
46
|
+
*/
|
47
|
+
wdSession.CLASS_ID = Components.ID('{e193dc71-5b1d-4fea-b4c2-ec71f4557f0f}');
|
48
|
+
|
49
|
+
|
50
|
+
/**
|
51
|
+
* This component's class name.
|
52
|
+
* @type {string}
|
53
|
+
*/
|
54
|
+
wdSession.CLASS_NAME = 'wdSession';
|
55
|
+
|
56
|
+
|
57
|
+
/**
|
58
|
+
* This component's contract ID.
|
59
|
+
* @type {string}
|
60
|
+
*/
|
61
|
+
wdSession.CONTRACT_ID = '@googlecode.com/webdriver/wdsession;1';
|
62
|
+
|
63
|
+
|
64
|
+
/**
|
65
|
+
* This session's ID.
|
66
|
+
* @type {?string}
|
67
|
+
* @private
|
68
|
+
*/
|
69
|
+
wdSession.prototype.id_ = null;
|
70
|
+
|
71
|
+
|
72
|
+
/**
|
73
|
+
* The main chrome window that this is session is currently focused on. All
|
74
|
+
* command's for this session will be directed at the current window, which
|
75
|
+
* may be inside a [I]FRAME, within this window.
|
76
|
+
* @type {?ChromeWindow}
|
77
|
+
* @private
|
78
|
+
*/
|
79
|
+
wdSession.prototype.chromeWindow_ = null;
|
80
|
+
|
81
|
+
|
82
|
+
/**
|
83
|
+
* The content window this session is currently focused on.
|
84
|
+
* @type {?nsIDOMWindow}
|
85
|
+
* @private
|
86
|
+
*/
|
87
|
+
wdSession.prototype.window_ = null;
|
88
|
+
|
89
|
+
|
90
|
+
/**
|
91
|
+
* The current user input speed setting for this session.
|
92
|
+
* @type {number}
|
93
|
+
* @private
|
94
|
+
*/
|
95
|
+
wdSession.prototype.inputSpeed_ = 1;
|
96
|
+
|
97
|
+
|
98
|
+
/** @see nsISupports.QueryInterface */
|
99
|
+
wdSession.prototype.QueryInterface = function(aIID) {
|
100
|
+
if (aIID.equals(Components.interfaces.nsISupports)) {
|
101
|
+
return this;
|
102
|
+
}
|
103
|
+
throw Components.results.NS_ERROR_NO_INTERFACE;
|
104
|
+
};
|
105
|
+
|
106
|
+
|
107
|
+
/** @return {?string} This session's ID. */
|
108
|
+
wdSession.prototype.getId = function() {
|
109
|
+
return this.id_;
|
110
|
+
};
|
111
|
+
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Sets this session's ID.
|
115
|
+
* @param {string} id The session ID.
|
116
|
+
*/
|
117
|
+
wdSession.prototype.setId = function(id) {
|
118
|
+
this.id_ = id;
|
119
|
+
};
|
120
|
+
|
121
|
+
|
122
|
+
/**
|
123
|
+
* @return {browser|tabbrowser} The browser object for this session's current
|
124
|
+
* window.
|
125
|
+
*/
|
126
|
+
wdSession.prototype.getBrowser = function() {
|
127
|
+
return this.chromeWindow_.getBrowser();
|
128
|
+
};
|
129
|
+
|
130
|
+
|
131
|
+
/** @return {?ChromeWindow} The chrome window for this session. */
|
132
|
+
wdSession.prototype.getChromeWindow = function() {
|
133
|
+
return this.chromeWindow_;
|
134
|
+
};
|
135
|
+
|
136
|
+
|
137
|
+
/** @return {?nsIDOMWindow} This session's current window. */
|
138
|
+
wdSession.prototype.getWindow = function() {
|
139
|
+
if (!this.window_.document) {
|
140
|
+
// Uh-oh, we lost our DOM! Try to recover by changing focus to the
|
141
|
+
// main content window.
|
142
|
+
this.setWindow(this.chromeWindow_.getBrowser().contentWindow);
|
143
|
+
}
|
144
|
+
return this.window_;
|
145
|
+
};
|
146
|
+
|
147
|
+
|
148
|
+
/** @return {nsIDOMDocument} This session's current document. */
|
149
|
+
wdSession.prototype.getDocument = function() {
|
150
|
+
return this.getWindow().document;
|
151
|
+
return this.window_.document;
|
152
|
+
};
|
153
|
+
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Set the chrome window for this session; will also set the current window to
|
157
|
+
* the main content window inside the chrome window.
|
158
|
+
* @param {ChromeWindow} win The new chrome window.
|
159
|
+
*/
|
160
|
+
wdSession.prototype.setChromeWindow = function(win) {
|
161
|
+
this.chromeWindow_ = win;
|
162
|
+
this.setWindow(win.getBrowser().contentWindow);
|
163
|
+
};
|
164
|
+
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Set this session's current window. If the selected window is a frameset,
|
168
|
+
* the current window will be adjusted to focus on the first frame.
|
169
|
+
* @param {nsIDOMWindow} win The new window.
|
170
|
+
*/
|
171
|
+
wdSession.prototype.setWindow = function(win) {
|
172
|
+
this.window_ = win;
|
173
|
+
var frames = this.window_.frames;
|
174
|
+
if (frames && frames.length && 'FRAME' == frames[0].frameElement.tagName) {
|
175
|
+
this.window_ = frames[0];
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
|
180
|
+
/**
|
181
|
+
* @return {number} The user input speed for this session.
|
182
|
+
*/
|
183
|
+
wdSession.prototype.getInputSpeed = function() {
|
184
|
+
return this.inputSpeed_;
|
185
|
+
};
|
186
|
+
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Sets the user input speed for this session.
|
190
|
+
* @param {number} speed The new input speed.
|
191
|
+
*/
|
192
|
+
wdSession.prototype.setInputSpeed = function(speed) {
|
193
|
+
this.inputSpeed_ = speed;
|
194
|
+
};
|
195
|
+
|
196
|
+
|
197
|
+
///////////////////////////////////////////////////////////////////
|
198
|
+
//
|
199
|
+
// nsIFactory functions
|
200
|
+
//
|
201
|
+
///////////////////////////////////////////////////////////////////
|
202
|
+
|
203
|
+
/** @constructor */
|
204
|
+
function wdSessionFactory() {
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
/** @see nsIFactory.createInstance */
|
209
|
+
wdSessionFactory.prototype.createInstance = function(aOuter, aIID) {
|
210
|
+
if (aOuter != null) {
|
211
|
+
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
212
|
+
}
|
213
|
+
return new wdSession().QueryInterface(aIID);
|
214
|
+
};
|
215
|
+
|
216
|
+
///////////////////////////////////////////////////////////////////
|
217
|
+
//
|
218
|
+
// nsIModule functions
|
219
|
+
//
|
220
|
+
///////////////////////////////////////////////////////////////////
|
221
|
+
|
222
|
+
/** @constructor */
|
223
|
+
function wdSessionModule() {
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Whether this module has already been registered.
|
229
|
+
* @type {!boolean}
|
230
|
+
* @private
|
231
|
+
*/
|
232
|
+
wdSessionModule.prototype.hasRegistered_ = false;
|
233
|
+
|
234
|
+
|
235
|
+
/** @see nsIModule.registerSelf */
|
236
|
+
wdSessionModule.prototype.registerSelf = function(aCompMgr, aFileSpec, aLocation, aType) {
|
237
|
+
if (this.hasRegistered_) {
|
238
|
+
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
239
|
+
}
|
240
|
+
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
241
|
+
registerFactoryLocation(
|
242
|
+
wdSession.CLASS_ID,
|
243
|
+
wdSession.CLASS_NAME,
|
244
|
+
wdSession.CONTRACT_ID,
|
245
|
+
aFileSpec, aLocation, aType);
|
246
|
+
this.hasRegistered_ = true;
|
247
|
+
};
|
248
|
+
|
249
|
+
|
250
|
+
/** @see nsIModule.unregisterSelf */
|
251
|
+
wdSessionModule.prototype.unregisterSelf = function(aCompMgr, aLocation) {
|
252
|
+
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
253
|
+
unregisterFactoryLocation(wdSession.CLASS_ID, aLocation);
|
254
|
+
};
|
255
|
+
|
256
|
+
|
257
|
+
/** @see nsIModule.getClassObject */
|
258
|
+
wdSessionModule.prototype.getClassObject = function(aCompMgr, aCID, aIID) {
|
259
|
+
if (!aIID.equals(Components.interfaces.nsIFactory)) {
|
260
|
+
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
261
|
+
} else if (!aCID.equals(wdSession.CLASS_ID)) {
|
262
|
+
throw Components.results.NS_ERROR_NO_INTERFACE;
|
263
|
+
}
|
264
|
+
return new wdSessionFactory();
|
265
|
+
};
|
266
|
+
|
267
|
+
|
268
|
+
/** @see nsIModule.canUnload */
|
269
|
+
wdSessionModule.prototype.canUnload = function() {
|
270
|
+
return true;
|
271
|
+
};
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Module initialization.
|
277
|
+
*/
|
278
|
+
function NSGetModule() {
|
279
|
+
return new wdSessionModule();
|
280
|
+
}
|
281
|
+
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2007-2010 WebDriver committers
|
3
|
+
Copyright 2007-2010 Google Inc.
|
4
|
+
Portions copyright 2007 ThoughtWorks, Inc
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Logs a message to the console service.
|
21
|
+
* @param {string} message The message to log.
|
22
|
+
*/
|
23
|
+
function log(message) {
|
24
|
+
Components.classes['@mozilla.org/consoleservice;1'].
|
25
|
+
getService(Components.interfaces.nsIConsoleService).
|
26
|
+
logStringMessage(message);
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Service that keeps track of all the active FirefoxDriver sessions.
|
32
|
+
* @constructor
|
33
|
+
*/
|
34
|
+
function wdSessionStoreService() {
|
35
|
+
|
36
|
+
/**
|
37
|
+
* A wrapped self-reference for XPConnect.
|
38
|
+
* @type {wdSessionStoreService}
|
39
|
+
*/
|
40
|
+
this.wrappedJSObject = this;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Map of active sessions.
|
44
|
+
* @type {Object}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
this.sessions_ = {};
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
/**
|
52
|
+
* This component's ID.
|
53
|
+
* @type {nsIJSID}
|
54
|
+
*/
|
55
|
+
wdSessionStoreService.CLASS_ID = Components.ID('{b54195d3-841e-47df-b709-edf1bc4c7166}');
|
56
|
+
|
57
|
+
|
58
|
+
/**
|
59
|
+
* This component's class name.
|
60
|
+
* @type {string}
|
61
|
+
*/
|
62
|
+
wdSessionStoreService.CLASS_NAME = 'wdSessionStoreService';
|
63
|
+
|
64
|
+
|
65
|
+
/**
|
66
|
+
* This component's contract ID.
|
67
|
+
* @type {string}
|
68
|
+
*/
|
69
|
+
wdSessionStoreService.CONTRACT_ID = '@googlecode.com/webdriver/wdsessionstoreservice;1';
|
70
|
+
|
71
|
+
|
72
|
+
/** @see nsISupports.QueryInterface */
|
73
|
+
wdSessionStoreService.prototype.QueryInterface = function(aIID) {
|
74
|
+
if (aIID.equals(Components.interfaces.nsISupports)) {
|
75
|
+
return this;
|
76
|
+
}
|
77
|
+
throw Components.results.NS_ERROR_NO_INTERFACE;
|
78
|
+
};
|
79
|
+
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @return {wdSession} A new WebDriver session.
|
83
|
+
*/
|
84
|
+
wdSessionStoreService.prototype.createSession = function() {
|
85
|
+
var id = Components.classes['@mozilla.org/uuid-generator;1'].
|
86
|
+
getService(Components.interfaces.nsIUUIDGenerator).
|
87
|
+
generateUUID().
|
88
|
+
toString();
|
89
|
+
id = id.substring(1, id.length - 1); // Remove enclosing {} characters
|
90
|
+
|
91
|
+
var session = Components.classes['@googlecode.com/webdriver/wdsession;1'].
|
92
|
+
createInstance(Components.interfaces.nsISupports);
|
93
|
+
|
94
|
+
// Ah, xpconnect...
|
95
|
+
session.wrappedJSObject.setId(id);
|
96
|
+
this.sessions_[id] = session;
|
97
|
+
return session;
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Deletes the specified session.
|
103
|
+
* @param {string} sessionId ID of the session to delete.
|
104
|
+
*/
|
105
|
+
wdSessionStoreService.prototype.deleteSession = function(sessionId) {
|
106
|
+
if (sessionId in this.sessions_) {
|
107
|
+
delete this.sessions_[sessionId];
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Retrieves the session with the given ID.
|
114
|
+
* @param {string} sessionId ID of the session to retrieve.
|
115
|
+
* @return {wdSession} The matching session.
|
116
|
+
* @throws NS_ERROR_NOT_AVAILABLE if the session does not exist.
|
117
|
+
*/
|
118
|
+
wdSessionStoreService.prototype.getSession = function(sessionId) {
|
119
|
+
if (sessionId in this.sessions_) {
|
120
|
+
var session = this.sessions_[sessionId].wrappedJSObject; // XPConnect
|
121
|
+
return this.sessions_[sessionId];
|
122
|
+
}
|
123
|
+
var sessions = [];
|
124
|
+
for (var session in this.sessions_) {
|
125
|
+
sessions.push(session);
|
126
|
+
}
|
127
|
+
throw Components.results.NS_ERROR_NOT_AVAILABLE;
|
128
|
+
};
|
129
|
+
|
130
|
+
|
131
|
+
///////////////////////////////////////////////////////////////////
|
132
|
+
//
|
133
|
+
// nsIFactory functions
|
134
|
+
//
|
135
|
+
///////////////////////////////////////////////////////////////////
|
136
|
+
|
137
|
+
/** @constructor */
|
138
|
+
function wdSessionStoreServiceFactory() {
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
/**
|
143
|
+
* The singleton instance for this component.
|
144
|
+
* @type {?wdSessionStoreService}
|
145
|
+
* @private
|
146
|
+
*/
|
147
|
+
wdSessionStoreServiceFactory.prototype.instance_ = null;
|
148
|
+
|
149
|
+
|
150
|
+
/** @see nsIFactory.createInstance */
|
151
|
+
wdSessionStoreServiceFactory.prototype.createInstance = function(aOuter, aIID) {
|
152
|
+
if (aOuter != null) {
|
153
|
+
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
154
|
+
}
|
155
|
+
if (!this.instance_) {
|
156
|
+
this.instance_ = new wdSessionStoreService();
|
157
|
+
}
|
158
|
+
return this.instance_.QueryInterface(aIID);
|
159
|
+
};
|
160
|
+
|
161
|
+
///////////////////////////////////////////////////////////////////
|
162
|
+
//
|
163
|
+
// nsIModule functions
|
164
|
+
//
|
165
|
+
///////////////////////////////////////////////////////////////////
|
166
|
+
|
167
|
+
/** @constructor */
|
168
|
+
function wdSessionStoreServiceModule() {
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Whether this module has already been registered.
|
174
|
+
* @type {!boolean}
|
175
|
+
* @private
|
176
|
+
*/
|
177
|
+
wdSessionStoreServiceModule.prototype.hasRegistered_ = false;
|
178
|
+
|
179
|
+
|
180
|
+
/** @see nsIModule.registerSelf */
|
181
|
+
wdSessionStoreServiceModule.prototype.registerSelf = function(aCompMgr, aFileSpec, aLocation, aType) {
|
182
|
+
if (this.hasRegistered_) {
|
183
|
+
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
184
|
+
}
|
185
|
+
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
186
|
+
registerFactoryLocation(
|
187
|
+
wdSessionStoreService.CLASS_ID,
|
188
|
+
wdSessionStoreService.CLASS_NAME,
|
189
|
+
wdSessionStoreService.CONTRACT_ID,
|
190
|
+
aFileSpec, aLocation, aType);
|
191
|
+
this.hasRegistered_ = true;
|
192
|
+
};
|
193
|
+
|
194
|
+
|
195
|
+
/** @see nsIModule.unregisterSelf */
|
196
|
+
wdSessionStoreServiceModule.prototype.unregisterSelf = function(aCompMgr, aLocation) {
|
197
|
+
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
198
|
+
unregisterFactoryLocation(wdSessionStoreService.CLASS_ID, aLocation);
|
199
|
+
};
|
200
|
+
|
201
|
+
|
202
|
+
/** @see nsIModule.getClassObject */
|
203
|
+
wdSessionStoreServiceModule.prototype.getClassObject = function(aCompMgr, aCID, aIID) {
|
204
|
+
if (!aIID.equals(Components.interfaces.nsIFactory)) {
|
205
|
+
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
206
|
+
} else if (!aCID.equals(wdSessionStoreService.CLASS_ID)) {
|
207
|
+
throw Components.results.NS_ERROR_NO_INTERFACE;
|
208
|
+
}
|
209
|
+
return new wdSessionStoreServiceFactory();
|
210
|
+
};
|
211
|
+
|
212
|
+
|
213
|
+
/** @see nsIModule.canUnload */
|
214
|
+
wdSessionStoreServiceModule.prototype.canUnload = function() {
|
215
|
+
return true;
|
216
|
+
};
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Module initialization.
|
222
|
+
*/
|
223
|
+
function NSGetModule() {
|
224
|
+
return new wdSessionStoreServiceModule();
|
225
|
+
}
|
226
|
+
|