mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
bc8ce42355
- Bug 1226200: Don't assume a TCPSocket has only one managee (and rename LoneManagedOrNull) r=jdm (aa2d0fcc14) - Bug 1227300, Part 1 - Add an alert notification component. r=MattN,wchen (37758ce9ff) - Bug 1230700. Make Notification::ShowInternal explicitly suppress the exception from GetPermissionInternal. r=smaug (9e288cf5ae) - Bug 1225336 - Add telemetry about web notification display/messages. r=wchen,kitcambridge p=vladan# Please enter the commit message for your changes. Lines starting (b2e481691a) - Bug 1219030 - Collect notification management telemetry. r=wchen,MattN; p=ally (c0ba425b4e) - Bug 1212611 - Use system notification for website notifications in Android. r=mfinkle (84985bcf01) - Bug 1227300, Part 2 - Implement showAlert. r=MattN,wchen (33eedc7e91) - Bug 1214305 - Part 0: Ensure site security service is initialized before trying to use DataStorage via IPC. (8bd73f43b0) - Bug 1137681 - Make user agent docshell overrides affect network requests. r=jduell (e8dabb8338) - Bug 1233245 - Propagate the interception information in the non-e10s case for all HTTP redirects, not just the internal ones; r=jdm (6922fddcf8) - Bug 1226444 - Use helper function to identify preloads. r=sicking (d110669f73) - Bug 1214305 - Part 1: Refactor the logic for querying whether a connection should go through a secure upgrade into NS_ShouldSecureUpgrade; r=mcmanus (2d04c78290) - Bug 1137681 - Per-tab user agent emulation. r=bz (4ff70db690) - Bug 1227300, Part 3 - Implement showAlert for the OS X alerts backend. r=mstange (5eb05d0728) - Bug 1227300, Part 4 - Implement showAlert for the libnotify alerts backend. r=karlt (0942fa2764) - Bug 1227300, Part 5 - Implement showAlert for the B2G alerts backend. r=mhenretty (e39581aea5) - Bug 1227300, Part 6 - Use showAlert to display web notifications. r=wchen (ab79eaa0c8) - domBug 1227300, Part 7 - Update test interfaces. a=testonly (387cb62772) - Bug 1214305 - Part 3: Add a nsIInterceptedChannel.secureUpgradedChannelURI helper; r=jdm (811d25bd58) - Bug 1214305 - Part 4: Use the secure upgraded channel URI in ServiceWorkerManager::PrepareFetchEvent; r=jdm (0c44bf527c) - Bug 1214305 - Part 5: Use the secure upgraded channel URI in FetchEventRunnable::Init; r=jdm (a30f239261) - Bug 1214305 - Part 6: Use a non-IPC redirect for synthesized upgraded responses to ensure the response URL is correctly propagated; r=mcmanus (8ba8a5728c) - Bug 1214305 - Part 7: Decide in the child process whether an intercepted channel should go through a secure upgrade; r=mcmanus (93e27decae) - Bug 1198397 - Add a test for interception of requests upgraded through the CSP upgrade-insecure-requests directive; r=jdm (21eb14eb34) - Bug 1214305 - Part 8: Enable secure upgrade service worker tests on e10s; r=jdm (c14f5fb504) - Bug 1214305 - Part 10: Clean up global DataStorage references in the child process; r=keeler (ef0b52d049) - Bug 1224771 - Close all web notifications when the originating tab is closed. r=wchen (da295b4ba7) - Bug 1214305 - Part 2: Refactor the logic for obtaining the secure upgraded URI into HttpBaseChannel; r=mcmanus (3346078285) - Bug 1237151 (part 1) - Remove ignored qualifiers in dom/media/gmp/. r=cpearce. (18134820a6) - Bug 1237151 (part 2) - Remove ignored qualifiers in WebRTC-relate code. r=jesup. (effe5bd694) - Bug 1118820 part 1 (style system part) - [css-grid] Implement the 'auto-fill' and 'auto-fit' keywords in the repeat() function. r=dholbert (5db1a577db) - Bug 1118820 part 2a - [css-grid] Add a LineNameMap class that lets us lookup line names with a dynamic number of 'repeat(auto-fill/auto-fit)' tracks taken into account. r=dholbert (3ecf4b53f0) - Bug 1118820 part 2b - [css-grid] Move the static functions FindLine/RFindLine/FindNamedLine into the LineNameMap class (idempotent patch). r=dholbert (efb12c594b) - Bug 1118820 part 2c+2d - [css-grid] Modify the LineNameMap::FindLine/RFindLine/FindNamedLine methods to take line names associated with 'repeat(auto-fill/auto-fit)' tracks into account. Instantiate and pass around a LineNameMap object instead of an array of line name arrays. r=dholbert (a3db750297) - Bug 1118820 part 3a - [css-grid] Modify TrackSizingFunctions to take a dynamic number of 'repeat(auto-fill/auto-fit)' tracks taking into account. r=dholbert (9aa6033332) - Bug 1118820 part 3b - [css-grid] Implement the CalculateRepeatFillCount method that calculates the number of 'repeat(auto-fill/auto-fit)' tracks to use for the given sizes. r=dholbert (cf75fab8a8) - Bug 1118820 part 4 - [css-grid] Provide the sizes to use for CalculateRepeatFillCount. r=dholbert (8184c00dba) - Bug 1118820 part 5 - [css-grid] Remove any empty 'repeat(auto-fit)' tracks at the end of its range and adjust affected grid area line numbers accordingly. r=dholbert (c02ba6a6e3) - Bug 1229165 - [css-grid] Reftests for min/max-width/height properties on the grid container. (725097f878) - Bug 1229999 - [css-grid] Reftest. (51b5bc9535) - Bug 1237151 (part 3) - Remove ignored qualifiers in all remaining code. r=froydnj. (69917ebbad) - more bits of Bug 1178892 - Split the profiler into Core & Gecko files (41bb127b9c) - Bug 1199841 - Restructure private browsing to remember status after OnStopRequest r=jdm (16c2c1044d) - Bug 1233845 - Report an interception error and cancel the HTTP channel when encountering a known topcrash situation. r=ehsan (5d08075110) - Bug 664163 - Fix Get(Local|Remote)(Address|Port) in HttpChannelChild. r=jduell (cbf70af4e8) - Bug 1229177 - Show the tracking protection shield for fetch and XHR requests. r=jduell (5833b3e872) - Bug 1220678 Don't crash when DivertToParent() is called on an intercepted channel. r=jdm (5d7ff6ecc8) - Bug 1220681 P1 Make HttpChannelChild::DivertToParent() work with synthetic responses. r=jdm (67715703ef) - Bug 1169819 Add browser chrome test to validate SW force refresh. r=ehsan (c0b6b3e874) - Bug 1220681 P2 Test synthetic responses that trigger downloads. r=ehsan (c701f3ddb1) - Bug 1220681 P3 Delay diversion on parent side until response head has been synthesized. r=jdm (7c697aacee) - Bug 1220681 P4 Automatically suspend the parent channel after synthesizing the response for diverison. r=jdm (27f31bcb35) - Bug 1220681 P5 Don't double suspend parent channel during synthesized divert to parent. r=jdm (62081d4b56) - Bug 1220681 P6 Use clients.claim() in browser_download.js to avoid worker unregister race. r=jdm (c8de291727) - Bug 1240161 - Remove "only-if-cached" from RequestCache; r=bkelly (283486f584) - Bug 1184550 - Add a mochitest for the Request constructor that tests that the body is set to used after being fetched and then fails on the second fetch with the same Request. r=bkelly (db4a967203) - Bug 1205495 - Correctly use the requests's body and redirect mode in reroute.js; r=nsm (a36a96624a) - Bug 1189656 - Fix fetch-request-fallback test paths. r=bkelly (366c884179) - Bug 1219085 - Import the fetch-request-redirect.https.html test from Blink; r=jdm (bf6b484d82) - Bug 1209081 - Part 1: Implement the "navigate" value for RequestMode; r=bkelly (a22f19d94b) - Bug 1209081 - Part 2: Upgrade the saved Requests in the DOM Cache to reflect the "navigate" RequestMode if they represent navigation content policy types; r=bkelly (60d1da23bb) - Bug 1219469 - Part 1: Revert the error reporting added in bug 1233845; r=jdm (dcc022b9d3) - Bug 1219469 - Part 2: Make HttpChannelParentListener be the controller; r=jdm,jduell (9c5f0dfbe0) - Bug 1229369 - Intercept redirected network fetches that have their request mode set to manual; r=jdm (fb21d86ed2)
299 lines
10 KiB
C++
299 lines
10 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsPrintingPromptService.h"
|
|
|
|
#include "nsIComponentManager.h"
|
|
#include "nsIDialogParamBlock.h"
|
|
#include "nsIDOMWindow.h"
|
|
#include "nsIServiceManager.h"
|
|
#include "nsISupportsUtils.h"
|
|
#include "nsISupportsArray.h"
|
|
#include "nsString.h"
|
|
#include "nsIPrintDialogService.h"
|
|
|
|
// Printing Progress Includes
|
|
#include "nsPrintProgress.h"
|
|
#include "nsPrintProgressParams.h"
|
|
|
|
static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul";
|
|
static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
|
|
static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul";
|
|
static const char *kPageSetupDialogURL = "chrome://global/content/printPageSetup.xul";
|
|
static const char *kPrinterPropertiesURL = "chrome://global/content/printjoboptions.xul";
|
|
|
|
/****************************************************************
|
|
************************* ParamBlock ***************************
|
|
****************************************************************/
|
|
|
|
class ParamBlock {
|
|
|
|
public:
|
|
ParamBlock()
|
|
{
|
|
mBlock = 0;
|
|
}
|
|
~ParamBlock()
|
|
{
|
|
NS_IF_RELEASE(mBlock);
|
|
}
|
|
nsresult Init() {
|
|
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
|
}
|
|
nsIDialogParamBlock * operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN { return mBlock; }
|
|
operator nsIDialogParamBlock * () const { return mBlock; }
|
|
|
|
private:
|
|
nsIDialogParamBlock *mBlock;
|
|
};
|
|
|
|
/****************************************************************
|
|
***************** nsPrintingPromptService **********************
|
|
****************************************************************/
|
|
|
|
NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
|
|
|
|
nsPrintingPromptService::nsPrintingPromptService()
|
|
{
|
|
}
|
|
|
|
nsPrintingPromptService::~nsPrintingPromptService()
|
|
{
|
|
}
|
|
|
|
nsresult
|
|
nsPrintingPromptService::Init()
|
|
{
|
|
nsresult rv;
|
|
mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
|
|
{
|
|
NS_ENSURE_ARG(webBrowserPrint);
|
|
NS_ENSURE_ARG(printSettings);
|
|
|
|
// Try to access a component dialog
|
|
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
|
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
|
if (dlgPrint)
|
|
return dlgPrint->Show(parent, printSettings, webBrowserPrint);
|
|
|
|
// Show the built-in dialog instead
|
|
ParamBlock block;
|
|
nsresult rv = block.Init();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
block->SetInt(0, 0);
|
|
return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
|
|
nsIWebBrowserPrint* webBrowserPrint, // ok to be null
|
|
nsIPrintSettings* printSettings, // ok to be null
|
|
nsIObserver* openDialogObserver, // ok to be null
|
|
bool isForPrinting,
|
|
nsIWebProgressListener** webProgressListener,
|
|
nsIPrintProgressParams** printProgressParams,
|
|
bool* notifyOnOpen)
|
|
{
|
|
NS_ENSURE_ARG(webProgressListener);
|
|
NS_ENSURE_ARG(printProgressParams);
|
|
NS_ENSURE_ARG(notifyOnOpen);
|
|
|
|
*notifyOnOpen = false;
|
|
|
|
nsPrintProgress* prtProgress = new nsPrintProgress(printSettings);
|
|
mPrintProgress = prtProgress;
|
|
mWebProgressListener = prtProgress;
|
|
|
|
nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
|
|
|
|
nsCOMPtr<nsIDOMWindow> parentWindow = parent;
|
|
|
|
if (mWatcher && !parentWindow) {
|
|
mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
|
|
}
|
|
|
|
if (parentWindow) {
|
|
mPrintProgress->OpenProgressDialog(parentWindow,
|
|
isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
|
|
prtProgressParams, openDialogObserver, notifyOnOpen);
|
|
}
|
|
|
|
prtProgressParams.forget(printProgressParams);
|
|
NS_ADDREF(*webProgressListener = this);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
|
|
{
|
|
NS_ENSURE_ARG(printSettings);
|
|
|
|
// Try to access a component dialog
|
|
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
|
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
|
if (dlgPrint)
|
|
return dlgPrint->ShowPageSetup(parent, printSettings);
|
|
|
|
ParamBlock block;
|
|
nsresult rv = block.Init();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
block->SetInt(0, 0);
|
|
return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings)
|
|
{
|
|
/* fixme: We simply ignore the |aPrinter| argument here
|
|
* We should get the supported printer attributes from the printer and
|
|
* populate the print job options dialog with these data instead of using
|
|
* the "default set" here.
|
|
* However, this requires changes on all platforms and is another big chunk
|
|
* of patches ... ;-(
|
|
*/
|
|
NS_ENSURE_ARG(printerName);
|
|
NS_ENSURE_ARG(printSettings);
|
|
|
|
ParamBlock block;
|
|
nsresult rv = block.Init();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
block->SetInt(0, 0);
|
|
return DoDialog(parent, block, nullptr, printSettings, kPrinterPropertiesURL);
|
|
|
|
}
|
|
|
|
nsresult
|
|
nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent,
|
|
nsIDialogParamBlock *aParamBlock,
|
|
nsIWebBrowserPrint *aWebBrowserPrint,
|
|
nsIPrintSettings* aPS,
|
|
const char *aChromeURL)
|
|
{
|
|
NS_ENSURE_ARG(aParamBlock);
|
|
NS_ENSURE_ARG(aPS);
|
|
NS_ENSURE_ARG(aChromeURL);
|
|
|
|
if (!mWatcher)
|
|
return NS_ERROR_FAILURE;
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
// get a parent, if at all possible
|
|
// (though we'd rather this didn't fail, it's OK if it does. so there's
|
|
// no failure or null check.)
|
|
nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime
|
|
if (!aParent)
|
|
{
|
|
mWatcher->GetActiveWindow(getter_AddRefs(activeParent));
|
|
aParent = activeParent;
|
|
}
|
|
|
|
// create a nsISupportsArray of the parameters
|
|
// being passed to the window
|
|
nsCOMPtr<nsISupportsArray> array;
|
|
NS_NewISupportsArray(getter_AddRefs(array));
|
|
if (!array) return NS_ERROR_FAILURE;
|
|
|
|
nsCOMPtr<nsISupports> psSupports(do_QueryInterface(aPS));
|
|
NS_ASSERTION(psSupports, "PrintSettings must be a supports");
|
|
array->AppendElement(psSupports);
|
|
|
|
if (aWebBrowserPrint) {
|
|
nsCOMPtr<nsISupports> wbpSupports(do_QueryInterface(aWebBrowserPrint));
|
|
NS_ASSERTION(wbpSupports, "nsIWebBrowserPrint must be a supports");
|
|
array->AppendElement(wbpSupports);
|
|
}
|
|
|
|
nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(aParamBlock));
|
|
NS_ASSERTION(blkSupps, "IOBlk must be a supports");
|
|
array->AppendElement(blkSupps);
|
|
|
|
nsCOMPtr<nsISupports> arguments(do_QueryInterface(array));
|
|
NS_ASSERTION(array, "array must be a supports");
|
|
|
|
|
|
nsCOMPtr<nsIDOMWindow> dialog;
|
|
rv = mWatcher->OpenWindow(aParent, aChromeURL, "_blank",
|
|
"centerscreen,chrome,modal,titlebar", arguments,
|
|
getter_AddRefs(dialog));
|
|
|
|
// if aWebBrowserPrint is not null then we are printing
|
|
// so we want to pass back NS_ERROR_ABORT on cancel
|
|
if (NS_SUCCEEDED(rv) && aWebBrowserPrint)
|
|
{
|
|
int32_t status;
|
|
aParamBlock->GetInt(0, &status);
|
|
return status == 0?NS_ERROR_ABORT:NS_OK;
|
|
}
|
|
|
|
return rv;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// nsIWebProgressListener
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
|
|
{
|
|
if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
|
|
mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
|
if (mPrintProgress) {
|
|
mPrintProgress->CloseProgressDialog(true);
|
|
}
|
|
mPrintProgress = nullptr;
|
|
mWebProgressListener = nullptr;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
|
|
{
|
|
if (mWebProgressListener) {
|
|
return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
|
|
{
|
|
if (mWebProgressListener) {
|
|
return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
|
|
{
|
|
if (mWebProgressListener) {
|
|
return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
|
|
{
|
|
if (mWebProgressListener) {
|
|
return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
|
|
}
|
|
return NS_OK;
|
|
}
|