diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 151732be41f4..19111c3a5765 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -697,7 +697,7 @@ nsAccessibilityService::UpdateListBullet(nsIPresShell* aPresShell, void nsAccessibilityService::UpdateImageMap(nsImageFrame* aImageFrame) { - nsIPresShell* presShell = aImageFrame->PresContext()->PresShell(); + nsIPresShell* presShell = aImageFrame->PresShell(); DocAccessible* document = GetDocAccessible(presShell); if (document) { Accessible* accessible = diff --git a/accessible/tests/crashtests/890760.html b/accessible/tests/crashtests/890760.html new file mode 100644 index 000000000000..ecc76160b919 --- /dev/null +++ b/accessible/tests/crashtests/890760.html @@ -0,0 +1,14 @@ + + + + + + + diff --git a/accessible/tests/crashtests/crashtests.list b/accessible/tests/crashtests/crashtests.list index 36168a376ee9..d339f02d40d4 100644 --- a/accessible/tests/crashtests/crashtests.list +++ b/accessible/tests/crashtests/crashtests.list @@ -1,6 +1,7 @@ load 448064.xhtml # This test instantiates a11y, so be careful about adding tests before it load 471493.xul asserts-if(!browserIsRemote,2) load 884202.html +load 890760.html load 893515.html load 1072792.xhtml diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index f2ca994e9e96..399b40afdeb0 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -951,7 +951,8 @@ nsContextMenu.prototype = { this.browser.contentPrincipal, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); openUILink(this.mediaURL, e, { disallowInheritPrincipal: true, - referrerURI }); + referrerURI, + forceAllowDataURI: true }); } }, diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index ecfd00708a32..2cc27580f2fa 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -207,6 +207,7 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI openLinkIn(url, where, params); } +/* eslint-disable complexity */ function openLinkIn(url, where, params) { if (!where || !url) return; @@ -222,6 +223,7 @@ function openLinkIn(url, where, params) { params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET); var aRelatedToCurrent = params.relatedToCurrent; var aAllowMixedContent = params.allowMixedContent; + var aForceAllowDataURI = params.forceAllowDataURI; var aInBackground = params.inBackground; var aDisallowInheritPrincipal = params.disallowInheritPrincipal; var aInitiatingDoc = params.initiatingDoc; @@ -433,6 +435,9 @@ function openLinkIn(url, where, params) { if (aIndicateErrorPageLoad) { flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ERROR_LOAD_CHANGES_RV; } + if (aForceAllowDataURI) { + flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI; + } let {URI_INHERITS_SECURITY_CONTEXT} = Ci.nsIProtocolHandler; if (aForceAboutBlankViewerInCurrent && diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index e79e8c6dc115..116daf01e38b 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -495,17 +495,35 @@ Section "-Application" APP_IDX ; since this will either add it for the user if unelevated or All Users if ; elevated. ${If} $AddStartMenuSC == 1 - CreateShortCut "$SMPROGRAMS\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" - ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" - ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandShortName}.lnk" \ - "$INSTDIR" - ${If} ${AtLeastWin7} - ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\${BrandShortName}.lnk" "$AppUserModelID" "true" + ; See if there's an existing shortcut for this installation using the old + ; name that we should just rename, instead of creating a new shortcut. + ; We could do this renaming even when $AddStartMenuSC is false; the idea + ; behind not doing that is to interpret "false" as "don't do anything + ; involving start menu shortcuts at all." We could also try to do this for + ; both shell contexts, but that won't typically accomplish anything. + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" + ShellLink::GetShortCutTarget "$SMPROGRAMS\${BrandFullName}.lnk" + Pop $0 + ${GetLongPath} "$0" $0 + ${If} $0 == "$INSTDIR\${FileMainEXE}" + ${AndIfNot} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + Rename "$SMPROGRAMS\${BrandFullName}.lnk" \ + "$SMPROGRAMS\${BrandShortName}.lnk" + ${LogMsg} "Renamed existing shortcut to $SMPROGRAMS\${BrandShortName}.lnk" ${EndIf} - ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" ${Else} - ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" + CreateShortCut "$SMPROGRAMS\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\${BrandShortName}.lnk" \ + "$AppUserModelID" "true" + ${EndIf} + ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" + ${Else} + ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" + ${EndIf} ${EndIf} ${EndIf} @@ -525,17 +543,28 @@ Section "-Application" APP_IDX ${EndIf} ${If} $AddDesktopSC == 1 - CreateShortCut "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" - ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" - ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandShortName}.lnk" \ - "$INSTDIR" - ${If} ${AtLeastWin7} - ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$DESKTOP\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" + ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk" + Pop $0 + ${GetLongPath} "$0" $0 + ${If} $0 == "$INSTDIR\${FileMainEXE}" + ${AndIfNot} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + Rename "$DESKTOP\${BrandFullName}.lnk" "$DESKTOP\${BrandShortName}.lnk" + ${LogMsg} "Renamed existing shortcut to $DESKTOP\${BrandShortName}.lnk" ${EndIf} - ${LogMsg} "Added Shortcut: $DESKTOP\${BrandShortName}.lnk" ${Else} - ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandShortName}.lnk" + CreateShortCut "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} "$AppUserModelID" != "" + ApplicationID::Set "$DESKTOP\${BrandShortName}.lnk" \ + "$AppUserModelID" "true" + ${EndIf} + ${LogMsg} "Added Shortcut: $DESKTOP\${BrandShortName}.lnk" + ${Else} + ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandShortName}.lnk" + ${EndIf} ${EndIf} ${EndIf} diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index a6742b98e2e6..4263f379db64 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -72,13 +72,13 @@ ; Do this for both shell contexts in case the user has shortcuts in multiple ; locations, then restore the previous context at the end. SetShellVarContext all - ${UpdateShortcutBranding} + ${UpdateShortcutsBranding} ${If} ${AtLeastWin8} ${TouchStartMenuShortcut} ${EndIf} Call FixShortcutAppModelIDs SetShellVarContext current - ${UpdateShortcutBranding} + ${UpdateShortcutsBranding} ${If} ${AtLeastWin8} ${TouchStartMenuShortcut} ${EndIf} @@ -339,130 +339,51 @@ !macroend !define ShowShortcuts "!insertmacro ShowShortcuts" -; Update the branding information on all shortcuts our installer created, +; Update the branding name on all shortcuts our installer created ; to convert from BrandFullName (which is what we used to name shortcuts) -; to BrandShortName (which is what we now name shortcuts). Also update the -; icon if it's been changed. -; This should only be called sometime after both MigrateStartMenuShortcut -; and MigrateTaskBarShurtcut, and it assumes SHCTX is set correctly. -!macro UpdateShortcutBranding +; to BrandShortName (which is what we now name shortcuts). We only rename +; desktop and start menu shortcuts, because touching taskbar pins often +; (but inconsistently) triggers various broken behaviors in the shell. +; This should only be called sometime after MigrateStartMenuShortcut, +; and it assumes SHCTX is set correctly. +!macro UpdateShortcutsBranding + ${UpdateOneShortcutBranding} "STARTMENU" "$SMPROGRAMS" + ${UpdateOneShortcutBranding} "DESKTOP" "$DESKTOP" +!macroend +!define UpdateShortcutsBranding "!insertmacro UpdateShortcutsBranding" + +!macro UpdateOneShortcutBranding LOG_SECTION SHORTCUT_DIR + ; Only try to rename the shortcuts found in the shortcuts log, to avoid + ; blowing away a name that the user created. ${GetLongPath} "$INSTDIR\uninstall\${SHORTCUTS_LOG}" $R9 ${If} ${FileExists} "$R9" ClearErrors - ; The entries in the shortcut log are numbered, but we never actually - ; create more than one shortcut (or log entry) in each location. - ReadINIStr $R8 "$R9" "STARTMENU" "Shortcut0" + ; The shortcuts log contains a numbered list of entries for each section, + ; but we never actually create more than one. + ReadINIStr $R8 "$R9" "${LOG_SECTION}" "Shortcut0" ${IfNot} ${Errors} - ${If} ${FileExists} "$SMPROGRAMS\$R8" - ShellLink::GetShortCutTarget "$SMPROGRAMS\$R8" + ${If} ${FileExists} "${SHORTCUT_DIR}\$R8" + ShellLink::GetShortCutTarget "${SHORTCUT_DIR}\$R8" Pop $R7 ${GetLongPath} "$R7" $R7 ${If} $R7 == "$INSTDIR\${FileMainEXE}" - ShellLink::GetShortCutIconLocation "$SMPROGRAMS\$R8" - Pop $R6 - ${GetLongPath} "$R6" $R6 - ${If} $R6 != "$INSTDIR\firefox.ico" - ${AndIf} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${ElseIf} $R6 == "$INSTDIR\firefox.ico" - ${AndIfNot} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${Else} - StrCpy $R5 "0" - ${EndIf} - - ${If} $R5 == "1" - ${OrIf} $R8 != "${BrandShortName}.lnk" - Delete "$SMPROGRAMS\$R8" - ${If} ${FileExists} "$INSTDIR\firefox.ico" - CreateShortcut "$SMPROGRAMS\${BrandShortName}.lnk" \ - "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\firefox.ico" - ${Else} - CreateShortcut "$SMPROGRAMS\${BrandShortName}.lnk" \ - "$INSTDIR\${FileMainEXE}" - ${EndIf} - WriteINIStr "$R9" "STARTMENU" "Shortcut0" "${BrandShortName}.lnk" - ${EndIf} - ${EndIf} - ${EndIf} - ${EndIf} - - ClearErrors - ReadINIStr $R8 "$R9" "DESKTOP" "Shortcut0" - ${IfNot} ${Errors} - ${If} ${FileExists} "$DESKTOP\$R8" - ShellLink::GetShortCutTarget "$DESKTOP\$R8" - Pop $R7 - ${GetLongPath} "$R7" $R7 - ${If} $R7 == "$INSTDIR\${FileMainEXE}" - ShellLink::GetShortCutIconLocation "$DESKTOP\$R8" - Pop $R6 - ${GetLongPath} "$R6" $R6 - ${If} $R6 != "$INSTDIR\firefox.ico" - ${AndIf} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${ElseIf} $R6 == "$INSTDIR\firefox.ico" - ${AndIfNot} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${Else} - StrCpy $R5 "0" - ${EndIf} - - ${If} $R5 == "1" - ${OrIf} $R8 != "${BrandShortName}.lnk" - Delete "$DESKTOP\$R8" - ${If} ${FileExists} "$INSTDIR\firefox.ico" - CreateShortcut "$DESKTOP\${BrandShortName}.lnk" \ - "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\firefox.ico" - ${Else} - CreateShortcut "$DESKTOP\${BrandShortName}.lnk" \ - "$INSTDIR\${FileMainEXE}" - ${EndIf} - WriteINIStr "$R9" "DESKTOP" "Shortcut0" "${BrandShortName}.lnk" - ${EndIf} - ${EndIf} - ${EndIf} - ${EndIf} - - ClearErrors - ReadINIStr $R8 "$R9" "QUICKLAUNCH" "Shortcut0" - ${IfNot} ${Errors} - ; "QUICKLAUNCH" actually means a taskbar pin. - ; We can't simultaneously rename and change the icon for a taskbar pin - ; without the icon breaking, and the icon is more important than the name, - ; so we'll forget about changing the name and just overwrite the icon. - ${If} ${FileExists} "$QUICKLAUNCH\User Pinned\TaskBar\$R8" - ShellLink::GetShortCutTarget "$QUICKLAUNCH\User Pinned\TaskBar\$R8" - Pop $R7 - ${GetLongPath} "$R7" $R7 - ${If} "$INSTDIR\${FileMainEXE}" == "$R7" - ShellLink::GetShortCutIconLocation "$QUICKLAUNCH\User Pinned\TaskBar\$R8" - Pop $R6 - ${GetLongPath} "$R6" $R6 - ${If} $R6 != "$INSTDIR\firefox.ico" - ${AndIf} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${ElseIf} $R6 == "$INSTDIR\firefox.ico" - ${AndIfNot} ${FileExists} "$INSTDIR\firefox.ico" - StrCpy $R5 "1" - ${Else} - StrCpy $R5 "0" - ${EndIf} - - ${If} $R5 == "1" - ${If} ${FileExists} "$INSTDIR\firefox.ico" - CreateShortcut "$QUICKLAUNCH\User Pinned\TaskBar\$R8" "$R7" "" \ - "$INSTDIR\firefox.ico" - ${Else} - CreateShortcut "$QUICKLAUNCH\User Pinned\TaskBar\$R8" "$R7" - ${EndIf} + ${AndIf} $R8 != "${BrandShortName}.lnk" + ${AndIfNot} ${FileExists} "${SHORTCUT_DIR}\${BrandShortName}.lnk" + ClearErrors + Rename "${SHORTCUT_DIR}\$R8" "${SHORTCUT_DIR}\${BrandShortName}.lnk" + ${IfNot} ${Errors} + ; Update the shortcut log manually instead of calling LogShortcut + ; because it would add a Shortcut1 entry, and we really do want to + ; overwrite the existing entry 0, since we just renamed the file. + WriteINIStr "$R9" "${LOG_SECTION}" "Shortcut0" \ + "${BrandShortName}.lnk" ${EndIf} ${EndIf} ${EndIf} ${EndIf} ${EndIf} !macroend -!define UpdateShortcutBranding "!insertmacro UpdateShortcutBranding" +!define UpdateOneShortcutBranding "!insertmacro UpdateOneShortcutBranding" !macro AddAssociationIfNoneExist FILE_TYPE KEY ClearErrors diff --git a/build/build-clang/build-clang.py b/build/build-clang/build-clang.py index 2fc2bfb2f4a1..d4bcf920a418 100755 --- a/build/build-clang/build-clang.py +++ b/build/build-clang/build-clang.py @@ -456,15 +456,15 @@ if __name__ == "__main__": for p in config.get("patches", []): patch(p, source_dir) - symlinks = [(source_dir + "/clang", + symlinks = [(clang_source_dir, llvm_source_dir + "/tools/clang"), - (source_dir + "/extra", + (extra_source_dir, llvm_source_dir + "/tools/clang/tools/extra"), - (source_dir + "/compiler-rt", + (compiler_rt_source_dir, llvm_source_dir + "/projects/compiler-rt"), - (source_dir + "/libcxx", + (libcxx_source_dir, llvm_source_dir + "/projects/libcxx"), - (source_dir + "/libcxxabi", + (libcxxabi_source_dir, llvm_source_dir + "/projects/libcxxabi")] for l in symlinks: # On Windows, we have to re-copy the whole directory every time. diff --git a/build/build-clang/clang-win32.json b/build/build-clang/clang-win32.json index 645610d2ec64..80d931a5553c 100644 --- a/build/build-clang/clang-win32.json +++ b/build/build-clang/clang-win32.json @@ -12,7 +12,7 @@ "cc": "cl.exe", "cxx": "cl.exe", "patches": [ - "build/src/build/build-clang/msvc-host-x64.patch", - "build/src/build/build-clang/loosen-msvc-detection.patch" + "msvc-host-x64.patch", + "loosen-msvc-detection.patch" ] } diff --git a/build/build-clang/clang-win64.json b/build/build-clang/clang-win64.json index d28475e22eba..79ad4042d3d8 100644 --- a/build/build-clang/clang-win64.json +++ b/build/build-clang/clang-win64.json @@ -13,6 +13,6 @@ "cxx": "cl.exe", "ml": "ml64.exe", "patches": [ - "build/src/build/build-clang/loosen-msvc-detection.patch" + "loosen-msvc-detection.patch" ] } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 0e24e7462804..155fcd03cf81 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1310,6 +1310,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsCOMPtr shEntry; nsString target; nsAutoString srcdoc; + bool forceAllowDataURI = false; nsCOMPtr sourceDocShell; nsCOMPtr baseURI; @@ -1346,6 +1347,7 @@ nsDocShell::LoadURI(nsIURI* aURI, aLoadInfo->GetSrcdocData(srcdoc); aLoadInfo->GetSourceDocShell(getter_AddRefs(sourceDocShell)); aLoadInfo->GetBaseURI(getter_AddRefs(baseURI)); + aLoadInfo->GetForceAllowDataURI(&forceAllowDataURI); } MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, @@ -1609,6 +1611,10 @@ nsDocShell::LoadURI(nsIURI* aURI, flags |= INTERNAL_LOAD_FLAGS_IS_SRCDOC; } + if (forceAllowDataURI) { + flags |= INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI; + } + return InternalLoad(aURI, originalURI, resultPrincipalURI, @@ -4917,6 +4923,9 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI, } nsAutoPopupStatePusher statePusher(popupState); + bool forceAllowDataURI = + aLoadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI; + // Don't pass certain flags that aren't needed and end up confusing // ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that they are // passed to LoadURI though, since it uses them. @@ -4947,6 +4956,7 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI, loadInfo->SetHeadersStream(aHeaderStream); loadInfo->SetBaseURI(aBaseURI); loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal); + loadInfo->SetForceAllowDataURI(forceAllowDataURI); if (fixupInfo) { nsAutoString searchProvider, keyword; @@ -8850,7 +8860,7 @@ nsDocShell::RestoreFromHistory() if (rootViewSibling) { nsIFrame* frame = rootViewSibling->GetFrame(); sibling = - frame ? frame->PresContext()->PresShell()->GetDocument() : nullptr; + frame ? frame->PresShell()->GetDocument() : nullptr; } // Transfer ownership to mContentViewer. By ensuring that either the @@ -10189,6 +10199,7 @@ nsDocShell::InternalLoad(nsIURI* aURI, // principal to inherit is: it should be aTriggeringPrincipal. loadInfo->SetPrincipalIsExplicit(true); loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(LOAD_LINK)); + loadInfo->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI); rv = win->Open(NS_ConvertUTF8toUTF16(spec), aWindowTarget, // window name @@ -10866,7 +10877,9 @@ nsDocShell::InternalLoad(nsIURI* aURI, nsCOMPtr req; rv = DoURILoad(aURI, aOriginalURI, aResultPrincipalURI, aLoadReplace, - loadFromExternal, aReferrer, + loadFromExternal, + (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI), + aReferrer, !(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER), aReferrerPolicy, aTriggeringPrincipal, principalToInherit, aTypeHint, @@ -11004,6 +11017,7 @@ nsDocShell::DoURILoad(nsIURI* aURI, Maybe> const& aResultPrincipalURI, bool aLoadReplace, bool aLoadFromExternal, + bool aForceAllowDataURI, nsIURI* aReferrerURI, bool aSendReferrer, uint32_t aReferrerPolicy, @@ -11184,6 +11198,7 @@ nsDocShell::DoURILoad(nsIURI* aURI, loadInfo->SetPrincipalToInherit(aPrincipalToInherit); } loadInfo->SetLoadTriggeredFromExternal(aLoadFromExternal); + loadInfo->SetForceAllowDataURI(aForceAllowDataURI); // We have to do this in case our OriginAttributes are different from the // OriginAttributes of the parent document. Or in case there isn't a diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index ca93a3c7a5bf..c097fcb1f49b 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -452,6 +452,7 @@ protected: mozilla::Maybe> const& aResultPrincipalURI, bool aLoadReplace, bool aLoadFromExternal, + bool aForceAllowDataURI, nsIURI* aReferrer, bool aSendReferrer, uint32_t aReferrerPolicy, diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp index 40a4b7edd31a..836b629a5db3 100644 --- a/docshell/base/nsDocShellLoadInfo.cpp +++ b/docshell/base/nsDocShellLoadInfo.cpp @@ -67,6 +67,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo() , mLoadReplace(false) , mInheritPrincipal(false) , mPrincipalIsExplicit(false) + , mForceAllowDataURI(false) , mSendReferrer(true) , mReferrerPolicy(mozilla::net::RP_Unset) , mLoadType(nsIDocShellLoadInfo::loadNormal) @@ -209,6 +210,20 @@ nsDocShellLoadInfo::SetPrincipalIsExplicit(bool aPrincipalIsExplicit) return NS_OK; } +NS_IMETHODIMP +nsDocShellLoadInfo::GetForceAllowDataURI(bool* aForceAllowDataURI) +{ + *aForceAllowDataURI = mForceAllowDataURI; + return NS_OK; +} + +NS_IMETHODIMP +nsDocShellLoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI) +{ + mForceAllowDataURI = aForceAllowDataURI; + return NS_OK; +} + NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType* aLoadType) { diff --git a/docshell/base/nsDocShellLoadInfo.h b/docshell/base/nsDocShellLoadInfo.h index 58e6fcd734c2..9a080326dbf4 100644 --- a/docshell/base/nsDocShellLoadInfo.h +++ b/docshell/base/nsDocShellLoadInfo.h @@ -39,6 +39,7 @@ protected: bool mLoadReplace; bool mInheritPrincipal; bool mPrincipalIsExplicit; + bool mForceAllowDataURI; bool mSendReferrer; nsDocShellInfoReferrerPolicy mReferrerPolicy; nsDocShellInfoLoadType mLoadType; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 4beac80ff594..2f3572890907 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -127,6 +127,9 @@ interface nsIDocShell : nsIDocShellTreeItem const long INTERNAL_LOAD_FLAGS_NO_OPENER = 0x100; + // Whether a top-level data URI navigation is allowed for that load + const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200; + // NB: 0x80 is available. /** diff --git a/docshell/base/nsIDocShellLoadInfo.idl b/docshell/base/nsIDocShellLoadInfo.idl index e66a3a4a6c1c..c8d52c7c5539 100644 --- a/docshell/base/nsIDocShellLoadInfo.idl +++ b/docshell/base/nsIDocShellLoadInfo.idl @@ -65,6 +65,12 @@ interface nsIDocShellLoadInfo : nsISupports */ attribute boolean principalIsExplicit; + /** + * If this attribute is true, then a top-level navigation + * to a data URI will be allowed. + */ + attribute boolean forceAllowDataURI; + /* these are load type enums... */ const long loadNormal = 0; // Normal Load const long loadNormalReplace = 1; // Normal Load but replaces current history slot diff --git a/docshell/base/nsIWebNavigation.idl b/docshell/base/nsIWebNavigation.idl index 78e89a41359f..8fcb21f4a62f 100644 --- a/docshell/base/nsIWebNavigation.idl +++ b/docshell/base/nsIWebNavigation.idl @@ -206,6 +206,12 @@ interface nsIWebNavigation : nsISupports */ const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000; + /** + * Allows a top-level data: navigation to occur. E.g. view-image + * is an explicit user action which should be allowed. + */ + const unsigned long LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x400000; + /** * Loads a given URI. This will give priority to loading the requested URI * in the object implementing this interface. If it can't be loaded here diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 5716c86ab13f..098db6e57084 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -783,7 +783,6 @@ CustomElementRegistry::Define(const nsAString& aName, * observedAttributesIterable to a sequence. Rethrow * any exceptions from the conversion. */ - // TODO: Bug 1293921 - Implement connected/disconnected/adopted/attributeChanged lifecycle callbacks for custom elements if (callbacksHolder->mAttributeChangedCallback.WasPassed()) { // Enter constructor's compartment. JSAutoCompartment ac(cx, constructor); @@ -796,12 +795,22 @@ CustomElementRegistry::Define(const nsAString& aName, } if (!observedAttributesIterable.isUndefined()) { + if (!observedAttributesIterable.isObject()) { + aRv.ThrowTypeError(NS_LITERAL_STRING("observedAttributes")); + return; + } + JS::ForOfIterator iter(cx); - if (!iter.init(observedAttributesIterable)) { + if (!iter.init(observedAttributesIterable, JS::ForOfIterator::AllowNonIterable)) { aRv.StealExceptionFromJSContext(cx); return; } + if (!iter.valueIsIterable()) { + aRv.ThrowTypeError(NS_LITERAL_STRING("observedAttributes")); + return; + } + JS::Rooted attribute(cx); while (true) { bool done; @@ -813,13 +822,16 @@ CustomElementRegistry::Define(const nsAString& aName, break; } - JSString *attrJSStr = attribute.toString(); - nsAutoJSString attrStr; - if (!attrStr.init(cx, attrJSStr)) { + nsAutoString attrStr; + if (!ConvertJSValueToString(cx, attribute, eStringify, eStringify, attrStr)) { aRv.StealExceptionFromJSContext(cx); return; } - observedAttributes.AppendElement(NS_Atomize(attrStr)); + + if (!observedAttributes.AppendElement(NS_Atomize(attrStr))) { + aRv.Throw(NS_ERROR_OUT_OF_MEMORY); + return; + } } } } // Leave constructor's compartment. diff --git a/dom/base/crashtests/1413815.html b/dom/base/crashtests/1413815.html new file mode 100644 index 000000000000..309e54d082ae --- /dev/null +++ b/dom/base/crashtests/1413815.html @@ -0,0 +1,20 @@ + + + + + diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index b9832550febe..f7ab9ecedf5c 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -234,3 +234,4 @@ load 1403377.html load 1405771.html load 1406109-1.html pref(dom.webcomponents.enabled,true) load 1324463.html +pref(dom.webcomponents.customelements.enabled,true) load 1413815.html diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 709609f45158..fcf693864397 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -3030,16 +3030,16 @@ nsFrameLoader::SetClipSubdocument(bool aClip) nsIFrame* frame = GetPrimaryFrameOfOwningContent(); if (frame) { frame->InvalidateFrame(); - frame->PresContext()->PresShell()-> + frame->PresShell()-> FrameNeedsReflow(frame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); nsSubDocumentFrame* subdocFrame = do_QueryFrame(frame); if (subdocFrame) { nsIFrame* subdocRootFrame = subdocFrame->GetSubdocumentRootFrame(); if (subdocRootFrame) { - nsIFrame* subdocRootScrollFrame = subdocRootFrame->PresContext()->PresShell()-> + nsIFrame* subdocRootScrollFrame = subdocRootFrame->PresShell()-> GetRootScrollFrame(); if (subdocRootScrollFrame) { - frame->PresContext()->PresShell()-> + frame->PresShell()-> FrameNeedsReflow(frame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); } } @@ -3067,7 +3067,7 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp) if (subdocFrame) { nsIFrame* subdocRootFrame = subdocFrame->GetSubdocumentRootFrame(); if (subdocRootFrame) { - nsIScrollableFrame* subdocRootScrollFrame = subdocRootFrame->PresContext()->PresShell()-> + nsIScrollableFrame* subdocRootScrollFrame = subdocRootFrame->PresShell()-> GetRootScrollFrameAsScrollable(); if (subdocRootScrollFrame) { subdocRootScrollFrame->ScrollTo(subdocRootScrollFrame->GetScrollPosition(), nsIScrollableFrame::INSTANT); diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp index 5f09becf263d..463a1614b1ed 100644 --- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -3250,7 +3250,7 @@ ContentEventHandler::FrameRelativeRect::RectRelativeTo( return mRect; } - nsIFrame* rootFrame = mBaseFrame->PresContext()->PresShell()->GetRootFrame(); + nsIFrame* rootFrame = mBaseFrame->PresShell()->GetRootFrame(); nsRect baseFrameRectInRootFrame = nsLayoutUtils::TransformFrameRectToAncestor(mBaseFrame, nsRect(), rootFrame); diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 44f059d4f82b..a631183e8b42 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -3310,7 +3310,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext, ScrollbarsForWheel::SetActiveScrollTarget(scrollTarget); nsIFrame* rootScrollFrame = !mCurrentTarget ? nullptr : - mCurrentTarget->PresContext()->PresShell()->GetRootScrollFrame(); + mCurrentTarget->PresShell()->GetRootScrollFrame(); nsIScrollableFrame* rootScrollableFrame = nullptr; if (rootScrollFrame) { rootScrollableFrame = do_QueryFrame(rootScrollFrame); diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index b770085b6c8f..774cdc120579 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -4132,9 +4132,8 @@ void HTMLMediaElement::SetPlayedOrSeeked(bool aValue) if (!frame) { return; } - frame->PresContext()->PresShell()->FrameNeedsReflow(frame, - nsIPresShell::eTreeChange, - NS_FRAME_IS_DIRTY); + frame->PresShell()->FrameNeedsReflow(frame, nsIPresShell::eTreeChange, + NS_FRAME_IS_DIRTY); } void diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index e5f1a050c8f3..c4b47aeef87f 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -275,8 +275,7 @@ IDBFactory::CreateForJSInternal(JSContext* aCx, factory->mPrincipalInfo = aPrincipalInfo.forget(); factory->mOwningObject = aOwningObject; mozilla::HoldJSObjects(factory.get()); - factory->mEventTarget = NS_IsMainThread() ? - SystemGroup::EventTargetFor(TaskCategory::Other) : GetCurrentThreadEventTarget(); + factory->mEventTarget = GetCurrentThreadEventTarget(); factory->mInnerWindowID = aInnerWindowID; factory.forget(aFactory); diff --git a/dom/indexedDB/IDBFactory.h b/dom/indexedDB/IDBFactory.h index fcde42b8d486..e1460798e0f2 100644 --- a/dom/indexedDB/IDBFactory.h +++ b/dom/indexedDB/IDBFactory.h @@ -71,9 +71,8 @@ class IDBFactory final indexedDB::BackgroundFactoryChild* mBackgroundActor; - // A DocGroup-specific EventTarget if created by CreateForWindow(). - // Otherwise, it must either be set to SystemGroup on main thread or - // NS_GetCurrentThread() off main thread. + // It is either set to a DocGroup-specific EventTarget if created by + // CreateForWindow() or set to GetCurrentThreadEventTarget() otherwise. nsCOMPtr mEventTarget; uint64_t mInnerWindowID; diff --git a/dom/media/mediasource/AutoTaskQueue.h b/dom/media/mediasource/AutoTaskQueue.h index c3aa08291a70..38432a01e4ce 100644 --- a/dom/media/mediasource/AutoTaskQueue.h +++ b/dom/media/mediasource/AutoTaskQueue.h @@ -36,11 +36,11 @@ public: return mTaskQueue->TailDispatcher(); } - void Dispatch(already_AddRefed aRunnable, - DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, - DispatchReason aReason = NormalDispatch) override + nsresult Dispatch(already_AddRefed aRunnable, + DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, + DispatchReason aReason = NormalDispatch) override { - mTaskQueue->Dispatch(Move(aRunnable), aFailureHandling, aReason); + return mTaskQueue->Dispatch(Move(aRunnable), aFailureHandling, aReason); } // Prevent a GCC warning about the other overload of Dispatch being hidden. diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index 5876db2aeaef..d8db2e063426 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -48,6 +48,10 @@ nsContentSecurityManager::AllowTopLevelNavigationToDataURI(nsIChannel* aChannel) if (loadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_DOCUMENT) { return true; } + if (loadInfo->GetForceAllowDataURI()) { + // if the loadinfo explicitly allows the data URI navigation, let's allow it now + return true; + } nsCOMPtr uri; nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, true); diff --git a/dom/security/test/general/browser.ini b/dom/security/test/general/browser.ini index 73ae72dddd9b..b00baa95dc6e 100644 --- a/dom/security/test/general/browser.ini +++ b/dom/security/test/general/browser.ini @@ -9,3 +9,6 @@ support-files = [browser_test_data_text_csv.js] support-files = file_data_text_csv.html +[browser_test_view_image_data_navigation.js] +support-files = + file_view_image_data_navigation.html diff --git a/dom/security/test/general/browser_test_view_image_data_navigation.js b/dom/security/test/general/browser_test_view_image_data_navigation.js new file mode 100644 index 000000000000..22de3589407b --- /dev/null +++ b/dom/security/test/general/browser_test_view_image_data_navigation.js @@ -0,0 +1,30 @@ +"use strict"; + +const TEST_PAGE = getRootDirectory(gTestPath) + "file_view_image_data_navigation.html"; + +add_task(async function test_principal_right_click_open_link_in_new_tab() { + await SpecialPowers.pushPrefEnv({ + "set": [["security.data_uri.block_toplevel_data_uri_navigations", true]], + }); + + await BrowserTestUtils.withNewTab(TEST_PAGE, async function(browser) { + let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true); + + // simulate right-click->view-image + BrowserTestUtils.waitForEvent(document, "popupshown", false, event => { + // These are operations that must be executed synchronously with the event. + document.getElementById("context-viewimage").doCommand(); + event.target.hidePopup(); + return true; + }); + BrowserTestUtils.synthesizeMouseAtCenter("#testimage", + { type: "contextmenu", button: 2 }, + gBrowser.selectedBrowser); + await loadPromise; + + await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() { + ok(content.document.location.toString().startsWith("data:image/svg+xml;"), + "data:image/svg navigation allowed through right-click view-image") + }); + }); +}); diff --git a/dom/security/test/general/file_view_image_data_navigation.html b/dom/security/test/general/file_view_image_data_navigation.html new file mode 100644 index 000000000000..a3f9acfb4dae --- /dev/null +++ b/dom/security/test/general/file_view_image_data_navigation.html @@ -0,0 +1,12 @@ + + + + + Bug 1407891: Test navigation for right-click view-image on data:image/svg + + + + + + + diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 63941d9315f7..261fb4fd0b71 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -50,6 +50,8 @@ #include "ScaledFontDWrite.h" #endif +using namespace std; + namespace mozilla { namespace gfx { @@ -276,6 +278,7 @@ GetSkImageForSurface(SourceSurface* aSurface, const Rect* aBounds = nullptr, con DrawTargetSkia::DrawTargetSkia() : mSnapshot(nullptr) + , mSnapshotLock{make_shared("DrawTargetSkia::mSnapshotLock")} #ifdef MOZ_WIDGET_COCOA , mCG(nullptr) , mColorSpace(nullptr) @@ -316,7 +319,7 @@ DrawTargetSkia::Snapshot() } else { image = mSurface->makeImageSnapshot(); } - if (!snapshot->InitFromImage(image, mFormat, this)) { + if (!snapshot->InitFromImage(image, mFormat, this, mSnapshotLock)) { return nullptr; } mSnapshot = snapshot; @@ -2214,6 +2217,7 @@ DrawTargetSkia::CreateFilter(FilterType aType) void DrawTargetSkia::MarkChanged() { + MutexAutoLock lock(*mSnapshotLock); if (mSnapshot) { mSnapshot->DrawTargetWillChange(); mSnapshot = nullptr; diff --git a/gfx/2d/DrawTargetSkia.h b/gfx/2d/DrawTargetSkia.h index 6fef4e9afb4c..812120cb427b 100644 --- a/gfx/2d/DrawTargetSkia.h +++ b/gfx/2d/DrawTargetSkia.h @@ -206,6 +206,7 @@ private: sk_sp mSurface; SkCanvas* mCanvas; SourceSurfaceSkia* mSnapshot; + std::shared_ptr mSnapshotLock; #ifdef MOZ_WIDGET_COCOA friend class BorrowedCGContext; diff --git a/gfx/2d/Filters.h b/gfx/2d/Filters.h index fc610b85496f..d40910a4610b 100644 --- a/gfx/2d/Filters.h +++ b/gfx/2d/Filters.h @@ -475,7 +475,7 @@ enum UnpremultiplyInputs IN_UNPREMULTIPLY_IN = 0 }; -class FilterNode : public RefCounted +class FilterNode : public external::AtomicRefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNode) diff --git a/gfx/2d/SourceSurfaceSkia.cpp b/gfx/2d/SourceSurfaceSkia.cpp index 9bc49715a161..737f1992b247 100644 --- a/gfx/2d/SourceSurfaceSkia.cpp +++ b/gfx/2d/SourceSurfaceSkia.cpp @@ -13,6 +13,8 @@ #include "skia/include/core/SkData.h" #include "mozilla/CheckedInt.h" +using namespace std; + namespace mozilla { namespace gfx { @@ -24,9 +26,12 @@ SourceSurfaceSkia::SourceSurfaceSkia() SourceSurfaceSkia::~SourceSurfaceSkia() { - if (mDrawTarget) { - mDrawTarget->SnapshotDestroyed(); - mDrawTarget = nullptr; + if (mSnapshotLock) { + MutexAutoLock lock{*mSnapshotLock}; + if (mDrawTarget) { + mDrawTarget->SnapshotDestroyed(); + mDrawTarget = nullptr; + } } } @@ -104,7 +109,8 @@ SourceSurfaceSkia::InitFromData(unsigned char* aData, bool SourceSurfaceSkia::InitFromImage(const sk_sp& aImage, SurfaceFormat aFormat, - DrawTargetSkia* aOwner) + DrawTargetSkia* aOwner, + shared_ptr aSnapshotLock) { if (!aImage) { return false; @@ -137,6 +143,8 @@ SourceSurfaceSkia::InitFromImage(const sk_sp& aImage, mImage = aImage; if (aOwner) { + MOZ_ASSERT(aSnapshotLock); + mSnapshotLock = move(aSnapshotLock); mDrawTarget = aOwner; } @@ -186,6 +194,10 @@ SourceSurfaceSkia::Unmap() void SourceSurfaceSkia::DrawTargetWillChange() { + // In this case synchronisation on destroy should be guaranteed! + MOZ_ASSERT(mSnapshotLock); + mSnapshotLock->AssertCurrentThreadOwns(); + MutexAutoLock lock(mChangeMutex); if (mDrawTarget) { // Raster snapshots do not use Skia's internal copy-on-write mechanism, diff --git a/gfx/2d/SourceSurfaceSkia.h b/gfx/2d/SourceSurfaceSkia.h index ed3942a081af..f6b04ce47c3c 100644 --- a/gfx/2d/SourceSurfaceSkia.h +++ b/gfx/2d/SourceSurfaceSkia.h @@ -18,6 +18,7 @@ namespace mozilla { namespace gfx { class DrawTargetSkia; +class SnapshotLock; class SourceSurfaceSkia : public DataSourceSurface { @@ -39,7 +40,8 @@ public: bool InitFromImage(const sk_sp& aImage, SurfaceFormat aFormat = SurfaceFormat::UNKNOWN, - DrawTargetSkia* aOwner = nullptr); + DrawTargetSkia* aOwner = nullptr, + std::shared_ptr aSnapshotLock = std::shared_ptr{}); virtual uint8_t* GetData(); @@ -62,6 +64,7 @@ private: IntSize mSize; int32_t mStride; RefPtr mDrawTarget; + std::shared_ptr mSnapshotLock; Mutex mChangeMutex; }; diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index 0eea2147effe..ba12e7933560 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -213,6 +213,15 @@ GPUParent::RecvInit(nsTArray&& prefs, } else { gtk_init(nullptr, nullptr); } + + // Ensure we have an FT library for font instantiation. + // This would normally be set by gfxPlatform::Init(). + // Since we bypass that, we must do it here instead. + if (gfxVars::UseWebRender()) { + FT_Library library = Factory::NewFTLibrary(); + MOZ_ASSERT(library); + Factory::SetFTLibrary(library); + } #endif // Make sure to do this *after* we update gfxVars above. diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index bbb5bd3a340e..80b5e113c2b9 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -613,7 +613,7 @@ UpdateRootFrameForTouchTargetDocument(nsIFrame* aRootFrame) // Re-target so that the hit test is performed relative to the frame for the // Root Content Document instead of the Root Document which are different in // Android. See bug 1229752 comment 16 for an explanation of why this is necessary. - if (nsIDocument* doc = aRootFrame->PresContext()->PresShell()->GetPrimaryContentDocument()) { + if (nsIDocument* doc = aRootFrame->PresShell()->GetPrimaryContentDocument()) { if (nsIPresShell* shell = doc->GetShell()) { if (nsIFrame* frame = shell->GetRootFrame()) { return frame; @@ -648,7 +648,7 @@ PrepareForSetTargetAPZCNotification(nsIWidget* aWidget, nsLayoutUtils::GetFrameForPoint(aRootFrame, point, flags); nsIScrollableFrame* scrollAncestor = target ? nsLayoutUtils::GetAsyncScrollableAncestorFrame(target) - : aRootFrame->PresContext()->PresShell()->GetRootScrollFrameAsScrollable(); + : aRootFrame->PresShell()->GetRootScrollFrameAsScrollable(); // Assuming that if there's no scrollAncestor, there's already a displayPort. nsCOMPtr dpElement = scrollAncestor @@ -685,7 +685,7 @@ PrepareForSetTargetAPZCNotification(nsIWidget* aWidget, // element again and bail out on this operation. APZCCH_LOG("Widget %p's document element %p didn't have a displayport\n", aWidget, dpElement.get()); - APZCCallbackHelper::InitializeRootDisplayport(aRootFrame->PresContext()->PresShell()); + APZCCallbackHelper::InitializeRootDisplayport(aRootFrame->PresShell()); return false; } diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index ad8d740ba32e..056e773dfcde 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -268,7 +268,7 @@ static already_AddRefed TexClientFromReadback(SharedSurface* src, CompositableForwarder* allocator, TextureFlags baseFlags, LayersBackend layersBackend) { - auto backendType = gfx::BackendType::CAIRO; + auto backendType = gfx::BackendType::SKIA; TexClientFactory factory(allocator, src->mHasAlpha, src->mSize, backendType, baseFlags, layersBackend); diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 8c26de230d38..a7131127586d 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -1141,11 +1141,6 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator, return MakeAndAddRef(data, aTextureFlags, aAllocator); } - if (moz2DBackend == BackendType::SKIA && aFormat == SurfaceFormat::B8G8R8X8) { - // Skia doesn't support RGBX, so ensure we clear the buffer for the proper alpha values. - aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_CLEAR_BUFFER); - } - // Can't do any better than a buffer texture client. return TextureClient::CreateForRawBufferAccess(aAllocator, aFormat, aSize, moz2DBackend, aLayersBackend, @@ -1250,13 +1245,20 @@ TextureClient::CreateForRawBufferAccess(LayersIPCChannel* aAllocator, return nullptr; } - // D2D backend does not support CreateDrawTargetForData(). Use CAIRO instead. - if (aMoz2DBackend == gfx::BackendType::DIRECT2D || - aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) { - aMoz2DBackend = gfx::BackendType::CAIRO; + if (aFormat == SurfaceFormat::B8G8R8X8) { + // Skia doesn't support RGBX, so ensure we clear the buffer for the proper alpha values. + aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_CLEAR_BUFFER); } - TextureData* texData = BufferTextureData::Create(aSize, aFormat, aMoz2DBackend, + // Note that we ignore the backend type if we get here. It should only be D2D + // or Skia, and D2D does not support data surfaces. Therefore it is safe to + // force the buffer to be Skia. + NS_WARNING_ASSERTION(aMoz2DBackend != gfx::BackendType::SKIA && + aMoz2DBackend != gfx::BackendType::DIRECT2D && + aMoz2DBackend != gfx::BackendType::DIRECT2D1_1, + "Unsupported TextureClient backend type"); + + TextureData* texData = BufferTextureData::Create(aSize, aFormat, gfx::BackendType::SKIA, aLayersBackend, aTextureFlags, aAllocFlags, aAllocator); if (!texData) { diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index aed64c29dd2d..a2f19e9172a1 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -81,7 +81,7 @@ WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder mLayerScrollData.emplace_back(); mLayerScrollData.back().InitializeRoot(mLayerScrollData.size() - 1); if (aDisplayListBuilder->IsBuildingLayerEventRegions()) { - nsIPresShell* shell = aDisplayListBuilder->RootReferenceFrame()->PresContext()->PresShell(); + nsIPresShell* shell = aDisplayListBuilder->RootReferenceFrame()->PresShell(); if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(shell)) { mLayerScrollData.back().SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent); } diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index a3f45c4bbe0a..d4d903c549dd 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -94,7 +94,7 @@ protected: if (mHonoringInvalidations && !mDocWrapper->ShouldIgnoreInvalidation()) { nsIFrame* frame = elem->GetPrimaryFrame(); - if (!frame || frame->PresContext()->PresShell()->IsDestroying()) { + if (!frame || frame->PresShell()->IsDestroying()) { // We're being destroyed. Bail out. return; } diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp index a0982bfa6f68..6fe9eb3851eb 100644 --- a/ipc/glue/BackgroundUtils.cpp +++ b/ipc/glue/BackgroundUtils.cpp @@ -387,6 +387,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo, aLoadInfo->GetUpgradeInsecureRequests(), aLoadInfo->GetVerifySignedContent(), aLoadInfo->GetEnforceSRI(), + aLoadInfo->GetForceAllowDataURI(), aLoadInfo->GetForceInheritPrincipalDropped(), aLoadInfo->GetInnerWindowID(), aLoadInfo->GetOuterWindowID(), @@ -495,6 +496,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs, loadInfoArgs.upgradeInsecureRequests(), loadInfoArgs.verifySignedContent(), loadInfoArgs.enforceSRI(), + loadInfoArgs.forceAllowDataURI(), loadInfoArgs.forceInheritPrincipalDropped(), loadInfoArgs.innerWindowID(), loadInfoArgs.outerWindowID(), diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 98e7bd46b0ff..f5d578eb67e8 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -3130,8 +3130,17 @@ Parser::functionArguments(YieldHandling yieldHandling, return false; } + // The next step is to detect arguments with default expressions, + // e.g. |function parseInt(str, radix = 10) {}|. But if we have a + // parentheses-free arrow function, |a => ...|, the '=' necessary + // for a default expression would really be an assignment operator: + // that is, |a = b => 42;| would parse as |a = (b => 42);|. So we + // should stop parsing arguments here. + if (parenFreeArrow) + break; + bool matched; - if (!tokenStream.matchToken(&matched, TOK_ASSIGN)) + if (!tokenStream.matchToken(&matched, TOK_ASSIGN, TokenStream::Operand)) return false; if (matched) { // A default argument without parentheses would look like: @@ -3166,10 +3175,11 @@ Parser::functionArguments(YieldHandling yieldHandling, return false; } - if (parenFreeArrow || IsSetterKind(kind)) + // Setter syntax uniquely requires exactly one argument. + if (IsSetterKind(kind)) break; - if (!tokenStream.matchToken(&matched, TOK_COMMA)) + if (!tokenStream.matchToken(&matched, TOK_COMMA, TokenStream::Operand)) return false; if (!matched) break; @@ -3177,16 +3187,14 @@ Parser::functionArguments(YieldHandling yieldHandling, if (!hasRest) { if (!tokenStream.peekToken(&tt, TokenStream::Operand)) return null(); - if (tt == TOK_RP) { - tokenStream.addModifierException(TokenStream::NoneIsOperand); + if (tt == TOK_RP) break; - } } } if (!parenFreeArrow) { TokenKind tt; - if (!tokenStream.getToken(&tt)) + if (!tokenStream.getToken(&tt, TokenStream::Operand)) return false; if (tt != TOK_RP) { if (IsSetterKind(kind)) { @@ -4443,8 +4451,10 @@ Parser::objectBindingPattern(DeclarationKind kind, TokenKind tt; if (!tokenStream.peekToken(&tt)) return null(); - if (tt == TOK_RC) + if (tt == TOK_RC) { + tokenStream.addModifierException(TokenStream::OperandIsNone); break; + } if (tt == TOK_TRIPLEDOT) { tokenStream.consumeKnownToken(TOK_TRIPLEDOT); @@ -4484,7 +4494,7 @@ Parser::objectBindingPattern(DeclarationKind kind, return null(); bool hasInitializer; - if (!tokenStream.matchToken(&hasInitializer, TOK_ASSIGN)) + if (!tokenStream.matchToken(&hasInitializer, TOK_ASSIGN, TokenStream::Operand)) return null(); Node bindingExpr = hasInitializer @@ -4530,7 +4540,7 @@ Parser::objectBindingPattern(DeclarationKind kind, } bool matched; - if (!tokenStream.matchToken(&matched, TOK_COMMA)) + if (!tokenStream.matchToken(&matched, TOK_COMMA, TokenStream::Operand)) return null(); if (!matched) break; @@ -4540,7 +4550,7 @@ Parser::objectBindingPattern(DeclarationKind kind, } } - MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RC, TokenStream::None, + MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RC, TokenStream::Operand, reportMissingClosing(JSMSG_CURLY_AFTER_LIST, JSMSG_CURLY_OPENED, begin)); @@ -4575,6 +4585,7 @@ Parser::arrayBindingPattern(DeclarationKind kind, YieldHand if (tt == TOK_RB) { tokenStream.ungetToken(); + tokenStream.addModifierException(TokenStream::OperandIsNone); break; } @@ -4600,7 +4611,7 @@ Parser::arrayBindingPattern(DeclarationKind kind, YieldHand return null(); bool hasInitializer; - if (!tokenStream.matchToken(&hasInitializer, TOK_ASSIGN)) + if (!tokenStream.matchToken(&hasInitializer, TOK_ASSIGN, TokenStream::Operand)) return null(); Node element = hasInitializer @@ -4615,7 +4626,7 @@ Parser::arrayBindingPattern(DeclarationKind kind, YieldHand if (tt != TOK_COMMA) { // If we didn't already match TOK_COMMA in above case. bool matched; - if (!tokenStream.matchToken(&matched, TOK_COMMA)) + if (!tokenStream.matchToken(&matched, TOK_COMMA, TokenStream::Operand)) return null(); if (!matched) break; @@ -4627,7 +4638,7 @@ Parser::arrayBindingPattern(DeclarationKind kind, YieldHand } } - MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RB, TokenStream::None, + MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RB, TokenStream::Operand, reportMissingClosing(JSMSG_BRACKET_AFTER_LIST, JSMSG_BRACKET_OPENED, begin)); @@ -7931,7 +7942,7 @@ Parser::condExpr(InHandling inHandling, YieldHandling yield if (!thenExpr) return null(); - MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_IN_COND); + MUST_MATCH_TOKEN_MOD(TOK_COLON, TokenStream::Operand, JSMSG_COLON_IN_COND); Node elseExpr = assignExpr(inHandling, yieldHandling, TripledotProhibited); if (!elseExpr) @@ -8021,6 +8032,7 @@ Parser::assignExpr(InHandling inHandling, YieldHandling yie PossibleError possibleErrorInner(*this); Node lhs; TokenKind tokenAfterLHS; + bool isArrow; if (maybeAsyncArrow) { tokenStream.consumeKnownToken(TOK_ASYNC, TokenStream::Operand); @@ -8034,54 +8046,33 @@ Parser::assignExpr(InHandling inHandling, YieldHandling yie if (!name) return null(); - if (!tokenStream.getToken(&tokenAfterLHS)) + if (!tokenStream.peekTokenSameLine(&tokenAfterLHS)) return null(); if (tokenAfterLHS != TOK_ARROW) { error(JSMSG_UNEXPECTED_TOKEN, - "'=>' after argument list", TokenKindToDesc(tokenAfterLHS)); + "'=>' on the same line after an argument list", TokenKindToDesc(tokenAfterLHS)); return null(); } + + isArrow = true; } else { lhs = condExpr(inHandling, yieldHandling, tripledotHandling, &possibleErrorInner, invoked); if (!lhs) return null(); - if (!tokenStream.getToken(&tokenAfterLHS)) + // Use Operand here because the ConditionalExpression parsed above + // could be the entirety of this AssignmentExpression, and then ASI + // permits this token to be a regular expression. + if (!tokenStream.peekTokenSameLine(&tokenAfterLHS, TokenStream::Operand)) return null(); + + isArrow = tokenAfterLHS == TOK_ARROW; } - ParseNodeKind kind; - switch (tokenAfterLHS) { - case TOK_ASSIGN: kind = PNK_ASSIGN; break; - case TOK_ADDASSIGN: kind = PNK_ADDASSIGN; break; - case TOK_SUBASSIGN: kind = PNK_SUBASSIGN; break; - case TOK_BITORASSIGN: kind = PNK_BITORASSIGN; break; - case TOK_BITXORASSIGN: kind = PNK_BITXORASSIGN; break; - case TOK_BITANDASSIGN: kind = PNK_BITANDASSIGN; break; - case TOK_LSHASSIGN: kind = PNK_LSHASSIGN; break; - case TOK_RSHASSIGN: kind = PNK_RSHASSIGN; break; - case TOK_URSHASSIGN: kind = PNK_URSHASSIGN; break; - case TOK_MULASSIGN: kind = PNK_MULASSIGN; break; - case TOK_DIVASSIGN: kind = PNK_DIVASSIGN; break; - case TOK_MODASSIGN: kind = PNK_MODASSIGN; break; - case TOK_POWASSIGN: kind = PNK_POWASSIGN; break; - - case TOK_ARROW: { - - // A line terminator between ArrowParameters and the => should trigger a SyntaxError. - tokenStream.ungetToken(); - TokenKind next; - if (!tokenStream.peekTokenSameLine(&next)) - return null(); - MOZ_ASSERT(next == TOK_ARROW || next == TOK_EOL); - - if (next != TOK_ARROW) { - error(JSMSG_LINE_BREAK_BEFORE_ARROW); - return null(); - } - + if (isArrow) { tokenStream.seek(start); + TokenKind next; if (!tokenStream.getToken(&next, TokenStream::Operand)) return null(); uint32_t toStringStart = pos().begin; @@ -8111,7 +8102,25 @@ Parser::assignExpr(InHandling inHandling, YieldHandling yie return functionDefinition(pn, toStringStart, inHandling, yieldHandling, nullptr, Arrow, GeneratorKind::NotGenerator, asyncKind); - } + } + + MOZ_ALWAYS_TRUE(tokenStream.getToken(&tokenAfterLHS, TokenStream::Operand)); + + ParseNodeKind kind; + switch (tokenAfterLHS) { + case TOK_ASSIGN: kind = PNK_ASSIGN; break; + case TOK_ADDASSIGN: kind = PNK_ADDASSIGN; break; + case TOK_SUBASSIGN: kind = PNK_SUBASSIGN; break; + case TOK_BITORASSIGN: kind = PNK_BITORASSIGN; break; + case TOK_BITXORASSIGN: kind = PNK_BITXORASSIGN; break; + case TOK_BITANDASSIGN: kind = PNK_BITANDASSIGN; break; + case TOK_LSHASSIGN: kind = PNK_LSHASSIGN; break; + case TOK_RSHASSIGN: kind = PNK_RSHASSIGN; break; + case TOK_URSHASSIGN: kind = PNK_URSHASSIGN; break; + case TOK_MULASSIGN: kind = PNK_MULASSIGN; break; + case TOK_DIVASSIGN: kind = PNK_DIVASSIGN; break; + case TOK_MODASSIGN: kind = PNK_MODASSIGN; break; + case TOK_POWASSIGN: kind = PNK_POWASSIGN; break; default: MOZ_ASSERT(!tokenStream.isCurrentTokenAssignment()); @@ -8123,7 +8132,6 @@ Parser::assignExpr(InHandling inHandling, YieldHandling yie } tokenStream.ungetToken(); - tokenStream.addModifierException(TokenStream::OperandIsNone); return lhs; } @@ -8711,7 +8719,7 @@ Parser::argumentList(YieldHandling yieldHandling, Node list handler.addList(listNode, argNode); bool matched; - if (!tokenStream.matchToken(&matched, TOK_COMMA)) + if (!tokenStream.matchToken(&matched, TOK_COMMA, TokenStream::Operand)) return false; if (!matched) break; @@ -8719,13 +8727,11 @@ Parser::argumentList(YieldHandling yieldHandling, Node list TokenKind tt; if (!tokenStream.peekToken(&tt, TokenStream::Operand)) return null(); - if (tt == TOK_RP) { - tokenStream.addModifierException(TokenStream::NoneIsOperand); + if (tt == TOK_RP) break; - } } - MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_ARGS); + MUST_MATCH_TOKEN_MOD(TOK_RP, TokenStream::Operand, JSMSG_PAREN_AFTER_ARGS); handler.setEndPosition(listNode, pos().end); return true; @@ -9593,15 +9599,18 @@ Parser::propertyName(YieldHandling yieldHandling, error(JSMSG_BAD_PROP_ID); return null(); } + tokenStream.ungetToken(); - *propType = tt == TOK_ASSIGN ? - PropertyType::CoverInitializedName : - PropertyType::Shorthand; + tokenStream.addModifierException(TokenStream::OperandIsNone); + *propType = tt == TOK_ASSIGN + ? PropertyType::CoverInitializedName + : PropertyType::Shorthand; return propName; } if (tt == TOK_LP) { tokenStream.ungetToken(); + if (isGenerator && isAsync) *propType = PropertyType::AsyncGeneratorMethod; else if (isGenerator) @@ -9638,7 +9647,7 @@ Parser::computedPropertyName(YieldHandling yieldHandling, if (!assignNode) return null(); - MUST_MATCH_TOKEN(TOK_RB, JSMSG_COMP_PROP_UNTERM_EXPR); + MUST_MATCH_TOKEN_MOD(TOK_RB, TokenStream::Operand, JSMSG_COMP_PROP_UNTERM_EXPR); return handler.newComputedName(assignNode, begin, pos().end); } @@ -9663,8 +9672,10 @@ Parser::objectLiteral(YieldHandling yieldHandling, TokenKind tt; if (!tokenStream.peekToken(&tt)) return null(); - if (tt == TOK_RC) + if (tt == TOK_RC) { + tokenStream.addModifierException(TokenStream::OperandIsNone); break; + } if (tt == TOK_TRIPLEDOT) { tokenStream.consumeKnownToken(TOK_TRIPLEDOT); @@ -9850,7 +9861,7 @@ Parser::objectLiteral(YieldHandling yieldHandling, } bool matched; - if (!tokenStream.matchToken(&matched, TOK_COMMA)) + if (!tokenStream.matchToken(&matched, TOK_COMMA, TokenStream::Operand)) return null(); if (!matched) break; @@ -9858,7 +9869,7 @@ Parser::objectLiteral(YieldHandling yieldHandling, possibleError->setPendingDestructuringErrorAt(pos(), JSMSG_REST_WITH_COMMA); } - MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RC, TokenStream::None, + MUST_MATCH_TOKEN_MOD_WITH_REPORT(TOK_RC, TokenStream::Operand, reportMissingClosing(JSMSG_CURLY_AFTER_LIST, JSMSG_CURLY_OPENED, openedPos)); diff --git a/js/src/jit-test/README b/js/src/jit-test/README index c3281c8d163c..966cafb40bb1 100644 --- a/js/src/jit-test/README +++ b/js/src/jit-test/README @@ -2,12 +2,12 @@ JS Trace Test Suite * PURPOSE -This is a test suite for testing TraceMonkey. All tests are run in the JS shell +This is a test suite for testing the SpiderMonkey JIT. All tests are run in the JS shell with tracing enabled (-j). * REQUIREMENTS -Python 2.5. This is already a standard requirement for building our tree. +Python 2.7. This is already a standard requirement for building our tree. * RUNNING THE TESTS diff --git a/js/src/tests/README.txt b/js/src/tests/README.txt index 53f546975df2..147c669b9b33 100644 --- a/js/src/tests/README.txt +++ b/js/src/tests/README.txt @@ -4,14 +4,14 @@ JS Test Suite Readme The JS test suite is a fairly extensive collection of correctness and regression tests for the Spidermonkey engine. Two harnesses run these tests: the shell test harness in this directory and the "reftest" harness built into the browser, used -by Tinderbox. The browser reftests require additional manifest files; these are +in continuous integration. The browser reftests require additional manifest files; these are generated automatically by the build phase 'package-tests' using the '--make-manifests' option to jstests.py. Creating a test --------------- For general information, see -https://developer.mozilla.org/en-US/docs/SpiderMonkey/Creating_JavaScript_tests +https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Creating_JavaScript_tests Adding a test ------------- diff --git a/js/src/tests/ecma_6/ArrowFunctions/arrow-not-as-end-of-statement.js b/js/src/tests/ecma_6/ArrowFunctions/arrow-not-as-end-of-statement.js index 202c13876a32..9c9921656580 100644 --- a/js/src/tests/ecma_6/ArrowFunctions/arrow-not-as-end-of-statement.js +++ b/js/src/tests/ecma_6/ArrowFunctions/arrow-not-as-end-of-statement.js @@ -8,12 +8,64 @@ assertEq(`x ${a => {}} z`, "x a => {} z"); +for (a => {}; ; ) + break; + for (; a => {}; ) break; for (; ; a => {}) break; +Function.prototype[Symbol.iterator] = function() { return { next() { return { done: true }; } }; }; +for (let m of 0 ? 1 : a => {}) + assertEq(true, false); +for (let [m] of 0 ? 1 : a => {}) + assertEq(true, false); +delete Function.prototype[Symbol.iterator]; + +for (let w in 0 ? 1 : a => {}) + break; +for (let [w] in 0 ? 1 : a => {}) + break; + +function* stargen() +{ + yield a => {} + /Q/g; + + var first = true; + Function.prototype[Symbol.iterator] = function() { + return { + next() { + var res = { done: true, value: 8675309 }; + if (first) + { + res = { value: "fnord", done: false }; + first = false; + } + + return res; + } + }; + }; + + + yield* a => {} + /Q/g; + + delete Function.prototype[Symbol.iterator]; + + yield 99; +} +var gen = stargen(); +assertEq(typeof gen.next().value, "function"); +var result = gen.next(); +assertEq(result.value, "fnord"); +assertEq(result.done, false); +assertEq(gen.next().value, 99); +assertEq(gen.next().done, true); + switch (1) { case a => {}: @@ -53,15 +105,106 @@ switch (a => {}) with (a => {}); assertEq(typeof (a => {}), "function"); +assertEq(typeof (a => b => {}), "function"); for (var x in y => {}) continue; +assertEq(eval("a => {}, 17, 42;"), 42); +assertEq(eval("42, a => {}, 17;"), 17); +assertEq(typeof eval("17, 42, a => {};"), "function"); + +assertEq(eval("1 ? 0 : a => {}, 17, 42;"), 42); +assertEq(eval("42, 1 ? 0 : a => {}, 17;"), 17); +assertEq(eval("17, 42, 1 ? 0 : a => {};"), 0); + var z = { x: 0 ? 1 : async a => {} }; assertEq(typeof z.x, "function"); var q = 0 ? 1 : async () => {}; assertEq(typeof q, "function"); +var m = 0 ? 42 : m = foo => {} // ASI +/Q/g; +assertEq(typeof m, "function"); + +var { q: w = 0 ? 1 : a => {} } = {}; +assertEq(typeof w, "function"); + +Function.prototype.c = 42; +var { c } = 0 ? 1 : a => {} // ASI +/Q/g; +assertEq(c, 42); + +var c = 0 ? 1 : a => {} +/Q/g; +assertEq(typeof c, "function"); +delete Function.prototype.c; + +assertEq(typeof eval(0 ? 1 : a => {}), "function"); + +var zoom = 1 ? a => {} : 357; +assertEq(typeof zoom, "function"); + +var { b = 0 ? 1 : a => {} } = {}; +assertEq(typeof b, "function"); + +var [k = 0 ? 1 : a => {}] = []; +assertEq(typeof k, "function"); + +assertEq(typeof [0 ? 1 : a => {}][0], "function"); + +Function.prototype[Symbol.iterator] = function() { return { next() { return { done: true }; } }; }; +assertEq([...0 ? 1 : a => {}].length, 0); +delete Function.prototype[Symbol.iterator]; + +var props = Object.getOwnPropertyNames({ ...0 ? 1 : a => {} }).sort(); +assertEq(props.length, 0); + +function f1(x = 0 ? 1 : a => {}) { return x; } +assertEq(typeof f1(), "function"); +assertEq(f1(5), 5); + +var g1 = (x = 0 ? 1 : a => {}) => { return x; }; +assertEq(typeof g1(), "function"); +assertEq(g1(5), 5); + +var h1 = async (x = 0 ? 1 : a => {}) => { return x; }; +assertEq(typeof h1, "function"); + +function f2(m, x = 0 ? 1 : a => {}) { return x; } +assertEq(typeof f2(1), "function"); +assertEq(f2(1, 5), 5); + +var g2 = (m, x = 0 ? 1 : a => {}) => { return x; }; +assertEq(typeof g2(1), "function"); +assertEq(g2(1, 5), 5); + +var h2 = async (m, x = 0 ? 1 : a => {}) => { return x; }; +assertEq(typeof h2, "function"); + +function f3(x = 0 ? 1 : a => {}, q) { return x; } +assertEq(typeof f3(), "function"); +assertEq(f3(5), 5); + +var g3 = (x = 0 ? 1 : a => {}, q) => { return x; }; +assertEq(typeof g3(), "function"); +assertEq(g3(5), 5); + +var h3 = async (x = 0 ? 1 : a => {}, q) => { return x; }; +assertEq(typeof h3, "function"); + +var asyncf = async () => {}; +assertEq(typeof asyncf, "function"); + +var { [0 ? 1 : a => {}]: h } = { "a => {}": "boo-urns!" }; +assertEq(h, "boo-urns!"); + +var gencomp = (for (prop of [0]) 0 ? 1 : a => {}); +assertEq(typeof gencomp.next().value, "function"); + +var arrcomp = [for (prop of [0]) 0 ? 1 : a => {}]; +assertEq(typeof arrcomp[0], "function"); + if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_6/Comprehensions/inside-derived-class.js b/js/src/tests/ecma_6/Comprehensions/inside-derived-class.js new file mode 100644 index 000000000000..4ebdb090416a --- /dev/null +++ b/js/src/tests/ecma_6/Comprehensions/inside-derived-class.js @@ -0,0 +1,32 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 1299519; +var summary = + "Generator comprehension lambdas in derived constructors shouldn't assert"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +class Base {}; + +class Derived extends Base +{ + constructor() { + var a = (for (_ of []) _); + var b = [for (_ of []) _]; + } +}; + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); diff --git a/layout/base/AccessibleCaret.cpp b/layout/base/AccessibleCaret.cpp index 965caa834d5c..3fffa37ac7cd 100644 --- a/layout/base/AccessibleCaret.cpp +++ b/layout/base/AccessibleCaret.cpp @@ -269,7 +269,7 @@ AccessibleCaret::RemoveCaretElement(nsIDocument* aDocument) frame = frame->GetPlaceholderFrame(); } nsAutoScriptBlocker scriptBlocker; - nsCSSFrameConstructor* fc = frame->PresContext()->PresShell()->FrameConstructor(); + nsCSSFrameConstructor* fc = frame->PresShell()->FrameConstructor(); fc->BeginUpdate(); frame->GetParent()->RemoveFrame(nsIFrame::kPrincipalList, frame); fc->EndUpdate(); diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index fa6bfc3f3502..0ab51152ac72 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -584,7 +584,7 @@ FindFrameTargetedByInputEvent(WidgetGUIEvent* aEvent, // never be targeted --- something nsSubDocumentFrame in an ancestor document // would be targeted instead. nsIFrame* restrictToDescendants = target ? - target->PresContext()->PresShell()->GetRootFrame() : aRootFrame; + target->PresShell()->GetRootFrame() : aRootFrame; nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, restrictToDescendants, prefs, aFlags); diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 8d6f7c1080a1..f7209f2a6e30 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -5277,7 +5277,7 @@ PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder, bool addedScrollingBackgroundColor = (aFlags & APPEND_UNSCROLLED_ONLY); if (!aFrame->GetParent() && !addedScrollingBackgroundColor) { nsIScrollableFrame* sf = - aFrame->PresContext()->PresShell()->GetRootScrollFrameAsScrollable(); + aFrame->PresShell()->GetRootScrollFrameAsScrollable(); if (sf) { nsCanvasFrame* canvasFrame = do_QueryFrame(sf->GetScrolledFrame()); if (canvasFrame && canvasFrame->IsVisibleForPainting(&aBuilder)) { @@ -5566,7 +5566,7 @@ static nsView* FindFloatingViewContaining(nsView* aView, nsPoint aPt) nsIFrame* frame = aView->GetFrame(); if (frame) { if (!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY) || - !frame->PresContext()->PresShell()->IsActive()) { + !frame->PresShell()->IsActive()) { return nullptr; } } @@ -5603,7 +5603,7 @@ static nsView* FindViewContaining(nsView* aView, nsPoint aPt) nsIFrame* frame = aView->GetFrame(); if (frame) { if (!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY) || - !frame->PresContext()->PresShell()->IsActive()) { + !frame->PresShell()->IsActive()) { return nullptr; } } @@ -5785,7 +5785,7 @@ PresShell::MarkFramesInListApproximatelyVisible(const nsDisplayList& aList, } // Use the presshell containing the frame. - auto* presShell = static_cast(frame->PresContext()->PresShell()); + auto* presShell = static_cast(frame->PresShell()); MOZ_ASSERT(!presShell->AssumeAllFramesVisible()); if (presShell->mApproximatelyVisibleFrames.EnsureInserted(frame)) { // The frame was added to mApproximatelyVisibleFrames, so increment its visible count. @@ -5919,7 +5919,7 @@ PresShell::MarkFramesInSubtreeApproximatelyVisible(nsIFrame* aFrame, Maybe& aVisibleRegions, bool aRemoveOnly /* = false */) { - MOZ_ASSERT(aFrame->PresContext()->PresShell() == this, "wrong presshell"); + MOZ_ASSERT(aFrame->PresShell() == this, "wrong presshell"); if (aFrame->TrackingVisibility() && aFrame->StyleVisibility()->IsVisible() && @@ -7266,8 +7266,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, return NS_OK; } - PresShell* shell = - static_cast(frame->PresContext()->PresShell()); + PresShell* shell = static_cast(frame->PresShell()); switch (aEvent->mMessage) { case eTouchMove: case eTouchCancel: @@ -7296,8 +7295,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, break; } - shell = static_cast( - contentFrame->PresContext()->PresShell()); + shell = static_cast(contentFrame->PresShell()); if (shell) { break; } diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 51c1b2a2604d..49fa4396807e 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -728,6 +728,16 @@ RecomputePosition(nsIFrame* aFrame) return false; } + // Flexbox and Grid layout supports CSS Align and the optimizations below + // don't support that yet. + if (aFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) { + nsIFrame* ph = aFrame->GetPlaceholderFrame(); + if (ph && ph->HasAnyStateBits(PLACEHOLDER_STATICPOS_NEEDS_CSSALIGN)) { + StyleChangeReflow(aFrame, nsChangeHint_NeedReflow); + return false; + } + } + aFrame->SchedulePaint(); // For relative positioning, we can simply update the frame rect @@ -797,7 +807,7 @@ RecomputePosition(nsIFrame* aFrame) // doesn't need to change, we can simply update the frame position. Otherwise // we fall back to a reflow. RefPtr rc = - aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); + aFrame->PresShell()->CreateReferenceRenderingContext(); // Construct a bogus parent reflow state so that there's a usable // containing block reflow state. @@ -1235,7 +1245,7 @@ StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint) } do { - aFrame->PresContext()->PresShell()->FrameNeedsReflow( + aFrame->PresShell()->FrameNeedsReflow( aFrame, dirtyType, dirtyBits, rootHandling); aFrame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame); } while (aFrame); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 510ca003f725..423a5f3685a5 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -855,7 +855,7 @@ GetScrollFrameFromContent(nsIContent* aContent) { nsIFrame* frame = aContent->GetPrimaryFrame(); if (aContent->OwnerDoc()->GetRootElement() == aContent) { - nsIPresShell* presShell = frame ? frame->PresContext()->PresShell() : nullptr; + nsIPresShell* presShell = frame ? frame->PresShell() : nullptr; if (!presShell) { presShell = aContent->OwnerDoc()->GetShell(); } @@ -2176,7 +2176,7 @@ nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame, uint32_t aFlags) } } if (aFlags & SCROLLABLE_ALWAYS_MATCH_ROOT) { - nsIPresShell* ps = f->PresContext()->PresShell(); + nsIPresShell* ps = f->PresShell(); if (ps->GetRootScrollFrame() == f && ps->GetDocument() && ps->GetDocument()->IsRootDisplayDocument()) { return scrollableFrame; @@ -2186,7 +2186,7 @@ nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame, uint32_t aFlags) if ((aFlags & SCROLLABLE_FIXEDPOS_FINDS_ROOT) && f->StyleDisplay()->mPosition == NS_STYLE_POSITION_FIXED && nsLayoutUtils::IsReallyFixedPos(f)) { - return f->PresContext()->PresShell()->GetRootScrollFrameAsScrollable(); + return f->PresShell()->GetRootScrollFrameAsScrollable(); } } return nullptr; @@ -2376,7 +2376,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(nsIWidget* aWidget, int32_t rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel(); int32_t localAPD = aFrame->PresContext()->AppUnitsPerDevPixel(); widgetToView = widgetToView.ScaleToOtherAppUnits(rootAPD, localAPD); - nsIPresShell* shell = aFrame->PresContext()->PresShell(); + nsIPresShell* shell = aFrame->PresShell(); // XXX Bug 1224748 - Update nsLayoutUtils functions to correctly handle nsPresShell resolution widgetToView = widgetToView.RemoveResolution(GetCurrentAPZResolutionScale(shell)); @@ -2777,7 +2777,7 @@ nsLayoutUtils::FindNearestCommonAncestorFrame(nsIFrame* aFrame1, nsIFrame* aFram AutoTArray ancestors2; nsIFrame* commonAncestor = nullptr; if (aFrame1->PresContext() == aFrame2->PresContext()) { - commonAncestor = aFrame1->PresContext()->PresShell()->GetRootFrame(); + commonAncestor = aFrame1->PresShell()->GetRootFrame(); } for (nsIFrame* f = aFrame1; f != commonAncestor; f = nsLayoutUtils::GetCrossDocParentFrame(f)) { @@ -3278,8 +3278,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, } if (aFlags & IGNORE_ROOT_SCROLL_FRAME) { - nsIFrame* rootScrollFrame = - aFrame->PresContext()->PresShell()->GetRootScrollFrame(); + nsIFrame* rootScrollFrame = aFrame->PresShell()->GetRootScrollFrame(); if (rootScrollFrame) { builder.SetIgnoreScrollFrame(rootScrollFrame); } @@ -3460,11 +3459,11 @@ nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(nsIFrame* aFra frame = do_QueryFrame(scrollAncestor); MOZ_ASSERT(frame); MOZ_ASSERT(scrollAncestor->WantAsyncScroll() || - frame->PresContext()->PresShell()->GetRootScrollFrame() == frame); + frame->PresShell()->GetRootScrollFrame() == frame); if (nsLayoutUtils::AsyncPanZoomEnabled(frame) && !nsLayoutUtils::HasDisplayPort(frame->GetContent())) { nsLayoutUtils::SetDisplayPortMargins( - frame->GetContent(), frame->PresContext()->PresShell(), ScreenMargin(), 0, + frame->GetContent(), frame->PresShell(), ScreenMargin(), 0, aRepaintMode); } } @@ -3533,7 +3532,7 @@ nsLayoutUtils::ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame) break; } MOZ_ASSERT(scrollAncestor->WantAsyncScroll() || - frame->PresContext()->PresShell()->GetRootScrollFrame() == frame); + frame->PresShell()->GetRootScrollFrame() == frame); if (nsLayoutUtils::HasDisplayPort(frame->GetContent())) { scrollAncestor->TriggerDisplayPortExpiration(); // Stop after the first trigger. If it failed, there's no point in @@ -4283,7 +4282,7 @@ void nsLayoutUtils::RectListBuilder::AddRect(const nsRect& aRect) { nsIFrame* nsLayoutUtils::GetContainingBlockForClientRect(nsIFrame* aFrame) { - return aFrame->PresContext()->PresShell()->GetRootFrame(); + return aFrame->PresShell()->GetRootFrame(); } nsRect @@ -4763,8 +4762,7 @@ nsLayoutUtils::IsViewportScrollbarFrame(nsIFrame* aFrame) if (!aFrame) return false; - nsIFrame* rootScrollFrame = - aFrame->PresContext()->PresShell()->GetRootScrollFrame(); + nsIFrame* rootScrollFrame = aFrame->PresShell()->GetRootScrollFrame(); if (!rootScrollFrame) return false; @@ -6489,7 +6487,7 @@ nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame) } if (layer) return layer; - return aFrame->PresContext()->PresShell()->FrameManager()->GetRootFrame(); + return aFrame->PresShell()->FrameManager()->GetRootFrame(); } SamplingFilter @@ -8834,13 +8832,13 @@ nsLayoutUtils::CalculateExpandedScrollableRect(nsIFrame* aFrame) { nsRect scrollableRect = CalculateScrollableRectForFrame(aFrame->GetScrollTargetFrame(), - aFrame->PresContext()->PresShell()->GetRootFrame()); + aFrame->PresShell()->GetRootFrame()); nsSize compSize = CalculateCompositionSizeForFrame(aFrame); - if (aFrame == aFrame->PresContext()->PresShell()->GetRootScrollFrame()) { + if (aFrame == aFrame->PresShell()->GetRootScrollFrame()) { // the composition size for the root scroll frame does not include the // local resolution, so we adjust. - float res = aFrame->PresContext()->PresShell()->GetResolution(); + float res = aFrame->PresShell()->GetResolution(); compSize.width = NSToCoordRound(compSize.width / res); compSize.height = NSToCoordRound(compSize.height / res); } diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index bddf1718308f..6a4c67b64444 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -552,7 +552,7 @@ public: static_cast(mFrame.GetFrame()); static_cast(combo->mDropdownFrame)-> SetSuppressScrollbarUpdate(true); - nsCOMPtr shell = mFrame->PresContext()->PresShell(); + nsCOMPtr shell = mFrame->PresShell(); shell->FrameNeedsReflow(combo->mDropdownFrame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); shell->FlushPendingNotifications(FlushType::Layout); @@ -1046,7 +1046,7 @@ nsComboboxControlFrame::HandleRedisplayTextEvent() ActuallyDisplayText(true); // XXXbz This should perhaps be eResize. Check. - PresContext()->PresShell()->FrameNeedsReflow(mDisplayFrame, + PresShell()->FrameNeedsReflow(mDisplayFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); @@ -1364,7 +1364,7 @@ nsComboboxControlFrame::CreateFrameForDisplayNode() MOZ_ASSERT(mDisplayContent); // Get PresShell - nsIPresShell *shell = PresContext()->PresShell(); + nsIPresShell *shell = PresShell(); StyleSetHandle styleSet = shell->StyleSet(); // create the style contexts for the anonymous block frame and text frame diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 415e96c7d40f..adb89fa00e6d 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -1982,7 +1982,7 @@ nsListControlFrame::ScrollToFrame(dom::HTMLOptionElement& aOptElement) // otherwise we find the content's frame and scroll to it nsIFrame* childFrame = aOptElement.GetPrimaryFrame(); if (childFrame) { - PresContext()->PresShell()-> + PresShell()-> ScrollFrameRectIntoView(childFrame, nsRect(nsPoint(0, 0), childFrame->GetSize()), nsIPresShell::ScrollAxis(), nsIPresShell::ScrollAxis(), diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index 91eff1af6d62..18cdd8101f83 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -200,9 +200,8 @@ nsMeterFrame::AttributeChanged(int32_t aNameSpaceID, aAttribute == nsGkAtoms::min )) { nsIFrame* barFrame = mBarDiv->GetPrimaryFrame(); NS_ASSERTION(barFrame, "The meter frame should have a child with a frame!"); - PresContext()->PresShell()->FrameNeedsReflow(barFrame, - nsIPresShell::eResize, - NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(barFrame, nsIPresShell::eResize, + NS_FRAME_IS_DIRTY); InvalidateFrame(); } diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index c6ca8368c52d..5ba47aeb03dd 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -212,7 +212,7 @@ nsProgressFrame::AttributeChanged(int32_t aNameSpaceID, if (aNameSpaceID == kNameSpaceID_None && (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max)) { - auto shell = PresContext()->PresShell(); + auto shell = PresShell(); for (auto childFrame : PrincipalChildList()) { shell->FrameNeedsReflow(childFrame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index b1e0e65d1163..b99705e57f0d 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -630,7 +630,7 @@ nsRangeFrame::UpdateForValueChange() #ifdef ACCESSIBILITY nsAccessibilityService* accService = nsIPresShell::AccService(); if (accService) { - accService->RangeValueChanged(PresContext()->PresShell(), mContent); + accService->RangeValueChanged(PresShell(), mContent); } #endif @@ -760,8 +760,8 @@ nsRangeFrame::AttributeChanged(int32_t aNameSpaceID, UpdateForValueChange(); } } else if (aAttribute == nsGkAtoms::orient) { - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize, - NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize, + NS_FRAME_IS_DIRTY); } } diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index c997f6920679..b5a2f8ccdd64 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -41,7 +41,7 @@ public: virtual already_AddRefed GetRefDrawTarget() override { RefPtr ctx = - mFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); + mFrame->PresShell()->CreateReferenceRenderingContext(); RefPtr dt = ctx->GetDrawTarget(); return dt.forget(); } @@ -822,7 +822,7 @@ TextOverflow::CanHaveTextOverflow(nsIFrame* aBlockFrame) } // Inhibit the markers if a descendant content owns the caret. - RefPtr caret = aBlockFrame->PresContext()->PresShell()->GetCaret(); + RefPtr caret = aBlockFrame->PresShell()->GetCaret(); if (caret && caret->IsVisible()) { nsCOMPtr domSelection = caret->GetSelection(); if (domSelection) { @@ -896,7 +896,7 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame) } } else { RefPtr rc = - aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); + aFrame->PresShell()->CreateReferenceRenderingContext(); RefPtr fm = nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame); mISize = nsLayoutUtils::AppUnitWidthOfStringBidi(mStyle->mString, aFrame, diff --git a/layout/generic/ViewportFrame.cpp b/layout/generic/ViewportFrame.cpp index a6b4c55c50bb..1e480e7de805 100644 --- a/layout/generic/ViewportFrame.cpp +++ b/layout/generic/ViewportFrame.cpp @@ -178,7 +178,7 @@ ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder, } } - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); if (nsCanvasFrame* canvasFrame = shell->GetCanvasFrame()) { if (Element* container = canvasFrame->GetCustomContentContainer()) { if (nsIFrame* frame = container->GetPrimaryFrame()) { @@ -279,7 +279,7 @@ ViewportFrame::AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) con // If a scroll position clamping scroll-port size has been set, layout // fixed position elements to this size instead of the computed size. nsRect rect(0, 0, aReflowInput->ComputedWidth(), aReflowInput->ComputedHeight()); - nsIPresShell* ps = PresContext()->PresShell(); + nsIPresShell* ps = PresShell(); if (ps->IsScrollPositionClampingScrollPortSizeSet()) { rect.SizeTo(ps->GetScrollPositionClampingScrollPortSize()); } @@ -399,7 +399,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext, nsSubDocumentFrame* container = static_cast (nsLayoutUtils::GetCrossDocParentFrame(this)); if (container && !container->ShouldClipSubdocument()) { - container->PresContext()->PresShell()-> + container->PresShell()-> FrameNeedsReflow(container, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); } } @@ -412,7 +412,7 @@ bool ViewportFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) { nsIScrollableFrame* rootScrollFrame = - PresContext()->PresShell()->GetRootScrollFrameAsScrollable(); + PresShell()->GetRootScrollFrameAsScrollable(); if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) { return false; } diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index 9cc6df039214..0f12b802897e 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -70,7 +70,7 @@ nsAbsoluteContainingBlock::AppendFrames(nsIFrame* aDelegatingFrame, // no damage to intrinsic widths, since absolutely positioned frames can't // change them - aDelegatingFrame->PresContext()->PresShell()-> + aDelegatingFrame->PresShell()-> FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -92,7 +92,7 @@ nsAbsoluteContainingBlock::InsertFrames(nsIFrame* aDelegatingFrame, // no damage to intrinsic widths, since absolutely positioned frames can't // change them - aDelegatingFrame->PresContext()->PresShell()-> + aDelegatingFrame->PresShell()-> FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); } diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 0930ec2201cd..7b33146518ab 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -3044,9 +3044,8 @@ nsBlockFrame::AttributeChanged(int32_t aNameSpaceID, if (ancestor) { // XXX Not sure if this is necessary anymore if (ancestor->RenumberList()) { - PresContext()->PresShell()-> - FrameNeedsReflow(ancestor, nsIPresShell::eStyleChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(ancestor, nsIPresShell::eStyleChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } } } @@ -5103,7 +5102,7 @@ nsBlockFrame::SetOverflowOutOfFlows(const nsFrameList& aList, nsFrameList* list = RemovePropTableFrames(OverflowOutOfFlowsProperty()); NS_ASSERTION(aPropValue == list, "prop value mismatch"); list->Clear(); - list->Delete(PresContext()->PresShell()); + list->Delete(PresShell()); RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS); } else if (GetStateBits() & NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS) { @@ -5112,7 +5111,7 @@ nsBlockFrame::SetOverflowOutOfFlows(const nsFrameList& aList, *aPropValue = aList; } else { - SetPropTableFrames(new (PresContext()->PresShell()) nsFrameList(aList), + SetPropTableFrames(new (PresShell()) nsFrameList(aList), OverflowOutOfFlowsProperty()); AddStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS); } @@ -5170,7 +5169,7 @@ nsBlockFrame::EnsurePushedFloats() if (result) return result; - result = new (PresContext()->PresShell()) nsFrameList; + result = new (PresShell()) nsFrameList; SetProperty(PushedFloatProperty(), result); AddStateBits(NS_BLOCK_HAS_PUSHED_FLOATS); @@ -5234,7 +5233,7 @@ nsBlockFrame::AppendFrames(ChildListID aListID, AddFrames(aFrameList, lastKid); if (aListID != kNoReflowPrincipalList) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient? } @@ -5270,7 +5269,7 @@ nsBlockFrame::InsertFrames(ChildListID aListID, AddFrames(aFrameList, aPrevFrame); if (aListID != kNoReflowPrincipalList) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient? } @@ -5316,7 +5315,7 @@ nsBlockFrame::RemoveFrame(ChildListID aListID, MOZ_CRASH("unexpected child list"); } - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient? } @@ -7095,7 +7094,7 @@ void nsBlockFrame::CreateBulletFrameForListItem(bool aCreateBulletList, bool aListStylePositionInside) { - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); CSSPseudoElementType pseudoType = aCreateBulletList ? CSSPseudoElementType::mozListBullet : diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 74881be3a490..5c34e378008b 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -440,16 +440,16 @@ protected: } nsLineBox* NewLineBox(nsIFrame* aFrame, bool aIsBlock) { - return NS_NewLineBox(PresContext()->PresShell(), aFrame, aIsBlock); + return NS_NewLineBox(PresShell(), aFrame, aIsBlock); } nsLineBox* NewLineBox(nsLineBox* aFromLine, nsIFrame* aFrame, int32_t aCount) { - return NS_NewLineBox(PresContext()->PresShell(), aFromLine, aFrame, aCount); + return NS_NewLineBox(PresShell(), aFromLine, aFrame, aCount); } void FreeLineBox(nsLineBox* aLine) { if (aLine == GetLineCursor()) { ClearLineCursor(); } - aLine->Destroy(PresContext()->PresShell()); + aLine->Destroy(PresShell()); } /** * Helper method for StealFrame. diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 2324644ffab7..980edc02cfe2 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -95,8 +95,7 @@ nsContainerFrame::SetInitialChildList(ChildListID aListID, "The placeholder should points to a backdrop frame"); } #endif - nsFrameList* list = - new (PresContext()->PresShell()) nsFrameList(aChildList); + nsFrameList* list = new (PresShell()) nsFrameList(aChildList); SetProperty(BackdropProperty(), list); } else { MOZ_ASSERT_UNREACHABLE("Unexpected child list"); @@ -118,9 +117,8 @@ nsContainerFrame::AppendFrames(ChildListID aListID, mFrames.AppendFrames(this, aFrameList); if (aListID != kNoReflowPrincipalList) { - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } } @@ -142,9 +140,8 @@ nsContainerFrame::InsertFrames(ChildListID aListID, mFrames.InsertFrames(this, aPrevFrame, aFrameList); if (aListID != kNoReflowPrincipalList) { - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } } @@ -162,7 +159,7 @@ nsContainerFrame::RemoveFrame(ChildListID aListID, if (kNoReflowPrincipalList == aListID) { generateReflowCommand = false; } - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); nsContainerFrame* lastParent = nullptr; while (aOldFrame) { nsIFrame* oldFrameNextContinuation = aOldFrame->GetNextContinuation(); @@ -1257,7 +1254,7 @@ TryRemoveFrame(nsIFrame* aFrame, // aChildToRemove *may* have been removed from this list. if (list->IsEmpty()) { aFrame->RemoveProperty(aProp); - list->Delete(aFrame->PresContext()->PresShell()); + list->Delete(aFrame->PresShell()); } return true; } @@ -1641,7 +1638,7 @@ nsContainerFrame::DrainExcessOverflowContainersList(ChildFrameMerger aMergeFunc) } else if (overflowContainers) { aMergeFunc(*overflowContainers, toMove, this); if (selfExcessOCFrames->IsEmpty()) { - selfExcessOCFrames->Delete(PresContext()->PresShell()); + selfExcessOCFrames->Delete(PresShell()); } else { SetPropTableFrames(selfExcessOCFrames, ExcessOverflowContainersProperty()); } @@ -1651,7 +1648,7 @@ nsContainerFrame::DrainExcessOverflowContainersList(ChildFrameMerger aMergeFunc) overflowContainers = selfExcessOCFrames; } else { SetPropTableFrames(selfExcessOCFrames, ExcessOverflowContainersProperty()); - auto shell = PresContext()->PresShell(); + auto shell = PresShell(); overflowContainers = new (shell) nsFrameList(toMove); } SetPropTableFrames(overflowContainers, OverflowContainersProperty()); @@ -1987,9 +1984,8 @@ nsContainerFrame::AttributeChanged(int32_t aNameSpaceID, // XXX Not sure if this is necessary anymore if (RenumberList()) { - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eStyleChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } } return rv; diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index a8f359c5bb4c..4880742d6524 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -937,7 +937,7 @@ nsContainerFrame::DestroyOverflowList() { nsFrameList* list = RemovePropTableFrames(OverflowProperty()); MOZ_ASSERT(list && list->IsEmpty()); - list->Delete(PresContext()->PresShell()); + list->Delete(PresShell()); } #endif /* nsContainerFrame_h___ */ diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp index 34bcd5ed73b6..a6cee25e6c5e 100644 --- a/layout/generic/nsFontInflationData.cpp +++ b/layout/generic/nsFontInflationData.cpp @@ -204,7 +204,7 @@ nsFontInflationData::UpdateISize(const ReflowInput &aReflowInput) // See comment above "font.size.inflation.lineThreshold" in // modules/libpref/src/init/all.js . - nsIPresShell* presShell = bfc->PresContext()->PresShell(); + nsIPresShell* presShell = bfc->PresShell(); uint32_t lineThreshold = presShell->FontSizeInflationLineThreshold(); nscoord newTextThreshold = (newNCAISize * lineThreshold) / 100; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f130f5562085..db094beeadbc 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -715,7 +715,7 @@ nsFrame::Init(nsIContent* aContent, "root frame should always be a container"); } - if (PresContext()->PresShell()->AssumeAllFramesVisible() && + if (PresShell()->AssumeAllFramesVisible() && TrackingVisibility()) { IncApproximateVisibleCount(); } @@ -1946,7 +1946,7 @@ nsIFrame::GetVisibility() const void nsIFrame::UpdateVisibilitySynchronously() { - nsIPresShell* presShell = PresContext()->PresShell(); + nsIPresShell* presShell = PresShell(); if (!presShell) { return; } @@ -2015,7 +2015,7 @@ nsIFrame::EnableVisibilityTracking() AddStateBits(NS_FRAME_VISIBILITY_IS_TRACKED); SetProperty(VisibilityStateProperty(), 0); - nsIPresShell* presShell = PresContext()->PresShell(); + nsIPresShell* presShell = PresShell(); if (!presShell) { return; } @@ -2477,7 +2477,7 @@ DisplayDebugBorders(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, } // Draw a border around the current event target if (nsFrame::GetShowEventTargetFrameBorder() && - aFrame->PresContext()->PresShell()->GetDrawEventTargetFrame() == aFrame) { + aFrame->PresShell()->GetDrawEventTargetFrame() == aFrame) { aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayGeneric(aBuilder, aFrame, PaintEventTargetBorder, "EventTargetBorder", DisplayItemType::TYPE_EVENT_TARGET_BORDER)); @@ -3369,7 +3369,7 @@ DescendIntoChild(nsDisplayListBuilder* aBuilder, nsIFrame *aChild, // There are cases where the "ignore scroll frame" on the builder is not set // correctly, and so we additionally want to catch cases where the child is // a root scrollframe and we are ignoring scrolling on the viewport. - nsIPresShell* shell = child->PresContext()->PresShell(); + nsIPresShell* shell = child->PresShell(); bool keepDescending = child == aBuilder->GetIgnoreScrollFrame() || (shell->IgnoringViewportScrolling() && child == shell->GetRootScrollFrame()); if (!keepDescending) { @@ -3556,7 +3556,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, // (which means we're painting it, modulo occlusion), mark it as visible // within the displayport. if (aBuilder->IsPaintingToWindow() && child->TrackingVisibility()) { - child->PresContext()->PresShell()->EnsureFrameInApproximatelyVisibleList(child); + child->PresShell()->EnsureFrameInApproximatelyVisibleList(child); awayFromCommonPath = true; } @@ -4594,7 +4594,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext, offsets = GetContentOffsetsFromPoint(pt, SKIP_HIDDEN); handleTableSelection = false; } else { - GetDataForTableSelection(frameselection, PresContext()->PresShell(), + GetDataForTableSelection(frameselection, PresShell(), aEvent->AsMouseEvent(), getter_AddRefs(parentContent), &contentOffsetForTableSel, @@ -7924,7 +7924,7 @@ nsIFrame::GetConstFrameSelection() const frame = frame->GetParent(); } - return PresContext()->PresShell()->ConstFrameSelection(); + return PresShell()->ConstFrameSelection(); } bool diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 300bdbe43874..efde175705d6 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -542,7 +542,7 @@ nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(nsIFrame *aFrame, // If the mouse cursor in on a frame which is descendant of same // selection root, we can expand the selection to the frame. - if (cursorFrame && cursorFrame->PresContext()->PresShell() == mShell) + if (cursorFrame && cursorFrame->PresShell() == mShell) { nsIContent* cursorContent = cursorFrame->GetContent(); NS_ENSURE_TRUE(cursorContent, NS_ERROR_FAILURE); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 4ace8b7f5b85..53807e9fb123 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -381,7 +381,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState, std::max(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight)); nsSize visualScrollPortSize = scrollPortSize; - nsIPresShell* presShell = PresContext()->PresShell(); + nsIPresShell* presShell = PresShell(); if (mHelper.mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) { nsSize compositionSize = nsLayoutUtils::CalculateCompositionSizeForFrame(this, false); float resolution = presShell->GetResolution(); @@ -1055,7 +1055,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, PlaceScrollArea(state, oldScrollPosition); if (!mHelper.mPostedReflowCallback) { // Make sure we'll try scrolling to restored position - PresContext()->PresShell()->PostReflowCallback(&mHelper); + PresShell()->PostReflowCallback(&mHelper); mHelper.mPostedReflowCallback = true; } @@ -1879,7 +1879,7 @@ public: } mCallee = aCallee; - APZCCallbackHelper::SuppressDisplayport(true, mCallee->mOuter->PresContext()->PresShell()); + APZCCallbackHelper::SuppressDisplayport(true, mCallee->mOuter->PresShell()); return true; } @@ -1904,7 +1904,7 @@ private: void RemoveObserver() { if (mCallee) { RefreshDriver(mCallee)->RemoveRefreshObserver(this, FlushType::Style); - APZCCallbackHelper::SuppressDisplayport(false, mCallee->mOuter->PresContext()->PresShell()); + APZCCallbackHelper::SuppressDisplayport(false, mCallee->mOuter->PresShell()); } } }; @@ -2091,7 +2091,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, // active scroll containers so that we paint by whole tile increments // when scrolling. nsLayoutUtils::SetDisplayPortMargins(mOuter->GetContent(), - mOuter->PresContext()->PresShell(), + mOuter->PresShell(), ScreenMargin(), 0, nsLayoutUtils::RepaintMode::DoNotRepaint); @@ -2452,13 +2452,13 @@ bool ScrollFrameHelper::IsIgnoringViewportClipping() const if (!mIsRoot) return false; nsSubDocumentFrame* subdocFrame = static_cast - (nsLayoutUtils::GetCrossDocParentFrame(mOuter->PresContext()->PresShell()->GetRootFrame())); + (nsLayoutUtils::GetCrossDocParentFrame(mOuter->PresShell()->GetRootFrame())); return subdocFrame && !subdocFrame->ShouldClipSubdocument(); } void ScrollFrameHelper::MarkScrollbarsDirtyForReflow() const { - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); + nsIPresShell* presShell = mOuter->PresShell(); if (mVScrollbarBox) { presShell->FrameNeedsReflow(mVScrollbarBox, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); } @@ -2472,7 +2472,7 @@ bool ScrollFrameHelper::ShouldClampScrollPosition() const if (!mIsRoot) return true; nsSubDocumentFrame* subdocFrame = static_cast - (nsLayoutUtils::GetCrossDocParentFrame(mOuter->PresContext()->PresShell()->GetRootFrame())); + (nsLayoutUtils::GetCrossDocParentFrame(mOuter->PresShell()->GetRootFrame())); return !subdocFrame || subdocFrame->ShouldClampScrollPosition(); } @@ -2719,7 +2719,7 @@ ScrollFrameHelper::ScrollActivityCallback(nsITimer *aTimer, void* anInstance) // Fire the synth mouse move. self->mScrollActivityTimer->Cancel(); self->mScrollActivityTimer = nullptr; - self->mOuter->PresContext()->PresShell()->SynthesizeMouseMove(true); + self->mOuter->PresShell()->SynthesizeMouseMove(true); } @@ -3394,7 +3394,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Root scrollframes have FrameMetrics and clipping on their container // layers, so don't apply clipping again. mAddClipRectToLayer = - !(mIsRoot && mOuter->PresContext()->PresShell()->GetIsViewportOverridden()); + !(mIsRoot && mOuter->PresShell()->GetIsViewportOverridden()); // Whether we might want to build a scrollable layer for this scroll frame // at some point in the future. This controls whether we add the information @@ -3493,7 +3493,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (mIsRoot) { clipRect.SizeTo(nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter)); if (mOuter->PresContext()->IsRootContentDocument()) { - double res = mOuter->PresContext()->PresShell()->GetResolution(); + double res = mOuter->PresShell()->GetResolution(); clipRect.width = NSToCoordRound(clipRect.width / res); clipRect.height = NSToCoordRound(clipRect.height / res); } @@ -3596,7 +3596,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Set a displayport so next paint we don't have to force layerization // after the fact. nsLayoutUtils::SetDisplayPortMargins(mOuter->GetContent(), - mOuter->PresContext()->PresShell(), + mOuter->PresShell(), ScreenMargin(), 0, nsLayoutUtils::RepaintMode::DoNotRepaint); @@ -3778,7 +3778,7 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder, // The displayPort getter takes care of adjusting for resolution. So if // we have resolution but no displayPort then we need to adjust for // resolution here. - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); + nsIPresShell* presShell = mOuter->PresShell(); *aVisibleRect = aVisibleRect->RemoveResolution( presShell->ScaleToResolution() ? presShell->GetResolution () : 1.0f); *aDirtyRect = aDirtyRect->RemoveResolution( @@ -3947,7 +3947,7 @@ ScrollFrameHelper::GetScrollRangeForClamping() const nsSize ScrollFrameHelper::GetScrollPositionClampingScrollPortSize() const { - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); + nsIPresShell* presShell = mOuter->PresShell(); if (mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) { return presShell->GetScrollPositionClampingScrollPortSize(); } @@ -4261,7 +4261,7 @@ ScrollFrameHelper::GetPageScrollAmount() const if (mIsRoot) { // Reduce effective scrollport height by the height of any fixed-pos // headers or footers - nsIFrame* root = mOuter->PresContext()->PresShell()->GetRootFrame(); + nsIFrame* root = mOuter->PresShell()->GetRootFrame(); effectiveScrollPortSize = GetScrollPortSizeExcludingHeadersAndFooters(root, mScrollPort); } else { @@ -4659,7 +4659,7 @@ ScrollFrameHelper::Destroy(PostDestroyData& aPostDestroyData) aPostDestroyData.AddAnonymousContent(mResizerContent.forget()); if (mPostedReflowCallback) { - mOuter->PresContext()->PresShell()->CancelReflowCallback(this); + mOuter->PresShell()->CancelReflowCallback(this); mPostedReflowCallback = false; } @@ -5326,7 +5326,7 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) } if (!mHelper.mPostedReflowCallback) { // Make sure we'll try scrolling to restored position - PresContext()->PresShell()->PostReflowCallback(&mHelper); + PresShell()->PostReflowCallback(&mHelper); mHelper.mPostedReflowCallback = true; } if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { @@ -5531,7 +5531,7 @@ ScrollFrameHelper::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) // needing reflow. Don't use NS_FRAME_IS_DIRTY as dirty as that means // we have to reflow the frame and all its descendants, and we don't // have to do that here. Only this frame needs to be reflowed. - mOuter->PresContext()->PresShell()->FrameNeedsReflow( + mOuter->PresShell()->FrameNeedsReflow( mOuter, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); // Ensure that next time nsHTMLScrollFrame::Reflow runs, we don't skip // updating the scrollbars. (Because the overflow area of the scrolled @@ -5634,7 +5634,7 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState, NS_ASSERTION(!mSuppressScrollbarUpdate, "This should have been suppressed"); - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); + nsIPresShell* presShell = mOuter->PresShell(); bool hasResizer = HasResizer(); bool scrollbarOnLeft = !IsScrollbarOnRight(); @@ -5762,7 +5762,7 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState, // post reflow callback to modify scrollbar attributes mUpdateScrollbarAttributes = true; if (!mPostedReflowCallback) { - aState.PresContext()->PresShell()->PostReflowCallback(this); + aState.PresShell()->PostReflowCallback(this); mPostedReflowCallback = true; } } @@ -5779,7 +5779,7 @@ void ScrollFrameHelper::SetScrollbarEnabled(nsIContent* aContent, nscoord aMaxPos) { DebugOnly weakShell( - do_GetWeakReference(mOuter->PresContext()->PresShell())); + do_GetWeakReference(mOuter->PresShell())); if (aMaxPos) { aContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, true); } else { @@ -5794,7 +5794,7 @@ ScrollFrameHelper::SetCoordAttribute(nsIContent* aContent, nsAtom* aAtom, nscoord aSize) { DebugOnly weakShell( - do_GetWeakReference(mOuter->PresContext()->PresShell())); + do_GetWeakReference(mOuter->PresShell())); // convert to pixels int32_t pixelSize = nsPresContext::AppUnitsToIntCSSPixels(aSize); @@ -6093,7 +6093,7 @@ ScrollFrameHelper::SaveState() const state->SetAllowScrollOriginDowngrade(allowScrollOriginDowngrade); if (mIsRoot) { // Only save resolution properties for root scroll frames - nsIPresShell* shell = mOuter->PresContext()->PresShell(); + nsIPresShell* shell = mOuter->PresShell(); state->SetResolution(shell->GetResolution()); state->SetScaleToResolution(shell->ScaleToResolution()); } @@ -6114,7 +6114,7 @@ ScrollFrameHelper::RestoreState(nsPresState* aState) aState->GetResolution() == 1.0)); if (mIsRoot) { - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); + nsIPresShell* presShell = mOuter->PresShell(); if (aState->GetScaleToResolution()) { presShell->SetResolutionAndScaleTo(aState->GetResolution()); } else { diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 6cc56b34bcaf..066b14d62a14 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -6687,7 +6687,7 @@ nsGridContainerFrame::NoteNewChildren(ChildListID aListID, MOZ_ASSERT(supportedLists.Contains(aListID), "unexpected child list"); #endif - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); for (auto pif = GetPrevInFlow(); pif; pif = pif->GetPrevInFlow()) { if (aListID == kPrincipalList) { pif->AddStateBits(NS_STATE_GRID_DID_PUSH_ITEMS); @@ -6726,7 +6726,7 @@ nsGridContainerFrame::MergeSortedExcessOverflowContainers(nsFrameList& aList) if (eoc) { ::MergeSortedFrameLists(*eoc, aList, GetContent()); } else { - SetPropTableFrames(new (PresContext()->PresShell()) nsFrameList(aList), + SetPropTableFrames(new (PresShell()) nsFrameList(aList), ExcessOverflowContainersProperty()); } } @@ -6915,7 +6915,7 @@ nsGridContainerFrame::GetGridFrameWithComputedInfo(nsIFrame* aFrame) if (reflowNeeded) { // Trigger a reflow that generates additional grid property data. - nsIPresShell* shell = gridFrame->PresContext()->PresShell(); + nsIPresShell* shell = gridFrame->PresShell(); gridFrame->AddStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES); shell->FrameNeedsReflow(gridFrame, nsIPresShell::eResize, diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index f525c3267f3e..60bc8e7009c8 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -641,6 +641,10 @@ public: return StyleContext()->PresContext(); } + nsIPresShell* PresShell() const { + return PresContext()->PresShell(); + } + /** * Called to initialize the frame. This is called immediately after creating * the frame. diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 8da85dbb53cc..96fb0ff968f0 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -188,7 +188,7 @@ nsImageFrame::DisconnectMap() #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = GetAccService()) { - accService->RecreateAccessible(PresContext()->PresShell(), mContent); + accService->RecreateAccessible(PresShell(), mContent); } #endif } @@ -197,7 +197,7 @@ void nsImageFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { if (mReflowCallbackPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackPosted = false; } @@ -1072,7 +1072,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay); if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) && !mReflowCallbackPosted) { - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); mReflowCallbackPosted = true; shell->PostReflowCallback(this); } @@ -2124,7 +2124,7 @@ nsImageFrame::GetCursor(const nsPoint& aPoint, // here, since it means that areas on which the cursor isn't // specified will inherit the style from the image. RefPtr areaStyle = - PresContext()->PresShell()->StyleSet()-> + PresShell()->StyleSet()-> ResolveStyleFor(area->AsElement(), StyleContext(), LazyComputeBehavior::Allow); FillCursorInformationFromStyle(areaStyle->StyleUserInterface(), @@ -2150,9 +2150,8 @@ nsImageFrame::AttributeChanged(int32_t aNameSpaceID, } if (nsGkAtoms::alt == aAttribute) { - PresContext()->PresShell()->FrameNeedsReflow(this, - nsIPresShell::eStyleChange, - NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } return NS_OK; diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index 38d92b78097a..6def7f6d53e3 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -195,7 +195,7 @@ void nsPluginFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { if (mReflowCallbackPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); } // Ensure our DidComposite observer is gone. @@ -359,7 +359,7 @@ nsPluginFrame::PrepForDrawing(nsIWidget *aWidget) #ifdef ACCESSIBILITY nsAccessibilityService* accService = nsIPresShell::AccService(); if (accService) { - accService->RecreateAccessible(PresContext()->PresShell(), mContent); + accService->RecreateAccessible(PresShell(), mContent); } #endif diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index e25f91e0e7c6..8668186b4c61 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -221,7 +221,7 @@ nsSubDocumentFrame::GetSubdocumentPresShellForPainting(uint32_t aFlags) nsIFrame* subdocRootFrame = subdocView->GetFrame(); if (subdocRootFrame) { - presShell = subdocRootFrame->PresContext()->PresShell(); + presShell = subdocRootFrame->PresShell(); } // If painting is suppressed in the presshell, we try to look for a better @@ -237,7 +237,7 @@ nsSubDocumentFrame::GetSubdocumentPresShellForPainting(uint32_t aFlags) frame = nextView->GetFrame(); } if (frame) { - nsIPresShell* ps = frame->PresContext()->PresShell(); + nsIPresShell* ps = frame->PresShell(); if (!presShell || (ps && !ps->IsPaintingSuppressed() && sShowPreviousPage)) { subdocView = nextView; subdocRootFrame = frame; @@ -847,7 +847,7 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext, FinishAndStoreOverflow(&aDesiredSize); if (!aPresContext->IsPaginated() && !mPostedReflowCallback) { - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); mPostedReflowCallback = true; } @@ -911,7 +911,7 @@ nsSubDocumentFrame::AttributeChanged(int32_t aNameSpaceID, else if (aAttribute == nsGkAtoms::showresizer) { nsIFrame* rootFrame = GetSubdocumentRootFrame(); if (rootFrame) { - rootFrame->PresContext()->PresShell()-> + rootFrame->PresShell()-> FrameNeedsReflow(rootFrame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); } } @@ -1000,7 +1000,7 @@ void nsSubDocumentFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { if (mPostedReflowCallback) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mPostedReflowCallback = false; } @@ -1021,7 +1021,7 @@ nsSubDocumentFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostD nsContentUtils::AddScriptRunner( new nsHideViewer(mContent, frameloader, - PresContext()->PresShell(), + PresShell(), (mDidCreateDoc || mCallingShow))); } else { frameloader->SetDetachedSubdocFrame(nullptr, nullptr); @@ -1254,12 +1254,12 @@ nsSubDocumentFrame::EndSwapDocShells(nsIFrame* aOther) // And repaint them, for good measure, in case there's nothing // interesting that happens during reflow. if (weakThis.IsAlive()) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); InvalidateFrameSubtree(); } if (weakOther.IsAlive()) { - other->PresContext()->PresShell()-> + other->PresShell()-> FrameNeedsReflow(other, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); other->InvalidateFrameSubtree(); } diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 6df8053c90df..e27ccca03413 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -681,7 +681,7 @@ InvalidateFrameDueToGlyphsChanged(nsIFrame* aFrame) { MOZ_ASSERT(aFrame); - nsIPresShell* shell = aFrame->PresContext()->PresShell(); + nsIPresShell* shell = aFrame->PresShell(); for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(f)) { f->InvalidateFrame(); @@ -2036,7 +2036,7 @@ static already_AddRefed CreateReferenceDrawTarget(const nsTextFrame* aTextFrame) { RefPtr ctx = - aTextFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); + aTextFrame->PresShell()->CreateReferenceRenderingContext(); RefPtr dt = ctx->GetDrawTarget(); return dt.forget(); } diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 092526c34d28..8a6e7e556476 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -362,7 +362,7 @@ nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder, if (aBuilder->IsInsidePointerEventsNoneDoc() || frameIsPointerEventsNone) { mEventRegionsOverride |= EventRegionsOverride::ForceEmptyHitRegion; } - if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresContext()->PresShell())) { + if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresShell())) { mEventRegionsOverride |= EventRegionsOverride::ForceDispatchToContent; } } diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index aedc2e2905d0..dc3813e68187 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -705,7 +705,7 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIFrame* aParentFrame) if (!parent) return NS_OK; - frame->PresContext()->PresShell()-> + frame->PresShell()-> FrameNeedsReflow(frame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); return NS_OK; @@ -770,7 +770,7 @@ nsMathMLContainerFrame::AttributeChanged(int32_t aNameSpaceID, // XXX Since they are numerous MathML attributes that affect layout, and // we can't check all of them here, play safe by requesting a reflow. // XXXldb This should only do work for attributes that cause changes! - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); return NS_OK; diff --git a/layout/mathml/nsMathMLmactionFrame.cpp b/layout/mathml/nsMathMLmactionFrame.cpp index 6be40b77c704..af51234e7537 100644 --- a/layout/mathml/nsMathMLmactionFrame.cpp +++ b/layout/mathml/nsMathMLmactionFrame.cpp @@ -226,7 +226,7 @@ nsMathMLmactionFrame::AttributeChanged(int32_t aNameSpaceID, } if (needsReflow) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); } @@ -333,7 +333,7 @@ nsMathMLmactionFrame::MouseClick() mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::selection_, value, notify); // Now trigger a content-changed reflow... - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(mSelectedFrame, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); } diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index 8bab100054e6..b7614034c5e2 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -743,7 +743,7 @@ nsMathMLmtableWrapperFrame::AttributeChanged(int32_t aNameSpaceID, // align - just need to issue a dirty (resize) reflow command if (aAttribute == nsGkAtoms::align) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); return NS_OK; } @@ -755,7 +755,7 @@ nsMathMLmtableWrapperFrame::AttributeChanged(int32_t aNameSpaceID, nsMathMLContainerFrame::RebuildAutomaticDataForChildren(GetParent()); // Need to reflow the parent, not us, because this can actually // affect siblings. - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(GetParent(), nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); return NS_OK; } diff --git a/layout/mathml/nsMathMLmunderoverFrame.cpp b/layout/mathml/nsMathMLmunderoverFrame.cpp index 359d36b90737..05ebbc8307c4 100644 --- a/layout/mathml/nsMathMLmunderoverFrame.cpp +++ b/layout/mathml/nsMathMLmunderoverFrame.cpp @@ -77,7 +77,7 @@ void nsMathMLmunderoverFrame::DestroyFrom(nsIFrame* aDestroyRoot, PostDestroyData& aPostDestroyData) { if (!mPostReflowIncrementScriptLevelCommands.IsEmpty()) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); } nsMathMLContainerFrame::DestroyFrom(aDestroyRoot, aPostDestroyData); } @@ -119,7 +119,7 @@ nsMathMLmunderoverFrame::SetIncrementScriptLevel(uint32_t aChildIndex, } if (mPostReflowIncrementScriptLevelCommands.IsEmpty()) { - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); } mPostReflowIncrementScriptLevelCommands.AppendElement( diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp index c16b1898971c..a1bd785271e5 100644 --- a/layout/painting/nsCSSRendering.cpp +++ b/layout/painting/nsCSSRendering.cpp @@ -1460,7 +1460,7 @@ nsCSSRendering::FindBackgroundFrame(nsIFrame* aForFrame, nsIFrame** aBackgroundFrame) { nsIFrame* rootElementFrame = - aForFrame->PresContext()->PresShell()->FrameConstructor()->GetRootElementStyleFrame(); + aForFrame->PresShell()->FrameConstructor()->GetRootElementStyleFrame(); if (IsCanvasFrame(aForFrame)) { *aBackgroundFrame = FindCanvasBackgroundFrame(aForFrame, rootElementFrame); return true; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 24fa10886066..2f4e35162eea 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -1125,7 +1125,7 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, // position: fixed items are reflowed into and only drawn inside the // viewport, or the scroll position clamping scrollport size, if one is // set. - nsIPresShell* ps = aFrame->PresContext()->PresShell(); + nsIPresShell* ps = aFrame->PresShell(); if (ps->IsScrollPositionClampingScrollPortSizeSet()) { dirtyRectRelativeToDirtyFrame = nsRect(nsPoint(0, 0), ps->GetScrollPositionClampingScrollPortSize()); @@ -1266,7 +1266,7 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame, bool aPointerEventsNoneDoc) { PresShellState* state = mPresShellStates.AppendElement(); - state->mPresShell = aReferenceFrame->PresContext()->PresShell(); + state->mPresShell = aReferenceFrame->PresShell(); state->mCaretFrame = nullptr; state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length(); @@ -1349,7 +1349,7 @@ void nsDisplayListBuilder::LeavePresShell(nsIFrame* aReferenceFrame, nsDisplayList* aPaintedContents) { NS_ASSERTION(CurrentPresShellState()->mPresShell == - aReferenceFrame->PresContext()->PresShell(), + aReferenceFrame->PresShell(), "Presshell mismatch"); if (mIsPaintingToWindow) { @@ -1444,7 +1444,7 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame, // Store the current display data so that it can be used for fixed // background images. NS_ASSERTION(CurrentPresShellState()->mPresShell == - aDirtyFrame->PresContext()->PresShell(), + aDirtyFrame->PresShell(), "Presshell mismatch"); MOZ_ASSERT(!CurrentPresShellState()->mFixedBackgroundDisplayData, "already traversed this presshell's root frame?"); @@ -3274,7 +3274,7 @@ static Maybe GetViewportRectRelativeToReferenceFrame(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) { - nsIFrame* rootFrame = aFrame->PresContext()->PresShell()->GetRootFrame(); + nsIFrame* rootFrame = aFrame->PresShell()->GetRootFrame(); nsRect rootRect = rootFrame->GetRectRelativeToSelf(); if (nsLayoutUtils::TransformRect(rootFrame, aFrame, rootRect) == nsLayoutUtils::TRANSFORM_SUCCEEDED) { return Some(rootRect + aBuilder->ToReferenceFrame(aFrame)); @@ -6863,7 +6863,7 @@ nsDisplaySubDocument::nsDisplaySubDocument(nsDisplayListBuilder* aBuilder, MOZ_COUNT_CTOR(nsDisplaySubDocument); mForceDispatchToContentRegion = aBuilder->IsBuildingLayerEventRegions() && - nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresContext()->PresShell()); + nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresShell()); // The SubDocument display item is conceptually outside the viewport frame, // so in cases where the viewport frame is an AGR, the SubDocument's AGR @@ -6950,7 +6950,7 @@ nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder, } nsRect displayport; - nsIFrame* rootScrollFrame = mFrame->PresContext()->PresShell()->GetRootScrollFrame(); + nsIFrame* rootScrollFrame = mFrame->PresShell()->GetRootScrollFrame(); MOZ_ASSERT(rootScrollFrame); Unused << nsLayoutUtils::GetDisplayPort(rootScrollFrame->GetContent(), &displayport, RelativeTo::ScrollFrame); @@ -7027,7 +7027,7 @@ nsDisplayResolution::HitTest(nsDisplayListBuilder* aBuilder, HitTestState* aState, nsTArray *aOutFrames) { - nsIPresShell* presShell = mFrame->PresContext()->PresShell(); + nsIPresShell* presShell = mFrame->PresShell(); nsRect rect = aRect.RemoveResolution(presShell->ScaleToResolution() ? presShell->GetResolution () : 1.0f); mList.HitTest(aBuilder, rect, aState, aOutFrames); } @@ -7036,7 +7036,7 @@ already_AddRefed nsDisplayResolution::BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aContainerParameters) { - nsIPresShell* presShell = mFrame->PresContext()->PresShell(); + nsIPresShell* presShell = mFrame->PresShell(); ContainerLayerParameters containerParameters( presShell->GetResolution(), presShell->GetResolution(), nsIntPoint(), aContainerParameters); diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index 2cbec92eb4aa..40cf051182a1 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -3310,10 +3310,10 @@ public: #endif virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override { - mFrame->PresContext()->PresShell()->PaintCount(mFrameName, aCtx, - mFrame->PresContext(), - mFrame, ToReferenceFrame(), - mColor); + mFrame->PresShell()->PaintCount(mFrameName, aCtx, + mFrame->PresContext(), + mFrame, ToReferenceFrame(), + mColor); } NS_DISPLAY_DECL_NAME("nsDisplayReflowCount", TYPE_REFLOW_COUNT) protected: @@ -3324,7 +3324,7 @@ protected: #define DO_GLOBAL_REFLOW_COUNT_DSP(_name) \ PR_BEGIN_MACRO \ if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery() && \ - PresContext()->PresShell()->IsPaintingFrameCounts()) { \ + PresShell()->IsPaintingFrameCounts()) { \ aLists.Outlines()->AppendNewToTop( \ new (aBuilder) nsDisplayReflowCount(aBuilder, this, _name)); \ } \ @@ -3333,7 +3333,7 @@ protected: #define DO_GLOBAL_REFLOW_COUNT_DSP_COLOR(_name, _color) \ PR_BEGIN_MACRO \ if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery() && \ - PresContext()->PresShell()->IsPaintingFrameCounts()) { \ + PresShell()->IsPaintingFrameCounts()) { \ aLists.Outlines()->AppendNewToTop( \ new (aBuilder) nsDisplayReflowCount(aBuilder, this, _name, _color)); \ } \ diff --git a/layout/reftests/async-scrolling/reftest.list b/layout/reftests/async-scrolling/reftest.list index 4b713c02ef12..f545fba3d1a1 100644 --- a/layout/reftests/async-scrolling/reftest.list +++ b/layout/reftests/async-scrolling/reftest.list @@ -5,7 +5,7 @@ skip-if(!asyncPan) == bg-fixed-cover-3.html bg-fixed-cover-3-ref.html skip-if(!asyncPan) == bg-fixed-child.html bg-fixed-child-ref.html skip-if(!asyncPan) == bg-fixed-child-clip-1.html bg-fixed-child-clip-ref.html skip-if(!asyncPan) == bg-fixed-child-clip-2.html bg-fixed-child-clip-ref.html -fuzzy(1,246) fuzzy-if(skiaContent,2,170) fuzzy-if(browserIsRemote&&d2d,53,185) skip-if(!asyncPan) == bg-fixed-child-mask.html bg-fixed-child-mask-ref.html +fuzzy(1,246) fuzzy-if(skiaContent,2,170) fuzzy-if(browserIsRemote&&d2d,53,187) skip-if(!asyncPan) == bg-fixed-child-mask.html bg-fixed-child-mask-ref.html skip-if(!asyncPan) == bg-fixed-in-opacity.html bg-fixed-in-opacity-ref.html skip-if(!asyncPan) == bg-fixed-child-no-culling-1.html bg-fixed-child-no-culling-1-ref.html skip-if(!asyncPan) == bg-fixed-child-no-culling-2.html bg-fixed-child-no-culling-2-ref.html diff --git a/layout/reftests/border-radius/reftest.list b/layout/reftests/border-radius/reftest.list index ac15821ef8f3..ea76c40249c1 100644 --- a/layout/reftests/border-radius/reftest.list +++ b/layout/reftests/border-radius/reftest.list @@ -43,22 +43,22 @@ fuzzy-if(skiaContent,17,62) fuzzy-if(webrender,41-41,66-66) == clipping-3.html c # Tests for clipping the contents of replaced elements and overflow!=visible != clipping-4-ref.html clipping-4-notref.html -fuzzy-if(true,1,20) fuzzy-if(d2d,64,196) fuzzy-if(cocoaWidget,1,180) fuzzy-if(Android,140,237) == clipping-4-canvas.html clipping-4-ref.html # bug 732535 +fuzzy-if(true,1,20) fuzzy-if(d2d,72,196) fuzzy-if(cocoaWidget,1,180) fuzzy-if(Android,140,237) == clipping-4-canvas.html clipping-4-ref.html # bug 732535 fuzzy-if(Android,5,54) fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,10) fuzzy-if(skiaContent,1,172) == clipping-4-image.html clipping-4-ref.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,10) fuzzy-if(skiaContent,1,77) == clipping-4-overflow-hidden.html clipping-4-ref.html == clipping-5-canvas.html clipping-5-refc.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-5-image.html clipping-5-refi.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(skiaContent,1,77) == clipping-5-overflow-hidden.html clipping-5-ref.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,5,21) fuzzy-if(skiaContent,1,97) == clipping-5-refi.html clipping-5-ref.html -fuzzy-if(true,1,7) fuzzy-if(d2d,48,94) fuzzy-if(cocoaWidget,1,99) fuzzy-if(Android,99,115) fuzzy-if(skiaContent,1,77) == clipping-5-refc.html clipping-5-ref.html # bug 732535 +fuzzy-if(true,1,7) fuzzy-if(d2d,55,94) fuzzy-if(cocoaWidget,1,99) fuzzy-if(Android,99,115) fuzzy-if(skiaContent,1,77) == clipping-5-refc.html clipping-5-ref.html # bug 732535 fuzzy-if(winWidget,105,71) fuzzy-if(Android,8,469) fuzzy-if(skiaContent,7,58) fuzzy-if(d3d11&&advancedLayers,120,319) fuzzy-if(winWidget&&stylo,137,319) == clipping-6.html clipping-6-ref.html # PaintedLayer and MaskLayer with transforms that aren't identical fuzzy-if(true,2,29) fuzzy-if(d2d,46,71) fuzzy-if(Android,255,586) fuzzy-if(skiaContent,28,96) == clipping-7.html clipping-7-ref.html # ColorLayer and MaskLayer with transforms that aren't identical. Reference image rendered without using layers (which causes fuzzy failures). fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-and-zindex-1.html clipping-and-zindex-1-ref.html -fuzzy-if(cocoaWidget,1,4) fuzzy-if(d3d11&&advancedLayers,30,3) == intersecting-clipping-1-canvas.html intersecting-clipping-1-refc.html +fuzzy-if(cocoaWidget,1,4) fuzzy-if(d2d,59,342) fuzzy-if(d3d11&&advancedLayers&&!d2d,30,3) == intersecting-clipping-1-canvas.html intersecting-clipping-1-refc.html == intersecting-clipping-1-image.html intersecting-clipping-1-refi.html == intersecting-clipping-1-overflow-hidden.html intersecting-clipping-1-ref.html fuzzy-if(Android,5,105) fuzzy-if(d2d,1,20) fuzzy-if(skiaContent,1,300) == intersecting-clipping-1-refi.html intersecting-clipping-1-ref.html -fuzzy-if(true,1,33) fuzzy-if(d2d,48,350) fuzzy-if(cocoaWidget,1,332) fuzzy-if(Android,124,440) fuzzy-if(skiaContent,1,135) fuzzy-if(d3d11&&advancedLayers,48,353) == intersecting-clipping-1-refc.html intersecting-clipping-1-ref.html # bug 732535 +fuzzy-if(true,1,33) fuzzy-if(d2d,59,350) fuzzy-if(cocoaWidget,1,332) fuzzy-if(Android,124,440) fuzzy-if(skiaContent,1,135) fuzzy-if(d3d11&&advancedLayers,59,353) == intersecting-clipping-1-refc.html intersecting-clipping-1-ref.html # bug 732535 # Inheritance == inherit-1.html inherit-1-ref.html # border-radius shouldn't inherit diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 47e1e5597620..eb289872050c 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1714,7 +1714,7 @@ needs-focus != 703186-1.html 703186-2.html == 714519-1-q.html 714519-1-ref.html == 714519-2-as.html 714519-2-ref.html == 714519-2-q.html 714519-2-ref.html -fuzzy-if(true,1,21) fuzzy-if(d2d,69,173) fuzzy-if(cocoaWidget,1,170) == 718521.html 718521-ref.html # bug 773482 +fuzzy-if(true,1,21) fuzzy-if(d2d,71,173) fuzzy-if(cocoaWidget,1,170) == 718521.html 718521-ref.html # bug 773482 == 720987.html 720987-ref.html == 722888-1.html 722888-1-ref.html fuzzy(2,40000) == 722923-1.html 722923-1-ref.html diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-001-ref.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-001-ref.html new file mode 100644 index 000000000000..9c76a04314dd --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-001-ref.html @@ -0,0 +1,37 @@ + + + + Reference: dynamic change .left on abs.pos. item w. align-self:center + + + + + +
+
X
+
+ + + diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-001.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-001.html new file mode 100644 index 000000000000..0ae5584435f8 --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-001.html @@ -0,0 +1,46 @@ + + + + CSS Grid Test: dynamic change .left on abs.pos. item w. align-self:center + + + + + + + +
+
X
+
+ + + + + diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-002-ref.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-002-ref.html new file mode 100644 index 000000000000..3e5868d8b1b1 --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-002-ref.html @@ -0,0 +1,37 @@ + + + + Reference: dynamic change .left on abs.pos. item w. align-self:end + + + + + +
+
X
+
+ + + diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-002.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-002.html new file mode 100644 index 000000000000..8659dcd619f6 --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-002.html @@ -0,0 +1,45 @@ + + + + CSS Grid Test: dynamic change .left on abs.pos. item w. align-self:end + + + + + + + +
+
X
+
+ + + + + diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-003-ref.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-003-ref.html new file mode 100644 index 000000000000..b25750147c38 --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-003-ref.html @@ -0,0 +1,38 @@ + + + + Reference: dynamic change .left on abs.pos. item w. align-self:start + + + + + +
+
X
+
X
+
+ + + diff --git a/layout/reftests/css-grid/grid-item-align-dynamic-pos-003.html b/layout/reftests/css-grid/grid-item-align-dynamic-pos-003.html new file mode 100644 index 000000000000..1643494c9bb6 --- /dev/null +++ b/layout/reftests/css-grid/grid-item-align-dynamic-pos-003.html @@ -0,0 +1,47 @@ + + + + CSS Grid Test: dynamic change .left on abs.pos. item w. align-self:start + + + + + + + +
+
X
+
X
+
+ + + + + diff --git a/layout/reftests/css-grid/reftest.list b/layout/reftests/css-grid/reftest.list index 79c8c65f71a2..29b9b8649eca 100644 --- a/layout/reftests/css-grid/reftest.list +++ b/layout/reftests/css-grid/reftest.list @@ -278,5 +278,9 @@ asserts(0-10) == grid-fragmentation-015.html grid-fragmentation-015-ref.html # b == grid-fragmentation-dyn2-029.html grid-fragmentation-029-ref.html == grid-fragmentation-dyn2-030.html grid-fragmentation-030-ref.html == grid-fragmentation-dyn2-031.html grid-fragmentation-031-ref.html + == bug1306106.html bug1306106-ref.html == grid-percent-intrinsic-sizing-001.html grid-percent-intrinsic-sizing-001-ref.html +== grid-item-align-dynamic-pos-001.html grid-item-align-dynamic-pos-001-ref.html +== grid-item-align-dynamic-pos-002.html grid-item-align-dynamic-pos-002-ref.html +== grid-item-align-dynamic-pos-003.html grid-item-align-dynamic-pos-003-ref.html diff --git a/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001-ref.html b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001-ref.html new file mode 100644 index 000000000000..60b0b9955a38 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001-ref.html @@ -0,0 +1,36 @@ + + + + Reference: dynamic change .left on abs.pos. item w. align-self:center + + + + + +
+
X
+
+ + + diff --git a/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001.html b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001.html new file mode 100644 index 000000000000..9c7b3b4087ab --- /dev/null +++ b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-001.html @@ -0,0 +1,45 @@ + + + + CSS Flexbox Test: dynamic change .left on abs.pos. item w. align-self:center + + + + + + + +
+
X
+
+ + + + + diff --git a/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002-ref.html b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002-ref.html new file mode 100644 index 000000000000..13b3b950218a --- /dev/null +++ b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002-ref.html @@ -0,0 +1,36 @@ + + + + Reference: dynamic change .left on abs.pos. item w. align-self:end + + + + + +
+
X
+
+ + + diff --git a/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002.html b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002.html new file mode 100644 index 000000000000..405ea1b23622 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-item-align-self-dynamic-pos-002.html @@ -0,0 +1,44 @@ + + + + CSS Flexbox Test: dynamic change .left on abs.pos. item w. align-self:end + + + + + + + +
+
X
+
+ + + + + diff --git a/layout/reftests/flexbox/reftest.list b/layout/reftests/flexbox/reftest.list index d305a7fb4b57..6a2f8414ebe8 100644 --- a/layout/reftests/flexbox/reftest.list +++ b/layout/reftests/flexbox/reftest.list @@ -19,6 +19,8 @@ fails == flexbox-align-self-baseline-horiz-2.xhtml flexbox-align-self-baseline- # background size in test vs. ref fuzzy-if(cocoaWidget,1,2) random-if(winWidget||gtkWidget) skip-if(Android) == flexbox-align-self-baseline-horiz-3.xhtml flexbox-align-self-baseline-horiz-3-ref.xhtml # XXXdholbert investigate the random-if. The skip-if(Android) is because checkbox/radio appearance:none doesn't work as expected. == flexbox-align-self-baseline-horiz-4.xhtml flexbox-align-self-baseline-horiz-4-ref.xhtml +== flexbox-item-align-self-dynamic-pos-001.html flexbox-item-align-self-dynamic-pos-001-ref.html +== flexbox-item-align-self-dynamic-pos-002.html flexbox-item-align-self-dynamic-pos-002-ref.html # Tests for box-sizing on flex containers and flex items. == flexbox-box-sizing-on-container-horiz-1.html flexbox-box-sizing-on-container-horiz-1-ref.html diff --git a/layout/style/crashtests/1415663.html b/layout/style/crashtests/1415663.html new file mode 100644 index 000000000000..1e7cf93ab0b7 --- /dev/null +++ b/layout/style/crashtests/1415663.html @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index 2d43103c532f..df926e278b19 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -260,4 +260,5 @@ load 1411143.html load 1411478.html load 1413288.html load 1413361.html +load 1415663.html pref(dom.webcomponents.enabled,true) load 1415353.html diff --git a/layout/style/nsFontFaceUtils.cpp b/layout/style/nsFontFaceUtils.cpp index f54330abd506..2154e90dff27 100644 --- a/layout/style/nsFontFaceUtils.cpp +++ b/layout/style/nsFontFaceUtils.cpp @@ -110,7 +110,7 @@ nsFontFaceUtils::MarkDirtyForFontChange(nsIFrame* aSubtreeRoot, AutoTArray subtrees; subtrees.AppendElement(aSubtreeRoot); - nsIPresShell* ps = aSubtreeRoot->PresContext()->PresShell(); + nsIPresShell* ps = aSubtreeRoot->PresShell(); // check descendants, iterating over subtrees that may include // additional subtrees associated with placeholders diff --git a/layout/svg/SVGObserverUtils.h b/layout/svg/SVGObserverUtils.h index 60720e60bee0..07ee3a7272d2 100644 --- a/layout/svg/SVGObserverUtils.h +++ b/layout/svg/SVGObserverUtils.h @@ -177,7 +177,7 @@ struct nsSVGFrameReferenceFromProperty { explicit nsSVGFrameReferenceFromProperty(nsIFrame* aFrame) : mFrame(aFrame) - , mFramePresShell(aFrame->PresContext()->PresShell()) + , mFramePresShell(aFrame->PresShell()) {} // Clear our reference to the frame. diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 3efba17f73f9..d91ac8aad809 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3331,7 +3331,7 @@ SVGTextFrame::ScheduleReflowSVGNonDisplayText(nsIPresShell::IntrinsicDirty aReas MOZ_ASSERT(f, "should have found an ancestor frame to reflow"); - PresContext()->PresShell()->FrameNeedsReflow(f, aReason, NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(f, aReason, NS_FRAME_IS_DIRTY); } NS_IMPL_ISUPPORTS(SVGTextFrame::MutationObserver, nsIMutationObserver) @@ -4213,7 +4213,7 @@ SVGTextFrame::GetSubStringLengthSlowFallback(nsIContent* aContent, // but we would still need to resort to full reflow for percentage // positioning attributes. For now we just do a full reflow regardless since // the cases that would cause us to be called are relatively uncommon. - PresContext()->PresShell()->FlushPendingNotifications(FlushType::Layout); + PresShell()->FlushPendingNotifications(FlushType::Layout); UpdateGlyphPositioning(); diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index 8192988a10a6..3469cdf3c99f 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -440,7 +440,7 @@ nsSVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) // PresShell and prevent it from reflowing us properly in future. Besides // that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us // synchronously, so there's no need. - if (needReflow && !PresContext()->PresShell()->IsReflowLocked()) { + if (needReflow && !PresShell()->IsReflowLocked()) { RequestReflow(nsIPresShell::eResize); } @@ -503,7 +503,7 @@ void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType) if (!kid) return; - PresContext()->PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY); } void diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index 79c33a183b3e..474c06822e43 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -101,7 +101,7 @@ nsSVGImageFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDest } if (mReflowCallbackPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackPosted = false; } @@ -451,7 +451,7 @@ nsSVGImageFrame::ReflowSVG() SVGObserverUtils::UpdateEffects(this); if (!mReflowCallbackPosted) { - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); mReflowCallbackPosted = true; shell->PostReflowCallback(this); } diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index 0b7d94caaef6..c58f5efbfb8c 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -131,7 +131,7 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent, // has had its first reflow, and that its size depends on our // intrinsic size. We need it to resize itself to use our (now // available) intrinsic size: - embeddingFrame->PresContext()->PresShell()-> + embeddingFrame->PresShell()-> FrameNeedsReflow(embeddingFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } } @@ -514,7 +514,7 @@ nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext, // Make sure elements styled by :hover get updated if script/animation moves // them under or out from under the pointer: - PresContext()->PresShell()->SynthesizeMouseMove(false); + PresShell()->SynthesizeMouseMove(false); } /* virtual */ void @@ -716,14 +716,14 @@ nsSVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID, if (DependsOnIntrinsicSize(embeddingFrame)) { // Tell embeddingFrame's presShell it needs to be reflowed (which takes // care of reflowing us too). - embeddingFrame->PresContext()->PresShell()-> + embeddingFrame->PresShell()-> FrameNeedsReflow(embeddingFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } // else our width and height is overridden - don't reflow anything } else { // We are not embedded by reference, so our 'width' and 'height' // attributes are not overridden - we need to reflow. - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } } diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index ba5636c494f7..ffac9adc022b 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -248,7 +248,7 @@ nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) nsFrameState dirtyBit = (outerSVGFrame == aFrame ? NS_FRAME_IS_DIRTY : NS_FRAME_HAS_DIRTY_CHILDREN); - aFrame->PresContext()->PresShell()->FrameNeedsReflow( + aFrame->PresShell()->FrameNeedsReflow( outerSVGFrame, nsIPresShell::eResize, dirtyBit); } diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 13557f16ca81..a349b1bb9046 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -66,7 +66,7 @@ public: mozilla::layers::WebRenderLayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override { - RefPtr frameSelection = mFrame->PresContext()->PresShell()->FrameSelection(); + RefPtr frameSelection = mFrame->PresShell()->FrameSelection(); if (frameSelection->GetTableCellSelection()) { return false; } @@ -218,7 +218,7 @@ nsTableCellFrame::AttributeChanged(int32_t aNameSpaceID, // BasicTableLayoutStrategy if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::nowrap && PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); } diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index 2b8639fb63ad..108a6109469c 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -242,7 +242,7 @@ nsTableColGroupFrame::InsertColsReflow(int32_t aColIndex, { AddColsToTable(aColIndex, true, aCols); - PresContext()->PresShell()->FrameNeedsReflow(this, + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -270,9 +270,8 @@ nsTableColGroupFrame::RemoveChild(nsTableColFrame& aChild, } } - PresContext()->PresShell()->FrameNeedsReflow(this, - nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } void diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 490f33b69c59..729b54f91426 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -373,7 +373,7 @@ nsTableFrame::RowOrColSpanChanged(nsTableCellFrame* aCellFrame) // XXX Should this use eStyleChange? It currently doesn't need // to, but it might given more optimization. - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY); } } @@ -726,7 +726,7 @@ nsTableFrame::AppendAnonymousColFrames(nsTableColGroupFrame* aColGroupFrame, NS_PRECONDITION(aColType != eColAnonymousCol, "Shouldn't happen"); MOZ_ASSERT(aNumColsToAdd > 0, "We should be adding _something_."); - nsIPresShell *shell = PresContext()->PresShell(); + nsIPresShell *shell = PresShell(); // Get the last col frame nsFrameList newColFrames; @@ -1219,7 +1219,7 @@ nsDisplayItemGeometry* nsDisplayTableItem::AllocateGeometry(nsDisplayListBuilder* aBuilder) { return new nsDisplayTableItemGeometry(this, aBuilder, - mFrame->GetOffsetTo(mFrame->PresContext()->PresShell()->GetRootFrame())); + mFrame->GetOffsetTo(mFrame->PresShell()->GetRootFrame())); } void @@ -1233,7 +1233,7 @@ nsDisplayTableItem::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder, bool invalidateForAttachmentFixed = false; if (mDrawsBackground && mPartHasFixedBackground) { nsPoint frameOffsetToViewport = mFrame->GetOffsetTo( - mFrame->PresContext()->PresShell()->GetRootFrame()); + mFrame->PresShell()->GetRootFrame()); invalidateForAttachmentFixed = frameOffsetToViewport != geometry->mFrameOffsetToViewport; } @@ -2577,8 +2577,8 @@ nsTableFrame::AppendFrames(ChildListID aListID, printf("=== TableFrame::AppendFrames\n"); Dump(true, true, true); #endif - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); SetGeometryDirty(); } @@ -2749,8 +2749,8 @@ nsTableFrame::HomogenousInsertFrames(ChildListID aListID, return; } - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); SetGeometryDirty(); #ifdef DEBUG_TABLE_CELLMAP printf("=== TableFrame::InsertFrames\n"); @@ -2838,7 +2838,7 @@ nsTableFrame::RemoveFrame(ChildListID aListID, mozilla::StyleDisplay::TableColumnGroup != aOldFrame->StyleDisplay()->mDisplay, "Wrong list name; use kColGroupList iff colgroup"); - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); nsTableFrame* lastParent = nullptr; while (aOldFrame) { nsIFrame* oldFrameNextContinuation = aOldFrame->GetNextContinuation(); diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 3e6d822a0086..11444c92d423 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -218,8 +218,8 @@ nsTableRowFrame::AppendFrames(ChildListID aListID, tableFrame->AppendCell(static_cast(*childFrame), GetRowIndex()); } - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } @@ -264,8 +264,8 @@ nsTableRowFrame::InsertFrames(ChildListID aListID, } tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex); - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } @@ -284,9 +284,8 @@ nsTableRowFrame::RemoveFrame(ChildListID aListID, // Remove the frame and destroy it mFrames.DestroyFrame(aOldFrame); - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index cd4e3c14b26e..8662702d1e2b 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1489,9 +1489,8 @@ nsTableRowGroupFrame::AppendFrames(ChildListID aListID, if (rows.Length() > 0) { nsTableFrame* tableFrame = GetTableFrame(); tableFrame->AppendRows(this, rowIndex, rows); - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } } @@ -1539,9 +1538,8 @@ nsTableRowGroupFrame::InsertFrames(ChildListID aListID, int32_t rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : startRowIndex; tableFrame->InsertRows(this, rows, rowIndex, true); - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } } @@ -1561,9 +1559,8 @@ nsTableRowGroupFrame::RemoveFrame(ChildListID aListID, // remove the rows from the table (and flag a rebalance) tableFrame->RemoveRows(*rowFrame, 1, true); - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); tableFrame->SetGeometryDirty(); } mFrames.DestroyFrame(aOldFrame); diff --git a/layout/tables/nsTableWrapperFrame.cpp b/layout/tables/nsTableWrapperFrame.cpp index 39df4d72e0c2..6471e2e85b9e 100644 --- a/layout/tables/nsTableWrapperFrame.cpp +++ b/layout/tables/nsTableWrapperFrame.cpp @@ -121,8 +121,8 @@ nsTableWrapperFrame::AppendFrames(ChildListID aListID, // Reflow the new caption frame. It's already marked dirty, so // just tell the pres shell. - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } void @@ -140,8 +140,8 @@ nsTableWrapperFrame::InsertFrames(ChildListID aListID, // Reflow the new caption frame. It's already marked dirty, so // just tell the pres shell. - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } void @@ -161,9 +161,8 @@ nsTableWrapperFrame::RemoveFrame(ChildListID aListID, // Remove the frame and destroy it mCaptionFrames.DestroyFrame(aOldFrame); - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); // also means child removed + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } void diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index 963f3085ec7b..d2fbcdda1363 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -1030,9 +1030,8 @@ nsBoxFrame::RemoveFrame(ChildListID aListID, aOldFrame->Destroy(); // mark us dirty and generate a reflow command - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } void @@ -1067,9 +1066,8 @@ nsBoxFrame::InsertFrames(ChildListID aListID, SetDebugOnChildList(state, mFrames.FirstChild(), true); #endif - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1101,9 +1099,8 @@ nsBoxFrame::AppendFrames(ChildListID aListID, // XXXbz why is this NS_FRAME_FIRST_REFLOW check here? if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); } } @@ -1228,8 +1225,8 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID, UpdateMouseThrough(); } - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } else if (aAttribute == nsGkAtoms::ordinal) { nsIFrame* parent = GetParentXULBox(this); @@ -1242,9 +1239,8 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID, StyleDisplay()->mDisplay != mozilla::StyleDisplay::MozPopup) { parent->XULRelayoutChildAtOrdinal(this); // XXXldb Should this instead be a tree change on the child or parent? - PresContext()->PresShell()-> - FrameNeedsReflow(parent, nsIPresShell::eStyleChange, - NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(parent, nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } } // If the accesskey changed, register for the new value @@ -1256,8 +1252,8 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID, mContent->IsXULElement(nsGkAtoms::tree)) { // Reflow ourselves and all our children if "rows" changes, since // nsTreeBodyFrame's layout reads this from its parent (this frame). - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } return rv; diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index 118f7e43d7dd..4f5fe1b69437 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -149,7 +149,7 @@ nsImageBoxFrame::AttributeChanged(int32_t aNameSpaceID, if (aAttribute == nsGkAtoms::src) { UpdateImage(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } else if (aAttribute == nsGkAtoms::validate) @@ -861,7 +861,7 @@ nsImageBoxFrame::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage) nsPresContext::CSSPixelsToAppUnits(h)); if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } @@ -885,7 +885,7 @@ nsImageBoxFrame::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus) } else { // Fire an onerror DOM event. mIntrinsicSize.SizeTo(0, 0); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); FireImageDOMEvent(mContent, eLoadError); } diff --git a/layout/xul/nsListBoxBodyFrame.cpp b/layout/xul/nsListBoxBodyFrame.cpp index 52a6f3ab75bd..c858d5c2ef4e 100644 --- a/layout/xul/nsListBoxBodyFrame.cpp +++ b/layout/xul/nsListBoxBodyFrame.cpp @@ -216,7 +216,7 @@ nsListBoxBodyFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostD { // make sure we cancel any posted callbacks. if (mReflowCallbackPosted) - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); // Revoke any pending position changed events for (uint32_t i = 0; i < mPendingPositionChangeEvents.Length(); ++i) { @@ -239,7 +239,7 @@ nsListBoxBodyFrame::AttributeChanged(int32_t aNameSpaceID, nsresult rv = NS_OK; if (aAttribute == nsGkAtoms::rows) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } else @@ -492,7 +492,7 @@ nsListBoxBodyFrame::ReflowFinished() // if the row height changed then mark everything as a style change. // That will dirty the entire listbox if (mRowHeightWasSet) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); int32_t pos = mCurrentIndex * mRowHeight; if (mYPosition != pos) @@ -780,7 +780,7 @@ nsListBoxBodyFrame::PostReflowCallback() { if (!mReflowCallbackPosted) { mReflowCallbackPosted = true; - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); } } @@ -1074,7 +1074,7 @@ nsListBoxBodyFrame::DestroyRows(int32_t& aRowsToLose) nsIFrame* childFrame = GetFirstFrame(); nsBoxLayoutState state(PresContext()); - nsCSSFrameConstructor* fc = PresContext()->PresShell()->FrameConstructor(); + nsCSSFrameConstructor* fc = PresShell()->FrameConstructor(); fc->BeginUpdate(); while (childFrame && aRowsToLose > 0) { --aRowsToLose; @@ -1086,7 +1086,7 @@ nsListBoxBodyFrame::DestroyRows(int32_t& aRowsToLose) } fc->EndUpdate(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1099,7 +1099,7 @@ nsListBoxBodyFrame::ReverseDestroyRows(int32_t& aRowsToLose) nsIFrame* childFrame = GetLastFrame(); nsBoxLayoutState state(PresContext()); - nsCSSFrameConstructor* fc = PresContext()->PresShell()->FrameConstructor(); + nsCSSFrameConstructor* fc = PresShell()->FrameConstructor(); fc->BeginUpdate(); while (childFrame && aRowsToLose > 0) { --aRowsToLose; @@ -1112,7 +1112,7 @@ nsListBoxBodyFrame::ReverseDestroyRows(int32_t& aRowsToLose) } fc->EndUpdate(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1301,7 +1301,7 @@ nsListBoxBodyFrame::ContinueReflow(nscoord height) nsBoxLayoutState state(PresContext()); nsCSSFrameConstructor* fc = - PresContext()->PresShell()->FrameConstructor(); + PresShell()->FrameConstructor(); fc->BeginUpdate(); while (currFrame) { nsIFrame* nextFrame = currFrame->GetNextSibling(); @@ -1310,7 +1310,7 @@ nsListBoxBodyFrame::ContinueReflow(nscoord height) } fc->EndUpdate(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1328,7 +1328,7 @@ nsListBoxBodyFrame::ListBoxAppendFrames(nsFrameList& aFrameList) const nsFrameList::Slice& newFrames = mFrames.AppendFrames(nullptr, aFrameList); if (mLayoutManager) mLayoutManager->ChildrenAppended(this, state, newFrames); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); @@ -1345,7 +1345,7 @@ nsListBoxBodyFrame::ListBoxInsertFrames(nsIFrame* aPrevFrame, mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList); if (mLayoutManager) mLayoutManager->ChildrenInserted(this, state, aPrevFrame, newFrames); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); @@ -1386,7 +1386,7 @@ nsListBoxBodyFrame::OnContentInserted(nsIContent* aChildContent) } CreateRows(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1472,7 +1472,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext, RemoveChildFrame(state, aChildFrame); } - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1529,7 +1529,7 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState, nsAccessibilityService* accService = nsIPresShell::AccService(); if (accService) { nsIContent* content = aFrame->GetContent(); - accService->ContentRemoved(PresContext()->PresShell(), content); + accService->ContentRemoved(PresShell(), content); } #endif diff --git a/layout/xul/nsMenuBarFrame.cpp b/layout/xul/nsMenuBarFrame.cpp index 42a064e7e3c9..76cec3b6c923 100644 --- a/layout/xul/nsMenuBarFrame.cpp +++ b/layout/xul/nsMenuBarFrame.cpp @@ -162,7 +162,7 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent) return nullptr; // no character was pressed so just return // Enumerate over our list of frames. - auto insertion = PresContext()->PresShell()->FrameConstructor()-> + auto insertion = PresShell()->FrameConstructor()-> GetInsertionPoint(GetContent(), nullptr); nsContainerFrame* immediateParent = insertion.mParentFrame; if (!immediateParent) diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index 44062605c861..c25faab835f9 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -231,7 +231,7 @@ nsMenuFrame::Init(nsIContent* aContent, BuildAcceleratorText(false); if (!mReflowCallbackPosted) { mReflowCallbackPosted = true; - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); } } @@ -284,7 +284,7 @@ nsMenuFrame::DestroyPopupList() NS_ASSERTION(prop && prop->IsEmpty(), "popup list must exist and be empty when destroying"); RemoveStateBits(NS_STATE_MENU_HAS_POPUP_LIST); - prop->Delete(PresContext()->PresShell()); + prop->Delete(PresShell()); } void @@ -295,7 +295,7 @@ nsMenuFrame::SetPopupFrame(nsFrameList& aFrameList) if (popupFrame) { // Remove the frame from the list and store it in a nsFrameList* property. aFrameList.RemoveFrame(popupFrame); - nsFrameList* popupList = new (PresContext()->PresShell()) nsFrameList(popupFrame, popupFrame); + nsFrameList* popupList = new (PresShell()) nsFrameList(popupFrame, popupFrame); SetProperty(PopupListProperty(), popupList); AddStateBits(NS_STATE_MENU_HAS_POPUP_LIST); break; @@ -318,7 +318,7 @@ void nsMenuFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { if (mReflowCallbackPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackPosted = false; } @@ -1307,7 +1307,7 @@ nsMenuFrame::RemoveFrame(ChildListID aListID, popupList->RemoveFirstChild(); aOldFrame->Destroy(); DestroyPopupList(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); return; @@ -1328,7 +1328,7 @@ nsMenuFrame::InsertFrames(ChildListID aListID, SetXULDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG); #endif - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } @@ -1356,7 +1356,7 @@ nsMenuFrame::AppendFrames(ChildListID aListID, nsBoxLayoutState state(PresContext()); SetXULDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG); #endif - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index acd458954996..9bd7ddf9e5ed 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -944,8 +944,8 @@ nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) // do we need an actual reflow here? // is SetPopupPosition all that is needed? - PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); if (mPopupType == ePopupTypeMenu) { nsCOMPtr sound(do_CreateInstance("@mozilla.org/sound;1")); @@ -1878,7 +1878,7 @@ nsIScrollableFrame* nsMenuPopupFrame::GetScrollFrame(nsIFrame* aStart) void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsMenuFrame* aMenuItem) { if (aMenuItem) { - aMenuItem->PresContext()->PresShell()->ScrollFrameRectIntoView( + aMenuItem->PresShell()->ScrollFrameRectIntoView( aMenuItem, nsRect(nsPoint(0,0), aMenuItem->GetRect().Size()), nsIPresShell::ScrollAxis(), @@ -2029,7 +2029,7 @@ nsMenuPopupFrame::ChangeMenuItem(nsMenuFrame* aMenuItem, // the menu, blink it, or update any other state of the menuitem. The // command event will cause the item to be selected. nsContentUtils::DispatchXULCommand(aMenuItem->GetContent(), /* aTrusted = */ true, - nullptr, PresContext()->PresShell(), + nullptr, PresShell(), false, false, false, false); } #endif @@ -2062,7 +2062,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction doAction = false; // Enumerate over our list of frames. - auto insertion = PresContext()->PresShell()-> + auto insertion = PresShell()-> FrameConstructor()->GetInsertionPoint(GetContent(), nullptr); nsContainerFrame* immediateParent = insertion.mParentFrame; if (!immediateParent) @@ -2339,7 +2339,7 @@ void nsMenuPopupFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { if (mReflowCallbackData.mPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackData.Clear(); } diff --git a/layout/xul/nsProgressMeterFrame.cpp b/layout/xul/nsProgressMeterFrame.cpp index 786292e39b8f..e633dcce52c2 100644 --- a/layout/xul/nsProgressMeterFrame.cpp +++ b/layout/xul/nsProgressMeterFrame.cpp @@ -52,7 +52,7 @@ NS_IMETHODIMP nsReflowFrameRunnable::Run() { if (mWeakFrame.IsAlive()) { - mWeakFrame->PresContext()->PresShell()-> + mWeakFrame->PresShell()-> FrameNeedsReflow(mWeakFrame, mIntrinsicDirty, mBitToAdd); } return NS_OK; @@ -112,7 +112,7 @@ nsProgressMeterFrame::DoXULLayout(nsBoxLayoutState& aState) if (mNeedsReflowCallback) { nsIReflowCallback* cb = new nsAsyncProgressMeterInit(this); if (cb) { - PresContext()->PresShell()->PostReflowCallback(cb); + PresShell()->PostReflowCallback(cb); } mNeedsReflowCallback = false; } diff --git a/layout/xul/nsScrollbarFrame.cpp b/layout/xul/nsScrollbarFrame.cpp index fc870ea9f66a..f598035ef0a4 100644 --- a/layout/xul/nsScrollbarFrame.cpp +++ b/layout/xul/nsScrollbarFrame.cpp @@ -155,7 +155,7 @@ nsScrollbarFrame::GetScrollbarMediator() } sbm = do_QueryFrame(f); if (f && !sbm) { - f = f->PresContext()->PresShell()->GetRootScrollFrame(); + f = f->PresShell()->GetRootScrollFrame(); if (f && f->GetContent() == mScrollbarMediator) { return do_QueryFrame(f); } diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index 0c2818b8aaaa..5e3625a91980 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -103,7 +103,7 @@ nsSliderFrame::~nsSliderFrame() { if (mSuppressionActive) { APZCCallbackHelper::SuppressDisplayport(false, PresContext() ? - PresContext()->PresShell() : + PresShell() : nullptr); } } @@ -313,7 +313,7 @@ nsSliderFrame::AttributeChanged(int32_t aNameSpaceID, aAttribute == nsGkAtoms::pageincrement || aAttribute == nsGkAtoms::increment) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } @@ -1133,7 +1133,7 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent) nsCOMPtr scrollbar = GetContentOfBox(scrollbarBox); - nsIPresShell* shell = PresContext()->PresShell(); + nsIPresShell* shell = PresShell(); uint64_t inputblockId = InputAPZContext::GetInputBlockId(); uint32_t presShellId = shell->GetPresShellId(); AsyncDragMetrics dragMetrics(scrollTargetId, presShellId, inputblockId, @@ -1641,8 +1641,8 @@ void nsSliderFrame::SuppressDisplayport() { if (!mSuppressionActive) { - MOZ_ASSERT(PresContext()->PresShell()); - APZCCallbackHelper::SuppressDisplayport(true, PresContext()->PresShell()); + MOZ_ASSERT(PresShell()); + APZCCallbackHelper::SuppressDisplayport(true, PresShell()); mSuppressionActive = true; } } @@ -1651,8 +1651,8 @@ void nsSliderFrame::UnsuppressDisplayport() { if (mSuppressionActive) { - MOZ_ASSERT(PresContext()->PresShell()); - APZCCallbackHelper::SuppressDisplayport(false, PresContext()->PresShell()); + MOZ_ASSERT(PresShell()); + APZCCallbackHelper::SuppressDisplayport(false, PresShell()); mSuppressionActive = false; } } diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index a1c64f3f51c0..b5cf94b50757 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -83,7 +83,7 @@ nsTextBoxFrame::AttributeChanged(int32_t aNameSpaceID, UpdateAttributes(aAttribute, aResize, aRedraw); if (aResize) { - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); } else if (aRedraw) { @@ -215,7 +215,7 @@ nsTextBoxFrame::UpdateAccesskey(WeakFrame& aWeakThis) RecomputeTitle(); mAccessKey = accesskey; UpdateAccessTitle(); - PresContext()->PresShell()-> + PresShell()-> FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); return true; @@ -518,7 +518,7 @@ nsTextBoxFrame::DrawText(gfxContext& aRenderingContext, } RefPtr refContext = - PresContext()->PresShell()->CreateReferenceRenderingContext(); + PresShell()->CreateReferenceRenderingContext(); DrawTarget* refDrawTarget = refContext->GetDrawTarget(); CalculateUnderline(refDrawTarget, *fontMet); @@ -978,7 +978,7 @@ nsTextBoxFrame::DoXULLayout(nsBoxLayoutState& aBoxLayoutState) if (mNeedsReflowCallback) { nsIReflowCallback* cb = new nsAsyncAccesskeyUpdate(this); if (cb) { - PresContext()->PresShell()->PostReflowCallback(cb); + PresShell()->PostReflowCallback(cb); } mNeedsReflowCallback = false; } @@ -1101,7 +1101,7 @@ nsTextBoxFrame::CalcDrawRect(gfxContext &aRenderingContext) // changed. nsAccessibilityService* accService = GetAccService(); if (accService) { - accService->UpdateLabelValue(PresContext()->PresShell(), mContent, + accService->UpdateLabelValue(PresShell(), mContent, mCroppedTitle); } #endif diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 462b67e0c7e7..3f56aa758ecb 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -248,7 +248,7 @@ nsTreeBodyFrame::CalcMaxRowWidth() nsTreeColumn* col; RefPtr rc = - PresContext()->PresShell()->CreateReferenceRenderingContext(); + PresShell()->CreateReferenceRenderingContext(); for (int32_t row = 0; row < mRowCount; ++row) { rowWidth = 0; @@ -282,7 +282,7 @@ nsTreeBodyFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDest mScrollEvent.Revoke(); // Make sure we cancel any posted callbacks. if (mReflowCallbackPosted) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackPosted = false; } @@ -349,10 +349,10 @@ void nsTreeBodyFrame::EnsureView() { if (!mView) { - if (PresContext()->PresShell()->IsReflowLocked()) { + if (PresShell()->IsReflowLocked()) { if (!mReflowCallbackPosted) { mReflowCallbackPosted = true; - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); } return; } @@ -389,13 +389,13 @@ nsTreeBodyFrame::ManageReflowCallback(const nsRect& aRect, nscoord aHorzWidth) { if (!mReflowCallbackPosted && (!aRect.IsEqualEdges(mRect) || mHorzWidth != aHorzWidth)) { - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); mReflowCallbackPosted = true; mOriginalHorzWidth = mHorzWidth; } else if (mReflowCallbackPosted && mHorzWidth != aHorzWidth && mOriginalHorzWidth == aHorzWidth) { - PresContext()->PresShell()->CancelReflowCallback(this); + PresShell()->CancelReflowCallback(this); mReflowCallbackPosted = false; mOriginalHorzWidth = -1; } @@ -527,12 +527,12 @@ nsTreeBodyFrame::SetView(nsITreeView * aView) NS_ENSURE_STATE(weakFrame.IsAlive()); mView->GetRowCount(&mRowCount); - if (!PresContext()->PresShell()->IsReflowLocked()) { + if (!PresShell()->IsReflowLocked()) { // The scrollbar will need to be updated. FullScrollbarsUpdate(false); } else if (!mReflowCallbackPosted) { mReflowCallbackPosted = true; - PresContext()->PresShell()->PostReflowCallback(this); + PresShell()->PostReflowCallback(this); } } @@ -1771,7 +1771,7 @@ nsTreeBodyFrame::IsCellCropped(int32_t aRow, nsITreeColumn* aCol, bool *_retval) return NS_ERROR_INVALID_ARG; RefPtr rc = - PresContext()->PresShell()->CreateReferenceRenderingContext(); + PresShell()->CreateReferenceRenderingContext(); rv = GetCellWidth(aRow, col, rc, desiredSize, currentSize); NS_ENSURE_SUCCESS(rv, rv); @@ -1792,9 +1792,8 @@ nsTreeBodyFrame::MarkDirtyIfSelect() // XXX optimize this more mStringWidth = -1; - PresContext()->PresShell()->FrameNeedsReflow(this, - nsIPresShell::eTreeChange, - NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange, + NS_FRAME_IS_DIRTY); } } @@ -2920,8 +2919,8 @@ nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext, if (oldPageCount != mPageLength || mHorzWidth != CalcHorzWidth(GetScrollParts())) { // Schedule a ResizeReflow that will update our info properly. - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_IS_DIRTY); + PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize, + NS_FRAME_IS_DIRTY); } #ifdef DEBUG int32_t rowCount = mRowCount; diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index d19eb998c6a0..53212d888dcb 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -319,13 +319,12 @@ WebrtcGmpVideoEncoder::Encode(const webrtc::VideoFrame& aInputImage, // Would be really nice to avoid this sync dispatch, but it would require a // copy of the frame, since it doesn't appear to actually have a refcount. // Passing 'this' is safe since this is synchronous. - mGMPThread->Dispatch( + mozilla::SyncRunnable::DispatchToThread(mGMPThread, WrapRunnable(this, &WebrtcGmpVideoEncoder::Encode_g, &aInputImage, aCodecSpecificInfo, - aFrameTypes), - NS_DISPATCH_SYNC); + aFrameTypes)); return WEBRTC_VIDEO_CODEC_OK; } diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index e83952079536..ff999b559509 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -105,29 +105,83 @@ public: return sPreferences->mDefaultRootBranch; } - // Gets int or bool type pref value with default value if failed to get the - // pref. + // Gets the type of the pref. + static int32_t GetDefaultType(const char* aPref); + + // Fallible getters of default values. + static nsresult GetDefaultBool(const char* aPref, bool* aResult); + static nsresult GetDefaultInt(const char* aPref, int32_t* aResult); + static nsresult GetDefaultUint(const char* aPref, uint32_t* aResult) + { + return GetDefaultInt(aPref, reinterpret_cast(aResult)); + } + static nsresult GetDefaultCString(const char* aPref, nsACString& aResult); + static nsresult GetDefaultString(const char* aPref, nsAString& aResult); + static nsresult GetDefaultLocalizedCString(const char* aPref, + nsACString& aResult); + static nsresult GetDefaultLocalizedString(const char* aPref, + nsAString& aResult); + static nsresult GetDefaultComplex(const char* aPref, + const nsIID& aType, + void** aResult); + + // Infallible getters of default values, with fallback results on failure. + static bool GetDefaultBool(const char* aPref, bool aFailedResult) + { + bool result; + return NS_SUCCEEDED(GetDefaultBool(aPref, &result)) ? result + : aFailedResult; + } + static int32_t GetDefaultInt(const char* aPref, int32_t aFailedResult) + { + int32_t result; + return NS_SUCCEEDED(GetDefaultInt(aPref, &result)) ? result : aFailedResult; + } + static uint32_t GetDefaultUint(const char* aPref, uint32_t aFailedResult) + { + return static_cast( + GetDefaultInt(aPref, static_cast(aFailedResult))); + } + + // Gets the type of the pref. + static int32_t GetType(const char* aPref); + + // Fallible getters of user or default values. + static nsresult GetBool(const char* aPref, bool* aResult); + static nsresult GetInt(const char* aPref, int32_t* aResult); + static nsresult GetUint(const char* aPref, uint32_t* aResult) + { + return GetInt(aPref, reinterpret_cast(aResult)); + } + static nsresult GetFloat(const char* aPref, float* aResult); + static nsresult GetCString(const char* aPref, nsACString& aResult); + static nsresult GetString(const char* aPref, nsAString& aResult); + static nsresult GetLocalizedCString(const char* aPref, nsACString& aResult); + static nsresult GetLocalizedString(const char* aPref, nsAString& aResult); + static nsresult GetComplex(const char* aPref, + const nsIID& aType, + void** aResult); + + // Infallible getters of user or default values, with fallback results on + // failure. static bool GetBool(const char* aPref, bool aDefault = false) { bool result = aDefault; GetBool(aPref, &result); return result; } - static int32_t GetInt(const char* aPref, int32_t aDefault = 0) { int32_t result = aDefault; GetInt(aPref, &result); return result; } - static uint32_t GetUint(const char* aPref, uint32_t aDefault = 0) { uint32_t result = aDefault; GetUint(aPref, &result); return result; } - static float GetFloat(const char* aPref, float aDefault = 0) { float result = aDefault; @@ -135,36 +189,7 @@ public: return result; } - // Gets int, float, or bool type pref value with raw return value of - // nsIPrefBranch. - // - // |aResult| must not be nullptr; its contents are never modified when these - // methods fail. - static nsresult GetBool(const char* aPref, bool* aResult); - static nsresult GetInt(const char* aPref, int32_t* aResult); - static nsresult GetFloat(const char* aPref, float* aResult); - static nsresult GetUint(const char* aPref, uint32_t* aResult) - { - int32_t result; - nsresult rv = GetInt(aPref, &result); - if (NS_SUCCEEDED(rv)) { - *aResult = static_cast(result); - } - return rv; - } - - // Gets string type pref value with raw return value of nsIPrefBranch. - // |aResult| is never modified when these methods fail. - static nsresult GetCString(const char* aPref, nsACString& aResult); - static nsresult GetString(const char* aPref, nsAString& aResult); - static nsresult GetLocalizedCString(const char* aPref, nsACString& aResult); - static nsresult GetLocalizedString(const char* aPref, nsAString& aResult); - - static nsresult GetComplex(const char* aPref, - const nsIID& aType, - void** aResult); - - // Sets various type pref values. + // Setters of user values. static nsresult SetBool(const char* aPref, bool aValue); static nsresult SetInt(const char* aPref, int32_t aValue); static nsresult SetUint(const char* aPref, uint32_t aValue) @@ -176,7 +201,6 @@ public: static nsresult SetCString(const char* aPref, const nsACString& aValue); static nsresult SetString(const char* aPref, const char16ptr_t aValue); static nsresult SetString(const char* aPref, const nsAString& aValue); - static nsresult SetComplex(const char* aPref, const nsIID& aType, nsISupports* aValue); @@ -187,9 +211,6 @@ public: // Whether the pref has a user value or not. static bool HasUserValue(const char* aPref); - // Gets the type of the pref. - static int32_t GetType(const char* aPref); - // Adds/Removes the observer for the root pref branch. See nsIPrefBranch.idl // for details. static nsresult AddStrongObserver(nsIObserver* aObserver, const char* aPref); @@ -275,51 +296,6 @@ public: const char* aPref, float aDefault = 0.0f); - // Gets the default bool, int or uint value of the pref. The result is raw - // result of nsIPrefBranch::Get*Pref(). If the pref could have any value, you - // need to use these methods. If not so, you could use the methods below. - static nsresult GetDefaultBool(const char* aPref, bool* aResult); - static nsresult GetDefaultInt(const char* aPref, int32_t* aResult); - static nsresult GetDefaultUint(const char* aPref, uint32_t* aResult) - { - return GetDefaultInt(aPref, reinterpret_cast(aResult)); - } - - // Gets the default bool, int or uint value of the pref directly. You can set - // an invalid value of the pref to |aFailedResult|. If these methods fail to - // get the default value, they return |aFailedResult|. - static bool GetDefaultBool(const char* aPref, bool aFailedResult) - { - bool result; - return NS_SUCCEEDED(GetDefaultBool(aPref, &result)) ? result - : aFailedResult; - } - static int32_t GetDefaultInt(const char* aPref, int32_t aFailedResult) - { - int32_t result; - return NS_SUCCEEDED(GetDefaultInt(aPref, &result)) ? result : aFailedResult; - } - static uint32_t GetDefaultUint(const char* aPref, uint32_t aFailedResult) - { - return static_cast( - GetDefaultInt(aPref, static_cast(aFailedResult))); - } - - // Gets the default value of the char type pref. - static nsresult GetDefaultCString(const char* aPref, nsACString& aResult); - static nsresult GetDefaultString(const char* aPref, nsAString& aResult); - static nsresult GetDefaultLocalizedCString(const char* aPref, - nsACString& aResult); - static nsresult GetDefaultLocalizedString(const char* aPref, - nsAString& aResult); - - static nsresult GetDefaultComplex(const char* aPref, - const nsIID& aType, - void** aResult); - - // Gets the type of the pref. - static int32_t GetDefaultType(const char* aPref); - // Used to synchronise preferences between chrome and content processes. static void GetPreferences(InfallibleTArray* aPrefs); static void GetPreference(PrefSetting* aPref); diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index dfe324a9d775..3a9f6160a104 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -58,6 +58,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, , mUpgradeInsecureRequests(false) , mVerifySignedContent(false) , mEnforceSRI(false) + , mForceAllowDataURI(false) , mForceInheritPrincipalDropped(false) , mInnerWindowID(0) , mOuterWindowID(0) @@ -241,6 +242,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow, , mUpgradeInsecureRequests(false) , mVerifySignedContent(false) , mEnforceSRI(false) + , mForceAllowDataURI(false) , mForceInheritPrincipalDropped(false) , mInnerWindowID(0) , mOuterWindowID(0) @@ -309,6 +311,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs) , mUpgradeInsecureRequests(rhs.mUpgradeInsecureRequests) , mVerifySignedContent(rhs.mVerifySignedContent) , mEnforceSRI(rhs.mEnforceSRI) + , mForceAllowDataURI(rhs.mForceAllowDataURI) , mForceInheritPrincipalDropped(rhs.mForceInheritPrincipalDropped) , mInnerWindowID(rhs.mInnerWindowID) , mOuterWindowID(rhs.mOuterWindowID) @@ -346,6 +349,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, bool aUpgradeInsecureRequests, bool aVerifySignedContent, bool aEnforceSRI, + bool aForceAllowDataURI, bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID, uint64_t aOuterWindowID, @@ -378,6 +382,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, , mUpgradeInsecureRequests(aUpgradeInsecureRequests) , mVerifySignedContent(aVerifySignedContent) , mEnforceSRI(aEnforceSRI) + , mForceAllowDataURI(aForceAllowDataURI) , mForceInheritPrincipalDropped(aForceInheritPrincipalDropped) , mInnerWindowID(aInnerWindowID) , mOuterWindowID(aOuterWindowID) @@ -751,6 +756,23 @@ LoadInfo::GetEnforceSRI(bool* aResult) return NS_OK; } +NS_IMETHODIMP +LoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI) +{ + MOZ_ASSERT(!mForceAllowDataURI || + mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT, + "can only allow data URI navigation for TYPE_DOCUMENT"); + mForceAllowDataURI = aForceAllowDataURI; + return NS_OK; +} + +NS_IMETHODIMP +LoadInfo::GetForceAllowDataURI(bool* aForceAllowDataURI) +{ + *aForceAllowDataURI = mForceAllowDataURI; + return NS_OK; +} + NS_IMETHODIMP LoadInfo::GetForceInheritPrincipalDropped(bool* aResult) { diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h index bc6911f4d958..9cd3124317e2 100644 --- a/netwerk/base/LoadInfo.h +++ b/netwerk/base/LoadInfo.h @@ -103,6 +103,7 @@ private: bool aUpgradeInsecureRequests, bool aVerifySignedContent, bool aEnforceSRI, + bool aForceAllowDataURI, bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID, uint64_t aOuterWindowID, @@ -159,6 +160,7 @@ private: bool mUpgradeInsecureRequests; bool mVerifySignedContent; bool mEnforceSRI; + bool mForceAllowDataURI; bool mForceInheritPrincipalDropped; uint64_t mInnerWindowID; uint64_t mOuterWindowID; diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl index 03b48011be1d..577c95fe134b 100644 --- a/netwerk/base/nsILoadInfo.idl +++ b/netwerk/base/nsILoadInfo.idl @@ -506,6 +506,11 @@ interface nsILoadInfo : nsISupports */ [infallible] attribute boolean enforceSRI; + /** + * If true, toplevel data: URI navigation is allowed + */ + [infallible] attribute boolean forceAllowDataURI; + /** * The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info * object is created. Specifically, it will be dropped if the SEC_SANDBOXED diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh index 9da8f0f148ef..882667e2b102 100644 --- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -47,6 +47,7 @@ struct LoadInfoArgs bool upgradeInsecureRequests; bool verifySignedContent; bool enforceSRI; + bool forceAllowDataURI; bool forceInheritPrincipalDropped; uint64_t innerWindowID; uint64_t outerWindowID; diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index a713b966fc06..8cdf20c37681 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -119,8 +119,6 @@ Http2Session::Http2Session(nsISocketTransport *aSocketTransport, uint32_t versio , mAttemptingEarlyData(attemptingEarlyData) , mOriginFrameActivated(false) , mTlsHandshakeFinished(false) - , mFlushOKAddStream(false) - , mFlushOKReadSegments(false) { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); @@ -386,13 +384,6 @@ Http2Session::AddStream(nsAHttpTransaction *aHttpTransaction, { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); - MOZ_DIAGNOSTIC_ASSERT(!mFlushOKAddStream); - mFlushOKAddStream = true; - auto cleanup = MakeScopeExit([&] () { - MOZ_DIAGNOSTIC_ASSERT(mFlushOKAddStream); - mFlushOKAddStream = false; - }); - // integrity check if (mStreamTransactionHash.Get(aHttpTransaction)) { LOG3((" New transaction already present\n")); @@ -551,24 +542,6 @@ Http2Session::RealignOutputQueue() mOutputQueueSent = 0; } -void -Http2Session::MaybeFlushOutputQueue() -{ - // Only try to flush the output queue if we know any mSegmentReader that's set - // is properly set through the right channels. Otherwise, just set our write - // callbacks so the connection can call in with a proper segment reader that - // we'll be sure we can write to. - // See bug 1402014 comment 6 - MOZ_ASSERT(OnSocketThread(), "not on socket thread"); - LOG3(("Http2Session::MaybeFlushOutputQueue mFlushOKAddStream=%d, " - "mFlushOKReadSegments=%d", mFlushOKAddStream, mFlushOKReadSegments)); - if (mFlushOKAddStream || mFlushOKReadSegments) { - FlushOutputQueue(); - } else { - SetWriteCallbacks(); - } -} - void Http2Session::FlushOutputQueue() { @@ -821,7 +794,7 @@ Http2Session::GeneratePing(bool isAck) } LogIO(this, nullptr, "Generate Ping", packet, kFrameHeaderBytes + 8); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -835,7 +808,7 @@ Http2Session::GenerateSettingsAck() mOutputQueueUsed += kFrameHeaderBytes; CreateFrameHeader(packet, 0, FRAME_TYPE_SETTINGS, kFlag_ACK, 0); LogIO(this, nullptr, "Generate Settings ACK", packet, kFrameHeaderBytes); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -848,7 +821,7 @@ Http2Session::GeneratePriority(uint32_t aID, uint8_t aPriorityWeight) char *packet = CreatePriorityFrame(aID, 0, aPriorityWeight); LogIO(this, nullptr, "Generate Priority", packet, kFrameHeaderBytes + 5); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -875,7 +848,7 @@ Http2Session::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) NetworkEndian::writeUint32(packet + kFrameHeaderBytes, aStatusCode); LogIO(this, nullptr, "Generate Reset", packet, frameSize); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -898,7 +871,7 @@ Http2Session::GenerateGoAway(uint32_t aStatusCode) NetworkEndian::writeUint32(packet + frameSize - 4, aStatusCode); LogIO(this, nullptr, "Generate GoAway", packet, frameSize); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } // The Hello is comprised of @@ -1020,7 +993,7 @@ Http2Session::SendHello() // Http2Session::OnTransportStatus. Yeah, that's right. YOU! } - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -1035,7 +1008,7 @@ Http2Session::SendPriorityFrame(uint32_t streamID, char *packet = CreatePriorityFrame(streamID, dependsOn, weight); LogIO(this, nullptr, "SendPriorityFrame", packet, kFrameHeaderBytes + 5); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } char * @@ -2772,13 +2745,6 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader), "Inconsistent Write Function Callback"); - MOZ_DIAGNOSTIC_ASSERT(!mFlushOKReadSegments); - mFlushOKReadSegments = true; - auto cleanup = MakeScopeExit([&] () { - MOZ_DIAGNOSTIC_ASSERT(mFlushOKReadSegments); - mFlushOKReadSegments = false; - }); - nsresult rv = ConfirmTLSProfile(); if (NS_FAILED(rv)) { if (mGoAwayReason == INADEQUATE_SECURITY) { @@ -2789,9 +2755,8 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, return rv; } - if (reader) { - SetSegmentReader(reader); - } + if (reader) + mSegmentReader = reader; *countRead = 0; @@ -2802,7 +2767,7 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, LOG3(("Http2Session %p could not identify a stream to write; suspending.", this)); uint32_t availBeforeFlush = mOutputQueueUsed - mOutputQueueSent; - MaybeFlushOutputQueue(); + FlushOutputQueue(); uint32_t availAfterFlush = mOutputQueueUsed - mOutputQueueSent; if (availBeforeFlush != availAfterFlush) { LOG3(("Http2Session %p ResumeRecv After early flush in ReadSegments", this)); @@ -2821,7 +2786,7 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, if (!stream->Do0RTT()) { LOG3(("Http2Session %p will not get early data from Http2Stream %p 0x%X", this, stream, stream->StreamID())); - MaybeFlushOutputQueue(); + FlushOutputQueue(); SetWriteCallbacks(); if (!mCannotDo0RTTStreams.Contains(stream)) { mCannotDo0RTTStreams.AppendElement(stream); @@ -2863,7 +2828,7 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, // tries to flush the output queue) - SENDING_FIN_STREAM can be an example // of that. But we might still have old data buffered that would be good // to flush. - MaybeFlushOutputQueue(); + FlushOutputQueue(); // Allow new server reads - that might be data or control information // (e.g. window updates or http replies) that are responses to these writes @@ -3674,7 +3639,7 @@ Http2Session::UpdateLocalRwin(Http2Stream *stream, uint32_t bytes) UpdateLocalStreamWindow(stream, bytes); UpdateLocalSessionWindow(bytes); - MaybeFlushOutputQueue(); + FlushOutputQueue(); } void @@ -3763,7 +3728,7 @@ Http2Session::OnReadSegment(const char *buf, // If we can release old queued data then we can try and write the new // data directly to the network without using the output queue at all if (mOutputQueueUsed) - MaybeFlushOutputQueue(); + FlushOutputQueue(); if (!mOutputQueueUsed && mSegmentReader) { // try and write directly without output queue @@ -3805,7 +3770,7 @@ Http2Session::OnReadSegment(const char *buf, mOutputQueueUsed += count; *countRead = count; - MaybeFlushOutputQueue(); + FlushOutputQueue(); return NS_OK; } @@ -3814,7 +3779,7 @@ nsresult Http2Session::CommitToSegmentSize(uint32_t count, bool forceCommitment) { if (mOutputQueueUsed && !mAttemptingEarlyData) - MaybeFlushOutputQueue(); + FlushOutputQueue(); // would there be enough room to buffer this if needed? if ((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved)) @@ -4591,18 +4556,5 @@ Http2Session::TopLevelOuterContentWindowIdChanged(uint64_t windowId) } } -void -Http2Session::SetSegmentReader(nsAHttpSegmentReader *reader) -{ - LOG3(("Http2Session::SetSegmentReader this=%p mClosed=%d mSegmentReader=%p reader=%p", - this, mClosed, mSegmentReader, reader)); - MOZ_DIAGNOSTIC_ASSERT(!mSegmentReader || reader == mSegmentReader); - if (mClosed) { - mSegmentReader = nullptr; - } else { - mSegmentReader = reader; - } -} - } // namespace net } // namespace mozilla diff --git a/netwerk/protocol/http/Http2Session.h b/netwerk/protocol/http/Http2Session.h index 5339dd9c6b36..b6b95cc479c6 100644 --- a/netwerk/protocol/http/Http2Session.h +++ b/netwerk/protocol/http/Http2Session.h @@ -220,7 +220,7 @@ public: virtual MOZ_MUST_USE nsresult CommitToSegmentSize(uint32_t size, bool forceCommitment) override; MOZ_MUST_USE nsresult BufferOutput(const char *, uint32_t, uint32_t *); - void MaybeFlushOutputQueue(); + void FlushOutputQueue(); uint32_t AmountOfOutputBuffered() { return mOutputQueueUsed - mOutputQueueSent; } uint32_t GetServerInitialStreamWindow() { return mServerInitialStreamWindow; } @@ -563,12 +563,6 @@ private: // We should propagate this events to the first nsHttpTransaction. RefPtr mFirstHttpTransaction; bool mTlsHandshakeFinished; - - void SetSegmentReader(nsAHttpSegmentReader *); - void FlushOutputQueue(); - bool mFlushOKAddStream; - bool mFlushOKReadSegments; - private: /// connect tunnels void DispatchOnTunnel(nsAHttpTransaction *, nsIInterfaceRequestor *); diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index 25fc20f2baa9..7498e992946a 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -958,7 +958,7 @@ Http2Stream::TransmitFrame(const char *buf, } if (!mAttempting0RTT) { - mSession->MaybeFlushOutputQueue(); + mSession->FlushOutputQueue(); } // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0 diff --git a/taskcluster/scripts/misc/build-clang-windows-helper32.sh b/taskcluster/scripts/misc/build-clang-windows-helper32.sh index 1a25c2a6be6b..2d8769f09e30 100755 --- a/taskcluster/scripts/misc/build-clang-windows-helper32.sh +++ b/taskcluster/scripts/misc/build-clang-windows-helper32.sh @@ -47,11 +47,13 @@ EOF set +x BUILD_CLANG_DIR=build/src/build/build-clang -MOZCONFIG=${MOZCONFIG} build/src/mach python ${BUILD_CLANG_DIR}/build-clang.py -c ${BUILD_CLANG_DIR}/${1} +cd ${BUILD_CLANG_DIR} +MOZCONFIG=${MOZCONFIG} ../../mach python ./build-clang.py -c ./${1} +cd - set -x # Put a tarball in the artifacts dir UPLOAD_PATH=public/build mkdir -p ${UPLOAD_PATH} -cp clang*.tar.* ${UPLOAD_PATH} +cp ${BUILD_CLANG_DIR}/clang*.tar.* ${UPLOAD_PATH} diff --git a/taskcluster/scripts/misc/build-clang-windows-helper64.sh b/taskcluster/scripts/misc/build-clang-windows-helper64.sh index 28081399ad70..a8769f7797c2 100755 --- a/taskcluster/scripts/misc/build-clang-windows-helper64.sh +++ b/taskcluster/scripts/misc/build-clang-windows-helper64.sh @@ -46,11 +46,14 @@ EOF set +x BUILD_CLANG_DIR=build/src/build/build-clang -MOZCONFIG=${MOZCONFIG} build/src/mach python ${BUILD_CLANG_DIR}/build-clang.py -c ${BUILD_CLANG_DIR}/${1} +cd ${BUILD_CLANG_DIR} +MOZCONFIG=${MOZCONFIG} ../../mach python ./build-clang.py -c ./${1} +cd - + set -x # Put a tarball in the artifacts dir UPLOAD_PATH=public/build mkdir -p ${UPLOAD_PATH} -cp clang*.tar.* ${UPLOAD_PATH} +cp ${BUILD_CLANG_DIR}/clang*.tar.* ${UPLOAD_PATH} diff --git a/testing/mozbase/mozfile/mozfile/mozfile.py b/testing/mozbase/mozfile/mozfile/mozfile.py index 89a2effbf334..9821376e1400 100644 --- a/testing/mozbase/mozfile/mozfile/mozfile.py +++ b/testing/mozbase/mozfile/mozfile/mozfile.py @@ -61,17 +61,8 @@ def extract_zip(src, dest): namelist = bundle.namelist() for name in namelist: + bundle.extract(name, dest) filename = os.path.realpath(os.path.join(dest, name)) - if name.endswith('/'): - if not os.path.isdir(filename): - os.makedirs(filename) - else: - path = os.path.dirname(filename) - if not os.path.isdir(path): - os.makedirs(path) - _dest = open(filename, 'wb') - _dest.write(bundle.read(name)) - _dest.close() mode = bundle.getinfo(name).external_attr >> 16 & 0x1FF # Only update permissions if attributes are set. Otherwise fallback to the defaults. if mode: diff --git a/toolkit/components/extensions/webrequest/StreamFilterParent.cpp b/toolkit/components/extensions/webrequest/StreamFilterParent.cpp index 1b7b82a30697..68788e150580 100644 --- a/toolkit/components/extensions/webrequest/StreamFilterParent.cpp +++ b/toolkit/components/extensions/webrequest/StreamFilterParent.cpp @@ -418,8 +418,11 @@ StreamFilterParent::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) // Important: Do this only *after* running the next listener in the chain, so // that we get the final delivery target after any retargeting that it may do. if (nsCOMPtr req = do_QueryInterface(aRequest)) { - Unused << req->GetDeliveryTarget(getter_AddRefs(mIOThread)); - MOZ_ASSERT(mIOThread); + nsCOMPtr thread; + Unused << req->GetDeliveryTarget(getter_AddRefs(thread)); + if (thread) { + mIOThread = Move(thread); + } } return rv; diff --git a/view/nsView.cpp b/view/nsView.cpp index e8bafd537247..11248c0dacad 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -1146,5 +1146,5 @@ nsView::HandleEvent(WidgetGUIEvent* aEvent, bool nsView::IsPrimaryFramePaintSuppressed() { - return sShowPreviousPage && mFrame && mFrame->PresContext()->PresShell()->IsPaintingSuppressed(); + return sShowPreviousPage && mFrame && mFrame->PresShell()->IsPaintingSuppressed(); } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 2e7f0bce294f..1825bff5f6f3 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -7451,7 +7451,7 @@ nsWindow::GetAccessible() nsAccessibilityService* accService = GetOrCreateAccService(); if (accService) { a11y::DocAccessible* docAcc = - GetAccService()->GetDocAccessible(frame->PresContext()->PresShell()); + GetAccService()->GetDocAccessible(frame->PresShell()); if (docAcc) { NS_LOG_WMGETOBJECT(this, mWnd, docAcc->GetAccessibleOrDescendant(frame->GetContent())); diff --git a/xpcom/threads/AbstractThread.cpp b/xpcom/threads/AbstractThread.cpp index bcae3882fc0a..d8b65c8bbb77 100644 --- a/xpcom/threads/AbstractThread.cpp +++ b/xpcom/threads/AbstractThread.cpp @@ -46,20 +46,20 @@ public: MOZ_ASSERT_IF(aRequireTailDispatch, NS_IsMainThread() && aTarget->IsOnCurrentThread()); } - virtual void Dispatch(already_AddRefed aRunnable, - DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, - DispatchReason aReason = NormalDispatch) override + virtual nsresult Dispatch(already_AddRefed aRunnable, + DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, + DispatchReason aReason = NormalDispatch) override { AbstractThread* currentThread; if (aReason != TailDispatch && (currentThread = GetCurrent()) && RequiresTailDispatch(currentThread)) { currentThread->TailDispatcher().AddTask(this, Move(aRunnable), aFailureHandling); - return; + return NS_OK; } RefPtr runner(new Runner(this, Move(aRunnable), false /* already drained by TaskGroupRunnable */)); nsresult rv = mTarget->Dispatch(runner.forget(), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(aFailureHandling == DontAssertDispatchSuccess || NS_SUCCEEDED(rv)); - Unused << rv; + return rv; } // Prevent a GCC warning about the other overload of Dispatch being hidden. diff --git a/xpcom/threads/AbstractThread.h b/xpcom/threads/AbstractThread.h index cb4a1a37a985..60b329c490a9 100644 --- a/xpcom/threads/AbstractThread.h +++ b/xpcom/threads/AbstractThread.h @@ -69,9 +69,9 @@ public: enum DispatchFailureHandling { AssertDispatchSuccess, DontAssertDispatchSuccess }; enum DispatchReason { NormalDispatch, TailDispatch }; - virtual void Dispatch(already_AddRefed aRunnable, - DispatchFailureHandling aHandling = AssertDispatchSuccess, - DispatchReason aReason = NormalDispatch) = 0; + virtual nsresult Dispatch(already_AddRefed aRunnable, + DispatchFailureHandling aHandling = AssertDispatchSuccess, + DispatchReason aReason = NormalDispatch) = 0; virtual bool IsCurrentThreadIn() = 0; diff --git a/xpcom/threads/TaskQueue.h b/xpcom/threads/TaskQueue.h index b97586c8eccb..032a9b2d0a2a 100644 --- a/xpcom/threads/TaskQueue.h +++ b/xpcom/threads/TaskQueue.h @@ -61,9 +61,9 @@ public: TaskQueue* AsTaskQueue() override { return this; } - void Dispatch(already_AddRefed aRunnable, - DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, - DispatchReason aReason = NormalDispatch) override + nsresult Dispatch(already_AddRefed aRunnable, + DispatchFailureHandling aFailureHandling = AssertDispatchSuccess, + DispatchReason aReason = NormalDispatch) override { nsCOMPtr r = aRunnable; { @@ -74,7 +74,7 @@ public: MOZ_CRASH_UNSAFE_PRINTF("%s: Dispatch failed. rv=%x", mName, uint32_t(rv)); } #endif - Unused << rv; + return rv; } // If the ownership of |r| is not transferred in DispatchLocked() due to // dispatch failure, it will be deleted here outside the lock. We do so