This avoids a lot of mismatches between nsAString and char16_t*, thus removing
many getter_Copies() and ToNewUnicode() and get() calls, and generally making
things simpler.
Note: the patch removes GetDefaultPrinterNameFromGlobalPrinters() by simply
inlining it at its two callsites, which is easy with the changed types.
--HG--
extra : rebase_source : 9ab9b3694f093fc9b22c7f8e2394a98674d76c11
Removes the XPCOM interface for nsIDOMHTMLAreaElement, replacing it
with binding class usage.
MozReview-Commit-ID: IaX4JFTPZn6
--HG--
extra : rebase_source : 79f9200c6ff9e081a5d9bc21eaa605f88caa99e9
Removes the nsIDOMHTMLObjectElement XPCOM interface, replacing it with
HTMLObjectElement and FromContent conversion usage.
MozReview-Commit-ID: dmsjSO97uh
--HG--
extra : rebase_source : 9b2c25b8681f754bc34233afccdb6fc5d38f0804
nsDocumentViewer is the only implementation of both nsIContentViewer and
of nsIContentViewerFile.
This helps to make nsIContentViewerFile unused so that we can remove it
later in this patch series.
MozReview-Commit-ID: EgsgrXfTmx1
"fileNameStr = fileName;" will be fileNameStr.Assign(fileName), so this causes small memory leak. We should use Adopt, getter_copies, or AString parameter instead.
MozReview-Commit-ID: 5VTgttj2LdK
--HG--
extra : rebase_source : b372f04b210655e754b35fe4ebb2b8a32a19d6bf
With previous change, KeyboardEvent is dispatched even when invisible window
has focus. However, nsRootWindow::GetControllerForCommand() returns controller
for focused window even when the window is invisible because it uses
nsFocusManager::GetFocusedDescendant() to retrieve focused window.
Perhaps, we can assume that users won't expect to do something with invisible
window when they type some keys. Then, nsRootWindow::GetControllerForCommand()
should return controller for visible ancestor window if focused window is
invisible.
This patch makes nsFocusManager::GetFocusedDescendant() can return only visible
descendants. However, it already has a bool argument. Therefore, it should
have a flag instead of adding new flag. Most changes of this patch is replacing
its callers.
Then, nsRootWindow::GetControllerForCommand() and nsRootWindow::GetControllers()
should have a bool flag if it should return controller(s) for visible window.
This patch adds a bool flag for it. Fortunately, the interface isn't scriptable.
Finally, this patch makes nsXBLPrototypeHandler::DispatchXBLCommand() and
EventStateManager::DoContentCommandEvent() retrieve controller for visible
window since they are always handles user input.
MozReview-Commit-ID: GygttTHuKRm
--HG--
extra : rebase_source : 1341273c4606298cb9b890b9312d9f5c8a75d144
Bug 1376693 added a null-check to bail from print operations if
mPresShell/mPresContext are null, to avoid some null-deref crashes. However,
it turns out it's possible for these variables to be null under normal
conditions -- for example, when nsPrintEngine is printing documents,
mPrt->mPrintObject->mPresShell and mPrt->mPrintObject->mPresShell can be nullptr
if the document has <frameset> element and it's printing only content of a
<frame> element or all <frame> elements separately.
This special frameset-printing mode can cause these variables to be null;
however, the crash occurred only when mIsCreatingPrintPreview is true. So,
we should check the variables only when it's true.
Fortunately:
* the null-deref crashes that Bug 1376693 wanted to avoid were all in code
that we only visit when mIsCreatingPrintPreview is true (i.e. during print
preview).
* this special frameset-printing mode (which causes these variables to be
null) _cannot be used during print preview_.
So, we can avoid the print-preview-specific crashes without breaking
frameset-printing by simply making our null-check bail-out conditional on
mIsCreatingPrintPreview.
MozReview-Commit-ID: FJ3ynrXTxnI
--HG--
extra : rebase_source : 788ab55840c725dc401007b605c035c053049edf
Removes nsIDOMHTMLEmbedElement and all references. HTML elements are
now handled by WebIDL. With the deprecation of extensions, XPCOM
interfaces to HTML elements are no longer needed.
MozReview-Commit-ID: DI4XVvdgPDI
--HG--
extra : rebase_source : 74bd92619e3d1db04c3dd40ec3022474fe1d647c
nsXPIDLStrings are marked as VOIDED upon initialization. Most of these local
nsXPIDLString variables are immediately set via getter_Copies(), which will
either assign a string value (using Adopt()) or do SetIsVoid(). These can be
trivially converted to nsString, which will get the same treatment.
The patch suitably converts the remaining nsXPIDLString local variable as well.
--HG--
extra : rebase_source : 5fff9f2c6844559198f601853f8db08564add7d5
This removes about 2/3 of the occurrences of nsXPIDLString in the tree. The
places where nsXPIDLStrings are null-checked are replaced with |rv| checks.
The patch also removes a couple of unused declarations from
nsIStringBundle.idl.
Note that nsStringBundle::GetStringFromNameHelper() was merged into
GetStringFromName(), because they both would have had the same signature.
--HG--
extra : rebase_source : ac40bc31c2a4997f2db0bd5069cc008757a2df6d
According to the crash reports, nsPrintEngine::AfterNetworkPrint() may be called after nsPrintEngine::Destroy() is called. In this case, the method should do nothing because it's already been destroyed.
MozReview-Commit-ID: IwY9fR1OUwU
--HG--
extra : rebase_source : 6fb2e23a1e30da59c4c8823e72b8a4460c8adb28
This patch makes callers of nsPrintEngine::Print() and
nsPrintEngine::PrintPreview() grab the nsPrintEngine instance with local
variable before calling them. That guarantees that instance of nPrintEngine
won't be deleted during the calls. (We already had a RefPtr in CommonPrint
that basically did this. This patch moves it out to the callers to strengthen
its guarantee.)
MozReview-Commit-ID: 2jlYC4RKAg6
--HG--
extra : rebase_source : e6eac8df88e1d81d67a879786a2403ca00e84036
nsPrintEngine::FinishPrintPreview() may be called when nsAutoScriptBlocker is destroyed in nsPrintEngine::DoCommonPrint(). That means that the owner stopped print preview with the instance. In this case, nsPrintEngine::DoCommonPrint() doesn't need to keep initializing the instance anymore.
MozReview-Commit-ID: DRQfmyW9FEL
--HG--
extra : rebase_source : a49c0f5c74c24710334559496d173c3bae08db01
nsPrintObject::mPresShell and nsPrintObject::mPresContext are initialized by
nsPrintEngine::ReflowPrintObject(). However, while
nsPrintEngine::DoCommonPrint() is initializing mPrt and mPrintObject,
destroying nsAutoScriptBlocker may cause calling nsDocumentViewer::Destroy()
or nsPrintEngine::FinishPrintPreview() directly. Then,
nsPrintEngine::SetupToPrintContent() will be called. Therefore,
nsPrintEngine::SetupToPrintContent() sometimes see uninitialized mPrt, or
mPrt->mPrintObject->mPresShell and mPrt->mPrintObject->mPresContext.
Therefore, this patch makes nsPrintEngine::SetupToPrintContent() check whether
the necessary objects are already initialized. When one of them is not
initialized as expected, it won't to do anything.
Note that mPrt->mPrintObject is never nullptr with current design, but this
patch makes the method check it for preventing similar crash which might be
regressed with other bug fix in the future.
MozReview-Commit-ID: JKfObRm5enm
--HG--
extra : rebase_source : 977e9ffd7fc43fbeb3fac7dbd640df5a426a7427
Most of the names passed to nsIStringBundle::{Get,Format}StringFromUTF8Name
have one of the two following forms:
- a 16-bit C string literal, which is then converted to an 8-bit string in
order for the lookup to occur;
- an 8-bit C string literal converted to a 16-bit string, which is then
converted back to an 8-bit string in order for the lookup to occur.
This patch introduces and uses alternative methods that can take an 8-bit C
string literal, which requires changing some signatures in other methods and
functions. It replaces all C++ uses of the old methods.
The patch also changes the existing {Get,Format}StringFromName() methods so
they take an AUTF8String argument for the name instead of a wstring, because
that's nicer for JS code.
Even though there is a method for C++ code and a different one for JS code,
|binaryname| is used so that the existing method names can be used for the
common case in both languages.
The change reduces the number of NS_ConvertUTF8toUTF16 and
NS_ConvertUTF16toUTF8 conversions while running Speedometer v2 from ~270,000 to
~160,000. (Most of these conversions involved the string
"deprecatedReferrerDirective" in nsCSPParser.cpp.)
--HG--
extra : rebase_source : 3bee57a501035f76a81230d95186f8c3f460ff8e
nsRange::DoSetRange() adds/remove its root to/from mutation observer, initializes common ancestor, registers itself to the common ancestor, unregisters itself from old common ancestor, and notifies selection listeners of selection change.
However, those runtime cost is expensive but on the other hand, a lot of callers set both start and end of the range and that causes calling DoSetRange() twice.
This patch renames Set() to SetStartAndEnd() for easier to understand the meaning and make it call DoSetRange() only once.
MozReview-Commit-ID: FRV55tuBAgg
--HG--
extra : rebase_source : 67adf929cf119e2425f7d3741651217522094590
Although, this should be rewritten with range-based for loop, this patch just making them use nsCOMPtr to refer the objects.
MozReview-Commit-ID: IJBWs8CTyCF
For example, mPrt->mPrintObject is owned by mPrt. When nsPrintEngine needs to
call a method which takes a reference to mPrt->mPrintObject, the caller should
grab the mPrt instance for guaranteeing that mPrt->mPrintObject won't be deleted
during the method-call.
MozReview-Commit-ID: BiOQwVKdWM1