selenium-webdriver 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. data/{common/src/rb/CHANGES → CHANGES} +13 -0
  2. data/{common/src/rb/README → README} +1 -1
  3. data/{common/src/rb/lib → lib}/selenium-webdriver.rb +0 -0
  4. data/{common/src/rb/lib → lib}/selenium/webdriver.rb +2 -1
  5. data/{common/src/rb/lib → lib}/selenium/webdriver/bridge_helper.rb +0 -0
  6. data/{common/src/rb/lib → lib}/selenium/webdriver/child_process.rb +0 -0
  7. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome.rb +0 -0
  8. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/bridge.rb +2 -2
  9. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/command_executor.rb +0 -0
  10. data/lib/selenium/webdriver/chrome/extension.zip +0 -0
  11. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/launcher.rb +26 -20
  12. data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/dir.rb +0 -0
  13. data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/string.rb +0 -0
  14. data/{common/src/rb/lib → lib}/selenium/webdriver/driver.rb +0 -0
  15. data/{common/src/rb/lib → lib}/selenium/webdriver/driver_extensions/takes_screenshot.rb +0 -0
  16. data/{common/src/rb/lib → lib}/selenium/webdriver/element.rb +0 -0
  17. data/{common/src/rb/lib → lib}/selenium/webdriver/error.rb +0 -0
  18. data/{common/src/rb/lib → lib}/selenium/webdriver/file_reaper.rb +2 -1
  19. data/{common/src/rb/lib → lib}/selenium/webdriver/find.rb +0 -0
  20. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox.rb +2 -1
  21. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/binary.rb +32 -6
  22. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/bridge.rb +0 -0
  23. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  24. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/launcher.rb +0 -0
  25. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  26. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  27. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profile.rb +37 -72
  28. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profiles_ini.rb +0 -0
  29. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/util.rb +0 -0
  30. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie.rb +2 -2
  31. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/bridge.rb +7 -2
  32. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/lib.rb +0 -0
  33. data/{jobbie/prebuilt/Win32/Release → lib/selenium/webdriver/ie/native/win32}/InternetExplorerDriver.dll +0 -0
  34. data/lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll +0 -0
  35. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/util.rb +0 -0
  36. data/{common/src/rb/lib → lib}/selenium/webdriver/keys.rb +0 -0
  37. data/{common/src/rb/lib → lib}/selenium/webdriver/navigation.rb +0 -0
  38. data/{common/src/rb/lib → lib}/selenium/webdriver/options.rb +0 -0
  39. data/{common/src/rb/lib → lib}/selenium/webdriver/platform.rb +5 -1
  40. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote.rb +0 -0
  41. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/bridge.rb +0 -0
  42. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/capabilities.rb +0 -0
  43. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/commands.rb +0 -0
  44. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/common.rb +0 -0
  45. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/curb.rb +0 -0
  46. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/default.rb +5 -1
  47. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/response.rb +0 -0
  48. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/server_error.rb +0 -0
  49. data/{common/src/rb/lib → lib}/selenium/webdriver/target_locator.rb +0 -0
  50. data/{common/src/rb/lib → lib}/selenium/webdriver/timeouts.rb +0 -0
  51. data/lib/selenium/webdriver/zip_helper.rb +30 -0
  52. metadata +73 -214
  53. data/COPYING +0 -204
  54. data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
  55. data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
  56. data/chrome/src/extension/background.html +0 -9
  57. data/chrome/src/extension/background.js +0 -1029
  58. data/chrome/src/extension/content_script.js +0 -1488
  59. data/chrome/src/extension/icons/busy.png +0 -0
  60. data/chrome/src/extension/icons/free.png +0 -0
  61. data/chrome/src/extension/manifest-nonwin.json +0 -19
  62. data/chrome/src/extension/manifest-win.json +0 -20
  63. data/chrome/src/extension/utils.js +0 -231
  64. data/common/src/js/abstractcommandprocessor.js +0 -132
  65. data/common/src/js/asserts.js +0 -296
  66. data/common/src/js/by.js +0 -149
  67. data/common/src/js/command.js +0 -380
  68. data/common/src/js/core/Blank.html +0 -7
  69. data/common/src/js/core/InjectedRemoteRunner.html +0 -8
  70. data/common/src/js/core/RemoteRunner.html +0 -101
  71. data/common/src/js/core/SeleniumLog.html +0 -109
  72. data/common/src/js/core/TestPrompt.html +0 -145
  73. data/common/src/js/core/TestRunner-splash.html +0 -55
  74. data/common/src/js/core/TestRunner.html +0 -165
  75. data/common/src/js/core/icons/all.png +0 -0
  76. data/common/src/js/core/icons/continue.png +0 -0
  77. data/common/src/js/core/icons/continue_disabled.png +0 -0
  78. data/common/src/js/core/icons/pause.png +0 -0
  79. data/common/src/js/core/icons/pause_disabled.png +0 -0
  80. data/common/src/js/core/icons/selected.png +0 -0
  81. data/common/src/js/core/icons/step.png +0 -0
  82. data/common/src/js/core/icons/step_disabled.png +0 -0
  83. data/common/src/js/core/lib/cssQuery/cssQuery-p.js +0 -6
  84. data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +0 -142
  85. data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +0 -150
  86. data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +0 -53
  87. data/common/src/js/core/lib/cssQuery/src/cssQuery.js +0 -356
  88. data/common/src/js/core/lib/prototype.js +0 -2006
  89. data/common/src/js/core/lib/scriptaculous/builder.js +0 -101
  90. data/common/src/js/core/lib/scriptaculous/controls.js +0 -815
  91. data/common/src/js/core/lib/scriptaculous/dragdrop.js +0 -915
  92. data/common/src/js/core/lib/scriptaculous/effects.js +0 -958
  93. data/common/src/js/core/lib/scriptaculous/scriptaculous.js +0 -47
  94. data/common/src/js/core/lib/scriptaculous/slider.js +0 -283
  95. data/common/src/js/core/lib/scriptaculous/unittest.js +0 -383
  96. data/common/src/js/core/lib/snapsie.js +0 -91
  97. data/common/src/js/core/scripts/find_matching_child.js +0 -69
  98. data/common/src/js/core/scripts/htmlutils.js +0 -8716
  99. data/common/src/js/core/scripts/injection.html +0 -72
  100. data/common/src/js/core/scripts/selenium-api.js +0 -3291
  101. data/common/src/js/core/scripts/selenium-browserbot.js +0 -2457
  102. data/common/src/js/core/scripts/selenium-browserdetect.js +0 -153
  103. data/common/src/js/core/scripts/selenium-commandhandlers.js +0 -379
  104. data/common/src/js/core/scripts/selenium-executionloop.js +0 -175
  105. data/common/src/js/core/scripts/selenium-logging.js +0 -148
  106. data/common/src/js/core/scripts/selenium-remoterunner.js +0 -695
  107. data/common/src/js/core/scripts/selenium-testrunner.js +0 -1362
  108. data/common/src/js/core/scripts/selenium-version.js +0 -5
  109. data/common/src/js/core/scripts/ui-doc.html +0 -808
  110. data/common/src/js/core/scripts/ui-element.js +0 -1644
  111. data/common/src/js/core/scripts/ui-map-sample.js +0 -979
  112. data/common/src/js/core/scripts/user-extensions.js +0 -3
  113. data/common/src/js/core/scripts/user-extensions.js.sample +0 -75
  114. data/common/src/js/core/scripts/xmlextras.js +0 -153
  115. data/common/src/js/core/selenium-logo.png +0 -0
  116. data/common/src/js/core/selenium-test.css +0 -43
  117. data/common/src/js/core/selenium.css +0 -316
  118. data/common/src/js/core/xpath/dom.js +0 -566
  119. data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +0 -2816
  120. data/common/src/js/core/xpath/util.js +0 -549
  121. data/common/src/js/core/xpath/xmltoken.js +0 -149
  122. data/common/src/js/core/xpath/xpath.js +0 -2481
  123. data/common/src/js/extension/README +0 -2
  124. data/common/src/js/extension/dommessenger.js +0 -152
  125. data/common/src/js/factory.js +0 -55
  126. data/common/src/js/future.js +0 -141
  127. data/common/src/js/jsunit.js +0 -40
  128. data/common/src/js/jsunit/app/css/jsUnitStyle.css +0 -50
  129. data/common/src/js/jsunit/app/css/readme +0 -10
  130. data/common/src/js/jsunit/app/emptyPage.html +0 -11
  131. data/common/src/js/jsunit/app/jsUnitCore.js +0 -534
  132. data/common/src/js/jsunit/app/jsUnitMockTimeout.js +0 -81
  133. data/common/src/js/jsunit/app/jsUnitTestManager.js +0 -705
  134. data/common/src/js/jsunit/app/jsUnitTestSuite.js +0 -44
  135. data/common/src/js/jsunit/app/jsUnitTracer.js +0 -102
  136. data/common/src/js/jsunit/app/jsUnitVersionCheck.js +0 -59
  137. data/common/src/js/jsunit/app/main-counts-errors.html +0 -12
  138. data/common/src/js/jsunit/app/main-counts-failures.html +0 -13
  139. data/common/src/js/jsunit/app/main-counts-runs.html +0 -13
  140. data/common/src/js/jsunit/app/main-counts.html +0 -21
  141. data/common/src/js/jsunit/app/main-data.html +0 -178
  142. data/common/src/js/jsunit/app/main-errors.html +0 -23
  143. data/common/src/js/jsunit/app/main-frame.html +0 -19
  144. data/common/src/js/jsunit/app/main-loader.html +0 -45
  145. data/common/src/js/jsunit/app/main-progress.html +0 -25
  146. data/common/src/js/jsunit/app/main-results.html +0 -67
  147. data/common/src/js/jsunit/app/main-status.html +0 -13
  148. data/common/src/js/jsunit/app/testContainer.html +0 -16
  149. data/common/src/js/jsunit/app/testContainerController.html +0 -77
  150. data/common/src/js/jsunit/app/xbDebug.js +0 -306
  151. data/common/src/js/jsunit/changelog.txt +0 -60
  152. data/common/src/js/jsunit/css/jsUnitStyle.css +0 -83
  153. data/common/src/js/jsunit/images/green.gif +0 -0
  154. data/common/src/js/jsunit/images/logo_jsunit.gif +0 -0
  155. data/common/src/js/jsunit/images/powerby-transparent.gif +0 -0
  156. data/common/src/js/jsunit/images/red.gif +0 -0
  157. data/common/src/js/jsunit/licenses/JDOM_license.txt +0 -56
  158. data/common/src/js/jsunit/licenses/Jetty_license.html +0 -213
  159. data/common/src/js/jsunit/licenses/MPL-1.1.txt +0 -470
  160. data/common/src/js/jsunit/licenses/gpl-2.txt +0 -340
  161. data/common/src/js/jsunit/licenses/index.html +0 -141
  162. data/common/src/js/jsunit/licenses/lgpl-2.1.txt +0 -504
  163. data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +0 -35
  164. data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +0 -35
  165. data/common/src/js/jsunit/readme.txt +0 -19
  166. data/common/src/js/jsunit/testRunner.html +0 -167
  167. data/common/src/js/jsunit/version.txt +0 -1
  168. data/common/src/js/key.js +0 -117
  169. data/common/src/js/localcommandprocessor.js +0 -171
  170. data/common/src/js/testcase.js +0 -219
  171. data/common/src/js/timing.js +0 -89
  172. data/common/src/js/webdriver.js +0 -860
  173. data/common/src/js/webelement.js +0 -483
  174. data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
  175. data/firefox/prebuilt/amd64/libnoblur64.so +0 -0
  176. data/firefox/prebuilt/i386/libnoblur.so +0 -0
  177. data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
  178. data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
  179. data/firefox/prebuilt/nsICommandProcessor.xpt +0 -0
  180. data/firefox/prebuilt/nsINativeEvents.xpt +0 -0
  181. data/firefox/prebuilt/nsIResponseHandler.xpt +0 -0
  182. data/firefox/src/extension/chrome.manifest +0 -3
  183. data/firefox/src/extension/components/badCertListener.js +0 -295
  184. data/firefox/src/extension/components/dispatcher.js +0 -495
  185. data/firefox/src/extension/components/driver-component.js +0 -130
  186. data/firefox/src/extension/components/errorcode.js +0 -70
  187. data/firefox/src/extension/components/firefoxDriver.js +0 -831
  188. data/firefox/src/extension/components/json2.js +0 -273
  189. data/firefox/src/extension/components/keytest.html +0 -554
  190. data/firefox/src/extension/components/nsCommandProcessor.js +0 -684
  191. data/firefox/src/extension/components/promptService.js +0 -208
  192. data/firefox/src/extension/components/request.js +0 -219
  193. data/firefox/src/extension/components/response.js +0 -276
  194. data/firefox/src/extension/components/screenshooter.js +0 -81
  195. data/firefox/src/extension/components/session.js +0 -314
  196. data/firefox/src/extension/components/sessionstore.js +0 -226
  197. data/firefox/src/extension/components/socketListener.js +0 -435
  198. data/firefox/src/extension/components/utils.js +0 -1335
  199. data/firefox/src/extension/components/webLoadingListener.js +0 -57
  200. data/firefox/src/extension/components/webdriverserver.js +0 -110
  201. data/firefox/src/extension/components/wrappedElement.js +0 -706
  202. data/firefox/src/extension/content/fxdriver.xul +0 -30
  203. data/firefox/src/extension/content/server.js +0 -95
  204. data/firefox/src/extension/idl/nsICommandProcessor.idl +0 -38
  205. data/firefox/src/extension/idl/nsIResponseHandler.idl +0 -34
  206. data/firefox/src/extension/install.rdf +0 -29
  207. data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
