Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for recording/replaying on windows #969

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion gfx/thebes/gfxDWriteFontList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2456,11 +2456,19 @@ class BundledFontFileEnumerator : public IDWriteFontFileEnumerator {
BundledFontFileEnumerator::BundledFontFileEnumerator(IDWriteFactory* aFactory,
nsIFile* aFontDir)
: mFactory(aFactory), mFontDir(aFontDir) {
mFontDir->GetDirectoryEntries(getter_AddRefs(mEntries));
if (mFontDir) {
mFontDir->GetDirectoryEntries(getter_AddRefs(mEntries));
}
}

IFACEMETHODIMP
BundledFontFileEnumerator::MoveNext(BOOL* aHasCurrentFile) {
// Watch out for missing fonts when replaying.
if (recordreplay::IsReplaying()) {
return S_OK;
}
recordreplay::AutoPassThroughThreadEvents pt;

bool hasMore = false;
if (mEntries) {
if (NS_SUCCEEDED(mEntries->HasMoreElements(&hasMore)) && hasMore) {
Expand All @@ -2475,6 +2483,12 @@ BundledFontFileEnumerator::MoveNext(BOOL* aHasCurrentFile) {

IFACEMETHODIMP
BundledFontFileEnumerator::GetCurrentFontFile(IDWriteFontFile** aFontFile) {
// Watch out for missing fonts when replaying.
if (recordreplay::IsReplaying()) {
return S_OK;
}
recordreplay::AutoPassThroughThreadEvents pt;

nsCOMPtr<nsIFile> file = do_QueryInterface(mCurrent);
if (!file) {
return E_FAIL;
Expand Down Expand Up @@ -2511,6 +2525,16 @@ BundledFontLoader::CreateEnumeratorFromKey(
IDWriteFactory* aFactory, const void* aCollectionKey,
UINT32 aCollectionKeySize,
IDWriteFontFileEnumerator** aFontFileEnumerator) {
// The collection key's contents will be recorded/replayed and we can't dereference
// embedded pointers within it. Workaround this by creating a dummy enumerator when
// we're replaying.
if (recordreplay::IsReplaying()) {
*aFontFileEnumerator = new BundledFontFileEnumerator(aFactory, nullptr);
NS_ADDREF(*aFontFileEnumerator);
return S_OK;
}
recordreplay::AutoPassThroughThreadEvents pt;

nsIFile* fontDir = *(nsIFile**)aCollectionKey;
*aFontFileEnumerator = new BundledFontFileEnumerator(aFactory, fontDir);
NS_ADDREF(*aFontFileEnumerator);
Expand Down
9 changes: 8 additions & 1 deletion intl/icu/source/i18n/numfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#include "number_decimalquantity.h"
#include "number_utils.h"

#include "mozilla/RecordReplay.h"

//#define FMT_DEBUG

#ifdef FMT_DEBUG
Expand Down Expand Up @@ -1407,7 +1409,12 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
ns->getName(),
gFormatCldrStyles[style],
status);
pattern = UnicodeString(TRUE, patternPtr, -1);

// Record/replay string length to workaround the length differing when
// replaying for an unknown reason.
int len = mozilla::recordreplay::RecordReplayValue("NumberFormat::makeInstance", u_strlen(patternPtr));

pattern = UnicodeString(TRUE, patternPtr, len);
}
if (U_FAILURE(status)) {
return NULL;
Expand Down
4 changes: 4 additions & 0 deletions mozglue/dllservices/WindowsDllBlocklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "nsWindowsDllInterceptor.h"
#include "mozilla/CmdLineAndEnvUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/RecordReplay.h"
#include "mozilla/StackWalk_windows.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
Expand Down Expand Up @@ -353,6 +354,9 @@ static wchar_t* lastslash(wchar_t* s, int len) {
static NTSTATUS NTAPI patched_LdrLoadDll(PWCHAR filePath, PULONG flags,
PUNICODE_STRING moduleFileName,
PHANDLE handle) {
// This code only runs when recording.
recordreplay::AutoPassThroughThreadEvents pt;

// We have UCS2 (UTF16?), we want ASCII, but we also just want the filename
// portion
#define DLLNAME_MAX 128
Expand Down