head_library-base.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
31 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
32 
33 function readList(dataFile) {
34 
35  var data = readFile(dataFile);
36  var a = data.split("\n");
37 
38  var b = [];
39  for(var i = 0; i < a.length - 1; i++) {
40  b.push(a[i].split("\t")[0]);
41  }
42 
43  return b;
44 }
45 
46 function getFile(fileName) {
47  var file = Cc["@mozilla.org/file/directory_service;1"]
48  .getService(Ci.nsIProperties)
49  .get("resource:app", Ci.nsIFile);
50  file = file.clone();
51  file.append("testharness");
52  file.append("localdatabaselibrary");
53  file.append(fileName);
54  return file;
55 }
56 
57 function BatchEndListener() {
58  this.depth = 0;
59 }
60 BatchEndListener.prototype = {
61  QueryInterface: XPCOMUtils.generateQI([Ci.sbIMediaListListener]),
62  onItemAdded: function() true,
63  onBeforeItemRemoved: function() true,
64  onAfterItemRemoved: function() true,
65  onItemUpdated: function() true,
66  onItemMoved: function() true,
67  onBeforeListCleared: function() true,
68  onListCleared: function() true,
69  onBatchBegin: function(aMediaList) {
70  ++this.depth;
71  log("depth: " + this.depth);
72  },
73  onBatchEnd: function(aMediaList) {
74  --this.depth;
75  log("depth: " + this.depth);
76  },
77  waitForCompletion: function(aCallback) {
78  var targetDepth = this.depth;
79  aCallback();
80  log("waiting for depth " + this.depth + " to go to " + targetDepth);
81  while (this.depth > targetDepth) {
82  sleep(100);
83  }
84  },
85  waitForEndBatch: function() {
86  log("waiting for depth " + this.depth + " to go straight to 0");
87  while (this.depth > 0) {
88  sleep(100);
89  }
90  }
91 };
function sleep(ms, suppressOutput)
const Cc
function log(s)
sbOSDControlService prototype QueryInterface
function getFile(fileName)
function BatchEndListener()
function readList(dataFile)
const Ci
function readFile(fileName)
observe data
Definition: FeedWriter.js:1329
_getSelectedPageStyle s i
var file