aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-system-openh264
blob: d51644631776f354337b5a3d8e5ba8e55c31d72f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Revert bug 1045209 to allow using absolute path

diff --git dom/media/gmp/GMPChild.cpp dom/media/gmp/GMPChild.cpp
index 1dde3ac..12c88cf 100644
--- dom/media/gmp/GMPChild.cpp
+++ dom/media/gmp/GMPChild.cpp
@@ -76,21 +76,14 @@ GetFileBase(const std::string& aPluginPa
   }
 #endif
 
-  nsCOMPtr<nsIFile> parent;
-  rv = aFileBase->GetParent(getter_AddRefs(parent));
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-
-  nsAutoString parentLeafName;
-  rv = parent->GetLeafName(parentLeafName);
-  if (NS_FAILED(rv)) {
+  nsAutoString leafName;
+  if (NS_FAILED(aFileBase->GetLeafName(leafName))) {
     return false;
   }
 
-  aBaseName = Substring(parentLeafName,
+  aBaseName = Substring(leafName,
                         4,
-                        parentLeafName.Length() - 1);
+                        leafName.Length() - 1);
   return true;
 }
 
diff --git dom/media/gmp/GMPParent.cpp dom/media/gmp/GMPParent.cpp
index aa60acf..90878ca 100644
--- dom/media/gmp/GMPParent.cpp
+++ dom/media/gmp/GMPParent.cpp
@@ -90,23 +90,16 @@
   mService = aService;
   mDirectory = aPluginDir;
 
-  // aPluginDir is <profile-dir>/<gmp-plugin-id>/<version>
-  // where <gmp-plugin-id> should be gmp-gmpopenh264
-  nsCOMPtr<nsIFile> parent;
-  nsresult rv = aPluginDir->GetParent(getter_AddRefs(parent));
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-  nsAutoString parentLeafName;
-  rv = parent->GetLeafName(parentLeafName);
+  nsAutoString leafname;
+  nsresult rv = aPluginDir->GetLeafName(leafname);
   if (NS_FAILED(rv)) {
     return rv;
   }
   LOGD(("%s::%s: %p for %s", __CLASS__, __FUNCTION__, this,
-       NS_LossyConvertUTF16toASCII(parentLeafName).get()));
+       NS_LossyConvertUTF16toASCII(leafname).get()));
 
-  MOZ_ASSERT(parentLeafName.Length() > 4);
-  mName = Substring(parentLeafName, 4);
+  MOZ_ASSERT(leafname.Length() > 4);
+  mName = Substring(leafname, 4);
 
   return ReadGMPMetaData();
 }
diff --git toolkit/modules/GMPInstallManager.jsm toolkit/modules/GMPInstallManager.jsm
index 9593492..470384b 100644
--- toolkit/modules/GMPInstallManager.jsm
+++ toolkit/modules/GMPInstallManager.jsm
@@ -107,6 +107,7 @@
    */
   KEY_LOG_ENABLED: "media.gmp-manager.log",
   KEY_ADDON_LAST_UPDATE: "media.{0}.lastUpdate",
+  KEY_ADDON_PATH: "media.{0}.path",
   KEY_ADDON_VERSION: "media.{0}.version",
   KEY_ADDON_AUTOUPDATE: "media.{0}.autoupdate",
   KEY_URL: "media.gmp-manager.url",
@@ -888,9 +889,7 @@
       let gmpAddon = this._gmpAddon;
       let installToDirPath = Cc["@mozilla.org/file/local;1"].
                           createInstance(Ci.nsIFile);
-      let path = OS.Path.join(OS.Constants.Path.profileDir,
-                              gmpAddon.id,
-                              gmpAddon.version);
+      let path = OS.Path.join(OS.Constants.Path.profileDir, gmpAddon.id);
       installToDirPath.initWithPath(path);
       log.info("install to directory path: " + installToDirPath.path);
       let gmpInstaller = new GMPExtractor(zipPath, installToDirPath.path);
@@ -899,10 +898,12 @@
         // Success, set the prefs
         let now = Math.round(Date.now() / 1000);
         GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, now, gmpAddon.id);
-        // Setting the version pref signals installation completion to consumers,
-        // if you need to set other prefs etc. do it before this.
+        // Setting the path pref signals installation completion to consumers,
+        // so set the version and potential other information they use first.
         GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, gmpAddon.version,
                      gmpAddon.id);
