Skip to content

Commit

Permalink
Merge inbound to mozilla-central r=merge a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoroiu committed Oct 30, 2017
2 parents e63df06 + 3cbf188 commit 50156f9
Show file tree
Hide file tree
Showing 72 changed files with 602 additions and 300 deletions.
4 changes: 2 additions & 2 deletions browser/components/dirprovider/DirectoryProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)

localePlugins->AppendNative(NS_LITERAL_CSTRING("locale"));

nsCString defLocale;
nsAutoCString defLocale;
rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale",
getter_Copies(defLocale));
defLocale);
if (NS_SUCCEEDED(rv)) {

nsCOMPtr<nsIFile> defLocalePlugins;
Expand Down
8 changes: 4 additions & 4 deletions chrome/nsChromeRegistryChrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ nsChromeRegistryChrome::Init()
if (!prefs) {
NS_WARNING("Could not get pref service!");
} else {
nsCString provider;
rv = prefs->GetCharPref(SELECTED_SKIN_PREF, getter_Copies(provider));
nsAutoCString provider;
rv = prefs->GetCharPref(SELECTED_SKIN_PREF, provider);
if (NS_SUCCEEDED(rv))
mSelectedSkin = provider;

Expand Down Expand Up @@ -275,8 +275,8 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
NS_ConvertUTF16toUTF8 pref(someData);

if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
nsCString provider;
rv = prefs->GetCharPref(pref.get(), getter_Copies(provider));
nsAutoCString provider;
rv = prefs->GetCharPref(pref.get(), provider);
if (NS_FAILED(rv)) {
NS_ERROR("Couldn't get new skin pref!");
return rv;
Expand Down
Binary file modified config/external/icu/data/icudt59l.dat
Binary file not shown.
25 changes: 25 additions & 0 deletions dom/indexedDB/ActorsChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@ BackgroundFactoryRequestChild::BackgroundFactoryRequestChild(
uint64_t aRequestedVersion)
: BackgroundRequestChildBase(aOpenRequest)
, mFactory(aFactory)
, mDatabaseActor(nullptr)
, mRequestedVersion(aRequestedVersion)
, mIsDeleteOp(aIsDeleteOp)
{
Expand All @@ -1779,6 +1780,15 @@ BackgroundFactoryRequestChild::GetOpenDBRequest() const
return static_cast<IDBOpenDBRequest*>(mRequest.get());
}

void
BackgroundFactoryRequestChild::SetDatabaseActor(BackgroundDatabaseChild* aActor)
{
AssertIsOnOwningThread();
MOZ_ASSERT(!aActor || !mDatabaseActor);

mDatabaseActor = aActor;
}

bool
BackgroundFactoryRequestChild::HandleResponse(nsresult aResponse)
{
Expand All @@ -1790,6 +1800,11 @@ BackgroundFactoryRequestChild::HandleResponse(nsresult aResponse)

DispatchErrorEvent(mRequest, aResponse);

if (mDatabaseActor) {
mDatabaseActor->ReleaseDOMObject();
MOZ_ASSERT(!mDatabaseActor);
}

return true;
}

Expand All @@ -1808,13 +1823,16 @@ BackgroundFactoryRequestChild::HandleResponse(
IDBDatabase* database = databaseActor->GetDOMObject();
if (!database) {
databaseActor->EnsureDOMObject();
MOZ_ASSERT(mDatabaseActor);

database = databaseActor->GetDOMObject();
MOZ_ASSERT(database);

MOZ_ASSERT(!database->IsClosed());
}

MOZ_ASSERT(mDatabaseActor == databaseActor);

if (database->IsClosed()) {
// If the database was closed already, which is only possible if we fired an
// "upgradeneeded" event, then we shouldn't fire a "success" event here.
Expand All @@ -1827,6 +1845,7 @@ BackgroundFactoryRequestChild::HandleResponse(
}

databaseActor->ReleaseDOMObject();
MOZ_ASSERT(!mDatabaseActor);

return true;
}
Expand All @@ -1847,6 +1866,8 @@ BackgroundFactoryRequestChild::HandleResponse(

DispatchSuccessEvent(&helper, successEvent);

MOZ_ASSERT(!mDatabaseActor);

return true;
}

Expand Down Expand Up @@ -2095,6 +2116,8 @@ BackgroundDatabaseChild::EnsureDOMObject()

mDatabase = mTemporaryStrongDatabase;
mSpec.forget();

mOpenRequestActor->SetDatabaseActor(this);
}

void
Expand All @@ -2106,6 +2129,8 @@ BackgroundDatabaseChild::ReleaseDOMObject()
MOZ_ASSERT(mOpenRequestActor);
MOZ_ASSERT(mDatabase == mTemporaryStrongDatabase);

mOpenRequestActor->SetDatabaseActor(nullptr);

mOpenRequestActor = nullptr;

// This may be the final reference to the IDBDatabase object so we may end up
Expand Down
17 changes: 17 additions & 0 deletions dom/indexedDB/ActorsChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,20 @@ class BackgroundFactoryRequestChild final
friend class PermissionRequestParent;

RefPtr<IDBFactory> mFactory;

// Normally when opening of a database is successful, we receive a database
// actor in request response, so we can use it to call ReleaseDOMObject()
// which clears temporary strong reference to IDBDatabase.
// However, when there's an error, we don't receive a database actor and
// IDBRequest::mTransaction is already cleared (must be). So the only way how
// to call ReleaseDOMObject() is to have a back-reference to database actor.
// This creates a weak ref cycle between
// BackgroundFactoryRequestChild (using mDatabaseActor member) and
// BackgroundDatabaseChild actor (using mOpenRequestActor member).
// mDatabaseActor is set in EnsureDOMObject() and cleared in
// ReleaseDOMObject().
BackgroundDatabaseChild* mDatabaseActor;

const uint64_t mRequestedVersion;
const bool mIsDeleteOp;

Expand All @@ -270,6 +284,9 @@ class BackgroundFactoryRequestChild final
// Only destroyed by BackgroundFactoryChild.
~BackgroundFactoryRequestChild();

void
SetDatabaseActor(BackgroundDatabaseChild* aActor);

bool
HandleResponse(nsresult aResponse);

Expand Down
4 changes: 2 additions & 2 deletions extensions/auth/nsAuthGSSAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ static PRFuncPtr KLCacheHasValidTicketsPtr;
static nsresult
gssInit()
{
nsCString libPath;
nsAutoCString libPath;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->GetCharPref(kNegotiateAuthGssLib, getter_Copies(libPath));
prefs->GetCharPref(kNegotiateAuthGssLib, libPath);
prefs->GetBoolPref(kNegotiateAuthNativeImp, &gssNativeImp);
}

Expand Down
11 changes: 5 additions & 6 deletions extensions/pref/autoconfig/src/nsAutoConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr)
{

nsresult rv;
nsCString prefValue;
nsAutoCString prefValue;

/* Getting an email address through set of three preferences:
First getting a default account with
Expand All @@ -468,12 +468,12 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr)
*/

rv = mPrefBranch->GetCharPref("mail.accountmanager.defaultaccount",
getter_Copies(prefValue));
prefValue);
if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty()) {
emailAddr = NS_LITERAL_CSTRING("mail.account.") +
prefValue + NS_LITERAL_CSTRING(".identities");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
prefValue);
if (NS_FAILED(rv) || prefValue.IsEmpty())
return PromptForEMailAddress(emailAddr);
int32_t commandIndex = prefValue.FindChar(',');
Expand All @@ -482,15 +482,14 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr)
emailAddr = NS_LITERAL_CSTRING("mail.identity.") +
prefValue + NS_LITERAL_CSTRING(".useremail");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
prefValue);
if (NS_FAILED(rv) || prefValue.IsEmpty())
return PromptForEMailAddress(emailAddr);
emailAddr = prefValue;
}
else {
// look for 4.x pref in case we just migrated.
rv = mPrefBranch->GetCharPref("mail.identity.useremail",
getter_Copies(prefValue));
rv = mPrefBranch->GetCharPref("mail.identity.useremail", prefValue);
if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty())
emailAddr = prefValue;
else
Expand Down
17 changes: 7 additions & 10 deletions extensions/pref/autoconfig/src/nsReadConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, c
nsresult nsReadConfig::readConfigFile()
{
nsresult rv = NS_OK;
nsCString lockFileName;
nsCString lockVendor;
nsAutoCString lockFileName;
nsAutoCString lockVendor;
uint32_t fileNameLen = 0;

nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
Expand All @@ -133,7 +133,7 @@ nsresult nsReadConfig::readConfigFile()
// running mozilla or netscp6)

rv = defaultPrefBranch->GetCharPref("general.config.filename",
getter_Copies(lockFileName));
lockFileName);


