Update to 75.0b2
This commit is contained in:
parent
0f14c98579
commit
cf51908e15
2
.gitignore
vendored
2
.gitignore
vendored
@ -391,3 +391,5 @@ firefox-3.6.4.source.tar.bz2
|
||||
/firefox-langpacks-74.0-20200310.tar.xz
|
||||
/firefox-75.0b1.source.tar.xz
|
||||
/firefox-langpacks-75.0b1-20200310.tar.xz
|
||||
/firefox-langpacks-75.0b2-20200311.tar.xz
|
||||
/firefox-75.0b2.source.tar.xz
|
||||
|
12
firefox.spec
12
firefox.spec
@ -95,7 +95,7 @@ ExcludeArch: s390x
|
||||
%global tarballdir firefox-%{version}
|
||||
|
||||
%global official_branding 1
|
||||
%global pre_version b1
|
||||
%global pre_version b2
|
||||
|
||||
%bcond_without langpacks
|
||||
|
||||
@ -122,7 +122,7 @@ URL: https://www.mozilla.org/firefox/
|
||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
|
||||
%if %{with langpacks}
|
||||
Source1: firefox-langpacks-%{version}%{?pre_version}-20200310.tar.xz
|
||||
Source1: firefox-langpacks-%{version}%{?pre_version}-20200311.tar.xz
|
||||
%endif
|
||||
Source2: cbindgen-vendor.tar.xz
|
||||
Source10: firefox-mozconfig
|
||||
@ -172,7 +172,6 @@ Patch224: mozilla-1170092.patch
|
||||
Patch226: rhbz-1354671.patch
|
||||
Patch227: firefox-locale-debug.patch
|
||||
Patch239: mozilla-gnome-shell-search-provider.patch
|
||||
Patch240: mozilla-gnome-shell-search-provider-icons.patch
|
||||
Patch241: kiosk-workaround.patch
|
||||
|
||||
# Upstream patches
|
||||
@ -181,6 +180,7 @@ Patch412: mozilla-1337988.patch
|
||||
Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
|
||||
Patch417: bug1375074-save-restore-x28.patch
|
||||
Patch422: mozilla-1580174-webrtc-popup.patch
|
||||
Patch423: mozilla-1619258.patch
|
||||
|
||||
# Wayland specific upstream patches
|
||||
Patch574: firefox-pipewire.patch
|
||||
@ -376,10 +376,10 @@ This package contains results of tests executed during build.
|
||||
%endif
|
||||
%patch227 -p1 -b .locale-debug
|
||||
%patch239 -p1 -b .gnome-shell-search-provider
|
||||
%patch240 -p1 -b .gnome-shell-search-provider-icons
|
||||
# Workaround for kiosk mode
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1594738
|
||||
#%patch241 -p1 -b .kiosk-workaround
|
||||
%patch423 -p1 -b .1619258
|
||||
|
||||
%patch402 -p1 -b .1196777
|
||||
%ifarch %{arm}
|
||||
@ -943,8 +943,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
%{mozappdir}/gmp-clearkey
|
||||
%{mozappdir}/fonts/TwemojiMozilla.ttf
|
||||
%if !%{?system_nss}
|
||||
%{mozappdir}/libfreeblpriv3.chk
|
||||
%{mozappdir}/libsoftokn3.chk
|
||||
#%{mozappdir}/libfreeblpriv3.chk
|
||||
#%{mozappdir}/libsoftokn3.chk
|
||||
%exclude %{mozappdir}/libnssckbi.so
|
||||
%endif
|
||||
%if %{build_with_asan}
|
||||
|
117
mozilla-1619258.patch
Normal file
117
mozilla-1619258.patch
Normal file
@ -0,0 +1,117 @@
|
||||
changeset: 519528:3c63c1d6df70
|
||||
parent: 519514:7ac664c14598
|
||||
user: Martin Stransky <stransky@redhat.com>
|
||||
date: Wed Mar 04 12:46:41 2020 +0100
|
||||
files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||
description:
|
||||
Bug 1619258 [Wayland] Enable VA-API for all formats, r?jya
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D65536
|
||||
|
||||
|
||||
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||
@@ -130,20 +130,16 @@ VAAPIFrameHolder::VAAPIFrameHolder(FFmpe
|
||||
|
||||
VAAPIFrameHolder::~VAAPIFrameHolder() {
|
||||
mLib->av_buffer_unref(&mHWFrame);
|
||||
mLib->av_buffer_unref(&mAVHWFramesContext);
|
||||
mLib->av_buffer_unref(&mVAAPIDeviceContext);
|
||||
}
|
||||
|
||||
AVCodec* FFmpegVideoDecoder<LIBAV_VER>::FindVAAPICodec() {
|
||||
- if (mCodecID != AV_CODEC_ID_H264) {
|
||||
- return nullptr;
|
||||
- }
|
||||
-
|
||||
AVCodec* decoder = mLib->avcodec_find_decoder(mCodecID);
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig* config = mLib->avcodec_get_hw_config(decoder, i);
|
||||
if (!config) {
|
||||
break;
|
||||
}
|
||||
if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX &&
|
||||
config->device_type == AV_HWDEVICE_TYPE_VAAPI) {
|
||||
@@ -167,17 +163,16 @@ bool FFmpegVideoDecoder<LIBAV_VER>::Crea
|
||||
}
|
||||
|
||||
mCodecContext->hw_device_ctx = mLib->av_buffer_ref(mVAAPIDeviceContext);
|
||||
return true;
|
||||
}
|
||||
|
||||
MediaResult FFmpegVideoDecoder<LIBAV_VER>::InitVAAPIDecoder() {
|
||||
FFMPEG_LOG("Initialising VA-API FFmpeg decoder");
|
||||
- MOZ_ASSERT(mCodecID == AV_CODEC_ID_H264);
|
||||
|
||||
if (!mLib->IsVAAPIAvailable()) {
|
||||
FFMPEG_LOG("libva library is missing");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!gfxPlatformGtk::GetPlatform()->UseWaylandHardwareVideoDecoding()) {
|
||||
FFMPEG_LOG("VA-API FFmpeg is disabled by platform");
|
||||
@@ -277,21 +272,19 @@ FFmpegVideoDecoder<LIBAV_VER>::FFmpegVid
|
||||
mExtraData = new MediaByteBuffer;
|
||||
mExtraData->AppendElements(*aConfig.mExtraData);
|
||||
}
|
||||
|
||||
RefPtr<MediaDataDecoder::InitPromise> FFmpegVideoDecoder<LIBAV_VER>::Init() {
|
||||
MediaResult rv;
|
||||
|
||||
#ifdef MOZ_WAYLAND_USE_VAAPI
|
||||
- if (mCodecID == AV_CODEC_ID_H264) {
|
||||
- rv = InitVAAPIDecoder();
|
||||
- if (NS_SUCCEEDED(rv)) {
|
||||
- return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
|
||||
- }
|
||||
+ rv = InitVAAPIDecoder();
|
||||
+ if (NS_SUCCEEDED(rv)) {
|
||||
+ return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = InitDecoder();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
|
||||
}
|
||||
|
||||
@@ -692,9 +685,16 @@ void FFmpegVideoDecoder<LIBAV_VER>::Proc
|
||||
#ifdef MOZ_WAYLAND_USE_VAAPI
|
||||
if (mVAAPIDeviceContext) {
|
||||
mLib->av_buffer_unref(&mVAAPIDeviceContext);
|
||||
}
|
||||
#endif
|
||||
FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown();
|
||||
}
|
||||
|
||||
+#ifdef MOZ_WAYLAND_USE_VAAPI
|
||||
+bool FFmpegVideoDecoder<LIBAV_VER>::IsHardwareAccelerated(
|
||||
+ nsACString& aFailureReason) const {
|
||||
+ return mVAAPIDeviceContext != nullptr;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
} // namespace mozilla
|
||||
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||
@@ -87,16 +87,17 @@ class FFmpegVideoDecoder<LIBAV_VER>
|
||||
MediaResult CreateImage(int64_t aOffset, int64_t aPts, int64_t aDuration,
|
||||
MediaDataDecoder::DecodedData& aResults);
|
||||
|
||||
#ifdef MOZ_WAYLAND_USE_VAAPI
|
||||
MediaResult InitVAAPIDecoder();
|
||||
bool CreateVAAPIDeviceContext();
|
||||
void InitVAAPICodecContext();
|
||||
AVCodec* FindVAAPICodec();
|
||||
+ bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
|
||||
|
||||
MediaResult CreateImageVAAPI(int64_t aOffset, int64_t aPts, int64_t aDuration,
|
||||
MediaDataDecoder::DecodedData& aResults);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This method allocates a buffer for FFmpeg's decoder, wrapped in an Image.
|
||||
* Currently it only supports Planar YUV420, which appears to be the only
|
||||
|
@ -1,453 +0,0 @@
|
||||
changeset: 504680:441b26f2d4f4
|
||||
parent: 504674:5a55ac856fc4
|
||||
user: Martin Stransky <stransky@redhat.com>
|
||||
date: Mon Dec 02 12:21:08 2019 +0100
|
||||
files: browser/components/shell/nsGNOMEShellSearchProvider.cpp browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
description:
|
||||
Bug 1239694 Use history icons with Gnome shell search provider, r?jhorak
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D55434
|
||||
|
||||
|
||||
diff --git a/browser/components/shell/nsGNOMEShellSearchProvider.cpp b/browser/components/shell/nsGNOMEShellSearchProvider.cpp
|
||||
--- a/browser/components/shell/nsGNOMEShellSearchProvider.cpp
|
||||
+++ b/browser/components/shell/nsGNOMEShellSearchProvider.cpp
|
||||
@@ -19,21 +19,27 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGTKToolkit.h"
|
||||
#include "nsINavHistoryService.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsIFaviconService.h"
|
||||
#include "RemoteUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
+#include "imgIContainer.h"
|
||||
+#include "imgITools.h"
|
||||
+
|
||||
+#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
|
||||
-#define MAX_SEARCH_RESULTS_NUM 9
|
||||
+using namespace mozilla;
|
||||
+using namespace mozilla::gfx;
|
||||
+
|
||||
#define KEYWORD_SEARCH_STRING "special:search"
|
||||
#define KEYWORD_SEARCH_STRING_LEN 14
|
||||
|
||||
#define DBUS_BUS_NAME "org.mozilla.Firefox.SearchProvider"
|
||||
#define DBUS_OBJECT_PATH "/org/mozilla/Firefox/SearchProvider"
|
||||
|
||||
static const char* introspect_template =
|
||||
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection "
|
||||
@@ -81,17 +87,35 @@ DBusHandlerResult nsGNOMEShellSearchProv
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
dbus_connection_send(mConnection, reply, nullptr);
|
||||
dbus_message_unref(reply);
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
-nsresult nsGNOMEShellSearchProvider::QueryHistory(const char* aSearchTerm) {
|
||||
+nsGNOMEShellSearchProvider::nsGNOMEShellSearchProvider()
|
||||
+ : mConnection(nullptr), mSearchSerial(0) {
|
||||
+ memset(mHistoryIcons, 0, sizeof(mHistoryIcons));
|
||||
+}
|
||||
+
|
||||
+void nsGNOMEShellSearchProvider::SetHistoryIcon(int aSearchSerial,
|
||||
+ UniquePtr<uint8_t[]> aData,
|
||||
+ int aWidth, int aHeight,
|
||||
+ int aIconIndex) {
|
||||
+ MOZ_ASSERT(mSearchSerial == aSearchSerial);
|
||||
+ MOZ_ASSERT(aIconIndex < MAX_SEARCH_RESULTS_NUM);
|
||||
+ mHistoryIcons[aIconIndex].Set(aSearchSerial, std::move(aData), aWidth,
|
||||
+ aHeight);
|
||||
+}
|
||||
+
|
||||
+nsresult nsGNOMEShellSearchProvider::NewHistorySearch(const char* aSearchTerm) {
|
||||
+ // Initialize new search which invalidates all preview ones
|
||||
+ mSearchSerial++;
|
||||
+
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINavHistoryQuery> histQuery;
|
||||
rv = mHistoryService->GetNewQuery(getter_AddRefs(histQuery));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString searchTerm(aSearchTerm);
|
||||
rv = histQuery->SetSearchTerms(NS_ConvertUTF8toUTF16(searchTerm));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -165,24 +189,123 @@ void nsGNOMEShellSearchProvider::GetIDKe
|
||||
|
||||
int nsGNOMEShellSearchProvider::GetIndexFromIDKey(const char* aIDKey) {
|
||||
// ID is NN:URL where NN is index to our current history
|
||||
// result container.
|
||||
char tmp[] = {aIDKey[0], aIDKey[1], '\0'};
|
||||
return atoi(tmp);
|
||||
}
|
||||
|
||||
+class AsyncFaviconDataReady final : public nsIFaviconDataCallback {
|
||||
+ public:
|
||||
+ NS_DECL_ISUPPORTS
|
||||
+ NS_DECL_NSIFAVICONDATACALLBACK
|
||||
+
|
||||
+ AsyncFaviconDataReady(nsGNOMEShellSearchProvider* aSearchProvider,
|
||||
+ int aIconIndex, int aSearchSerial)
|
||||
+ : mSearchProvider(aSearchProvider),
|
||||
+ mIconIndex(aIconIndex),
|
||||
+ mSearchSerial(aSearchSerial){};
|
||||
+
|
||||
+ private:
|
||||
+ ~AsyncFaviconDataReady() {}
|
||||
+
|
||||
+ nsGNOMEShellSearchProvider* mSearchProvider;
|
||||
+ int mIconIndex;
|
||||
+ int mSearchSerial;
|
||||
+};
|
||||
+
|
||||
+NS_IMPL_ISUPPORTS(AsyncFaviconDataReady, nsIFaviconDataCallback)
|
||||
+
|
||||
+// Inspired by SurfaceToPackedBGRA
|
||||
+static UniquePtr<uint8_t[]> SurfaceToPackedRGBA(DataSourceSurface* aSurface) {
|
||||
+ IntSize size = aSurface->GetSize();
|
||||
+ CheckedInt<size_t> bufferSize =
|
||||
+ CheckedInt<size_t>(size.width * 4) * CheckedInt<size_t>(size.height);
|
||||
+ if (!bufferSize.isValid()) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ UniquePtr<uint8_t[]> imageBuffer(new (std::nothrow)
|
||||
+ uint8_t[bufferSize.value()]);
|
||||
+ if (!imageBuffer) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ DataSourceSurface::MappedSurface map;
|
||||
+ if (!aSurface->Map(DataSourceSurface::MapType::READ, &map)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ // Convert BGRA to RGBA
|
||||
+ uint32_t* aSrc = (uint32_t*)map.mData;
|
||||
+ uint32_t* aDst = (uint32_t*)imageBuffer.get();
|
||||
+ for (int i = 0; i < size.width * size.height; i++, aDst++, aSrc++) {
|
||||
+ *aDst = *aSrc & 0xff00ff00;
|
||||
+ *aDst |= (*aSrc & 0xff) << 16;
|
||||
+ *aDst |= (*aSrc & 0xff0000) >> 16;
|
||||
+ }
|
||||
+
|
||||
+ aSurface->Unmap();
|
||||
+
|
||||
+ return imageBuffer;
|
||||
+}
|
||||
+
|
||||
+NS_IMETHODIMP
|
||||
+AsyncFaviconDataReady::OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
|
||||
+ const uint8_t* aData,
|
||||
+ const nsACString& aMimeType,
|
||||
+ uint16_t aWidth) {
|
||||
+ // This is a callback from some previous search so we don't want it
|
||||
+ if (mSearchSerial != mSearchProvider->GetSearchSerial() || !aData ||
|
||||
+ !aDataLen) {
|
||||
+ return NS_ERROR_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ // Decode the image from the format it was returned to us in (probably PNG)
|
||||
+ nsCOMPtr<imgIContainer> container;
|
||||
+ nsCOMPtr<imgITools> imgtool = do_CreateInstance("@mozilla.org/image/tools;1");
|
||||
+ nsresult rv = imgtool->DecodeImageFromBuffer(
|
||||
+ reinterpret_cast<const char*>(aData), aDataLen, aMimeType,
|
||||
+ getter_AddRefs(container));
|
||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||
+
|
||||
+ RefPtr<SourceSurface> surface = container->GetFrame(
|
||||
+ imgIContainer::FRAME_FIRST,
|
||||
+ imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_ASYNC_NOTIFY);
|
||||
+
|
||||
+ if (!surface || surface->GetFormat() != SurfaceFormat::B8G8R8A8) {
|
||||
+ return NS_ERROR_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ // Allocate a new buffer that we own.
|
||||
+ RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
|
||||
+ UniquePtr<uint8_t[]> data = SurfaceToPackedRGBA(dataSurface);
|
||||
+ if (!data) {
|
||||
+ return NS_ERROR_OUT_OF_MEMORY;
|
||||
+ }
|
||||
+
|
||||
+ mSearchProvider->SetHistoryIcon(mSearchSerial, std::move(data),
|
||||
+ surface->GetSize().width,
|
||||
+ surface->GetSize().height, mIconIndex);
|
||||
+ return NS_OK;
|
||||
+}
|
||||
+
|
||||
void nsGNOMEShellSearchProvider::ComposeSearchResultReply(
|
||||
DBusMessage* reply, const char* aSearchTerm) {
|
||||
uint32_t childCount = 0;
|
||||
nsresult rv = mHistResultContainer->GetChildCount(&childCount);
|
||||
if (NS_FAILED(rv) || childCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Obtain the favicon service and get the favicon for the specified page
|
||||
+ nsCOMPtr<nsIFaviconService> favIconSvc(
|
||||
+ do_GetService("@mozilla.org/browser/favicon-service;1"));
|
||||
+ nsCOMPtr<nsIIOService> ios(do_GetService(NS_IOSERVICE_CONTRACTID));
|
||||
+
|
||||
if (childCount > MAX_SEARCH_RESULTS_NUM) {
|
||||
childCount = MAX_SEARCH_RESULTS_NUM;
|
||||
}
|
||||
|
||||
DBusMessageIter iter;
|
||||
dbus_message_iter_init_append(reply, &iter);
|
||||
DBusMessageIter iterArray;
|
||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &iterArray);
|
||||
@@ -195,16 +318,22 @@ void nsGNOMEShellSearchProvider::Compose
|
||||
}
|
||||
if (!IsHistoryResultNodeURI(child)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAutoCString uri;
|
||||
child->GetUri(uri);
|
||||
|
||||
+ nsCOMPtr<nsIURI> iconIri;
|
||||
+ ios->NewURI(uri, nullptr, nullptr, getter_AddRefs(iconIri));
|
||||
+ nsCOMPtr<nsIFaviconDataCallback> callback =
|
||||
+ new AsyncFaviconDataReady(this, i, mSearchSerial);
|
||||
+ favIconSvc->GetFaviconDataForPage(iconIri, callback, 0);
|
||||
+
|
||||
nsAutoCString idKey;
|
||||
GetIDKeyForURI(i, uri, idKey);
|
||||
|
||||
const char* id = idKey.get();
|
||||
dbus_message_iter_append_basic(&iterArray, DBUS_TYPE_STRING, &id);
|
||||
}
|
||||
|
||||
nsPrintfCString searchString("%s:%s", KEYWORD_SEARCH_STRING, aSearchTerm);
|
||||
@@ -221,17 +350,17 @@ DBusHandlerResult nsGNOMEShellSearchProv
|
||||
int elements;
|
||||
|
||||
if (!dbus_message_get_args(aMsg, nullptr, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
||||
&stringArray, &elements, DBUS_TYPE_INVALID) ||
|
||||
elements == 0) {
|
||||
reply = dbus_message_new_error(aMsg, DBUS_BUS_NAME, "Wrong argument");
|
||||
} else {
|
||||
reply = dbus_message_new_method_return(aMsg);
|
||||
- nsresult rv = QueryHistory(stringArray[0]);
|
||||
+ nsresult rv = NewHistorySearch(stringArray[0]);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
ComposeSearchResultReply(reply, stringArray[0]);
|
||||
}
|
||||
dbus_free_string_array(stringArray);
|
||||
}
|
||||
|
||||
dbus_connection_send(mConnection, reply, nullptr);
|
||||
dbus_message_unref(reply);
|
||||
@@ -249,17 +378,17 @@ DBusHandlerResult nsGNOMEShellSearchProv
|
||||
if (!dbus_message_get_args(aMsg, nullptr, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
||||
&unusedArray, &unusedNum, DBUS_TYPE_ARRAY,
|
||||
DBUS_TYPE_STRING, &stringArray, &elements,
|
||||
DBUS_TYPE_INVALID) ||
|
||||
elements == 0) {
|
||||
reply = dbus_message_new_error(aMsg, DBUS_BUS_NAME, "Wrong argument");
|
||||
} else {
|
||||
reply = dbus_message_new_method_return(aMsg);
|
||||
- nsresult rv = QueryHistory(stringArray[0]);
|
||||
+ nsresult rv = NewHistorySearch(stringArray[0]);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
ComposeSearchResultReply(reply, stringArray[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (unusedArray) {
|
||||
dbus_free_string_array(unusedArray);
|
||||
}
|
||||
@@ -280,45 +409,88 @@ static void appendStringDictionary(DBusM
|
||||
&iterDict);
|
||||
dbus_message_iter_append_basic(&iterDict, DBUS_TYPE_STRING, &aKey);
|
||||
dbus_message_iter_open_container(&iterDict, DBUS_TYPE_VARIANT, "s", &iterVar);
|
||||
dbus_message_iter_append_basic(&iterVar, DBUS_TYPE_STRING, &aValue);
|
||||
dbus_message_iter_close_container(&iterDict, &iterVar);
|
||||
dbus_message_iter_close_container(aIter, &iterDict);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ "icon-data": a tuple of type (iiibiiay) describing a pixbuf with width,
|
||||
+ height, rowstride, has-alpha,
|
||||
+ bits-per-sample, channels,
|
||||
+ image data
|
||||
+*/
|
||||
+void GnomeHistoryIcon::AppendIcon(DBusMessageIter* aIter) {
|
||||
+ DBusMessageIter iterDict, iterVar, iterStruct;
|
||||
+ dbus_message_iter_open_container(aIter, DBUS_TYPE_DICT_ENTRY, nullptr,
|
||||
+ &iterDict);
|
||||
+ const char* key = "icon-data";
|
||||
+ dbus_message_iter_append_basic(&iterDict, DBUS_TYPE_STRING, &key);
|
||||
+ dbus_message_iter_open_container(&iterDict, DBUS_TYPE_VARIANT, "(iiibiiay)",
|
||||
+ &iterVar);
|
||||
+ dbus_message_iter_open_container(&iterVar, DBUS_TYPE_STRUCT, nullptr,
|
||||
+ &iterStruct);
|
||||
+
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &mWidth);
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &mHeight);
|
||||
+ int rowstride = mWidth * 4;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &rowstride);
|
||||
+ int hasAlpha = true;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_BOOLEAN, &hasAlpha);
|
||||
+ int bitsPerSample = 8;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &bitsPerSample);
|
||||
+ int channels = 4;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &channels);
|
||||
+
|
||||
+ DBusMessageIter iterArray;
|
||||
+ dbus_message_iter_open_container(&iterStruct, DBUS_TYPE_ARRAY, "y",
|
||||
+ &iterArray);
|
||||
+ unsigned char* array = mData.get();
|
||||
+ dbus_message_iter_append_fixed_array(&iterArray, DBUS_TYPE_BYTE, &array,
|
||||
+ mWidth * mHeight * 4);
|
||||
+ dbus_message_iter_close_container(&iterStruct, &iterArray);
|
||||
+
|
||||
+ dbus_message_iter_close_container(&iterVar, &iterStruct);
|
||||
+ dbus_message_iter_close_container(&iterDict, &iterVar);
|
||||
+ dbus_message_iter_close_container(aIter, &iterDict);
|
||||
+}
|
||||
+
|
||||
/* We can return those fields at GetResultMetas:
|
||||
"id": the result ID
|
||||
"name": the display name for the result
|
||||
"icon": a serialized GIcon (see g_icon_serialize()), or alternatively,
|
||||
"gicon": a textual representation of a GIcon (see g_icon_to_string()),
|
||||
or alternativly,
|
||||
"icon-data": a tuple of type (iiibiiay) describing a pixbuf with width,
|
||||
height, rowstride, has-alpha, bits-per-sample, and image data
|
||||
"description": an optional short description (1-2 lines)
|
||||
*/
|
||||
void nsGNOMEShellSearchProvider::AppendResultID(DBusMessageIter* aIter,
|
||||
const char* aID) {
|
||||
+ int index = GetIndexFromIDKey(aID);
|
||||
nsCOMPtr<nsINavHistoryResultNode> child;
|
||||
- mHistResultContainer->GetChild(GetIndexFromIDKey(aID), getter_AddRefs(child));
|
||||
+ mHistResultContainer->GetChild(index, getter_AddRefs(child));
|
||||
nsAutoCString title;
|
||||
- if (NS_FAILED(child->GetTitle(title))) {
|
||||
- return;
|
||||
- }
|
||||
+ nsAutoCString uri;
|
||||
+ child->GetTitle(title);
|
||||
+ child->GetUri(uri);
|
||||
|
||||
- if (title.IsEmpty()) {
|
||||
- if (NS_FAILED(child->GetUri(title)) || title.IsEmpty()) {
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
+ const char* titleStr = !(title.IsEmpty()) ? title.get() : uri.get();
|
||||
+ const char* descStr = uri.get();
|
||||
|
||||
- const char* titleStr = title.get();
|
||||
appendStringDictionary(aIter, "id", aID);
|
||||
appendStringDictionary(aIter, "name", titleStr);
|
||||
- appendStringDictionary(aIter, "gicon", "text-html");
|
||||
+ appendStringDictionary(aIter, "description", descStr);
|
||||
+ if (mHistoryIcons[index].GetSearchSerial() == mSearchSerial) {
|
||||
+ mHistoryIcons[index].AppendIcon(aIter);
|
||||
+ } else {
|
||||
+ appendStringDictionary(aIter, "gicon", "text-html");
|
||||
+ }
|
||||
}
|
||||
|
||||
void nsGNOMEShellSearchProvider::AppendSearchID(DBusMessageIter* aIter,
|
||||
const char* aID) {
|
||||
if (strlen(aID) < KEYWORD_SEARCH_STRING_LEN + 2) {
|
||||
return;
|
||||
}
|
||||
appendStringDictionary(aIter, "id", KEYWORD_SEARCH_STRING);
|
||||
diff --git a/browser/components/shell/nsGNOMEShellSearchProvider.h b/browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
--- a/browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
+++ b/browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
@@ -7,49 +7,81 @@
|
||||
|
||||
#ifndef __nsGNOMEShellSearchProvider_h__
|
||||
#define __nsGNOMEShellSearchProvider_h__
|
||||
|
||||
#include "mozilla/DBusHelpers.h"
|
||||
#include "nsINavHistoryService.h"
|
||||
#include "nsUnixRemoteServer.h"
|
||||
#include "nsCOMPtr.h"
|
||||
+#include "mozilla/UniquePtr.h"
|
||||
+
|
||||
+#define MAX_SEARCH_RESULTS_NUM 9
|
||||
+
|
||||
+class GnomeHistoryIcon {
|
||||
+ public:
|
||||
+ GnomeHistoryIcon() : mSearchSerial(-1), mWidth(0), mHeight(0){};
|
||||
+
|
||||
+ // From which search is this icon
|
||||
+ void Set(int aSearchSerial, mozilla::UniquePtr<uint8_t[]> aData, int aWidth,
|
||||
+ int aHeight) {
|
||||
+ mSearchSerial = aSearchSerial;
|
||||
+ mWidth = aWidth;
|
||||
+ mHeight = aHeight;
|
||||
+ mData = std::move(aData);
|
||||
+ }
|
||||
+
|
||||
+ int GetSearchSerial() { return mSearchSerial; }
|
||||
+ void AppendIcon(DBusMessageIter* aIter);
|
||||
+
|
||||
+ private:
|
||||
+ int mSearchSerial;
|
||||
+ mozilla::UniquePtr<uint8_t[]> mData;
|
||||
+ int mWidth;
|
||||
+ int mHeight;
|
||||
+};
|
||||
|
||||
class nsGNOMEShellSearchProvider : public nsUnixRemoteServer {
|
||||
public:
|
||||
- nsGNOMEShellSearchProvider() : mConnection(nullptr) {}
|
||||
+ nsGNOMEShellSearchProvider();
|
||||
~nsGNOMEShellSearchProvider() { Shutdown(); }
|
||||
|
||||
nsresult Startup();
|
||||
void Shutdown();
|
||||
|
||||
DBusHandlerResult HandleDBusMessage(DBusConnection* aConnection,
|
||||
DBusMessage* msg);
|
||||
void UnregisterDBusInterface(DBusConnection* aConnection);
|
||||
|
||||
+ int GetSearchSerial() { return mSearchSerial; }
|
||||
+ void SetHistoryIcon(int aSearchSerial, mozilla::UniquePtr<uint8_t[]> aData,
|
||||
+ int aWidth, int aHeight, int aIconIndex);
|
||||
+
|
||||
private:
|
||||
DBusHandlerResult Introspect(DBusMessage* msg);
|
||||
|
||||
DBusHandlerResult GetInitialResultSet(DBusMessage* msg);
|
||||
DBusHandlerResult GetSubsearchResultSet(DBusMessage* msg);
|
||||
DBusHandlerResult GetResultMetas(DBusMessage* msg);
|
||||
DBusHandlerResult ActivateResult(DBusMessage* msg);
|
||||
DBusHandlerResult LaunchSearch(DBusMessage* msg);
|
||||
|
||||
- nsresult QueryHistory(const char* aSearchTerm);
|
||||
+ nsresult NewHistorySearch(const char* aSearchTerm);
|
||||
void GetIDKeyForURI(int aIndex, nsAutoCString& aUri, nsAutoCString& aIDKey);
|
||||
int GetIndexFromIDKey(const char* aIDKey);
|
||||
bool IsHistoryResultNodeURI(nsINavHistoryResultNode* aHistoryNode);
|
||||
void AppendResultID(DBusMessageIter* aIter, const char* aID);
|
||||
void AppendSearchID(DBusMessageIter* aIter, const char* aID);
|
||||
void ComposeSearchResultReply(DBusMessage* aReply, const char* aSearchTerm);
|
||||
void LaunchWithID(const char* aID, uint32_t aTimeStamp);
|
||||
void LaunchWithAllResults(uint32_t aTimeStamp);
|
||||
|
||||
// The connection is owned by DBus library
|
||||
RefPtr<DBusConnection> mConnection;
|
||||
nsCOMPtr<nsINavHistoryContainerResultNode> mHistResultContainer;
|
||||
nsCOMPtr<nsINavHistoryService> mHistoryService;
|
||||
nsAutoCStringN<32> mSearchTerm;
|
||||
nsAutoCString mGnomeSearchTitle;
|
||||
+ int mSearchSerial;
|
||||
+ GnomeHistoryIcon mHistoryIcons[MAX_SEARCH_RESULTS_NUM];
|
||||
};
|
||||
|
||||
#endif // __nsGNOMEShellSearchProvider_h__
|
||||
|
@ -1,7 +1,11 @@
|
||||
diff -up firefox-73.0/browser/components/shell/moz.build.gnome-shell-search-provider firefox-73.0/browser/components/shell/moz.build
|
||||
--- firefox-73.0/browser/components/shell/moz.build.gnome-shell-search-provider 2020-02-07 22:12:59.000000000 +0100
|
||||
+++ firefox-73.0/browser/components/shell/moz.build 2020-02-11 09:03:31.638803105 +0100
|
||||
@@ -34,6 +34,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gt
|
||||
diff -up firefox-75.0/browser/components/shell/moz.build.gnome-shell-search-provider firefox-75.0/browser/components/shell/moz.build
|
||||
--- firefox-75.0/browser/components/shell/moz.build.gnome-shell-search-provider 2020-03-09 20:05:31.000000000 +0100
|
||||
+++ firefox-75.0/browser/components/shell/moz.build 2020-03-11 10:10:14.935836645 +0100
|
||||
@@ -36,10 +36,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gt
|
||||
XPIDL_SOURCES += [
|
||||
'nsIGNOMEShellService.idl',
|
||||
]
|
||||
-
|
||||
SOURCES += [
|
||||
'nsGNOMEShellService.cpp',
|
||||
]
|
||||
@ -9,11 +13,13 @@ diff -up firefox-73.0/browser/components/shell/moz.build.gnome-shell-search-prov
|
||||
+ SOURCES += [
|
||||
+ 'nsGNOMEShellSearchProvider.cpp',
|
||||
+ ]
|
||||
+
|
||||
+ LOCAL_INCLUDES += [
|
||||
+ '/netwerk/base',
|
||||
+ ]
|
||||
elif CONFIG['OS_ARCH'] == 'WINNT':
|
||||
XPIDL_SOURCES += [
|
||||
'nsIWindowsShellService.idl',
|
||||
@@ -60,6 +65,8 @@ for var in ('MOZ_APP_NAME', 'MOZ_APP_VER
|
||||
@@ -66,6 +72,8 @@ for var in ('MOZ_APP_NAME', 'MOZ_APP_VER
|
||||
DEFINES[var] = '"%s"' % CONFIG[var]
|
||||
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
@ -22,10 +28,10 @@ diff -up firefox-73.0/browser/components/shell/moz.build.gnome-shell-search-prov
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Firefox', 'Shell Integration')
|
||||
diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gnome-shell-search-provider firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp
|
||||
--- firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gnome-shell-search-provider 2020-02-11 09:00:59.350512802 +0100
|
||||
+++ firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp 2020-02-11 09:00:59.350512802 +0100
|
||||
@@ -0,0 +1,621 @@
|
||||
diff -up firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gnome-shell-search-provider firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp
|
||||
--- firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gnome-shell-search-provider 2020-03-10 15:44:12.305387571 +0100
|
||||
+++ firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp 2020-03-11 10:18:05.196419671 +0100
|
||||
@@ -0,0 +1,796 @@
|
||||
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
+/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
+ */
|
||||
@ -35,6 +41,9 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+
|
||||
+#include "nsGNOMEShellSearchProvider.h"
|
||||
+
|
||||
+#include "nsWeakReference.h"
|
||||
+#include "nsNetCID.h"
|
||||
+#include "nsIOService.h"
|
||||
+#include "nsIBaseWindow.h"
|
||||
+#include "nsIDocShell.h"
|
||||
+#include "nsPIDOMWindow.h"
|
||||
@ -52,11 +61,17 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+#include "nsIFaviconService.h"
|
||||
+#include "RemoteUtils.h"
|
||||
+#include "nsIStringBundle.h"
|
||||
+#include "imgIContainer.h"
|
||||
+#include "imgITools.h"
|
||||
+
|
||||
+#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
+
|
||||
+#include <dbus/dbus.h>
|
||||
+#include <dbus/dbus-glib-lowlevel.h>
|
||||
+
|
||||
+#define MAX_SEARCH_RESULTS_NUM 9
|
||||
+using namespace mozilla;
|
||||
+using namespace mozilla::gfx;
|
||||
+
|
||||
+#define KEYWORD_SEARCH_STRING "special:search"
|
||||
+#define KEYWORD_SEARCH_STRING_LEN 14
|
||||
+
|
||||
@ -114,7 +129,25 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ return DBUS_HANDLER_RESULT_HANDLED;
|
||||
+}
|
||||
+
|
||||
+nsresult nsGNOMEShellSearchProvider::QueryHistory(const char* aSearchTerm) {
|
||||
+nsGNOMEShellSearchProvider::nsGNOMEShellSearchProvider()
|
||||
+ : mConnection(nullptr), mSearchSerial(0) {
|
||||
+ memset(mHistoryIcons, 0, sizeof(mHistoryIcons));
|
||||
+}
|
||||
+
|
||||
+void nsGNOMEShellSearchProvider::SetHistoryIcon(int aSearchSerial,
|
||||
+ UniquePtr<uint8_t[]> aData,
|
||||
+ int aWidth, int aHeight,
|
||||
+ int aIconIndex) {
|
||||
+ MOZ_ASSERT(mSearchSerial == aSearchSerial);
|
||||
+ MOZ_ASSERT(aIconIndex < MAX_SEARCH_RESULTS_NUM);
|
||||
+ mHistoryIcons[aIconIndex].Set(aSearchSerial, std::move(aData), aWidth,
|
||||
+ aHeight);
|
||||
+}
|
||||
+
|
||||
+nsresult nsGNOMEShellSearchProvider::NewHistorySearch(const char* aSearchTerm) {
|
||||
+ // Initialize new search which invalidates all preview ones
|
||||
+ mSearchSerial++;
|
||||
+
|
||||
+ nsresult rv;
|
||||
+ nsCOMPtr<nsINavHistoryQuery> histQuery;
|
||||
+ rv = mHistoryService->GetNewQuery(getter_AddRefs(histQuery));
|
||||
@ -198,6 +231,100 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ return atoi(tmp);
|
||||
+}
|
||||
+
|
||||
+class AsyncFaviconDataReady final : public nsIFaviconDataCallback {
|
||||
+ public:
|
||||
+ NS_DECL_ISUPPORTS
|
||||
+ NS_DECL_NSIFAVICONDATACALLBACK
|
||||
+
|
||||
+ AsyncFaviconDataReady(nsGNOMEShellSearchProvider* aSearchProvider,
|
||||
+ int aIconIndex, int aSearchSerial)
|
||||
+ : mSearchProvider(aSearchProvider),
|
||||
+ mIconIndex(aIconIndex),
|
||||
+ mSearchSerial(aSearchSerial){};
|
||||
+
|
||||
+ private:
|
||||
+ ~AsyncFaviconDataReady() {}
|
||||
+
|
||||
+ nsGNOMEShellSearchProvider* mSearchProvider;
|
||||
+ int mIconIndex;
|
||||
+ int mSearchSerial;
|
||||
+};
|
||||
+
|
||||
+NS_IMPL_ISUPPORTS(AsyncFaviconDataReady, nsIFaviconDataCallback)
|
||||
+
|
||||
+// Inspired by SurfaceToPackedBGRA
|
||||
+static UniquePtr<uint8_t[]> SurfaceToPackedRGBA(DataSourceSurface* aSurface) {
|
||||
+ IntSize size = aSurface->GetSize();
|
||||
+ CheckedInt<size_t> bufferSize =
|
||||
+ CheckedInt<size_t>(size.width * 4) * CheckedInt<size_t>(size.height);
|
||||
+ if (!bufferSize.isValid()) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ UniquePtr<uint8_t[]> imageBuffer(new (std::nothrow)
|
||||
+ uint8_t[bufferSize.value()]);
|
||||
+ if (!imageBuffer) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ DataSourceSurface::MappedSurface map;
|
||||
+ if (!aSurface->Map(DataSourceSurface::MapType::READ, &map)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ // Convert BGRA to RGBA
|
||||
+ uint32_t* aSrc = (uint32_t*)map.mData;
|
||||
+ uint32_t* aDst = (uint32_t*)imageBuffer.get();
|
||||
+ for (int i = 0; i < size.width * size.height; i++, aDst++, aSrc++) {
|
||||
+ *aDst = *aSrc & 0xff00ff00;
|
||||
+ *aDst |= (*aSrc & 0xff) << 16;
|
||||
+ *aDst |= (*aSrc & 0xff0000) >> 16;
|
||||
+ }
|
||||
+
|
||||
+ aSurface->Unmap();
|
||||
+
|
||||
+ return imageBuffer;
|
||||
+}
|
||||
+
|
||||
+NS_IMETHODIMP
|
||||
+AsyncFaviconDataReady::OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
|
||||
+ const uint8_t* aData,
|
||||
+ const nsACString& aMimeType,
|
||||
+ uint16_t aWidth) {
|
||||
+ // This is a callback from some previous search so we don't want it
|
||||
+ if (mSearchSerial != mSearchProvider->GetSearchSerial() || !aData ||
|
||||
+ !aDataLen) {
|
||||
+ return NS_ERROR_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ // Decode the image from the format it was returned to us in (probably PNG)
|
||||
+ nsCOMPtr<imgIContainer> container;
|
||||
+ nsCOMPtr<imgITools> imgtool = do_CreateInstance("@mozilla.org/image/tools;1");
|
||||
+ nsresult rv = imgtool->DecodeImageFromBuffer(
|
||||
+ reinterpret_cast<const char*>(aData), aDataLen, aMimeType,
|
||||
+ getter_AddRefs(container));
|
||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||
+
|
||||
+ RefPtr<SourceSurface> surface = container->GetFrame(
|
||||
+ imgIContainer::FRAME_FIRST,
|
||||
+ imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_ASYNC_NOTIFY);
|
||||
+
|
||||
+ if (!surface || surface->GetFormat() != SurfaceFormat::B8G8R8A8) {
|
||||
+ return NS_ERROR_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ // Allocate a new buffer that we own.
|
||||
+ RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
|
||||
+ UniquePtr<uint8_t[]> data = SurfaceToPackedRGBA(dataSurface);
|
||||
+ if (!data) {
|
||||
+ return NS_ERROR_OUT_OF_MEMORY;
|
||||
+ }
|
||||
+
|
||||
+ mSearchProvider->SetHistoryIcon(mSearchSerial, std::move(data),
|
||||
+ surface->GetSize().width,
|
||||
+ surface->GetSize().height, mIconIndex);
|
||||
+ return NS_OK;
|
||||
+}
|
||||
+
|
||||
+void nsGNOMEShellSearchProvider::ComposeSearchResultReply(
|
||||
+ DBusMessage* reply, const char* aSearchTerm) {
|
||||
+ uint32_t childCount = 0;
|
||||
@ -206,6 +333,11 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Obtain the favicon service and get the favicon for the specified page
|
||||
+ nsCOMPtr<nsIFaviconService> favIconSvc(
|
||||
+ do_GetService("@mozilla.org/browser/favicon-service;1"));
|
||||
+ nsCOMPtr<nsIIOService> ios(do_GetService(NS_IOSERVICE_CONTRACTID));
|
||||
+
|
||||
+ if (childCount > MAX_SEARCH_RESULTS_NUM) {
|
||||
+ childCount = MAX_SEARCH_RESULTS_NUM;
|
||||
+ }
|
||||
@ -228,6 +360,12 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ nsAutoCString uri;
|
||||
+ child->GetUri(uri);
|
||||
+
|
||||
+ nsCOMPtr<nsIURI> iconIri;
|
||||
+ ios->NewURI(uri, nullptr, nullptr, getter_AddRefs(iconIri));
|
||||
+ nsCOMPtr<nsIFaviconDataCallback> callback =
|
||||
+ new AsyncFaviconDataReady(this, i, mSearchSerial);
|
||||
+ favIconSvc->GetFaviconDataForPage(iconIri, callback, 0);
|
||||
+
|
||||
+ nsAutoCString idKey;
|
||||
+ GetIDKeyForURI(i, uri, idKey);
|
||||
+
|
||||
@ -254,7 +392,7 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ reply = dbus_message_new_error(aMsg, DBUS_BUS_NAME, "Wrong argument");
|
||||
+ } else {
|
||||
+ reply = dbus_message_new_method_return(aMsg);
|
||||
+ nsresult rv = QueryHistory(stringArray[0]);
|
||||
+ nsresult rv = NewHistorySearch(stringArray[0]);
|
||||
+ if (NS_SUCCEEDED(rv)) {
|
||||
+ ComposeSearchResultReply(reply, stringArray[0]);
|
||||
+ }
|
||||
@ -282,7 +420,7 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ reply = dbus_message_new_error(aMsg, DBUS_BUS_NAME, "Wrong argument");
|
||||
+ } else {
|
||||
+ reply = dbus_message_new_method_return(aMsg);
|
||||
+ nsresult rv = QueryHistory(stringArray[0]);
|
||||
+ nsresult rv = NewHistorySearch(stringArray[0]);
|
||||
+ if (NS_SUCCEEDED(rv)) {
|
||||
+ ComposeSearchResultReply(reply, stringArray[0]);
|
||||
+ }
|
||||
@ -313,6 +451,47 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ dbus_message_iter_close_container(aIter, &iterDict);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ "icon-data": a tuple of type (iiibiiay) describing a pixbuf with width,
|
||||
+ height, rowstride, has-alpha,
|
||||
+ bits-per-sample, channels,
|
||||
+ image data
|
||||
+*/
|
||||
+void GnomeHistoryIcon::AppendIcon(DBusMessageIter* aIter) {
|
||||
+ DBusMessageIter iterDict, iterVar, iterStruct;
|
||||
+ dbus_message_iter_open_container(aIter, DBUS_TYPE_DICT_ENTRY, nullptr,
|
||||
+ &iterDict);
|
||||
+ const char* key = "icon-data";
|
||||
+ dbus_message_iter_append_basic(&iterDict, DBUS_TYPE_STRING, &key);
|
||||
+ dbus_message_iter_open_container(&iterDict, DBUS_TYPE_VARIANT, "(iiibiiay)",
|
||||
+ &iterVar);
|
||||
+ dbus_message_iter_open_container(&iterVar, DBUS_TYPE_STRUCT, nullptr,
|
||||
+ &iterStruct);
|
||||
+
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &mWidth);
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &mHeight);
|
||||
+ int rowstride = mWidth * 4;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &rowstride);
|
||||
+ int hasAlpha = true;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_BOOLEAN, &hasAlpha);
|
||||
+ int bitsPerSample = 8;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &bitsPerSample);
|
||||
+ int channels = 4;
|
||||
+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &channels);
|
||||
+
|
||||
+ DBusMessageIter iterArray;
|
||||
+ dbus_message_iter_open_container(&iterStruct, DBUS_TYPE_ARRAY, "y",
|
||||
+ &iterArray);
|
||||
+ unsigned char* array = mData.get();
|
||||
+ dbus_message_iter_append_fixed_array(&iterArray, DBUS_TYPE_BYTE, &array,
|
||||
+ mWidth * mHeight * 4);
|
||||
+ dbus_message_iter_close_container(&iterStruct, &iterArray);
|
||||
+
|
||||
+ dbus_message_iter_close_container(&iterVar, &iterStruct);
|
||||
+ dbus_message_iter_close_container(&iterDict, &iterVar);
|
||||
+ dbus_message_iter_close_container(aIter, &iterDict);
|
||||
+}
|
||||
+
|
||||
+/* We can return those fields at GetResultMetas:
|
||||
+ "id": the result ID
|
||||
+ "name": the display name for the result
|
||||
@ -325,23 +504,25 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+*/
|
||||
+void nsGNOMEShellSearchProvider::AppendResultID(DBusMessageIter* aIter,
|
||||
+ const char* aID) {
|
||||
+ int index = GetIndexFromIDKey(aID);
|
||||
+ nsCOMPtr<nsINavHistoryResultNode> child;
|
||||
+ mHistResultContainer->GetChild(GetIndexFromIDKey(aID), getter_AddRefs(child));
|
||||
+ mHistResultContainer->GetChild(index, getter_AddRefs(child));
|
||||
+ nsAutoCString title;
|
||||
+ if (NS_FAILED(child->GetTitle(title))) {
|
||||
+ return;
|
||||
+ }
|
||||
+ nsAutoCString uri;
|
||||
+ child->GetTitle(title);
|
||||
+ child->GetUri(uri);
|
||||
+
|
||||
+ if (title.IsEmpty()) {
|
||||
+ if (NS_FAILED(child->GetUri(title)) || title.IsEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ const char* titleStr = !(title.IsEmpty()) ? title.get() : uri.get();
|
||||
+ const char* descStr = uri.get();
|
||||
+
|
||||
+ const char* titleStr = title.get();
|
||||
+ appendStringDictionary(aIter, "id", aID);
|
||||
+ appendStringDictionary(aIter, "name", titleStr);
|
||||
+ appendStringDictionary(aIter, "gicon", "text-html");
|
||||
+ appendStringDictionary(aIter, "description", descStr);
|
||||
+ if (mHistoryIcons[index].GetSearchSerial() == mSearchSerial) {
|
||||
+ mHistoryIcons[index].AppendIcon(aIter);
|
||||
+ } else {
|
||||
+ appendStringDictionary(aIter, "gicon", "text-html");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nsGNOMEShellSearchProvider::AppendSearchID(DBusMessageIter* aIter,
|
||||
@ -647,10 +828,10 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.cpp.gn
|
||||
+ // dbus_connection_unref() will be called by RefPtr here.
|
||||
+ mConnection = nullptr;
|
||||
+}
|
||||
diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnome-shell-search-provider firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
--- firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnome-shell-search-provider 2020-02-11 09:00:59.350512802 +0100
|
||||
+++ firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h 2020-02-11 09:00:59.350512802 +0100
|
||||
@@ -0,0 +1,55 @@
|
||||
diff -up firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnome-shell-search-provider firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.h
|
||||
--- firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnome-shell-search-provider 2020-03-10 15:44:12.305387571 +0100
|
||||
+++ firefox-75.0/browser/components/shell/nsGNOMEShellSearchProvider.h 2020-03-10 15:44:12.308387552 +0100
|
||||
@@ -0,0 +1,87 @@
|
||||
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
+/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
+ */
|
||||
@ -665,10 +846,36 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnom
|
||||
+#include "nsINavHistoryService.h"
|
||||
+#include "nsUnixRemoteServer.h"
|
||||
+#include "nsCOMPtr.h"
|
||||
+#include "mozilla/UniquePtr.h"
|
||||
+
|
||||
+#define MAX_SEARCH_RESULTS_NUM 9
|
||||
+
|
||||
+class GnomeHistoryIcon {
|
||||
+ public:
|
||||
+ GnomeHistoryIcon() : mSearchSerial(-1), mWidth(0), mHeight(0){};
|
||||
+
|
||||
+ // From which search is this icon
|
||||
+ void Set(int aSearchSerial, mozilla::UniquePtr<uint8_t[]> aData, int aWidth,
|
||||
+ int aHeight) {
|
||||
+ mSearchSerial = aSearchSerial;
|
||||
+ mWidth = aWidth;
|
||||
+ mHeight = aHeight;
|
||||
+ mData = std::move(aData);
|
||||
+ }
|
||||
+
|
||||
+ int GetSearchSerial() { return mSearchSerial; }
|
||||
+ void AppendIcon(DBusMessageIter* aIter);
|
||||
+
|
||||
+ private:
|
||||
+ int mSearchSerial;
|
||||
+ mozilla::UniquePtr<uint8_t[]> mData;
|
||||
+ int mWidth;
|
||||
+ int mHeight;
|
||||
+};
|
||||
+
|
||||
+class nsGNOMEShellSearchProvider : public nsUnixRemoteServer {
|
||||
+ public:
|
||||
+ nsGNOMEShellSearchProvider() : mConnection(nullptr) {}
|
||||
+ nsGNOMEShellSearchProvider();
|
||||
+ ~nsGNOMEShellSearchProvider() { Shutdown(); }
|
||||
+
|
||||
+ nsresult Startup();
|
||||
@ -678,6 +885,10 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnom
|
||||
+ DBusMessage* msg);
|
||||
+ void UnregisterDBusInterface(DBusConnection* aConnection);
|
||||
+
|
||||
+ int GetSearchSerial() { return mSearchSerial; }
|
||||
+ void SetHistoryIcon(int aSearchSerial, mozilla::UniquePtr<uint8_t[]> aData,
|
||||
+ int aWidth, int aHeight, int aIconIndex);
|
||||
+
|
||||
+ private:
|
||||
+ DBusHandlerResult Introspect(DBusMessage* msg);
|
||||
+
|
||||
@ -687,7 +898,7 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnom
|
||||
+ DBusHandlerResult ActivateResult(DBusMessage* msg);
|
||||
+ DBusHandlerResult LaunchSearch(DBusMessage* msg);
|
||||
+
|
||||
+ nsresult QueryHistory(const char* aSearchTerm);
|
||||
+ nsresult NewHistorySearch(const char* aSearchTerm);
|
||||
+ void GetIDKeyForURI(int aIndex, nsAutoCString& aUri, nsAutoCString& aIDKey);
|
||||
+ int GetIndexFromIDKey(const char* aIDKey);
|
||||
+ bool IsHistoryResultNodeURI(nsINavHistoryResultNode* aHistoryNode);
|
||||
@ -703,13 +914,15 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellSearchProvider.h.gnom
|
||||
+ nsCOMPtr<nsINavHistoryService> mHistoryService;
|
||||
+ nsAutoCStringN<32> mSearchTerm;
|
||||
+ nsAutoCString mGnomeSearchTitle;
|
||||
+ int mSearchSerial;
|
||||
+ GnomeHistoryIcon mHistoryIcons[MAX_SEARCH_RESULTS_NUM];
|
||||
+};
|
||||
+
|
||||
+#endif // __nsGNOMEShellSearchProvider_h__
|
||||
diff -up firefox-73.0/browser/components/shell/nsGNOMEShellService.cpp.gnome-shell-search-provider firefox-73.0/browser/components/shell/nsGNOMEShellService.cpp
|
||||
--- firefox-73.0/browser/components/shell/nsGNOMEShellService.cpp.gnome-shell-search-provider 2020-02-07 22:12:59.000000000 +0100
|
||||
+++ firefox-73.0/browser/components/shell/nsGNOMEShellService.cpp 2020-02-11 09:00:59.350512802 +0100
|
||||
@@ -89,6 +89,14 @@ nsresult nsGNOMEShellService::Init() {
|
||||
diff -up firefox-75.0/browser/components/shell/nsGNOMEShellService.cpp.gnome-shell-search-provider firefox-75.0/browser/components/shell/nsGNOMEShellService.cpp
|
||||
--- firefox-75.0/browser/components/shell/nsGNOMEShellService.cpp.gnome-shell-search-provider 2020-03-09 20:05:31.000000000 +0100
|
||||
+++ firefox-75.0/browser/components/shell/nsGNOMEShellService.cpp 2020-03-10 15:44:12.305387571 +0100
|
||||
@@ -101,6 +101,14 @@ nsresult nsGNOMEShellService::Init() {
|
||||
|
||||
if (!giovfs && !gsettings) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
@ -724,9 +937,9 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellService.cpp.gnome-she
|
||||
// Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use
|
||||
// the locale encoding. If it's not set, they use UTF-8.
|
||||
mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nullptr;
|
||||
diff -up firefox-73.0/browser/components/shell/nsGNOMEShellService.h.gnome-shell-search-provider firefox-73.0/browser/components/shell/nsGNOMEShellService.h
|
||||
--- firefox-73.0/browser/components/shell/nsGNOMEShellService.h.gnome-shell-search-provider 2020-02-07 22:12:59.000000000 +0100
|
||||
+++ firefox-73.0/browser/components/shell/nsGNOMEShellService.h 2020-02-11 09:00:59.350512802 +0100
|
||||
diff -up firefox-75.0/browser/components/shell/nsGNOMEShellService.h.gnome-shell-search-provider firefox-75.0/browser/components/shell/nsGNOMEShellService.h
|
||||
--- firefox-75.0/browser/components/shell/nsGNOMEShellService.h.gnome-shell-search-provider 2020-03-09 20:05:31.000000000 +0100
|
||||
+++ firefox-75.0/browser/components/shell/nsGNOMEShellService.h 2020-03-10 15:44:12.305387571 +0100
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "nsToolkitShellService.h"
|
||||
#include "nsString.h"
|
||||
@ -747,10 +960,10 @@ diff -up firefox-73.0/browser/components/shell/nsGNOMEShellService.h.gnome-shell
|
||||
bool GetAppPathFromLauncher();
|
||||
bool mUseLocaleFilenames;
|
||||
nsCString mAppPath;
|
||||
diff -up firefox-73.0/browser/locales/en-US/chrome/browser/browser.properties.gnome-shell-search-provider firefox-73.0/browser/locales/en-US/chrome/browser/browser.properties
|
||||
--- firefox-73.0/browser/locales/en-US/chrome/browser/browser.properties.gnome-shell-search-provider 2020-02-07 22:13:00.000000000 +0100
|
||||
+++ firefox-73.0/browser/locales/en-US/chrome/browser/browser.properties 2020-02-11 09:00:59.350512802 +0100
|
||||
@@ -1047,3 +1047,7 @@ confirmationHint.breakageReport.label =
|
||||
diff -up firefox-75.0/browser/locales/en-US/chrome/browser/browser.properties.gnome-shell-search-provider firefox-75.0/browser/locales/en-US/chrome/browser/browser.properties
|
||||
--- firefox-75.0/browser/locales/en-US/chrome/browser/browser.properties.gnome-shell-search-provider 2020-03-09 20:05:31.000000000 +0100
|
||||
+++ firefox-75.0/browser/locales/en-US/chrome/browser/browser.properties 2020-03-10 15:44:12.306387565 +0100
|
||||
@@ -1044,3 +1044,7 @@ confirmationHint.breakageReport.label =
|
||||
# Used by the export of user's live bookmarks to an OPML file as a title for the file.
|
||||
# %S will be replaced with brandShortName
|
||||
livebookmarkMigration.title = %S Live Bookmarks
|
||||
@ -758,9 +971,9 @@ diff -up firefox-73.0/browser/locales/en-US/chrome/browser/browser.properties.gn
|
||||
+# LOCALIZATION NOTE (gnomeSearchProviderSearch):
|
||||
+# Used for search by Gnome Shell activity screen, %s is a searched string.
|
||||
+gnomeSearchProviderSearch=Search the web for “%s”
|
||||
diff -up firefox-73.0/toolkit/components/remote/moz.build.gnome-shell-search-provider firefox-73.0/toolkit/components/remote/moz.build
|
||||
--- firefox-73.0/toolkit/components/remote/moz.build.gnome-shell-search-provider 2020-02-07 22:13:54.000000000 +0100
|
||||
+++ firefox-73.0/toolkit/components/remote/moz.build 2020-02-11 09:00:59.351512811 +0100
|
||||
diff -up firefox-75.0/toolkit/components/remote/moz.build.gnome-shell-search-provider firefox-75.0/toolkit/components/remote/moz.build
|
||||
--- firefox-75.0/toolkit/components/remote/moz.build.gnome-shell-search-provider 2020-03-09 20:07:32.000000000 +0100
|
||||
+++ firefox-75.0/toolkit/components/remote/moz.build 2020-03-10 15:44:12.306387565 +0100
|
||||
@@ -25,6 +25,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk'
|
||||
'nsDBusRemoteServer.cpp',
|
||||
]
|
||||
@ -772,9 +985,9 @@ diff -up firefox-73.0/toolkit/components/remote/moz.build.gnome-shell-search-pro
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
diff -up firefox-73.0/toolkit/components/remote/nsDBusRemoteServer.cpp.gnome-shell-search-provider firefox-73.0/toolkit/components/remote/nsDBusRemoteServer.cpp
|
||||
--- firefox-73.0/toolkit/components/remote/nsDBusRemoteServer.cpp.gnome-shell-search-provider 2020-02-07 22:13:54.000000000 +0100
|
||||
+++ firefox-73.0/toolkit/components/remote/nsDBusRemoteServer.cpp 2020-02-11 09:00:59.351512811 +0100
|
||||
diff -up firefox-75.0/toolkit/components/remote/nsDBusRemoteServer.cpp.gnome-shell-search-provider firefox-75.0/toolkit/components/remote/nsDBusRemoteServer.cpp
|
||||
--- firefox-75.0/toolkit/components/remote/nsDBusRemoteServer.cpp.gnome-shell-search-provider 2020-03-09 20:07:00.000000000 +0100
|
||||
+++ firefox-75.0/toolkit/components/remote/nsDBusRemoteServer.cpp 2020-03-10 15:44:12.306387565 +0100
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
4
sources
4
sources
@ -1,3 +1,3 @@
|
||||
SHA512 (cbindgen-vendor.tar.xz) = a12d9dd45301614f3a7fcd77f61e3f731718fc418fcf84b0ac7363ef4ddd8ff60e057febef917620ac89d2d47d76b8dccfa71405935e346b849b93425732016a
|
||||
SHA512 (firefox-75.0b1.source.tar.xz) = 8b2a7f0609dc416ca802cbb8d7449b3a403dbc02a5c9f4781d3811d83c5d85584429a3196384b4d7264997049a6ae6ede6e9083f5dd42436278170b948916d30
|
||||
SHA512 (firefox-langpacks-75.0b1-20200310.tar.xz) = e243083e29fe60b094e929f1dde01a7721bde7e7f816260c00448fc0610b7aa06fe9cd68a39c865a2a0b675e0a84e6a6baa07cde91be650c6ee49f146350fd24
|
||||
SHA512 (firefox-langpacks-75.0b2-20200311.tar.xz) = 43937ba89768e7a04be09bd6c71bd8ecd304cb3426de7a85196697010c72ce7b76085c7df6f5cbc3e5858f6db8a09809786af0ea10c35815a05e427a3d5bb4e7
|
||||
SHA512 (firefox-75.0b2.source.tar.xz) = 22292e90def9bc99c788a4eed13b7b887ccf95d7904ba649773c557854ffd4e22e3798404753a40146ef612c9bfbd71822f6b1547f0cfee6df8c52b47727f48c
|
||||
|
Loading…
x
Reference in New Issue
Block a user