+        GMPPrefs.set(GMPPrefs.KEY_ADDON_PATH,
+                     installToDirPath.path, gmpAddon.id);
         this._deferred.resolve(extractedPaths);
       }, err => {
         this._deferred.reject(err);
diff --git toolkit/mozapps/extensions/internal/GMPProvider.jsm toolkit/mozapps/extensions/internal/GMPProvider.jsm
index 1f3a0b1..93517be 100644
--- toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -40,6 +40,7 @@ const KEY_LOGGING_LEVEL      = KEY_LOG_B
 const KEY_LOGGING_DUMP       = KEY_LOG_BASE + "dump";
 const KEY_EME_ENABLED        = "media.eme.enabled"; // Global pref to enable/disable all EME plugins
 const KEY_PLUGIN_ENABLED     = "media.{0}.enabled";
+const KEY_PLUGIN_PATH        = "media.{0}.path";
 const KEY_PLUGIN_LAST_UPDATE = "media.{0}.lastUpdate";
 const KEY_PLUGIN_VERSION     = "media.{0}.version";
 const KEY_PLUGIN_AUTOUPDATE  = "media.{0}.autoupdate";
@@ -165,8 +166,8 @@ function GMPWrapper(aPluginInfo) {
                                               this._plugin.id + ") ");
   Preferences.observe(GMPPrefs.getPrefKey(KEY_PLUGIN_ENABLED, this._plugin.id),
                       this.onPrefEnabledChanged, this);
-  Preferences.observe(GMPPrefs.getPrefKey(KEY_PLUGIN_VERSION, this._plugin.id),
-                      this.onPrefVersionChanged, this);
+  Preferences.observe(GMPPrefs.getPrefKey(KEY_PLUGIN_PATH, this._plugin.id),
+                      this.onPrefPathChanged, this);
   if (this._plugin.isEME) {
     Preferences.observe(GMPPrefs.getPrefKey(KEY_EME_ENABLED, this._plugin.id),
                         this.onPrefEnabledChanged, this);
@@ -183,11 +184,8 @@ GMPWrapper.prototype = {
 
   set gmpPath(aPath) { this._gmpPath = aPath; },
   get gmpPath() {
-    if (!this._gmpPath && this.isInstalled) {
-      this._gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
-                                   this._plugin.id,
-                                   GMPPrefs.get(KEY_PLUGIN_VERSION, null,
-                                                this._plugin.id));
+    if (!this._gmpPath) {
+      this._gmpPath = GMPPrefs.get(KEY_PLUGIN_PATH, null, this._plugin.id);
     }
     return this._gmpPath;
   },
@@ -202,8 +200,13 @@ GMPWrapper.prototype = {
   get description() { return this._plugin.description; },
   get fullDescription() { return this._plugin.fullDescription; },
 
-  get version() { return GMPPrefs.get(KEY_PLUGIN_VERSION, null,
-                                      this._plugin.id); },
+  get version() { 
+    if (this.isInstalled) {
+        return GMPPrefs.get(KEY_PLUGIN_VERSION, null,
+                                    this._plugin.id);
+    }
+    return null;
+  },
 
   get isActive() { return !this.userDisabled; },
   get appDisabled() { return false; },
@@ -346,24 +349,17 @@ GMPWrapper.prototype = {
 
   get pluginMimeTypes() { return []; },
   get pluginLibraries() {
-    if (this.isInstalled) {
-      let path = this.version;
-      return [path];
-    }
-    return [];
+    let path = GMPPrefs.get(KEY_PLUGIN_PATH, null, this._plugin.id);
+    return path && path.length ? [OS.Path.basename(path)] : [];
   },
   get pluginFullpath() {
-    if (this.isInstalled) {
-      let path = OS.Path.join(OS.Constants.Path.profileDir,
-                              this._plugin.id,
-                              this.version);
-      return [path];
-    }
-    return [];
+    let path = GMPPrefs.get(KEY_PLUGIN_PATH, null, this._plugin.id);
+    return path && path.length ? [path] : [];
   },
 
   get isInstalled() {
-    return this.version && this.version.length > 0;
+    let path = GMPPrefs.get(KEY_PLUGIN_PATH, null, this._plugin.id);
+    return path && path.length > 0;
   },
 
   onPrefEnabledChanged: function() {
@@ -386,10 +382,10 @@ GMPWrapper.prototype = {
                                            this);
   },
 
-  onPrefVersionChanged: function() {
+  onPrefPathChanged: function() {
     AddonManagerPrivate.callAddonListeners("onUninstalling", this, false);
     if (this._gmpPath) {
-      this._log.info("onPrefVersionChanged() - unregistering gmp directory " +
+      this._log.info("onPrefPathChanged() - unregistering gmp directory " +
                      this._gmpPath);
       gmpService.removePluginDirectory(this._gmpPath);
     }
@@ -397,15 +393,9 @@ GMPWrapper.prototype = {
 
     AddonManagerPrivate.callInstallListeners("onExternalInstall", null, this,
                                              null, false);
-    this._gmpPath = null;
-    if (this.isInstalled) {
-      this._gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
-                                   this._plugin.id,
-                                   GMPPrefs.get(KEY_PLUGIN_VERSION, null,
-                                                this._plugin.id));
-    }
+    this._gmpPath = GMPPrefs.get(KEY_PLUGIN_PATH, null, this._plugin.id);
     if (this._gmpPath && this.isActive) {
-      this._log.info("onPrefVersionChanged() - registering gmp directory " +
+      this._log.info("onPrefPathChanged() - registering gmp directory " +
                      this._gmpPath);
       gmpService.addPluginDirectory(this._gmpPath);
     }
@@ -415,8 +405,8 @@ GMPWrapper.prototype = {
   shutdown: function() {
     Preferences.ignore(GMPPrefs.getPrefKey(KEY_PLUGIN_ENABLED, this._plugin.id),
                        this.onPrefEnabledChanged, this);
-    Preferences.ignore(GMPPrefs.getPrefKey(KEY_PLUGIN_VERSION, this._plugin.id),
-                       this.onPrefVersionChanged, this);
+    Preferences.ignore(GMPPrefs.getPrefKey(KEY_PLUGIN_PATH, this._plugin.id),
+                       this.onPrefPathChanged, this);
     if (this._isEME) {
       Preferences.ignore(GMPPrefs.getPrefKey(KEY_EME_ENABLED, this._plugin.id),
                          this.onPrefEnabledChanged, this);