MOZ_LOG(MCD, LogLevel::Debug, ("general.config.filename = %s\n", lockFileName.get()));
Expand Down Expand Up @@ -179,16 +179,14 @@ nsresult nsReadConfig::readConfigFile()
return rv;
}

rv = prefBranch->GetCharPref("general.config.filename",
getter_Copies(lockFileName));
rv = prefBranch->GetCharPref("general.config.filename", lockFileName);
if (NS_FAILED(rv))
// There is NO REASON we should ever get here. This is POST reading
// of the config file.
return NS_ERROR_FAILURE;


rv = prefBranch->GetCharPref("general.config.vendor",
getter_Copies(lockVendor));
rv = prefBranch->GetCharPref("general.config.vendor", lockVendor);
// If vendor is not nullptr, do this check
if (NS_SUCCEEDED(rv)) {

Expand All @@ -203,9 +201,8 @@ nsresult nsReadConfig::readConfigFile()
}

// get the value of the autoconfig url
nsCString urlName;
rv = prefBranch->GetCharPref("autoadmin.global_config_url",
getter_Copies(urlName));
nsAutoCString urlName;
rv = prefBranch->GetCharPref("autoadmin.global_config_url", urlName);
if (NS_SUCCEEDED(rv) && !urlName.IsEmpty()) {

// Instantiating nsAutoConfig object if the pref is present
Expand Down
4 changes: 2 additions & 2 deletions extensions/spellcheck/hunspell/glue/mozHunspell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ mozHunspell::LoadDictionaryList(bool aNotifyChildProcesses)
// check preferences first
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
nsCString extDictPath;
rv = prefs->GetCharPref("spellchecker.dictionary_path", getter_Copies(extDictPath));
nsAutoCString extDictPath;
rv = prefs->GetCharPref("spellchecker.dictionary_path", extDictPath);
if (NS_SUCCEEDED(rv)) {
// set the spellchecker.dictionary_path
rv = NS_NewNativeLocalFile(extDictPath, true, getter_AddRefs(dictDir));
Expand Down
9 changes: 9 additions & 0 deletions gfx/2d/2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ struct gfxFontStyle;
struct CGContext;
typedef struct CGContext *CGContextRef;

struct CGFont;
typedef CGFont* CGFontRef;

namespace mozilla {

class Mutex;
Expand Down Expand Up @@ -1533,6 +1536,12 @@ class GFX2D_API Factory
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize);
#endif

#ifdef XP_DARWIN
static already_AddRefed<ScaledFont>
CreateScaledFontForMacFont(CGFontRef aCGFont, const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
bool aUseFontSmoothing = true);
#endif

/**
* This creates a NativeFontResource from TrueType data.
*
Expand Down
11 changes: 11 additions & 0 deletions gfx/2d/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,17 @@ Factory::CreateScaledFontForFontconfigFont(cairo_scaled_font_t* aScaledFont, FcP
}
#endif

#ifdef XP_DARWIN
already_AddRefed<ScaledFont>
Factory::CreateScaledFontForMacFont(CGFontRef aCGFont,
const RefPtr<UnscaledFont>& aUnscaledFont,
Float aSize,
bool aUseFontSmoothing)
{
return MakeAndAddRef<ScaledFontMac>(aCGFont, aUnscaledFont, aSize, aUseFontSmoothing);
}
#endif

already_AddRefed<DrawTarget>
Factory::CreateDualDrawTarget(DrawTarget *targetA, DrawTarget *targetB)
{
Expand Down
13 changes: 9 additions & 4 deletions gfx/2d/ScaledFontMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "ScaledFontMac.h"
#include "UnscaledFontMac.h"
#include "mozilla/webrender/WebRenderTypes.h"
#ifdef USE_SKIA
#include "PathSkia.h"
#include "skia/include/core/SkPaint.h"
Expand Down Expand Up @@ -105,9 +106,11 @@ CreateCTFontFromCGFontWithVariations(CGFontRef aCGFont, CGFloat aSize)
ScaledFontMac::ScaledFontMac(CGFontRef aFont,
const RefPtr<UnscaledFont>& aUnscaledFont,
Float aSize,
bool aUseFontSmoothing,
bool aOwnsFont)
: ScaledFontBase(aUnscaledFont, aSize)
, mFont(aFont)
, mUseFontSmoothing(aUseFontSmoothing)
{
if (!sSymbolLookupDone) {
CTFontDrawGlyphsPtr =
Expand Down Expand Up @@ -363,9 +366,11 @@ ScaledFontMac::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOpti
Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
std::vector<FontVariation>* aOutVariations)
{
if (!GetVariationsForCTFont(mCTFont, aOutVariations)) {
return false;
}
GetVariationsForCTFont(mCTFont, aOutVariations);

wr::FontInstancePlatformOptions platformOptions;
platformOptions.font_smoothing = mUseFontSmoothing;
*aOutPlatformOptions = Some(platformOptions);
return true;
}

Expand Down Expand Up @@ -505,7 +510,7 @@ UnscaledFontMac::CreateScaledFont(Float aGlyphSize,
}

RefPtr<ScaledFontMac> scaledFont =
new ScaledFontMac(fontRef, this, aGlyphSize, fontRef != mFont);
new ScaledFontMac(fontRef, this, aGlyphSize, true, fontRef != mFont);

if (!scaledFont->PopulateCairoScaledFont()) {
gfxWarning() << "Unable to create cairo scaled Mac font.";
Expand Down
3 changes: 2 additions & 1 deletion gfx/2d/ScaledFontMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ScaledFontMac : public ScaledFontBase
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac, override)
ScaledFontMac(CGFontRef aFont, const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize, bool aOwnsFont = false);
ScaledFontMac(CGFontRef aFont, const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize, bool aUseFontSmoothing = true, bool aOwnsFont = false);
~ScaledFontMac();

FontType GetType() const override { return FontType::MAC; }
Expand All @@ -66,6 +66,7 @@ class ScaledFontMac : public ScaledFontBase
friend class DrawTargetSkia;
CGFontRef mFont;
CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null
bool mUseFontSmoothing;

typedef void (CTFontDrawGlyphsFuncT)(CTFontRef,
const CGGlyph[], const CGPoint[],
Expand Down
10 changes: 10 additions & 0 deletions gfx/layers/wr/WebRenderBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ void gfx_critical_note(const char* msg)
gfxCriticalNote << msg;
}

void gfx_critical_error(const char* msg)
{
gfxCriticalError() << msg;
}

void gecko_printf_stderr_output(const char* msg)
{
printf_stderr("%s\n", msg);
}

void* get_proc_address_from_glcontext(void* glcontext_ptr, const char* procname)
{
MOZ_ASSERT(glcontext_ptr);
Expand Down
Loading

0 comments on commit 50156f9

Please sign in to comment.