browser_483086.js
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is mozilla.org code.
15  *
16  * The Initial Developer of the Original Code is Mozilla Foundation.
17  * Portions created by the Initial Developer are Copyright (C) 2009
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Ryan Flint <rflint@dslr.net> (Original Author)
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPL"), or
25  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26  * in which case the provisions of the GPL or the LGPL are applicable instead
27  * of those above. If you wish to allow use of your version of this file only
28  * under the terms of either the GPL or the LGPL, and not to allow others to
29  * use your version of this file under the terms of the MPL, indicate your
30  * decision by deleting the provisions above and replace them with the notice
31  * and other provisions required by the GPL or the LGPL. If you do not delete
32  * the provisions above, a recipient may use your version of this file under
33  * the terms of any one of the MPL, the GPL or the LGPL.
34  *
35  * ***** END LICENSE BLOCK ***** */
36 let gSS = Cc["@mozilla.org/browser/search-service;1"].
37  getService(Ci.nsIBrowserSearchService);
38 let gObs = Cc["@mozilla.org/observer-service;1"].
39  getService(Ci.nsIObserverService);
40 
41 function test() {
43 
44  let observer = {
45  observe: function(aSubject, aTopic, aData) {
46  switch (aData) {
47  case "engine-added":
48  let engine = gSS.getEngineByName("483086a");
49  ok(engine, "Test engine 1 installed");
50  isnot(engine.searchForm, "foo://example.com",
51  "Invalid SearchForm URL dropped");
52  gSS.removeEngine(engine);
53  break;
54  case "engine-removed":
55  gObs.removeObserver(this, "browser-search-engine-modified");
56  test2();
57  break;
58  }
59  }
60  };
61 
62  gObs.addObserver(observer, "browser-search-engine-modified", false);
63  gSS.addEngine("http://localhost:8888/browser/browser/components/search/test/483086-1.xml",
64  Ci.nsISearchEngine.DATA_XML, "data:image/x-icon;%00",
65  false);
66 }
67 
68 function test2() {
69  let observer = {
70  observe: function(aSubject, aTopic, aData) {
71  switch (aData) {
72  case "engine-added":
73  let engine = gSS.getEngineByName("483086b");
74  ok(engine, "Test engine 2 installed");
75  is(engine.searchForm, "http://example.com", "SearchForm is correct");
76  gSS.removeEngine(engine);
77  break;
78  case "engine-removed":
79  gObs.removeObserver(this, "browser-search-engine-modified");
80  finish();
81  break;
82  }
83  }
84  };
85 
86  gObs.addObserver(observer, "browser-search-engine-modified", false);
87  gSS.addEngine("http://localhost:8888/browser/browser/components/search/test/483086-2.xml",
88  Ci.nsISearchEngine.DATA_XML, "data:image/x-icon;%00",
89  false);
90 }
const Cc
function test()
let gSS
getService(Ci.sbIFaceplateManager)
let gObs
waitForExplicitFinish()
function test2()
const Ci
let observer
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe