Added patches from mozbz#858919

This commit is contained in:
Martin Stransky 2014-10-15 16:41:46 +02:00
parent 439f52a9be
commit b024cf0ab0
3 changed files with 182 additions and 3 deletions

View File

@ -93,7 +93,7 @@
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 33.0
Release: 1%{?pre_tag}%{?dist}
Release: 2%{?pre_tag}%{?dist}
URL: http://www.mozilla.org/projects/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
@ -129,7 +129,9 @@ Patch217: firefox-baseline-disable.patch
# Upstream patches
Patch300: mozilla-858919.patch
Patch301: mozilla-1042889.patch
Patch301: mozilla-858919-2.patch
Patch302: mozilla-858919-3.patch
Patch310: mozilla-1042889.patch
%if %{official_branding}
# Required by Mozilla Corporation
@ -269,7 +271,9 @@ cd %{tarballdir}
# Upstream patches
%patch300 -p1 -b .858919
%patch301 -p1 -b .1042889
%patch301 -p1 -b .858919
%patch302 -p1 -b .858919
%patch310 -p1 -b .1042889
%if %{official_branding}
# Required by Mozilla Corporation
@ -715,6 +719,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
* Wed Oct 15 2014 Martin Stransky <stransky@redhat.com> - 33.0-2
- Added patches from mozbz#858919
* Tue Oct 14 2014 Martin Stransky <stransky@redhat.com> - 33.0-1
- Update to 33.0 build 2

28
mozilla-858919-2.patch Normal file
View File

@ -0,0 +1,28 @@
# HG changeset patch
# Parent 9d66436af432f057f65d16ab9f5871baca4ada78
# User Martin Stransky <stransky@redhat.com>
Bug 858919 - Send "alertshow" event for Web Notifications by libnotify, r=?karlt
diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -175,16 +175,19 @@ nsAlertsIconListener::ShowAlert(GdkPixbu
// different signature, so a marshaller is used instead of a C callback to
// get the user_data (this) in a parseable format. |closure| is created
// with a floating reference, which gets sunk by g_signal_connect_closure().
GClosure* closure = g_closure_new_simple(sizeof(GClosure), this);
g_closure_set_marshal(closure, notify_closed_marshal);
mClosureHandler = g_signal_connect_closure(mNotification, "closed", closure, FALSE);
gboolean result = notify_notification_show(mNotification, nullptr);
+ if (result && mAlertListener)
+ mAlertListener->Observe(nullptr, "alertshow", mAlertCookie.get());
+
return result ? NS_OK : NS_ERROR_FAILURE;
}
nsresult
nsAlertsIconListener::StartRequest(const nsAString & aImageUrl)
{
if (mIconRequest) {
// Another icon request is already in flight. Kill it.

144
mozilla-858919-3.patch Normal file
View File

@ -0,0 +1,144 @@
# HG changeset patch
# Parent 531e0bc755b2335dec5aae2a10f4ba454307981d
# User Martin Stransky <stransky@redhat.com>
Bug 858919 - Fixes image loading for libnotify notifications. r=?karlt
diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -46,16 +46,31 @@ static void notify_closed_marshal(GClosu
NS_ABORT_IF_FALSE(n_param_values >= 1, "No object in params");
nsAlertsIconListener* alert =
static_cast<nsAlertsIconListener*>(closure->data);
alert->SendClosed();
NS_RELEASE(alert);
}
+static GdkPixbuf*
+GetPixbufFromImgRequest(imgIRequest* aRequest)
+{
+ nsCOMPtr<imgIContainer> image;
+ nsresult rv = aRequest->GetImage(getter_AddRefs(image));
+ if (NS_FAILED(rv)) {
+ return nullptr;
+ }
+
+ nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
+ do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
+
+ return imgToPixbuf->ConvertImageToPixbuf(image);
+}
+
NS_IMPL_ISUPPORTS(nsAlertsIconListener, imgINotificationObserver,
nsIObserver, nsISupportsWeakReference)
nsAlertsIconListener::nsAlertsIconListener()
: mLoadedFrame(false),
mNotification(nullptr)
{
if (!libNotifyHandle && !libNotifyNotAvail) {
@@ -101,57 +116,55 @@ nsAlertsIconListener::Notify(imgIRequest
}
return NS_OK;
}
nsresult
nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest)
{
+ NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
+
uint32_t imgStatus = imgIRequest::STATUS_ERROR;
nsresult rv = aRequest->GetImageStatus(&imgStatus);
NS_ENSURE_SUCCESS(rv, rv);
if (imgStatus == imgIRequest::STATUS_ERROR && !mLoadedFrame) {
// We have an error getting the image. Display the notification with no icon.
ShowAlert(nullptr);
- }
- if (mIconRequest) {
+ // Cancel any pending request
mIconRequest->Cancel(NS_BINDING_ABORTED);
mIconRequest = nullptr;
}
+
return NS_OK;
}
nsresult
nsAlertsIconListener::OnStopFrame(imgIRequest* aRequest)
{
- if (aRequest != mIconRequest)
- return NS_ERROR_FAILURE;
+ NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
if (mLoadedFrame)
return NS_OK; // only use one frame
- nsCOMPtr<imgIContainer> image;
- nsresult rv = aRequest->GetImage(getter_AddRefs(image));
- if (NS_FAILED(rv))
- return rv;
-
- nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
- do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
-
- GdkPixbuf* imagePixbuf = imgToPixbuf->ConvertImageToPixbuf(image);
- if (!imagePixbuf)
- return NS_ERROR_FAILURE;
-
- ShowAlert(imagePixbuf);
-
- g_object_unref(imagePixbuf);
+ GdkPixbuf* imagePixbuf = GetPixbufFromImgRequest(aRequest);
+ if (!imagePixbuf) {
+ ShowAlert(nullptr);
+ } else {
+ ShowAlert(imagePixbuf);
+ g_object_unref(imagePixbuf);
+ }
mLoadedFrame = true;
+
+ // Cancel any pending request (multipart image loading/decoding for instance)
+ mIconRequest->Cancel(NS_BINDING_ABORTED);
+ mIconRequest = nullptr;
+
return NS_OK;
}
nsresult
nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
{
mNotification = notify_notification_new(mAlertTitle.get(), mAlertText.get(),
nullptr, nullptr);
@@ -196,19 +209,25 @@ nsAlertsIconListener::StartRequest(const
NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
if (!imageUri)
return ShowAlert(nullptr);
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
if (!il)
return ShowAlert(nullptr);
- return il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr,
- this, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
- nullptr, getter_AddRefs(mIconRequest));
+ nsresult rv = il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr,
+ this, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
+ nullptr, getter_AddRefs(mIconRequest));
+ if (NS_FAILED(rv))
+ return rv;
+
+ mIconRequest->StartDecoding();
+
+ return NS_OK;
}
void
nsAlertsIconListener::SendCallback()
{
if (mAlertListener)
mAlertListener->Observe(nullptr, "alertclickcallback", mAlertCookie.get());
}