зеркало из https://github.com/mozilla/gecko-dev.git
cleanup for bug 405105, r=gavin
This commit is contained in:
Родитель
31d8086891
Коммит
675cc0333d
|
@ -348,9 +348,9 @@ function resetPageInfo()
|
|||
/* Reset Media tab */
|
||||
var mediaTab = document.getElementById("mediaTab");
|
||||
if (!mediaTab.hidden) {
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.removeObserver(imagePermissionObserver, "perm-changed");
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.removeObserver(imagePermissionObserver, "perm-changed");
|
||||
mediaTab.hidden = true;
|
||||
}
|
||||
gImageView.clear();
|
||||
|
@ -370,10 +370,11 @@ function resetPageInfo()
|
|||
|
||||
function onUnloadPageInfo()
|
||||
{
|
||||
// Remove the observer, only if there is at least 1 image.
|
||||
if (!document.getElementById("mediaTab").hidden) {
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.removeObserver(imagePermissionObserver, "perm-changed");
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.removeObserver(imagePermissionObserver, "perm-changed");
|
||||
}
|
||||
|
||||
/* Call registered overlay unload functions */
|
||||
|
@ -542,6 +543,7 @@ function doGrab(iterator)
|
|||
processFrames();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(doGrab, 16, iterator);
|
||||
}
|
||||
|
||||
|
@ -557,6 +559,7 @@ function addImage(url, type, alt, elem, isBg)
|
|||
{
|
||||
if (!url)
|
||||
return;
|
||||
|
||||
if (!gImageHash.hasOwnProperty(url))
|
||||
gImageHash[url] = { };
|
||||
if (!gImageHash[url].hasOwnProperty(type))
|
||||
|
@ -584,11 +587,13 @@ function addImage(url, type, alt, elem, isBg)
|
|||
else
|
||||
sizeText = gStrings.unknown;
|
||||
gImageView.addRow([url, type, sizeText, alt, 1, elem, isBg]);
|
||||
|
||||
// Add the observer, only once.
|
||||
if (gImageView.data.length == 1) {
|
||||
document.getElementById("mediaTab").hidden = false;
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.addObserver(imagePermissionObserver, "perm-changed", false);
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.addObserver(imagePermissionObserver, "perm-changed", false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -665,6 +670,7 @@ function onBeginLinkDrag(event,urlField,descField)
|
|||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
if (!transArray)
|
||||
return;
|
||||
|
||||
var trans = Components.classes[TRANSFERABLE_CONTRACTID]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
if (!trans)
|
||||
|
@ -1017,6 +1023,7 @@ var imagePermissionObserver = {
|
|||
{
|
||||
if (document.getElementById("mediaPreviewBox").collapsed)
|
||||
return;
|
||||
|
||||
if (aTopic == "perm-changed") {
|
||||
var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
|
||||
if (permission.type == "image") {
|
||||
|
|
Загрузка…
Ссылка в новой задаче