@@ -1,208 +0,0 @@
1
- // Spoof the prompt service. Interesting thread on mozillazine:
2
- // http://www.mail-archive.com/dev-tech-xpcom@lists.mozilla.org/msg00193.html
3
-
4
- const CC = Components.classes;
5
- const CI = Components.interfaces;
6
-
7
- const CONSOLE = CC["@mozilla.org/consoleservice;1"].getService(CI["nsIConsoleService"]);
8
-
9
- function dumpn(message) {
10
- try {
11
- CONSOLE.logStringMessage(message + "\n");
12
- } catch (e) {
13
- dump(message + "\n");
14
- }
15
- }
16
-
17
- // Spoof implementation
18
- function DrivenPromptService() {
19
- // as defined in nsPromptService.h
20
- var ORIGINAL_PARENT_SERVICE_ID = "{A2112D6A-0E28-421f-B46A-25C0B308CBD0}";
21
-
22
- // Keep a reference to the original service
23
- var originalService = Components.classesByID[ORIGINAL_PARENT_SERVICE_ID].getService();
24
-
25
- this.originalPromptService_ =
26
- originalService.QueryInterface(Components.interfaces.nsIPromptService);
27
-
28
- dumpn("Spoofing prompt service");
29
- }
30
-
31
- // Constants from nsIPromtService.idl
32
- DrivenPromptService.prototype = {
33
- BUTTON_POS_0: 1,
34
- BUTTON_POS_1: 256,
35
- BUTTON_POS_2: 65536,
36
-
37
- // Button Title Flags (used to set the labels of buttons in the prompt)
38
- BUTTON_TITLE_OK: 1,
39
- BUTTON_TITLE_CANCEL: 2,
40
- BUTTON_TITLE_YES: 3,
41
- BUTTON_TITLE_NO: 4,
42
- BUTTON_TITLE_SAVE: 5,
43
- BUTTON_TITLE_DONT_SAVE: 6,
44
- BUTTON_TITLE_REVERT: 7,
45
- BUTTON_TITLE_IS_STRING: 127,
46
-
47
- // Button Default Flags (used to select which button is the default one)
48
- BUTTON_POS_0_DEFAULT: 0,
49
- BUTTON_POS_1_DEFAULT: 16777216,
50
- BUTTON_POS_2_DEFAULT: 33554432,
51
-
52
- // Causes the buttons to be initially disabled. They are enabled after a
53
- // timeout expires. The implementation may interpret this loosely as the
54
- // intent is to ensure that the user does not click through a security dialog
55
- // too quickly. Strictly speaking, the implementation could choose to ignore
56
- // this flag.
57
- BUTTON_DELAY_ENABLE: 67108864,
58
-
59
- // Selects the standard set of OK/Cancel buttons.
60
- STD_OK_CANCEL_BUTTONS: (this.BUTTON_TITLE_OK * this.BUTTON_POS_0) + (this.BUTTON_TITLE_CANCEL
61
- * this.BUTTON_POS_1),
62
-
63
- // Selects the standard set of Yes/No buttons.
64
- STD_YES_NO_BUTTONS: (this.BUTTON_TITLE_YES * this.BUTTON_POS_0) + (this.BUTTON_TITLE_NO
65
- * this.BUTTON_POS_1)
66
- };
67
-
68
- DrivenPromptService.prototype.findAssociatedDriver_ = function(window) {
69
- var ww = CC["@mozilla.org/embedcomp/window-watcher;1"].getService(CI["nsIWindowWatcher"]);
70
-
71
- // There might be an easy answer.
72
- var win = ww.getChromeForWindow(window);
73
- if (win) {
74
- return win;
75
- }
76
-
77
- // There isn't. Grab the top window's default view
78
- var parent = window ? window : ww.activeWindow;
79
- if (parent.wrappedJSObject)
80
- parent = parent.wrappedJSObject;
81
- var top = parent.top;
82
-
83
- // Now iterate over all open browsers to find the one we belong to
84
- var wm = CC["@mozilla.org/appshell/window-mediator;1"].getService(CI["nsIWindowMediator"]);
85
- var allWindows = wm.getEnumerator("navigator:browser");
86
- while (allWindows.hasMoreElements()) {
87
- var chrome = allWindows.getNext().QueryInterface(CI.nsIDOMWindow);
88
- if (chrome.content == window) {
89
- return chrome.fxdriver;
90
- }
91
- }
92
-
93
- // There's no meaningful way we can reach this.
94
- return undefined;
95
- };
96
-
97
- DrivenPromptService.prototype.alert = function(aParent, aDialogTitle, aText) {
98
- // Try to grab the top level window
99
- var driver = this.findAssociatedDriver_(aParent);
100
-
101
- if (driver && driver.response_) {
102
- var res = driver.response_;
103
- res.value = {
104
- title: aDialogTitle,
105
- text: aText,
106
- __webdriverType: 'alert'
107
- };
108
- res.send();
109
- } else {
110
- // TODO(simon): we should prevent the next command from blocking.
111
- }
112
-
113
- return this.originalPromptService_.alert(aParent, aDialogTitle, aText);
114
- };
115
-
116
- DrivenPromptService.prototype.alertCheck =
117
- function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
118
- return this.originalPromptService_.alertCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState);
119
- };
120
-
121
- DrivenPromptService.prototype.confirm = function(aParent, aDialogTitle, aText) {
122
- return this.originalPromptService_.confirm(aParent, aDialogTitle, aText);
123
- };
124
-
125
- DrivenPromptService.prototype.confirmCheck =
126
- function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
127
- return this.originalPromptService_.confirmCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState);
128
- };
129
-
130
- DrivenPromptService.prototype.confirmEx =
131
- function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
132
- return this.originalPromptService_.confirmEx(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState);
133
- };
134
-
135
- DrivenPromptService.prototype.prompt =
136
- function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
137
- return this.originalPromptService_.prompt(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState);
138
- };
139
-
140
- DrivenPromptService.prototype.promptUsernameAndPassword =
141
- function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
142
- return this.originalPromptService_.promptUsernameAndPassword(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState);
143
- };
144
-
145
- DrivenPromptService.prototype.promptPassword =
146
- function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
147
- return this.originalPromptService_.promptPassword(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState);
148
- };
149
-
150
- DrivenPromptService.prototype.select =
151
- function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
152
- return this.originalPromptService_.select(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection);
153
- };
154
-
155
- const PROMPT_CONTRACT_ID = "@mozilla.org/embedcomp/prompt-service;1";
156
- const DRIVEN_PROMPT_SERVICE_CLASS_ID = Components.ID('{e26dbdcd-d3ba-4ded-88c3-6cb07ee3e9e0}');
157
-
158
- var service = undefined;
159
-
160
- var PromptServiceSpoofFactory = {
161
- createInstance: function (aOuter, aIID) {
162
- if (aOuter != null)
163
- throw Components.results.NS_ERROR_NO_AGGREGATION;
164
- if (service == undefined) {
165
- service = new DrivenPromptService();
166
- }
167
- return service;
168
- }
169
- };
170
-
171
- function PromptServiceSpoofModule() {
172
- this.firstTime_ = true;
173
- }
174
-
175
- PromptServiceSpoofModule.prototype.registerSelf = function(aCompMgr, aFileSpec, aLocation, aType) {
176
- if (this.firstTime_) {
177
- this.firstTime_ = false;
178
- throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
179
- }
180
- aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
181
- aCompMgr.registerFactoryLocation(
182
- DRIVEN_PROMPT_SERVICE_CLASS_ID, "Driven prompt service", PROMPT_CONTRACT_ID, aFileSpec, aLocation, aType);
183
- };
184
-
185
- PromptServiceSpoofModule.prototype.unregisterSelf = function(aCompMgr, aLocation, aType) {
186
- dumpn("Unregistering\n");
187
- aCompMgr =
188
- aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
189
- aCompMgr.unregisterFactoryLocation(DRIVEN_PROMPT_SERVICE_CLASS_ID, aLocation);
190
- };
191
-
192
- PromptServiceSpoofModule.prototype.getClassObject = function(aCompMgr, aCID, aIID) {
193
- if (!aIID.equals(Components.interfaces.nsIFactory))
194
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
195
-
196
- if (aCID.equals(DRIVEN_PROMPT_SERVICE_CLASS_ID))
197
- return PromptServiceSpoofFactory;
198
-
199
- throw Components.results.NS_ERROR_NO_INTERFACE;
200
- };
201
-
202
- PromptServiceSpoofModule.prototype.canUnload = function(aCompMgr) {
203
- return true;
204
- };
205
-
206
- function NSGetModule(comMgr, fileSpec) {
207
- return new PromptServiceSpoofModule();
208
- }
@@ -1,219 +0,0 @@
1
- /*
2
- Copyright 2007-2010 WebDriver committers
3
- Copyright 2007-2010 Google Inc.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * Encapsulates information describing an HTTP request.
20
- * @param {Request.Method} method The HTTP method used to make the request.
21
- * @param {nsIURL} requestUrl URL for the requested resource.
22
- * @param {Object} headers Map of request headers;.
23
- * @param {?string} body The request body, or null, if the request method does
24
- * not permit a message body.
25
- * @constructor
26
- */
27
- function Request(method, requestUrl, headers, body) {
28
-
29
- /**
30
- * A wrapped self-reference for XPConnect.
31
- * @type {Request}
32
- */
33
- this.wrappedJSObject = this;
34
-
35
- /**
36
- * The HTTP method used to make the request.
37
- * @type {Request.Method}
38
- * @private
39
- */
40
- this.method_ = method;
41
-
42
-
43
- /**
44
- * URL for the requested resource.
45
- * @type {?nsIURL}
46
- * @private
47
- */
48
- this.requestUrl_ = requestUrl;
49
-
50
- /**
51
- * The request path, minus the segments mapped to the servlet.
52
- * @type {?string}
53
- * @private
54
- */
55
- this.pathInfo_ = this.requestUrl_.path;
56
-
57
- /**
58
- * Map of request headers. All header names are specified as lowercase
59
- * strings.
60
- * @type {Object}
61
- * @private
62
- */
63
- this.headers_ = {};
64
- for (var name in headers) {
65
- this.headers_[name] = headers[name]
66
- }
67
-
68
- /**
69
- * The request body, if there was one.
70
- * @type {?string}
71
- * @private
72
- */
73
- this.body_ = body;
74
-
75
- /**
76
- * Map of custom request attributes.
77
- * @type {Object}
78
- * @private
79
- */
80
- this.attributes_ = {};
81
- }
82
-
83
-
84
- /**
85
- * The set of valid HTTP methods.
86
- * @enum {string}
87
- */
88
- Request.Method = {
89
- 'DELETE': 'DELETE',
90
- 'GET': 'GET',
91
- 'HEAD': 'HEAD',
92
- 'OPTIONS': 'OPTIONS',
93
- 'POST': 'POST',
94
- 'PUT': 'PUT',
95
- 'TRACE': 'TRACE'
96
- };
97
-
98
-
99
- /**
100
- * Path to the servlet servicing this request.
101
- * @type {string}
102
- * @private
103
- */
104
- Request.prototype.servletPath_ = '/';
105
-
106
-
107
- /** @return {Request.Method} The HTTP method used to make the request. */
108
- Request.prototype.getMethod = function() {
109
- return this.method_;
110
- };
111
-
112
-
113
- /** @return {?nsIURL} The full request URL. */
114
- Request.prototype.getRequestUrl = function() {
115
- return this.requestUrl_;
116
- };
117
-
118
-
119
- /**
120
- * Retrieves the named header value.
121
- * @param {string} name The name of the header to lookup.
122
- * @return {string} The header value, if it was included in this request.
123
- */
124
- Request.prototype.getHeader = function(name) {
125
- return this.headers_[name.toLowerCase()];
126
- };
127
-
128
-
129
- /**
130
- * Sets the servlet path for this request; that is the path prefix that is
131
- * mapped to the receiving servlet. The remainder of the path, excluding query
132
- * and param data, is available via Request.getPathInfo().
133
- * @param {string} servletPath The receiving servlet's path.
134
- */
135
- Request.prototype.setServletPath = function(servletPath) {
136
- if (servletPath[0] != '/') {
137
- servletPath = '/' + servletPath;
138
- }
139
- var length = servletPath.length;
140
- if (length > 1 && servletPath[length - 1] == '/') {
141
- servletPath = servletPath.substring(0, length - 1);
142
- }
143
-
144
- this.servletPath_ = servletPath;
145
- this.pathInfo_ = this.requestUrl_.path;
146
- if (this.servletPath_ != '/') {
147
- this.pathInfo_ = this.pathInfo_.substring(this.servletPath_.length);
148
- }
149
-
150
- if (this.pathInfo_.length > 1 &&
151
- this.pathInfo_.charAt(this.pathInfo_.length - 1) == '/') {
152
- this.pathInfo_ = this.pathInfo_.substring(0, this.pathInfo_.length - 1);
153
- }
154
- };
155
-
156
-
157
- /** @return {string} The servlet path for this request. */
158
- Request.prototype.getServletPath = function() {
159
- return this.servletPath_;
160
- };
161
-
162
-
163
- /** @return {string} The path info for this request. */
164
- Request.prototype.getPathInfo = function() {
165
- return this.pathInfo_;
166
- };
167
-
168
-
169
- /** @return {?string} The request body if there was one. */
170
- Request.prototype.getBody = function() {
171
- return this.body_;
172
- };
173
-
174
-
175
- /** @return {string} The value of the named attribute if it exists. */
176
- Request.prototype.getAttribute = function(name) {
177
- return this.attributes_[name];
178
- };
179
-
180
-
181
- /** @return {Array.<string>} A list of names for all set attributes. */
182
- Request.prototype.getAttributeNames = function() {
183
- var names = [];
184
- for (var name in this.attributes_) {
185
- names.push(name);
186
- }
187
- return names;
188
- };
189
-
190
-
191
- /**
192
- * Sets an attribute on this request, replacing any previously set attribute
193
- * value.
194
- * @param {string} name The name of the attribute, or null to delete it.
195
- * @param {*} value The attribute value.
196
- */
197
- Request.prototype.setAttribute = function(name, value) {
198
- if (value === null || value === undefined) {
199
- delete this.attributes_[name];
200
- } else {
201
- this.attributes_[name] = value;
202
- }
203
- };
204
-
205
-
206
- /**
207
- * @return {string} This request as a string for debugging.
208
- */
209
- Request.prototype.toDebugString = function() {
210
- var message = this.method_ + ' ' + this.requestUrl_.path + ' HTTP/1.1\r\n';
211
- for (var name in this.headers_) {
212
- message += name + ':' + this.headers_[name] + '\r\n';
213
- }
214
- message += '\r\n';
215
- if (this.body_) {
216
- message += this.body_;
217
- }
218
- return message;
219
- };
@@ -1,276 +0,0 @@
1
- /*
2
- Copyright 2007-2010 WebDriver committers
3
- Copyright 2007-2010 Google Inc.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * Encapsulates the information for a HTTP response.
20
- * @param {?Request} request The request this is a response to. May be null if
21
- * this response is to a malformed request that could not be fully parsed.
22
- * @param {nsIOutputStream} outputStream The stream to write responses to.
23
- * @constructor
24
- */
25
- function Response(request, outputStream) {
26
-
27
- /**
28
- * The request this is a response to.
29
- * @type {?Request}
30
- * @private
31
- */
32
- this.request_ = request;
33
-
34
- /**
35
- * The stream to write responses to.
36
- * @type {nsIOutputStream}
37
- * @private
38
- */
39
- this.outputStream_ = outputStream;
40
-
41
- /**
42
- * The headers for this response.
43
- * @type {Object}
44
- * @private
45
- */
46
- this.headers_ = {};
47
-
48
- /**
49
- * This response's message body.
50
- * @type {string}
51
- * @private
52
- */
53
- this.body_ = '';
54
- }
55
-
56
-
57
- Response.CONTINUE = 100;
58
- Response.OK = 200;
59
- Response.NO_CONTENT = 204;
60
- Response.SEE_OTHER = 303;
61
- Response.BAD_REQUEST = 400;
62
- Response.NOT_FOUND = 404;
63
- Response.METHOD_NOT_ALLOWED = 405;
64
- Response.LENGTH_REQUIRED = 411;
65
- Response.INTERNAL_ERROR = 500;
66
- Response.NOT_IMPLEMENTED = 501;
67
- Response.HTTP_VERSION_NOT_SUPPORTED = 505;
68
-
69
- Response.TEXT_PLAIN = 'text/plain';
70
- Response.TEXT_HTML = 'text/html';
71
- Response.APPLICATION_JSON = 'application/json';
72
-
73
-
74
- /**
75
- * Internal map of supported status messages.
76
- * @enum {string}
77
- */
78
- Response.StatusMessage_ = {
79
- 100: 'Continue',
80
- 200: 'OK',
81
- 204: 'No Content',
82
- 303: 'See Other',
83
- 400: 'Bad Request',
84
- 404: 'Not Found',
85
- 405: 'Method Not Allowed',
86
- 411: 'Length Required',
87
- 500: 'Internal Server Error',
88
- 501: 'Not Implemented',
89
- 505: 'HTTP Version Not Supported'
90
- };
91
-
92
-
93
- /**
94
- * Constant for carriage return line feed.
95
- * @type {string}
96
- * @const
97
- */
98
- Response.CRLF = '\r\n';
99
-
100
-
101
- /**
102
- * Whether this response has been committed. Each response may only be
103
- * committed once.
104
- * @type {boolean}
105
- * @private
106
- */
107
- Response.prototype.committed_ = false;
108
-
109
-
110
- /**
111
- * This response's HTTP stauts code.
112
- * @type {number}
113
- * @private
114
- */
115
- Response.prototype.status_ = Response.OK;
116
-
117
-
118
- /** @return {number} The current HTTP response status code. */
119
- Response.prototype.getStatus = function() {
120
- return this.status_;
121
- };
122
-
123
-
124
- /**
125
- * Set this response's HTTP status code.
126
- */
127
- Response.prototype.setStatus = function(status) {
128
- this.status_ = status;
129
- };
130
-
131
-
132
- /**
133
- * Sets the value of a header field.
134
- * @param {string} name The name of the header.
135
- * @param {?string} value The header value, or null to delete the field.
136
- */
137
- Response.prototype.setHeader = function(name, value) {
138
- if (value == null) {
139
- delete this.headers_[name];
140
- } else {
141
- this.headers_[name] = value;
142
- }
143
- };
144
-
145
-
146
- /**
147
- * Sets the value of this response's Content-Type header. Responses are always
148
- * sent as UTF-8, so the content type value need not specify a charset.
149
- * @param {string} The new content type.
150
- */
151
- Response.prototype.setContentType = function(type) {
152
- this.setHeader('Content-Type', type + '; charset=UTF-8');
153
- };
154
-
155
-
156
- /**
157
- * @param {string} name The name of the header to get.
158
- * @return {string} The value of the named header if it has been specified.
159
- */
160
- Response.prototype.getHeader = function(name) {
161
- return this.headers_[name];
162
- };
163
-
164
-
165
- /**
166
- * Sets this response's message body, overwriting any previously saved content.
167
- * The message body will be converted to UTF-8 before the response is committed.
168
- * @param {string} body The new message body.
169
- * @see Response.prototype.commit
170
- */
171
- Response.prototype.setBody = function(body) {
172
- this.body_ = body.toString();
173
- };
174
-
175
-
176
- /** @return {string} The response message body. */
177
- Response.prototype.getBody = function() {
178
- return this.body_;
179
- };
180
-
181
-
182
- /**
183
- * Convenience function for sending a 303 redirect.
184
- * @param {string} location The location to redirect to.
185
- */
186
- Response.prototype.sendRedirect = function(location) {
187
- this.setStatus(Response.SEE_OTHER);
188
- this.setHeader('Location', location);
189
- this.commit();
190
- };
191
-
192
-
193
- /**
194
- * Convenience function for sending an error message.
195
- * @param {number} code The HTTP status code to use. Must be either a 4xx or
196
- * 5xx value.
197
- * @param {string} opt_message An optional error message to include.
198
- * @param {string} opt_contentType An optional content type to send with the
199
- * error response.
200
- */
201
- Response.prototype.sendError = function(code, opt_message, opt_contentType) {
202
- this.setStatus(code);
203
- this.setBody(opt_message || '');
204
- if (opt_contentType) {
205
- this.setContentType(opt_contentType);
206
- }
207
- this.commit();
208
- };
209
-
210
-
211
- /**
212
- * Commits this response. This function is a no-op if the response has already
213
- * been committed.
214
- */
215
- Response.prototype.commit = function() {
216
- if (this.committed_) {
217
- var info = ['Response already committed'];
218
- if (this.request_) {
219
- info.push('request: ' + this.request_.getMethod() + ' ' +
220
- this.request_.getRequestUrl().path);
221
- info.push(' ' + this.request_.getBody())
222
- }
223
- info.push('response: ' + this.status_ + ' ' +
224
- Response.StatusMessage_[this.status_]);
225
- info.push(' ' + this.body_);
226
- Components.utils.reportError(info.join('\n '));
227
- return;
228
- }
229
-
230
- var statusCanHaveBody = (this.status_ < 100 || this.status_ > 199) &&
231
- this.status_ != 204 && this.status_ != 304;
232
-
233
- var converter = Components.
234
- classes['@mozilla.org/intl/scriptableunicodeconverter'].
235
- createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
236
- converter.charset = 'UTF-8';
237
-
238
- var bytes = converter.convertToByteArray(this.body_, {});
239
-
240
- var statusLine = 'HTTP/1.1 ' + this.status_ + ' ' +
241
- Response.StatusMessage_[this.status_] + Response.CRLF;
242
-
243
- this.setHeader('Date', new Date().toUTCString());
244
- if (this.status_ < 100 || this.status_ > 199) {
245
- this.setHeader('Connection', 'close');
246
- }
247
- if (statusCanHaveBody) {
248
- this.setHeader('Content-Length', bytes.length);
249
- }
250
-
251
- var headers = '';
252
- for (var name in this.headers_) {
253
- headers += name + ': ' + this.headers_[name] + Response.CRLF;
254
- }
255
-
256
- // Send the status line and headers.
257
- var toSend = statusLine + headers + Response.CRLF;
258
- this.outputStream_.write(toSend, toSend.length);
259
-
260
- // If necessary, send the body.
261
- if (statusCanHaveBody &&
262
- ((this.status_ > 399 && this.status_ < 600) ||
263
- (this.request_.getMethod() != Request.Method.HEAD))) {
264
- var byteStream = converter.convertToInputStream(this.body_);
265
- this.outputStream_.writeFrom(byteStream, bytes.length);
266
- }
267
-
268
- // Finish things up: flush and close the stream; don't close the stream if
269
- // this is a 1xx response as there should be a final response sent (in another
270
- // instance using the same stream).
271
- this.outputStream_.flush();
272
- if (this.status_ < 100 || this.status_ > 199) {
273
- this.outputStream_.close();
274
- }
275
- this.committed_ = true;
276
- };