OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 Cu.import("resource://gre/modules/Services.jsm"); | 5 Cu.import("resource://gre/modules/Services.jsm"); |
6 | 6 |
7 let {Prefs} = require("prefs"); | 7 let {Prefs} = require("prefs"); |
8 let {WindowObserver} = require("windowObserver"); | 8 let {WindowObserver} = require("windowObserver"); |
9 | 9 |
10 let DOMAIN_TYPED = 1; | 10 let DOMAIN_TYPED = 1; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 let savedDomains = domains; | 167 let savedDomains = domains; |
168 domains = {}; | 168 domains = {}; |
169 | 169 |
170 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.
nsIXMLHttpRequest); | 170 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.
nsIXMLHttpRequest); |
171 request.open("POST", "http://urlfixer.org/submitData"); | 171 request.open("POST", "http://urlfixer.org/submitData"); |
172 request.setRequestHeader("Content-Type", "application/json"); | 172 request.setRequestHeader("Content-Type", "application/json"); |
173 request.addEventListener("load", function(event) | 173 request.addEventListener("load", function(event) |
174 { | 174 { |
175 if (event.target.status != 200) | 175 if (event.target.status != 200) |
176 domains = domains.concat(savedDomains); | 176 for (var i in savedDomains) |
| 177 domains[i] = savedDomains[i]; |
177 }, false); | 178 }, false); |
178 request.send(postData); | 179 request.send(postData); |
179 } | 180 } |
180 | 181 |
181 function initWebUI(event) | 182 function initWebUI(event) |
182 { | 183 { |
183 if (Prefs.domainOptIn) | 184 if (Prefs.domainOptIn) |
184 return; | 185 return; |
185 | 186 |
186 let container = event.target; | 187 let container = event.target; |
(...skipping 14 matching lines...) Expand all Loading... |
201 | 202 |
202 Prefs.domainOptInAsk = true; | 203 Prefs.domainOptInAsk = true; |
203 Prefs.domainOptIn = true; | 204 Prefs.domainOptIn = true; |
204 button.style.display = "none"; | 205 button.style.display = "none"; |
205 message.style.display = ""; | 206 message.style.display = ""; |
206 }, false); | 207 }, false); |
207 | 208 |
208 message.style.display = "none"; | 209 message.style.display = "none"; |
209 container.style.display = ""; | 210 container.style.display = ""; |
210 } | 211 } |
OLD | NEW |