зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-inbound to mozilla-central. a=merge
This commit is contained in:
Коммит
de5c4376b8
|
@ -160,11 +160,44 @@ getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static gint getCharacterCountCB(AtkText* aText);
|
||||
|
||||
// Note: this does not support magic offsets, which is fine for its callers
|
||||
// which do not implement any.
|
||||
static gchar*
|
||||
getCharTextAtOffset(AtkText* aText, gint aOffset,
|
||||
gint* aStartOffset, gint* aEndOffset)
|
||||
{
|
||||
gint end = aOffset + 1;
|
||||
gint count = getCharacterCountCB(aText);
|
||||
|
||||
if (aOffset > count) {
|
||||
aOffset = count;
|
||||
}
|
||||
if (end > count) {
|
||||
end = count;
|
||||
}
|
||||
if (aOffset < 0) {
|
||||
aOffset = 0;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = 0;
|
||||
}
|
||||
*aStartOffset = aOffset;
|
||||
*aEndOffset = end;
|
||||
|
||||
return getTextCB(aText, aOffset, end);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
getTextAfterOffsetCB(AtkText *aText, gint aOffset,
|
||||
AtkTextBoundary aBoundaryType,
|
||||
gint *aStartOffset, gint *aEndOffset)
|
||||
{
|
||||
if (aBoundaryType == ATK_TEXT_BOUNDARY_CHAR) {
|
||||
return getCharTextAtOffset(aText, aOffset + 1, aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
|
@ -192,6 +225,10 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
|
|||
AtkTextBoundary aBoundaryType,
|
||||
gint *aStartOffset, gint *aEndOffset)
|
||||
{
|
||||
if (aBoundaryType == ATK_TEXT_BOUNDARY_CHAR) {
|
||||
return getCharTextAtOffset(aText, aOffset, aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
|
@ -238,6 +275,10 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
|
|||
AtkTextBoundary aBoundaryType,
|
||||
gint *aStartOffset, gint *aEndOffset)
|
||||
{
|
||||
if (aBoundaryType == ATK_TEXT_BOUNDARY_CHAR) {
|
||||
return getCharTextAtOffset(aText, aOffset - 1, aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
|
|
|
@ -139,7 +139,7 @@ bool
|
|||
HTMLLabelIterator::IsLabel(Accessible* aLabel)
|
||||
{
|
||||
dom::HTMLLabelElement* labelEl =
|
||||
dom::HTMLLabelElement::FromContent(aLabel->GetContent());
|
||||
dom::HTMLLabelElement::FromNode(aLabel->GetContent());
|
||||
return labelEl && labelEl->GetControl() == mAcc->GetContent();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ using namespace mozilla;
|
|||
bool
|
||||
nsCoreUtils::IsLabelWithControl(nsIContent* aContent)
|
||||
{
|
||||
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(aContent);
|
||||
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(aContent);
|
||||
if (label && label->GetControl())
|
||||
return true;
|
||||
|
||||
|
@ -100,7 +100,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
|||
|
||||
nsCOMPtr<nsIContent> tcXULElm(do_QueryInterface(tcElm));
|
||||
nsCOMPtr<nsIBoxObject> tcBoxObj =
|
||||
nsXULElement::FromContent(tcXULElm)->GetBoxObject(IgnoreErrors());
|
||||
nsXULElement::FromNode(tcXULElm)->GetBoxObject(IgnoreErrors());
|
||||
|
||||
int32_t tcX = 0;
|
||||
tcBoxObj->GetX(&tcX);
|
||||
|
@ -493,7 +493,7 @@ nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
|
|||
nsCOMPtr<nsIDOMElement> tcElm;
|
||||
aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
|
||||
nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
|
||||
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromContentOrNull(tcContent);
|
||||
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcContent);
|
||||
if (!tcXULElm)
|
||||
return nullptr;
|
||||
|
||||
|
@ -510,7 +510,7 @@ nsCoreUtils::GetTreeBoxObject(nsIContent *aContent)
|
|||
kNameSpaceID_XUL)) {
|
||||
// We will get the nsITreeBoxObject from the tree node
|
||||
RefPtr<nsXULElement> xulElement =
|
||||
nsXULElement::FromContent(currentContent);
|
||||
nsXULElement::FromNode(currentContent);
|
||||
nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
|
||||
nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
|
||||
if (treeBox)
|
||||
|
|
|
@ -645,7 +645,7 @@ Accessible::RelativeBounds(nsIFrame** aBoundingFrame) const
|
|||
if (canvasFrame) {
|
||||
*aBoundingFrame = canvasFrame;
|
||||
dom::HTMLCanvasElement *canvas =
|
||||
dom::HTMLCanvasElement::FromContent(canvasFrame->GetContent());
|
||||
dom::HTMLCanvasElement::FromNode(canvasFrame->GetContent());
|
||||
|
||||
// get the bounding rect of the hit region
|
||||
nsRect bounds;
|
||||
|
@ -1067,7 +1067,7 @@ Accessible::NativeAttributes()
|
|||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tag, tagName);
|
||||
|
||||
// Expose draggable object attribute.
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromContent(mContent)) {
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromNode(mContent)) {
|
||||
if (htmlElement->Draggable()) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::draggable,
|
||||
NS_LITERAL_STRING("true"));
|
||||
|
|
|
@ -203,7 +203,7 @@ ImageAccessible::GetLongDescURI() const
|
|||
target->IsHTMLElement(nsGkAtoms::area)) &&
|
||||
target->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
nsGenericHTMLElement* element =
|
||||
nsGenericHTMLElement::FromContent(target);
|
||||
nsGenericHTMLElement::FromNode(target);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
element->GetURIAttr(nsGkAtoms::href, nullptr, getter_AddRefs(uri));
|
||||
|
|
|
@ -68,7 +68,7 @@ HTMLLabelAccessible::RelationByType(RelationType aType)
|
|||
{
|
||||
Relation rel = AccessibleWrap::RelationByType(aType);
|
||||
if (aType == RelationType::LABEL_FOR) {
|
||||
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(mContent);
|
||||
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(mContent);
|
||||
rel.AppendTarget(mDoc, label->GetControl());
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ HTMLSummaryAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
|
|||
return;
|
||||
}
|
||||
|
||||
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
|
||||
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
|
||||
if (!summary) {
|
||||
return;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ HTMLSummaryAccessible::NativeState()
|
|||
{
|
||||
uint64_t state = HyperTextAccessibleWrap::NativeState();
|
||||
|
||||
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
|
||||
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
|
||||
if (!summary) {
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ HTMLCheckboxAccessible::NativeState()
|
|||
uint64_t state = LeafAccessible::NativeState();
|
||||
|
||||
state |= states::CHECKABLE;
|
||||
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
|
||||
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
|
||||
if (!input)
|
||||
return state;
|
||||
|
||||
|
@ -115,7 +115,7 @@ HTMLRadioButtonAccessible::NativeState()
|
|||
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
|
||||
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
|
||||
if (input && input->Checked())
|
||||
state |= states::CHECKED;
|
||||
|
||||
|
@ -345,13 +345,13 @@ HTMLTextFieldAccessible::Value(nsString& aValue)
|
|||
if (NativeState() & states::PROTECTED) // Don't return password text!
|
||||
return;
|
||||
|
||||
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
|
||||
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
|
||||
if (textArea) {
|
||||
textArea->GetValue(aValue);
|
||||
return;
|
||||
}
|
||||
|
||||
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
|
||||
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
|
||||
if (input) {
|
||||
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
|
||||
// file input here.
|
||||
|
@ -392,7 +392,7 @@ HTMLTextFieldAccessible::NativeState()
|
|||
}
|
||||
|
||||
// Is it an <input> or a <textarea> ?
|
||||
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
|
||||
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
|
||||
state |= input && input->IsSingleLineTextControl() ?
|
||||
states::SINGLE_LINE : states::MULTI_LINE;
|
||||
|
||||
|
@ -557,8 +557,7 @@ HTMLSpinnerAccessible::Value(nsString& aValue)
|
|||
|
||||
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
|
||||
// file input here.
|
||||
HTMLInputElement::FromContent(mContent)->GetValue(aValue,
|
||||
CallerType::NonSystem);
|
||||
HTMLInputElement::FromNode(mContent)->GetValue(aValue, CallerType::NonSystem);
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -568,7 +567,7 @@ HTMLSpinnerAccessible::MaxValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,7 +578,7 @@ HTMLSpinnerAccessible::MinValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -589,7 +588,7 @@ HTMLSpinnerAccessible::Step() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -599,14 +598,14 @@ HTMLSpinnerAccessible::CurValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLSpinnerAccessible::SetCurValue(double aValue)
|
||||
{
|
||||
ErrorResult er;
|
||||
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
|
||||
HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
|
||||
return !er.Failed();
|
||||
}
|
||||
|
||||
|
@ -636,8 +635,8 @@ HTMLRangeAccessible::Value(nsString& aValue)
|
|||
|
||||
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
|
||||
// file input here.
|
||||
HTMLInputElement::FromContent(mContent)->GetValue(aValue,
|
||||
CallerType::NonSystem);
|
||||
HTMLInputElement::FromNode(mContent)->GetValue(aValue,
|
||||
CallerType::NonSystem);
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -647,7 +646,7 @@ HTMLRangeAccessible::MaxValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -657,7 +656,7 @@ HTMLRangeAccessible::MinValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -667,7 +666,7 @@ HTMLRangeAccessible::Step() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -677,14 +676,14 @@ HTMLRangeAccessible::CurValue() const
|
|||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
|
||||
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLRangeAccessible::SetCurValue(double aValue)
|
||||
{
|
||||
ErrorResult er;
|
||||
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
|
||||
HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
|
||||
return !er.Failed();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ HTMLAreaAccessible::Description(nsString& aDescription)
|
|||
|
||||
// Still to do - follow IE's standard here
|
||||
RefPtr<dom::HTMLAreaElement> area =
|
||||
dom::HTMLAreaElement::FromContentOrNull(mContent);
|
||||
dom::HTMLAreaElement::FromNodeOrNull(mContent);
|
||||
if (area)
|
||||
area->GetShape(aDescription);
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ HTMLSelectOptionAccessible::NativeState()
|
|||
return state;
|
||||
|
||||
// Are we selected?
|
||||
HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
|
||||
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
|
||||
bool selected = option && option->Selected();
|
||||
if (selected)
|
||||
state |= states::SELECTED;
|
||||
|
@ -280,7 +280,7 @@ HTMLSelectOptionAccessible::DoAction(uint8_t aIndex)
|
|||
void
|
||||
HTMLSelectOptionAccessible::SetSelected(bool aSelect)
|
||||
{
|
||||
HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
|
||||
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
|
||||
if (option)
|
||||
option->SetSelected(aSelect);
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ HTMLComboboxAccessible::SetCurrentItem(Accessible* aItem)
|
|||
Accessible*
|
||||
HTMLComboboxAccessible::SelectedOption() const
|
||||
{
|
||||
HTMLSelectElement* select = HTMLSelectElement::FromContent(mContent);
|
||||
HTMLSelectElement* select = HTMLSelectElement::FromNode(mContent);
|
||||
int32_t selectedIndex = select->SelectedIndex();
|
||||
|
||||
if (selectedIndex >= 0) {
|
||||
|
|
|
@ -480,7 +480,7 @@ HTMLTableAccessible::Caption() const
|
|||
void
|
||||
HTMLTableAccessible::Summary(nsString& aSummary)
|
||||
{
|
||||
dom::HTMLTableElement* table = dom::HTMLTableElement::FromContent(mContent);
|
||||
dom::HTMLTableElement* table = dom::HTMLTableElement::FromNode(mContent);
|
||||
|
||||
if (table)
|
||||
table->GetSummary(aSummary);
|
||||
|
|
|
@ -341,7 +341,7 @@ var AccessFu = {
|
|||
case "inprocess-browser-shown":
|
||||
{
|
||||
// Ignore notifications that aren't from a Browser
|
||||
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||
let frameLoader = aSubject;
|
||||
if (!frameLoader.ownerIsMozBrowserFrame) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ XULTabAccessible::DoAction(uint8_t index)
|
|||
{
|
||||
if (index == eAction_Switch) {
|
||||
// XXXbz Could this just FromContent?
|
||||
RefPtr<nsXULElement> tab = nsXULElement::FromContentOrNull(mContent);
|
||||
RefPtr<nsXULElement> tab = nsXULElement::FromNodeOrNull(mContent);
|
||||
if (tab) {
|
||||
tab->Click(mozilla::dom::CallerType::System);
|
||||
return true;
|
||||
|
|
|
@ -260,7 +260,12 @@ pref("browser.startup.homepage", "chrome://branding/locale/browsercon
|
|||
pref("browser.startup.firstrunSkipsHomepage", true);
|
||||
|
||||
// Show an about:blank window as early as possible for quick startup feedback.
|
||||
#ifdef XP_MACOSX
|
||||
// Disabled on Mac because the bouncing dock icon already provides feedback.
|
||||
pref("browser.startup.blankWindow", false);
|
||||
#else
|
||||
pref("browser.startup.blankWindow", true);
|
||||
#endif
|
||||
|
||||
pref("browser.slowStartup.notificationDisabled", false);
|
||||
pref("browser.slowStartup.timeThreshold", 20000);
|
||||
|
|
|
@ -122,6 +122,10 @@ const startupPhases = {
|
|||
}},
|
||||
};
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.startup.blankWindow")) {
|
||||
startupPhases["before profile selection"].whitelist.components.add("XULStore.js");
|
||||
}
|
||||
|
||||
if (!gBrowser.selectedBrowser.isRemoteBrowser) {
|
||||
// With e10s disabled, Places and RecentWindow.jsm (from a
|
||||
// SessionSaver.jsm timer) intermittently get loaded earlier. Likely
|
||||
|
|
|
@ -108,9 +108,6 @@ let propNameWhitelist = [
|
|||
// Bug 1441878
|
||||
{propName: "--theme-codemirror-gutter-background",
|
||||
isFromDevTools: true},
|
||||
// Bug 1442300
|
||||
{propName: "--in-content-category-background",
|
||||
isFromDevTools: false},
|
||||
// These custom properties are retrieved directly from CSSOM
|
||||
// in videocontrols.xml to get pre-defined style instead of computed
|
||||
// dimensions, which is why they are not referenced by CSS.
|
||||
|
|
|
@ -451,7 +451,7 @@ var SessionStoreInternal = {
|
|||
// they get restored).
|
||||
_crashedBrowsers: new WeakSet(),
|
||||
|
||||
// A map (xul:browser -> nsIFrameLoader) that maps a browser to the last
|
||||
// A map (xul:browser -> FrameLoader) that maps a browser to the last
|
||||
// associated frameLoader we heard about.
|
||||
_lastKnownFrameLoader: new WeakMap(),
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ support-files =
|
|||
[browser_autocomplete_marked_detached_tab.js]
|
||||
[browser_check_installed.js]
|
||||
[browser_creditCard_doorhanger.js]
|
||||
skip-if (os == "linux") || (os == "mac" && debug) || (os == "win") # bug 1425884
|
||||
skip-if = (os == "linux") || (os == "mac" && debug) || (os == "win") # bug 1425884
|
||||
[browser_creditCard_fill_master_password.js]
|
||||
[browser_dropdown_layout.js]
|
||||
[browser_editAddressDialog.js]
|
||||
|
|
|
@ -160,8 +160,6 @@ var TabCrashHandler = {
|
|||
break;
|
||||
}
|
||||
case "oop-frameloader-crashed": {
|
||||
aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||
|
||||
let browser = aSubject.ownerElement;
|
||||
if (!browser) {
|
||||
return;
|
||||
|
|
|
@ -262,7 +262,6 @@ var webrtcUI = {
|
|||
break;
|
||||
case "webrtc:UpdateBrowserIndicators":
|
||||
let id = aMessage.data.windowId;
|
||||
aMessage.targetFrameLoader.QueryInterface(Ci.nsIFrameLoader);
|
||||
let processMM =
|
||||
aMessage.targetFrameLoader.messageManager.processMessageManager;
|
||||
let index;
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
-moz-user-select: text;
|
||||
}
|
||||
|
||||
:root {
|
||||
--in-content-category-background: #fafafc;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
This is the debugger.html project output.
|
||||
See https://github.com/devtools-html/debugger.html
|
||||
|
||||
Version 24.0
|
||||
Version 25.0
|
||||
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-23...release-24
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-24...release-25
|
||||
|
||||
Packages:
|
||||
- babel-plugin-transform-es2015-modules-commonjs @6.26.0
|
||||
|
|
|
@ -1375,7 +1375,7 @@ html[dir="rtl"] .arrow svg,
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.outline .outline-pane-info {
|
||||
.outline-pane-info {
|
||||
width: 100%;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
|
|
|
@ -3167,7 +3167,7 @@ function createPendingBreakpoint(bp) {
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.replaceOriginalVariableName = exports.getFramework = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.getEmptyLines = exports.isInvalidPauseLocation = exports.getNextStep = exports.clearASTs = exports.clearScopes = exports.clearSymbols = exports.findOutOfScopeLocations = exports.getScopes = exports.getSymbols = exports.getClosestExpression = exports.stopParserWorker = exports.startParserWorker = undefined;
|
||||
exports.replaceOriginalVariableName = exports.getPausePoints = exports.getFramework = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.isInvalidPauseLocation = exports.getNextStep = exports.clearASTs = exports.clearScopes = exports.clearSymbols = exports.findOutOfScopeLocations = exports.getScopes = exports.getSymbols = exports.getClosestExpression = exports.stopParserWorker = exports.startParserWorker = undefined;
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
|
||||
|
@ -3188,12 +3188,12 @@ const clearScopes = exports.clearScopes = dispatcher.task("clearScopes");
|
|||
const clearASTs = exports.clearASTs = dispatcher.task("clearASTs");
|
||||
const getNextStep = exports.getNextStep = dispatcher.task("getNextStep");
|
||||
const isInvalidPauseLocation = exports.isInvalidPauseLocation = dispatcher.task("isInvalidPauseLocation");
|
||||
const getEmptyLines = exports.getEmptyLines = dispatcher.task("getEmptyLines");
|
||||
const hasSource = exports.hasSource = dispatcher.task("hasSource");
|
||||
const setSource = exports.setSource = dispatcher.task("setSource");
|
||||
const clearSources = exports.clearSources = dispatcher.task("clearSources");
|
||||
const hasSyntaxError = exports.hasSyntaxError = dispatcher.task("hasSyntaxError");
|
||||
const getFramework = exports.getFramework = dispatcher.task("getFramework");
|
||||
const getPausePoints = exports.getPausePoints = dispatcher.task("getPausePoints");
|
||||
const replaceOriginalVariableName = exports.replaceOriginalVariableName = dispatcher.task("replaceOriginalVariableName");
|
||||
|
||||
/***/ }),
|
||||
|
@ -4783,6 +4783,7 @@ exports.hasSymbols = hasSymbols;
|
|||
exports.isSymbolsLoading = isSymbolsLoading;
|
||||
exports.isEmptyLineInSource = isEmptyLineInSource;
|
||||
exports.getEmptyLines = getEmptyLines;
|
||||
exports.getPausePoints = getPausePoints;
|
||||
exports.getOutOfScopeLocations = getOutOfScopeLocations;
|
||||
exports.getPreview = getPreview;
|
||||
exports.getSourceMetaData = getSourceMetaData;
|
||||
|
@ -4797,6 +4798,8 @@ var _makeRecord = __webpack_require__(1361);
|
|||
|
||||
var _makeRecord2 = _interopRequireDefault(_makeRecord);
|
||||
|
||||
var _ast = __webpack_require__(1638);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
@ -4808,6 +4811,7 @@ function initialASTState() {
|
|||
outOfScopeLocations: null,
|
||||
inScopeLines: null,
|
||||
preview: null,
|
||||
pausePoints: I.Map(),
|
||||
sourceMetaData: I.Map()
|
||||
})();
|
||||
}
|
||||
|
@ -4822,10 +4826,13 @@ function update(state = initialASTState(), action) {
|
|||
}
|
||||
return state.setIn(["symbols", source.id], action.value);
|
||||
}
|
||||
case "SET_EMPTY_LINES":
|
||||
|
||||
case "SET_PAUSE_POINTS":
|
||||
{
|
||||
const { source, emptyLines } = action;
|
||||
return state.setIn(["emptyLines", source.id], emptyLines);
|
||||
const { source, pausePoints } = action;
|
||||
const emptyLines = (0, _ast.findEmptyLines)(source, pausePoints);
|
||||
|
||||
return state.setIn(["pausePoints", source.id], pausePoints).setIn(["emptyLines", source.id], emptyLines);
|
||||
}
|
||||
|
||||
case "OUT_OF_SCOPE_LOCATIONS":
|
||||
|
@ -4911,15 +4918,23 @@ function isSymbolsLoading(state, source) {
|
|||
|
||||
function isEmptyLineInSource(state, line, selectedSource) {
|
||||
const emptyLines = getEmptyLines(state, selectedSource);
|
||||
return emptyLines.includes(line);
|
||||
return emptyLines && emptyLines.includes(line);
|
||||
}
|
||||
|
||||
function getEmptyLines(state, source) {
|
||||
if (!source) {
|
||||
return [];
|
||||
return null;
|
||||
}
|
||||
|
||||
return state.ast.getIn(["emptyLines", source.id]) || [];
|
||||
return state.ast.getIn(["emptyLines", source.id]);
|
||||
}
|
||||
|
||||
function getPausePoints(state, source) {
|
||||
if (!source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return state.ast.getIn(["pausePoints", source.id]);
|
||||
}
|
||||
|
||||
function getOutOfScopeLocations(state) {
|
||||
|
@ -6328,8 +6343,8 @@ Object.defineProperty(exports, "__esModule", {
|
|||
});
|
||||
exports.setSourceMetaData = setSourceMetaData;
|
||||
exports.setSymbols = setSymbols;
|
||||
exports.setEmptyLines = setEmptyLines;
|
||||
exports.setOutOfScopeLocations = setOutOfScopeLocations;
|
||||
exports.setPausePoints = setPausePoints;
|
||||
|
||||
var _selectors = __webpack_require__(3590);
|
||||
|
||||
|
@ -6384,30 +6399,8 @@ function setSymbols(sourceId) {
|
|||
[_promise.PROMISE]: (0, _parser.getSymbols)(source.id)
|
||||
});
|
||||
|
||||
dispatch(setEmptyLines(sourceId));
|
||||
dispatch(setSourceMetaData(sourceId));
|
||||
};
|
||||
}
|
||||
|
||||
function setEmptyLines(sourceId) {
|
||||
return async ({ dispatch, getState }) => {
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), sourceId);
|
||||
if (!sourceRecord) {
|
||||
return;
|
||||
}
|
||||
|
||||
const source = sourceRecord.toJS();
|
||||
if (!source.text || source.isWasm) {
|
||||
return;
|
||||
}
|
||||
|
||||
const emptyLines = await (0, _parser.getEmptyLines)(source.id);
|
||||
|
||||
dispatch({
|
||||
type: "SET_EMPTY_LINES",
|
||||
source,
|
||||
emptyLines
|
||||
});
|
||||
await dispatch(setPausePoints(sourceId));
|
||||
await dispatch(setSourceMetaData(sourceId));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -6434,6 +6427,27 @@ function setOutOfScopeLocations() {
|
|||
};
|
||||
}
|
||||
|
||||
function setPausePoints(sourceId) {
|
||||
return async ({ dispatch, getState }) => {
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), sourceId);
|
||||
if (!sourceRecord) {
|
||||
return;
|
||||
}
|
||||
|
||||
const source = sourceRecord.toJS();
|
||||
if (!source.text || source.isWasm) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pausePoints = await (0, _parser.getPausePoints)(source.id);
|
||||
dispatch({
|
||||
type: "SET_PAUSE_POINTS",
|
||||
source,
|
||||
pausePoints
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 14:
|
||||
|
@ -12209,22 +12223,18 @@ var _prefs = __webpack_require__(226);
|
|||
|
||||
var _dbg = __webpack_require__(2246);
|
||||
|
||||
var _devtoolsConfig = __webpack_require__(1355);
|
||||
|
||||
var _bootstrap = __webpack_require__(1430);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
/* 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/>. */
|
||||
|
||||
function loadFromPrefs(actions) {
|
||||
const { pauseOnExceptions, ignoreCaughtExceptions } = _prefs.prefs;
|
||||
if (pauseOnExceptions || ignoreCaughtExceptions) {
|
||||
return actions.pauseOnExceptions(pauseOnExceptions, ignoreCaughtExceptions);
|
||||
}
|
||||
}
|
||||
} /* 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/>. */
|
||||
|
||||
function getClient(connection) {
|
||||
const { tab: { clientType } } = connection;
|
||||
|
@ -12248,14 +12258,12 @@ async function onConnect(connection, { services, toolboxActions }) {
|
|||
await client.onConnect(connection, actions);
|
||||
await loadFromPrefs(actions);
|
||||
|
||||
if (!(0, _devtoolsConfig.isFirefoxPanel)()) {
|
||||
(0, _dbg.setupHelper)({
|
||||
store,
|
||||
actions,
|
||||
selectors,
|
||||
client: client.clientCommands
|
||||
});
|
||||
}
|
||||
(0, _dbg.setupHelper)({
|
||||
store,
|
||||
actions,
|
||||
selectors,
|
||||
client: client.clientCommands
|
||||
});
|
||||
|
||||
(0, _bootstrap.bootstrapApp)(store);
|
||||
return { store, actions, selectors, client: commands };
|
||||
|
@ -13472,6 +13480,10 @@ var _actions2 = _interopRequireDefault(_actions);
|
|||
|
||||
var _ShortcutsModal = __webpack_require__(1535);
|
||||
|
||||
var _VisibilityHandler = __webpack_require__(3611);
|
||||
|
||||
var _VisibilityHandler2 = _interopRequireDefault(_VisibilityHandler);
|
||||
|
||||
var _selectors = __webpack_require__(3590);
|
||||
|
||||
var _devtoolsModules = __webpack_require__(1376);
|
||||
|
@ -13520,9 +13532,11 @@ var _QuickOpenModal2 = _interopRequireDefault(_QuickOpenModal);
|
|||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const shortcuts = new _devtoolsModules.KeyShortcuts({ window }); /* 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/>. */
|
||||
/* 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/>. */
|
||||
|
||||
const shortcuts = new _devtoolsModules.KeyShortcuts({ window });
|
||||
|
||||
const { appinfo } = _devtoolsModules.Services;
|
||||
|
||||
|
@ -13722,14 +13736,18 @@ class App extends _react.Component {
|
|||
render() {
|
||||
const { quickOpenEnabled } = this.props;
|
||||
return _react2.default.createElement(
|
||||
"div",
|
||||
{ className: "debugger" },
|
||||
this.renderLayout(),
|
||||
quickOpenEnabled === true && _react2.default.createElement(_QuickOpenModal2.default, {
|
||||
shortcutsModalEnabled: this.state.shortcutsModalEnabled,
|
||||
toggleShortcutsModal: () => this.toggleShortcutsModal()
|
||||
}),
|
||||
this.renderShortcutsModal()
|
||||
_VisibilityHandler2.default,
|
||||
null,
|
||||
_react2.default.createElement(
|
||||
"div",
|
||||
{ className: "debugger" },
|
||||
this.renderLayout(),
|
||||
quickOpenEnabled === true && _react2.default.createElement(_QuickOpenModal2.default, {
|
||||
shortcutsModalEnabled: this.state.shortcutsModalEnabled,
|
||||
toggleShortcutsModal: () => this.toggleShortcutsModal()
|
||||
}),
|
||||
this.renderShortcutsModal()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16793,7 +16811,10 @@ class Outline extends _react.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { symbols } = this.props;
|
||||
const { symbols, selectedSource } = this.props;
|
||||
if (!selectedSource) {
|
||||
return this.renderPlaceholder();
|
||||
}
|
||||
if (!symbols || symbols.loading) {
|
||||
return this.renderLoading();
|
||||
}
|
||||
|
@ -22509,7 +22530,7 @@ class GutterContextMenuComponent extends _react.Component {
|
|||
const line = (0, _editor.lineAtHeight)(props.editor, sourceId, event);
|
||||
const breakpoint = nextProps.breakpoints.find(bp => bp.location.line === line);
|
||||
|
||||
if (props.emptyLines.includes(line)) {
|
||||
if (props.emptyLines && props.emptyLines.includes(line)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22529,7 +22550,7 @@ exports.default = (0, _reactRedux.connect)(state => {
|
|||
breakpoints: (0, _selectors.getVisibleBreakpoints)(state),
|
||||
isPaused: (0, _selectors.isPaused)(state),
|
||||
contextMenu: (0, _selectors.getContextMenu)(state),
|
||||
emptyLines: selectedSource ? (0, _selectors.getEmptyLines)(state, selectedSource.toJS()) : []
|
||||
emptyLines: (0, _selectors.getEmptyLines)(state, selectedSource.toJS())
|
||||
};
|
||||
}, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(GutterContextMenuComponent);
|
||||
|
||||
|
@ -26901,9 +26922,9 @@ Object.defineProperty(exports, "__esModule", {
|
|||
value: true
|
||||
});
|
||||
exports.findBestMatchExpression = findBestMatchExpression;
|
||||
/* 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/>. */
|
||||
exports.findEmptyLines = findEmptyLines;
|
||||
|
||||
var _lodash = __webpack_require__(2);
|
||||
|
||||
function findBestMatchExpression(symbols, tokenPos) {
|
||||
const { memberExpressions, identifiers } = symbols;
|
||||
|
@ -26916,7 +26937,25 @@ function findBestMatchExpression(symbols, tokenPos) {
|
|||
}
|
||||
|
||||
return found;
|
||||
}, {});
|
||||
}, null);
|
||||
} /* 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/>. */
|
||||
|
||||
function findEmptyLines(selectedSource, pausePoints) {
|
||||
if (!pausePoints || !selectedSource) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const breakpoints = pausePoints.filter(point => point.types.breakpoint);
|
||||
const breakpointLines = breakpoints.map(point => point.location.line);
|
||||
|
||||
if (!selectedSource.text) {
|
||||
return [];
|
||||
}
|
||||
const lineCount = selectedSource.text.split("\n").length;
|
||||
const sourceLines = (0, _lodash.range)(1, lineCount);
|
||||
return (0, _lodash.without)(sourceLines, ...breakpointLines);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
@ -27902,6 +27941,18 @@ class QuickOpenModal extends _react.Component {
|
|||
});
|
||||
};
|
||||
|
||||
this.renderLoading = () => {
|
||||
const { symbolsLoading } = this.props;
|
||||
|
||||
if ((this.isFunctionQuery() || this.isVariableQuery()) && symbolsLoading) {
|
||||
return _react2.default.createElement(
|
||||
"div",
|
||||
{ className: "loading-indicator" },
|
||||
L10N.getStr("loadingText")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
this.state = { results: null, selectedIndex: 0 };
|
||||
}
|
||||
|
||||
|
@ -27943,7 +27994,7 @@ class QuickOpenModal extends _react.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { enabled, query, symbols } = this.props;
|
||||
const { enabled, query } = this.props;
|
||||
const { selectedIndex, results } = this.state;
|
||||
|
||||
if (!enabled) {
|
||||
|
@ -27967,11 +28018,7 @@ class QuickOpenModal extends _react.Component {
|
|||
expanded: expanded,
|
||||
selectedItemId: expanded && items[selectedIndex] ? items[selectedIndex].id : ""
|
||||
}),
|
||||
!symbols || symbols.functions.length == 0 && _react2.default.createElement(
|
||||
"div",
|
||||
{ className: "loading-indicator" },
|
||||
L10N.getStr("loadingText")
|
||||
),
|
||||
this.renderLoading(),
|
||||
newResults && _react2.default.createElement(_ResultList2.default, _extends({
|
||||
key: "results",
|
||||
items: items,
|
||||
|
@ -27988,16 +28035,13 @@ exports.QuickOpenModal = QuickOpenModal; /* istanbul ignore next: ignoring testi
|
|||
|
||||
function mapStateToProps(state) {
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(state);
|
||||
let symbols = null;
|
||||
if (selectedSource != null) {
|
||||
symbols = (0, _selectors.getSymbols)(state, selectedSource.toJS());
|
||||
}
|
||||
|
||||
return {
|
||||
enabled: (0, _selectors.getQuickOpenEnabled)(state),
|
||||
sources: (0, _quickOpen.formatSources)((0, _selectors.getSources)(state)),
|
||||
selectedSource,
|
||||
symbols: (0, _quickOpen.formatSymbols)(symbols),
|
||||
symbols: (0, _quickOpen.formatSymbols)((0, _selectors.getSymbols)(state, selectedSource)),
|
||||
symbolsLoading: (0, _selectors.isSymbolsLoading)(state, selectedSource),
|
||||
query: (0, _selectors.getQuickOpenQuery)(state),
|
||||
searchType: (0, _selectors.getQuickOpenType)(state),
|
||||
tabs: (0, _selectors.getTabs)(state).toArray()
|
||||
|
@ -28576,7 +28620,7 @@ exports.log = log;
|
|||
|
||||
var _devtoolsConfig = __webpack_require__(1355);
|
||||
|
||||
const blacklist = ["SET_POPUP_OBJECT_PROPERTIES", "SET_SYMBOLS", "OUT_OF_SCOPE_LOCATIONS", "MAP_SCOPES", "ADD_SCOPES", "IN_SCOPE_LINES", "SET_EMPTY_LINES"];
|
||||
const blacklist = ["SET_POPUP_OBJECT_PROPERTIES", "SET_PAUSE_POINTS", "SET_SYMBOLS", "OUT_OF_SCOPE_LOCATIONS", "MAP_SCOPES", "ADD_SCOPES", "IN_SCOPE_LINES", "SET_EMPTY_LINES"];
|
||||
|
||||
function cloneAction(action) {
|
||||
action = action || {};
|
||||
|
@ -31493,7 +31537,7 @@ function togglePrettyPrint(sourceId) {
|
|||
|
||||
await dispatch((0, _breakpoints.remapBreakpoints)(sourceId));
|
||||
await dispatch((0, _pause.mapFrames)());
|
||||
await dispatch((0, _ast.setEmptyLines)(newPrettySource.id));
|
||||
await dispatch((0, _ast.setPausePoints)(newPrettySource.id));
|
||||
await dispatch((0, _ast.setSymbols)(newPrettySource.id));
|
||||
|
||||
return dispatch((0, _sources.selectLocation)(_extends({}, options.location, { sourceId: newPrettySource.id })));
|
||||
|
@ -34212,6 +34256,8 @@ var timings = _interopRequireWildcard(_timings);
|
|||
|
||||
var _prefs = __webpack_require__(226);
|
||||
|
||||
var _devtoolsConfig = __webpack_require__(1355);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function findSource(dbg, url) {
|
||||
|
@ -34264,12 +34310,14 @@ function setupHelper(obj) {
|
|||
|
||||
window.dbg = dbg;
|
||||
|
||||
console.group("Development Notes");
|
||||
const baseUrl = "https://devtools-html.github.io/debugger.html";
|
||||
const localDevelopmentUrl = `${baseUrl}/docs/dbg.html`;
|
||||
console.log("Debugging Tips", localDevelopmentUrl);
|
||||
console.log("dbg", window.dbg);
|
||||
console.groupEnd();
|
||||
if ((0, _devtoolsConfig.isDevelopment)()) {
|
||||
console.group("Development Notes");
|
||||
const baseUrl = "https://devtools-html.github.io/debugger.html";
|
||||
const localDevelopmentUrl = `${baseUrl}/docs/dbg.html`;
|
||||
console.log("Debugging Tips", localDevelopmentUrl);
|
||||
console.log("dbg", window.dbg);
|
||||
console.groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
@ -37861,6 +37909,75 @@ function formatCopyName(frame) {
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3611:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var _propTypes = __webpack_require__(20);
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _react = __webpack_require__(0);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Helper class to disable panel rendering when it is in background.
|
||||
*
|
||||
* Toolbox code hides the iframes when switching to another panel
|
||||
* and triggers `visibilitychange` events.
|
||||
*
|
||||
* See devtools/client/framework/toolbox.js:setIframeVisible().
|
||||
*/
|
||||
|
||||
class VisibilityHandler extends _react.Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
children: _propTypes2.default.element.isRequired
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.isVisible = true;
|
||||
this.onVisibilityChange = this.onVisibilityChange.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener("visibilitychange", this.onVisibilityChange);
|
||||
}
|
||||
|
||||
shouldComponentUpdate() {
|
||||
return document.visibilityState == "visible";
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener("visibilitychange", this.onVisibilityChange);
|
||||
}
|
||||
|
||||
onVisibilityChange() {
|
||||
this.isVisible = false;
|
||||
if (document.visibilityState == "visible") {
|
||||
this.isVisible = true;
|
||||
}
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.isVisible ? this.props.children : null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = VisibilityHandler;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 362:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
|
|
|
@ -560,120 +560,6 @@ function toKey(value) {
|
|||
module.exports = toKey;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1129:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var baseDifference = __webpack_require__(1131),
|
||||
baseFlatten = __webpack_require__(707),
|
||||
baseRest = __webpack_require__(411),
|
||||
isArrayLikeObject = __webpack_require__(1155);
|
||||
|
||||
/**
|
||||
* Creates an array of `array` values not included in the other given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. The order and references of result values are
|
||||
* determined by the first array.
|
||||
*
|
||||
* **Note:** Unlike `_.pullAll`, this method returns a new array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {...Array} [values] The values to exclude.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @see _.without, _.xor
|
||||
* @example
|
||||
*
|
||||
* _.difference([2, 1], [2, 3]);
|
||||
* // => [1]
|
||||
*/
|
||||
var difference = baseRest(function(array, values) {
|
||||
return isArrayLikeObject(array)
|
||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
||||
: [];
|
||||
});
|
||||
|
||||
module.exports = difference;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1131:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var SetCache = __webpack_require__(276),
|
||||
arrayIncludes = __webpack_require__(563),
|
||||
arrayIncludesWith = __webpack_require__(567),
|
||||
arrayMap = __webpack_require__(110),
|
||||
baseUnary = __webpack_require__(215),
|
||||
cacheHas = __webpack_require__(280);
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
|
||||
/**
|
||||
* The base implementation of methods like `_.difference` without support
|
||||
* for excluding multiple arrays or iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Array} values The values to exclude.
|
||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
||||
* @param {Function} [comparator] The comparator invoked per element.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
*/
|
||||
function baseDifference(array, values, iteratee, comparator) {
|
||||
var index = -1,
|
||||
includes = arrayIncludes,
|
||||
isCommon = true,
|
||||
length = array.length,
|
||||
result = [],
|
||||
valuesLength = values.length;
|
||||
|
||||
if (!length) {
|
||||
return result;
|
||||
}
|
||||
if (iteratee) {
|
||||
values = arrayMap(values, baseUnary(iteratee));
|
||||
}
|
||||
if (comparator) {
|
||||
includes = arrayIncludesWith;
|
||||
isCommon = false;
|
||||
}
|
||||
else if (values.length >= LARGE_ARRAY_SIZE) {
|
||||
includes = cacheHas;
|
||||
isCommon = false;
|
||||
values = new SetCache(values);
|
||||
}
|
||||
outer:
|
||||
while (++index < length) {
|
||||
var value = array[index],
|
||||
computed = iteratee == null ? value : iteratee(value);
|
||||
|
||||
value = (comparator || value !== 0) ? value : 0;
|
||||
if (isCommon && computed === computed) {
|
||||
var valuesIndex = valuesLength;
|
||||
while (valuesIndex--) {
|
||||
if (values[valuesIndex] === computed) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
else if (!includes(values, computed, comparator)) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseDifference;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 114:
|
||||
|
@ -741,46 +627,6 @@ function baseAssignValue(object, key, value) {
|
|||
module.exports = baseAssignValue;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1155:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var isArrayLike = __webpack_require__(220),
|
||||
isObjectLike = __webpack_require__(14);
|
||||
|
||||
/**
|
||||
* This method is like `_.isArrayLike` except that it also checks if `value`
|
||||
* is an object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArrayLikeObject([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLikeObject(document.body.children);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLikeObject('abc');
|
||||
* // => false
|
||||
*
|
||||
* _.isArrayLikeObject(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
function isArrayLikeObject(value) {
|
||||
return isObjectLike(value) && isArrayLike(value);
|
||||
}
|
||||
|
||||
module.exports = isArrayLikeObject;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 116:
|
||||
|
@ -1217,7 +1063,6 @@ function traverseAst(sourceId, visitor, state) {
|
|||
}
|
||||
|
||||
t.traverse(ast, visitor, state);
|
||||
// t.fastTraverse(ast, visitor);
|
||||
return ast;
|
||||
}
|
||||
|
||||
|
@ -2081,16 +1926,14 @@ var _findOutOfScopeLocations2 = _interopRequireDefault(_findOutOfScopeLocations)
|
|||
|
||||
var _steps = __webpack_require__(1625);
|
||||
|
||||
var _getEmptyLines = __webpack_require__(1628);
|
||||
|
||||
var _getEmptyLines2 = _interopRequireDefault(_getEmptyLines);
|
||||
|
||||
var _validate = __webpack_require__(1629);
|
||||
|
||||
var _frameworks = __webpack_require__(1703);
|
||||
|
||||
var _pauseLocation = __webpack_require__(2422);
|
||||
|
||||
var _pausePoints = __webpack_require__(3612);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
@ -2114,9 +1957,9 @@ self.onmessage = workerHandler({
|
|||
clearSources: _sources.clearSources,
|
||||
isInvalidPauseLocation: _pauseLocation.isInvalidPauseLocation,
|
||||
getNextStep: _steps.getNextStep,
|
||||
getEmptyLines: _getEmptyLines2.default,
|
||||
hasSyntaxError: _validate.hasSyntaxError,
|
||||
getFramework: _frameworks.getFramework
|
||||
getFramework: _frameworks.getFramework,
|
||||
getPausePoints: _pausePoints.getPausePoints
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
@ -2526,68 +2369,6 @@ function _getNextStep(statement, position) {
|
|||
"use strict";
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1628:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getEmptyLines;
|
||||
|
||||
var _uniq = __webpack_require__(561);
|
||||
|
||||
var _uniq2 = _interopRequireDefault(_uniq);
|
||||
|
||||
var _difference = __webpack_require__(1129);
|
||||
|
||||
var _difference2 = _interopRequireDefault(_difference);
|
||||
|
||||
var _ast = __webpack_require__(1375);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const commentTokens = ["CommentBlock", "CommentLine"]; /* 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/>. */
|
||||
|
||||
function fillRange(start, end) {
|
||||
return Array(end - start + 1).fill().map((item, index) => start + index);
|
||||
}
|
||||
|
||||
// Populates a pre-filled array of every line number,
|
||||
// then removes lines which were found to be executable
|
||||
function getLines(ast) {
|
||||
return fillRange(1, ast.tokens[ast.tokens.length - 1].loc.end.line);
|
||||
}
|
||||
|
||||
// The following sequence stores lines which have executable code
|
||||
// (contents other than comments or EOF, regardless of line position)
|
||||
function getExecutableLines(ast) {
|
||||
const lines = ast.tokens.filter(token => !commentTokens.includes(token.type) && (!token.type || token.type.label && token.type.label != "eof")).map(token => token.loc.start.line);
|
||||
|
||||
return (0, _uniq2.default)(lines);
|
||||
}
|
||||
|
||||
function getEmptyLines(sourceId) {
|
||||
if (!sourceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ast = (0, _ast.getAst)(sourceId);
|
||||
if (!ast || !ast.comments) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const executableLines = getExecutableLines(ast);
|
||||
const lines = getLines(ast);
|
||||
return (0, _difference2.default)(lines, executableLines);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1629:
|
||||
|
@ -14552,11 +14333,20 @@ function parseSourceScopes(sourceId) {
|
|||
|
||||
const state = {
|
||||
sourceId,
|
||||
freeVariables: new Map(),
|
||||
freeVariableStack: [],
|
||||
scope: lexical,
|
||||
scopeStack: []
|
||||
};
|
||||
t.traverse(ast, scopeCollectionVisitor, state);
|
||||
|
||||
for (const [key, freeVariables] of state.freeVariables) {
|
||||
const binding = global.bindings[key];
|
||||
if (binding) {
|
||||
binding.refs = freeVariables.concat(binding.refs);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This should probably check for ".mjs" extension on the
|
||||
// original file, and should also be skipped if the the generated
|
||||
// code is an ES6 module rather than a script.
|
||||
|
@ -14605,6 +14395,9 @@ function pushTempScope(state, type, displayName, loc) {
|
|||
const scope = createTempScope(type, displayName, state.scope, loc);
|
||||
|
||||
state.scope = scope;
|
||||
|
||||
state.freeVariableStack.push(state.freeVariables);
|
||||
state.freeVariables = new Map();
|
||||
return scope;
|
||||
}
|
||||
|
||||
|
@ -14678,16 +14471,6 @@ function isLexicalVariable(node) {
|
|||
return isNode(node, "VariableDeclaration") && isLetOrConst(node);
|
||||
}
|
||||
|
||||
function findIdentifierInScopes(scope, name) {
|
||||
// Find nearest outer scope with the specifed name and add reference.
|
||||
for (let s = scope; s; s = s.parent) {
|
||||
if (name in s.bindings) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function createGlobalScope(ast, sourceId) {
|
||||
const global = createTempScope("object", "Global", null, {
|
||||
start: fromBabelLocation(ast.loc.start, sourceId),
|
||||
|
@ -14869,7 +14652,7 @@ const scopeCollectionVisitor = {
|
|||
node.declarations.forEach(declarator => {
|
||||
parseDeclarator(declarator.id, hoistAt, node.kind, node, state.sourceId);
|
||||
});
|
||||
} else if (t.isImportDeclaration(node)) {
|
||||
} else if (t.isImportDeclaration(node) && (!node.importKind || node.importKind === "value")) {
|
||||
node.specifiers.forEach(spec => {
|
||||
if (t.isImportNamespaceSpecifier(spec)) {
|
||||
state.scope.bindings[spec.local.name] = {
|
||||
|
@ -14899,25 +14682,31 @@ const scopeCollectionVisitor = {
|
|||
}
|
||||
});
|
||||
} else if (t.isIdentifier(node) && t.isReferenced(node, parentNode)) {
|
||||
const identScope = findIdentifierInScopes(state.scope, node.name);
|
||||
if (identScope) {
|
||||
identScope.bindings[node.name].refs.push({
|
||||
type: "ref",
|
||||
start: fromBabelLocation(node.loc.start, state.sourceId),
|
||||
end: fromBabelLocation(node.loc.end, state.sourceId),
|
||||
meta: buildMetaBindings(state.sourceId, node, ancestors)
|
||||
});
|
||||
let freeVariables = state.freeVariables.get(node.name);
|
||||
if (!freeVariables) {
|
||||
freeVariables = [];
|
||||
state.freeVariables.set(node.name, freeVariables);
|
||||
}
|
||||
|
||||
freeVariables.push({
|
||||
type: "ref",
|
||||
start: fromBabelLocation(node.loc.start, state.sourceId),
|
||||
end: fromBabelLocation(node.loc.end, state.sourceId),
|
||||
meta: buildMetaBindings(state.sourceId, node, ancestors)
|
||||
});
|
||||
} else if (t.isThisExpression(node)) {
|
||||
const identScope = findIdentifierInScopes(state.scope, "this");
|
||||
if (identScope) {
|
||||
identScope.bindings.this.refs.push({
|
||||
type: "ref",
|
||||
start: fromBabelLocation(node.loc.start, state.sourceId),
|
||||
end: fromBabelLocation(node.loc.end, state.sourceId),
|
||||
meta: buildMetaBindings(state.sourceId, node, ancestors)
|
||||
});
|
||||
let freeVariables = state.freeVariables.get("this");
|
||||
if (!freeVariables) {
|
||||
freeVariables = [];
|
||||
state.freeVariables.set("this", freeVariables);
|
||||
}
|
||||
|
||||
freeVariables.push({
|
||||
type: "ref",
|
||||
start: fromBabelLocation(node.loc.start, state.sourceId),
|
||||
end: fromBabelLocation(node.loc.end, state.sourceId),
|
||||
meta: buildMetaBindings(state.sourceId, node, ancestors)
|
||||
});
|
||||
} else if (t.isClassProperty(parentNode, { value: node })) {
|
||||
const scope = pushTempScope(state, "function", "Class Field", {
|
||||
start: fromBabelLocation(node.loc.start, state.sourceId),
|
||||
|
@ -14939,12 +14728,45 @@ const scopeCollectionVisitor = {
|
|||
}
|
||||
},
|
||||
exit(node, ancestors, state) {
|
||||
const scope = state.scopeStack.pop();
|
||||
if (!scope) {
|
||||
const currentScope = state.scope;
|
||||
const parentScope = state.scopeStack.pop();
|
||||
if (!parentScope) {
|
||||
throw new Error("Assertion failure - unsynchronized pop");
|
||||
}
|
||||
state.scope = parentScope;
|
||||
|
||||
state.scope = scope;
|
||||
// It is possible, as in the case of function expressions, that a single
|
||||
// node has added multiple scopes, so we need to traverse upward here
|
||||
// rather than jumping stright to 'parentScope'.
|
||||
for (let scope = currentScope; scope && scope !== parentScope; scope = scope.parent) {
|
||||
const freeVariables = state.freeVariables;
|
||||
state.freeVariables = state.freeVariableStack.pop();
|
||||
const parentFreeVariables = state.freeVariables;
|
||||
|
||||
// Match up any free variables that match this scope's bindings and
|
||||
// merge then into the refs.
|
||||
for (const key of Object.keys(scope.bindings)) {
|
||||
const binding = scope.bindings[key];
|
||||
|
||||
const freeVars = freeVariables.get(key);
|
||||
if (freeVars) {
|
||||
binding.refs.push(...freeVars);
|
||||
freeVariables.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
// Move any undeclared references in this scope into the parent for
|
||||
// processing in higher scopes.
|
||||
for (const [key, value] of freeVariables) {
|
||||
let refs = parentFreeVariables.get(key);
|
||||
if (!refs) {
|
||||
refs = [];
|
||||
parentFreeVariables.set(key, refs);
|
||||
}
|
||||
|
||||
refs.push(...value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -16448,6 +16270,72 @@ class SimplePath {
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3612:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPausePoints = getPausePoints;
|
||||
|
||||
var _ast = __webpack_require__(1375);
|
||||
|
||||
var _types = __webpack_require__(2268);
|
||||
|
||||
var t = _interopRequireWildcard(_types);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
const isControlFlow = node => t.isForStatement(node) || t.isWhileStatement(node) || t.isIfStatement(node);
|
||||
|
||||
const isAssignment = node => t.isVariableDeclaration(node) || t.isAssignmentExpression(node);
|
||||
|
||||
const isImport = node => t.isImport(node) || t.isImportDeclaration(node);
|
||||
const isReturn = node => t.isReturnStatement(node);
|
||||
const inExpression = parent => t.isArrayExpression(parent.node) || t.isObjectProperty(parent.node) || t.isCallExpression(parent.node);
|
||||
|
||||
function getPausePoints(sourceId) {
|
||||
const state = [];
|
||||
(0, _ast.traverseAst)(sourceId, { enter: onEnter }, state);
|
||||
return state;
|
||||
}
|
||||
|
||||
function formatNode(location, types) {
|
||||
return { location, types };
|
||||
}
|
||||
|
||||
function onEnter(node, ancestors, state) {
|
||||
const parent = ancestors[ancestors.length - 1];
|
||||
|
||||
if (isAssignment(node) || isImport(node) || isControlFlow(node) || isReturn(node)) {
|
||||
state.push(formatNode(node.loc.start, { breakpoint: true, stepOver: true }));
|
||||
}
|
||||
|
||||
if (t.isCallExpression(node)) {
|
||||
state.push(formatNode(node.loc.start, {
|
||||
breakpoint: true,
|
||||
|
||||
// NOTE: we do not want to land inside an expression e.g. [], {}, call
|
||||
stepOver: !inExpression(parent)
|
||||
}));
|
||||
}
|
||||
|
||||
if (t.isDebuggerStatement(node)) {
|
||||
state.push(formatNode(node.loc.start, { breakpoint: true, stepOver: true }));
|
||||
}
|
||||
|
||||
if (t.isFunction(node)) {
|
||||
const { line, column } = node.loc.end;
|
||||
state.push(formatNode(node.loc.start, { breakpoint: true }));
|
||||
state.push(formatNode({ line, column: column - 1 }, { breakpoint: true, stepOver: true }));
|
||||
}
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 398:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
|
@ -16777,228 +16665,6 @@ function nativeKeysIn(object) {
|
|||
module.exports = nativeKeysIn;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 411:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var identity = __webpack_require__(298),
|
||||
overRest = __webpack_require__(412),
|
||||
setToString = __webpack_require__(414);
|
||||
|
||||
/**
|
||||
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to apply a rest parameter to.
|
||||
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function baseRest(func, start) {
|
||||
return setToString(overRest(func, start, identity), func + '');
|
||||
}
|
||||
|
||||
module.exports = baseRest;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 412:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var apply = __webpack_require__(413);
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseRest` which transforms the rest array.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to apply a rest parameter to.
|
||||
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
||||
* @param {Function} transform The rest array transform.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function overRest(func, start, transform) {
|
||||
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
||||
return function() {
|
||||
var args = arguments,
|
||||
index = -1,
|
||||
length = nativeMax(args.length - start, 0),
|
||||
array = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
array[index] = args[start + index];
|
||||
}
|
||||
index = -1;
|
||||
var otherArgs = Array(start + 1);
|
||||
while (++index < start) {
|
||||
otherArgs[index] = args[index];
|
||||
}
|
||||
otherArgs[start] = transform(array);
|
||||
return apply(func, this, otherArgs);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = overRest;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 413:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/**
|
||||
* A faster alternative to `Function#apply`, this function invokes `func`
|
||||
* with the `this` binding of `thisArg` and the arguments of `args`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to invoke.
|
||||
* @param {*} thisArg The `this` binding of `func`.
|
||||
* @param {Array} args The arguments to invoke `func` with.
|
||||
* @returns {*} Returns the result of `func`.
|
||||
*/
|
||||
function apply(func, thisArg, args) {
|
||||
switch (args.length) {
|
||||
case 0: return func.call(thisArg);
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||||
}
|
||||
return func.apply(thisArg, args);
|
||||
}
|
||||
|
||||
module.exports = apply;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 414:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var baseSetToString = __webpack_require__(415),
|
||||
shortOut = __webpack_require__(417);
|
||||
|
||||
/**
|
||||
* Sets the `toString` method of `func` to return `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to modify.
|
||||
* @param {Function} string The `toString` result.
|
||||
* @returns {Function} Returns `func`.
|
||||
*/
|
||||
var setToString = shortOut(baseSetToString);
|
||||
|
||||
module.exports = setToString;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 415:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var constant = __webpack_require__(416),
|
||||
defineProperty = __webpack_require__(116),
|
||||
identity = __webpack_require__(298);
|
||||
|
||||
/**
|
||||
* The base implementation of `setToString` without support for hot loop shorting.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to modify.
|
||||
* @param {Function} string The `toString` result.
|
||||
* @returns {Function} Returns `func`.
|
||||
*/
|
||||
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
||||
return defineProperty(func, 'toString', {
|
||||
'configurable': true,
|
||||
'enumerable': false,
|
||||
'value': constant(string),
|
||||
'writable': true
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = baseSetToString;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 416:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/**
|
||||
* Creates a function that returns `value`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.4.0
|
||||
* @category Util
|
||||
* @param {*} value The value to return from the new function.
|
||||
* @returns {Function} Returns the new constant function.
|
||||
* @example
|
||||
*
|
||||
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
||||
*
|
||||
* console.log(objects);
|
||||
* // => [{ 'a': 1 }, { 'a': 1 }]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => true
|
||||
*/
|
||||
function constant(value) {
|
||||
return function() {
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = constant;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 417:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
||||
var HOT_COUNT = 800,
|
||||
HOT_SPAN = 16;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeNow = Date.now;
|
||||
|
||||
/**
|
||||
* Creates a function that'll short out and invoke `identity` instead
|
||||
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
||||
* milliseconds.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to restrict.
|
||||
* @returns {Function} Returns the new shortable function.
|
||||
*/
|
||||
function shortOut(func) {
|
||||
var count = 0,
|
||||
lastCalled = 0;
|
||||
|
||||
return function() {
|
||||
var stamp = nativeNow(),
|
||||
remaining = HOT_SPAN - (stamp - lastCalled);
|
||||
|
||||
lastCalled = stamp;
|
||||
if (remaining > 0) {
|
||||
if (++count >= HOT_COUNT) {
|
||||
return arguments[0];
|
||||
}
|
||||
} else {
|
||||
count = 0;
|
||||
}
|
||||
return func.apply(undefined, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = shortOut;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 435:
|
||||
|
|
|
@ -27,6 +27,10 @@ support-files =
|
|||
examples/babel/fixtures/modules/output.js.map
|
||||
examples/babel/fixtures/non-modules/output.js
|
||||
examples/babel/fixtures/non-modules/output.js.map
|
||||
examples/babel/fixtures/out-of-order-declarations/output.js
|
||||
examples/babel/fixtures/out-of-order-declarations/output.js.map
|
||||
examples/babel/fixtures/flowtype-bindings/output.js
|
||||
examples/babel/fixtures/flowtype-bindings/output.js.map
|
||||
examples/babel/fixtures/step-over-for-of/output.js
|
||||
examples/babel/fixtures/step-over-for-of/output.js.map
|
||||
examples/babel/fixtures/step-over-for-of-closure/output.js
|
||||
|
|
|
@ -251,8 +251,31 @@ add_task(async function() {
|
|||
"thirdModuleScoped()"
|
||||
]);
|
||||
|
||||
await breakpointScopes(dbg, "out-of-order-declarations", { line: 8, column: 4 }, [
|
||||
"callback",
|
||||
"fn()",
|
||||
["val", "undefined"],
|
||||
"root",
|
||||
["callback", "(optimized away)"],
|
||||
["fn", "(optimized away)"],
|
||||
["val", "(optimized away)"],
|
||||
"Module",
|
||||
|
||||
// This value is currently unmapped because import declarations don't map
|
||||
// very well and ones at the end of the file map especially badly.
|
||||
["aDefault", "(unmapped)"],
|
||||
["root", "(optimized away)"],
|
||||
["val", "(optimized away)"],
|
||||
]);
|
||||
|
||||
await breakpointScopes(dbg, "non-modules", { line: 7, column: 2 }, []);
|
||||
|
||||
await breakpointScopes(dbg, "flowtype-bindings", { line: 8, column: 2 }, [
|
||||
"Module",
|
||||
["aConst", '"a-const"'],
|
||||
"root()"
|
||||
]);
|
||||
|
||||
await breakpointScopes(dbg, "switches", { line: 7, column: 6 }, [
|
||||
"Switch",
|
||||
["val", "2"],
|
||||
|
|
|
@ -49,6 +49,7 @@ async function setConditionalBreakpoint(dbg, index, condition) {
|
|||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-scripts.html");
|
||||
await selectSource(dbg, "simple2");
|
||||
await waitForSelectedSource(dbg, "simple2");
|
||||
|
||||
await setConditionalBreakpoint(dbg, 5, "1");
|
||||
await waitForDispatch(dbg, "ADD_BREAKPOINT");
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import type { One, Two, Three } from "./src/mod";
|
||||
|
||||
type Other = {};
|
||||
|
||||
const aConst = "a-const";
|
||||
|
||||
export default function root() {
|
||||
console.log("pause here", aConst, root);
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
var flowtypeBindings =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = root;
|
||||
|
||||
|
||||
var aConst = "a-const";
|
||||
|
||||
function root() {
|
||||
console.log("pause here", aConst, root);
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
//# sourceMappingURL=output.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["webpack:///webpack/bootstrap 1fc1e80408151897b204","webpack:///./fixtures/flowtype-bindings/input.js"],"names":["root","aConst","console","log"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;kBCvDwBA,I;;;AAFxB,IAAMC,SAAS,SAAf;;AAEe,SAASD,IAAT,GAAgB;AAC7BE,UAAQC,GAAR,CAAY,YAAZ,EAA0BF,MAA1B,EAAkCD,IAAlC;AACD","file":"fixtures/flowtype-bindings/output.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1fc1e80408151897b204","import type { One, Two, Three } from \"./src/mod\";\n\ntype Other = {};\n\nconst aConst = \"a-const\";\n\nexport default function root() {\n console.log(\"pause here\", aConst, root);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./fixtures/flowtype-bindings/input.js"],"sourceRoot":""}
|
|
@ -0,0 +1 @@
|
|||
export default "a-default";
|
|
@ -0,0 +1,17 @@
|
|||
var val = "outer-value";
|
||||
|
||||
export default function root() {
|
||||
var val = "middle-value";
|
||||
var fn = function outerFn(outer){};
|
||||
|
||||
function callback() {
|
||||
console.log("pause here", val, aDefault, fn);
|
||||
|
||||
var val = "inner-value";
|
||||
function fn(inner){};
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
import aDefault from "./src/mod";
|
|
@ -0,0 +1,118 @@
|
|||
var outOfOrderDeclarations =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = root;
|
||||
|
||||
var _mod = __webpack_require__(1);
|
||||
|
||||
var _mod2 = _interopRequireDefault(_mod);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var val = "outer-value";
|
||||
|
||||
function root() {
|
||||
var val = "middle-value";
|
||||
var fn = function outerFn(outer) {};
|
||||
|
||||
function callback() {
|
||||
console.log("pause here", val, _mod2.default, fn);
|
||||
|
||||
var val = "inner-value";
|
||||
function fn(inner) {};
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
module.exports = exports["default"];
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = "a-default";
|
||||
module.exports = exports["default"];
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
//# sourceMappingURL=output.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["webpack:///webpack/bootstrap 4f5a475903003c64fcaa","webpack:///./fixtures/out-of-order-declarations/input.js","webpack:///./fixtures/out-of-order-declarations/src/mod.js"],"names":["root","val","fn","outerFn","outer","callback","console","log","inner"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;kBC3DwBA,I;;AAcxB;;;;;;AAhBA,IAAIC,MAAM,aAAV;;AAEe,SAASD,IAAT,GAAgB;AAC7B,MAAIC,MAAM,cAAV;AACA,MAAIC,KAAK,SAASC,OAAT,CAAiBC,KAAjB,EAAuB,CAAE,CAAlC;;AAEA,WAASC,QAAT,GAAoB;AAClBC,YAAQC,GAAR,CAAY,YAAZ,EAA0BN,GAA1B,iBAAyCC,EAAzC;;AAEA,QAAID,MAAM,aAAV;AACA,aAASC,EAAT,CAAYM,KAAZ,EAAkB,CAAE;AACrB;;AAEDH;AACD;;;;;;;;;;;;;;kBCdc,W","file":"fixtures/out-of-order-declarations/output.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4f5a475903003c64fcaa","var val = \"outer-value\";\n\nexport default function root() {\n var val = \"middle-value\";\n var fn = function outerFn(outer){};\n\n function callback() {\n console.log(\"pause here\", val, aDefault, fn);\n\n var val = \"inner-value\";\n function fn(inner){};\n }\n\n callback();\n}\n\nimport aDefault from \"./src/mod\";\n\n\n\n// WEBPACK FOOTER //\n// ./fixtures/out-of-order-declarations/input.js","export default \"a-default\";\n\n\n\n// WEBPACK FOOTER //\n// ./fixtures/out-of-order-declarations/src/mod.js"],"sourceRoot":""}
|
|
@ -0,0 +1 @@
|
|||
export default "a-default";
|
|
@ -13,6 +13,7 @@
|
|||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-transform-flow-strip-types": "^6.22.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"webpack": "^3.7.1"
|
||||
},
|
||||
|
|
|
@ -76,7 +76,9 @@ module.exports = [
|
|||
? [["env", { modules: babelModules ? "commonjs" : false }]]
|
||||
: [],
|
||||
plugins:
|
||||
babelEnv && babelModules ? ["add-module-exports"] : []
|
||||
(babelEnv && babelModules ? ["add-module-exports"] : []).concat([
|
||||
"babel-plugin-transform-flow-strip-types",
|
||||
])
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
<button onclick="classes()">Run classes</button>
|
||||
<script src="babel/fixtures/commonjs/output.js"></script>
|
||||
<button onclick="commonjs()">Run commonjs</button>
|
||||
<script src="babel/fixtures/flowtype-bindings/output.js"></script>
|
||||
<button onclick="flowtypeBindings()">Run flowtypeBindings</button>
|
||||
<script src="babel/fixtures/for-loops/output.js"></script>
|
||||
<button onclick="forLoops()">Run forLoops</button>
|
||||
<script src="babel/fixtures/for-of/output.js"></script>
|
||||
|
@ -29,6 +31,8 @@
|
|||
<button onclick="modules()">Run modules</button>
|
||||
<script src="babel/fixtures/non-modules/output.js"></script>
|
||||
<button onclick="nonModules()">Run nonModules</button>
|
||||
<script src="babel/fixtures/out-of-order-declarations/output.js"></script>
|
||||
<button onclick="outOfOrderDeclarations()">Run outOfOrderDeclarations</button>
|
||||
<script src="babel/fixtures/shadowed-vars/output.js"></script>
|
||||
<button onclick="shadowedVars()">Run shadowedVars</button>
|
||||
<script src="babel/fixtures/step-over-for-of/output.js"></script>
|
||||
|
|
|
@ -13735,7 +13735,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
|
||||
// If this is an anchor element, grab its type property to use as a hint
|
||||
nsAutoString typeHint;
|
||||
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContent(aContent);
|
||||
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNode(aContent);
|
||||
if (anchor) {
|
||||
anchor->GetType(typeHint);
|
||||
NS_ConvertUTF16toUTF8 utf8Hint(typeHint);
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
SetFlags(NS_MAYBE_MODIFIED_FREQUENTLY);
|
||||
}
|
||||
|
||||
NS_IMPL_FROMCONTENT_HELPER(CharacterData, IsCharacterData())
|
||||
NS_IMPL_FROMNODE_HELPER(CharacterData, IsCharacterData())
|
||||
|
||||
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
|
||||
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
||||
|
|
|
@ -26,7 +26,7 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent,
|
|||
mIndexInInserted(0)
|
||||
{
|
||||
mParentAsSlot = nsDocument::IsShadowDOMEnabled(mParent) ?
|
||||
HTMLSlotElement::FromContent(mParent) : nullptr;
|
||||
HTMLSlotElement::FromNode(mParent) : nullptr;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "mozilla/dom/DOMImplementationBinding.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "nsTextNode.h"
|
||||
|
|
|
@ -1537,7 +1537,7 @@ Element::GetElementsByMatching(nsElementMatchFunc aFunc,
|
|||
static uint32_t
|
||||
EditableInclusiveDescendantCount(nsIContent* aContent)
|
||||
{
|
||||
auto htmlElem = nsGenericHTMLElement::FromContent(aContent);
|
||||
auto htmlElem = nsGenericHTMLElement::FromNode(aContent);
|
||||
if (htmlElem) {
|
||||
return htmlElem->EditableInclusiveDescendantCount();
|
||||
}
|
||||
|
@ -1577,7 +1577,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
|
||||
#ifdef MOZ_XUL
|
||||
// First set the binding parent
|
||||
nsXULElement* xulElem = nsXULElement::FromContent(this);
|
||||
nsXULElement* xulElem = nsXULElement::FromNode(this);
|
||||
if (xulElem) {
|
||||
xulElem->SetXULBindingParent(aBindingParent);
|
||||
}
|
||||
|
@ -1979,7 +1979,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
bool clearBindingParent = true;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (nsXULElement* xulElem = nsXULElement::FromContent(this)) {;
|
||||
if (nsXULElement* xulElem = nsXULElement::FromNode(this)) {;
|
||||
xulElem->SetXULBindingParent(nullptr);
|
||||
clearBindingParent = false;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "nsNodeUtils.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "nsQueryObject.h"
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULElement.h"
|
||||
#endif /* MOZ_XUL */
|
||||
|
@ -73,6 +74,7 @@
|
|||
#endif
|
||||
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
|
@ -746,9 +748,9 @@ FragmentOrElement::nsExtendedDOMSlots::nsExtendedDOMSlots() = default;
|
|||
|
||||
FragmentOrElement::nsExtendedDOMSlots::~nsExtendedDOMSlots()
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoader> frameLoader = do_QueryInterface(mFrameLoaderOrOpener);
|
||||
RefPtr<nsFrameLoader> frameLoader = do_QueryObject(mFrameLoaderOrOpener);
|
||||
if (frameLoader) {
|
||||
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
|
||||
frameLoader->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,10 +769,9 @@ FragmentOrElement::nsExtendedDOMSlots::Unlink()
|
|||
mCustomElementData->Unlink();
|
||||
mCustomElementData = nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIFrameLoader> frameLoader =
|
||||
do_QueryInterface(mFrameLoaderOrOpener);
|
||||
RefPtr<nsFrameLoader> frameLoader = do_QueryObject(mFrameLoaderOrOpener);
|
||||
if (frameLoader) {
|
||||
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
|
||||
frameLoader->Destroy();
|
||||
}
|
||||
mFrameLoaderOrOpener = nullptr;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsError.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
|
||||
#include "mozilla/dom/NavigatorBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "mozilla/dom/DocumentFragment.h"
|
||||
#include "ChildIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLSlotElement.h"
|
||||
|
@ -619,7 +618,7 @@ ShadowRoot::ContentInserted(nsIContent* aChild)
|
|||
|
||||
// If parent's root is a shadow root, and parent is a slot whose assigned
|
||||
// nodes is the empty list, then run signal a slot change for parent.
|
||||
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
|
||||
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
|
||||
if (slot && slot->GetContainingShadow() == this &&
|
||||
slot->AssignedNodes().IsEmpty()) {
|
||||
slot->EnqueueSlotChangeEvent();
|
||||
|
@ -655,7 +654,7 @@ ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
|
|||
|
||||
// If parent's root is a shadow root, and parent is a slot whose assigned
|
||||
// nodes is the empty list, then run signal a slot change for parent.
|
||||
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
|
||||
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
|
||||
if (slot && slot->GetContainingShadow() == this &&
|
||||
slot->AssignedNodes().IsEmpty()) {
|
||||
slot->EnqueueSlotChangeEvent();
|
||||
|
|
|
@ -22,7 +22,7 @@ XPIDL_SOURCES += [
|
|||
'nsIDOMParser.idl',
|
||||
'nsIDOMSerializer.idl',
|
||||
'nsIDroppedLinkHandler.idl',
|
||||
'nsIFrameLoader.idl',
|
||||
'nsIFrameLoaderOwner.idl',
|
||||
'nsIImageLoadingContent.idl',
|
||||
'nsIMessageManager.idl',
|
||||
'nsIObjectLoadingContent.idl',
|
||||
|
@ -66,7 +66,6 @@ EXPORTS += [
|
|||
'nsDocumentWarningList.h',
|
||||
'nsDOMAttributeMap.h',
|
||||
'nsDOMCID.h',
|
||||
'nsDOMClassInfoID.h',
|
||||
'nsDOMJSUtils.h',
|
||||
'nsDOMNavigationTiming.h',
|
||||
'nsDOMString.h',
|
||||
|
@ -94,7 +93,6 @@ EXPORTS += [
|
|||
'nsINodeList.h',
|
||||
'nsIScriptContext.h',
|
||||
'nsIScriptGlobalObject.h',
|
||||
'nsIScriptNameSpaceManager.h',
|
||||
'nsIScriptObjectPrincipal.h',
|
||||
'nsIScriptTimeoutHandler.h',
|
||||
'nsIStyleSheetLinkingElement.h',
|
||||
|
@ -333,7 +331,6 @@ UNIFIED_SOURCES += [
|
|||
'nsQueryContentEventResult.cpp',
|
||||
'nsRange.cpp',
|
||||
'nsScreen.cpp',
|
||||
'nsScriptNameSpaceManager.cpp',
|
||||
'nsStructuredCloneContainer.cpp',
|
||||
'nsStubAnimationObserver.cpp',
|
||||
'nsStubDocumentObserver.cpp',
|
||||
|
|
|
@ -509,7 +509,7 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
|
|||
// set for linked images, and links
|
||||
nsCOMPtr<nsIContent> linkNode;
|
||||
|
||||
RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromContentOrNull(draggedNode);
|
||||
RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromNodeOrNull(draggedNode);
|
||||
if (areaElem) {
|
||||
// use the alt text (or, if missing, the href) as the title
|
||||
areaElem->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString);
|
||||
|
|
|
@ -546,7 +546,7 @@ nsContentList::GetSupportedNames(nsTArray<nsString>& aNames)
|
|||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
|
||||
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
|
||||
if (el) {
|
||||
// XXXbz should we be checking for particular tags here? How
|
||||
// stable is this part of the spec?
|
||||
|
|
|
@ -574,6 +574,13 @@ nsContentUtils::Init()
|
|||
NS_ENSURE_TRUE(sNameSpaceManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
sXPConnect = nsXPConnect::XPConnect();
|
||||
// We hold a strong ref to sXPConnect to ensure that it does not go away until
|
||||
// nsLayoutStatics::Shutdown is happening. Otherwise ~nsXPConnect can be
|
||||
// triggered by xpcModuleDtor late in shutdown and cause crashes due to
|
||||
// various stuff already being torn down by then. Note that this means that
|
||||
// we are effectively making sure that if we leak nsLayoutStatics then we also
|
||||
// leak nsXPConnect.
|
||||
NS_ADDREF(sXPConnect);
|
||||
|
||||
sSecurityManager = nsScriptSecurityManager::GetScriptSecurityManager();
|
||||
if(!sSecurityManager)
|
||||
|
@ -2092,7 +2099,7 @@ nsContentUtils::Shutdown()
|
|||
|
||||
NS_IF_RELEASE(sStringBundleService);
|
||||
NS_IF_RELEASE(sConsoleService);
|
||||
sXPConnect = nullptr;
|
||||
NS_IF_RELEASE(sXPConnect);
|
||||
NS_IF_RELEASE(sSecurityManager);
|
||||
NS_IF_RELEASE(sSystemPrincipal);
|
||||
NS_IF_RELEASE(sNullSubjectPrincipal);
|
||||
|
@ -3893,7 +3900,7 @@ nsContentUtils::ContentIsDraggable(nsIContent* aContent)
|
|||
{
|
||||
MOZ_ASSERT(aContent);
|
||||
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromContent(aContent)) {
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromNode(aContent)) {
|
||||
if (htmlElement->Draggable()) {
|
||||
return true;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -8,152 +8,22 @@
|
|||
#define nsDOMClassInfo_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/Id.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef GetClassName
|
||||
#endif
|
||||
|
||||
struct nsGlobalNameStruct;
|
||||
class nsGlobalWindowInner;
|
||||
class nsGlobalWindowOuter;
|
||||
|
||||
struct nsDOMClassInfoData;
|
||||
|
||||
typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)
|
||||
(nsDOMClassInfoData* aData);
|
||||
|
||||
typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
|
||||
|
||||
struct nsDOMClassInfoData
|
||||
class nsDOMClassInfo
|
||||
{
|
||||
// The ASCII name is available as mClass.name.
|
||||
const char16_t *mNameUTF16;
|
||||
const js::ClassOps mClassOps;
|
||||
const js::Class mClass;
|
||||
nsDOMClassInfoConstructorFnc mConstructorFptr;
|
||||
|
||||
nsIClassInfo *mCachedClassInfo;
|
||||
const nsIID *mProtoChainInterface;
|
||||
const nsIID **mInterfaces;
|
||||
uint32_t mScriptableFlags : 31; // flags must not use more than 31 bits!
|
||||
uint32_t mHasClassInterface : 1;
|
||||
bool mChromeOnly : 1;
|
||||
bool mAllowXBL : 1;
|
||||
bool mDisabled : 1;
|
||||
#ifdef DEBUG
|
||||
uint32_t mDebugID;
|
||||
#endif
|
||||
};
|
||||
|
||||
class nsWindowSH;
|
||||
|
||||
class nsDOMClassInfo : public nsXPCClassInfo
|
||||
{
|
||||
friend class nsWindowSH;
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMClassInfo() {};
|
||||
|
||||
public:
|
||||
explicit nsDOMClassInfo(nsDOMClassInfoData* aData);
|
||||
|
||||
NS_DECL_NSIXPCSCRIPTABLE
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSICLASSINFO
|
||||
|
||||
static nsresult Init();
|
||||
static void ShutDown();
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsDOMClassInfo(aData);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following two functions exist because of the way that Xray wrappers
|
||||
* work. In order to allow scriptable helpers to define non-IDL defined but
|
||||
* still "safe" properties for Xray wrappers, we call into the scriptable
|
||||
* helper with |obj| being the wrapper.
|
||||
*
|
||||
* Ideally, that would be the end of the story, however due to complications
|
||||
* dealing with document.domain, it's possible to end up in a scriptable
|
||||
* helper with a wrapper, even though we should be treating the lookup as a
|
||||
* transparent one.
|
||||
*
|
||||
* Note: So ObjectIsNativeWrapper(cx, obj) check usually means "through xray
|
||||
* wrapper this part is not visible".
|
||||
*/
|
||||
static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
|
||||
|
||||
protected:
|
||||
friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||
|
||||
const nsDOMClassInfoData* mData;
|
||||
|
||||
virtual void PreserveWrapper(nsISupports *aNative) override
|
||||
{
|
||||
}
|
||||
|
||||
static nsresult RegisterClassProtos(int32_t aDOMClassInfoID);
|
||||
|
||||
static nsIXPConnect *sXPConnect;
|
||||
|
||||
// nsIXPCScriptable code
|
||||
static nsresult DefineStaticJSVals();
|
||||
|
||||
static bool sIsInitialized;
|
||||
|
||||
public:
|
||||
static jsid sConstructor_id;
|
||||
static jsid sWrappedJSObject_id;
|
||||
};
|
||||
|
||||
typedef nsDOMClassInfo nsDOMGenericSH;
|
||||
|
||||
// Makes sure that the wrapper is preserved if new properties are added.
|
||||
class nsEventTargetSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
explicit nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsEventTargetSH()
|
||||
{
|
||||
}
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) override;
|
||||
|
||||
virtual void PreserveWrapper(nsISupports *aNative) override;
|
||||
};
|
||||
|
||||
// A place to hang some static methods that we should really consider
|
||||
// moving to be nsGlobalWindow member methods. See bug 1062418.
|
||||
class nsWindowSH
|
||||
{
|
||||
protected:
|
||||
static nsresult GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JS::PropertyDescriptor> desc);
|
||||
|
||||
friend class nsGlobalWindowInner;
|
||||
friend class nsGlobalWindowOuter;
|
||||
public:
|
||||
static bool NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
|
||||
const nsAString& aName,
|
||||
const nsGlobalNameStruct& aNameStruct);
|
||||
};
|
||||
|
||||
|
||||
// Event handler 'this' translator class, this is called by XPConnect
|
||||
// when a "function interface" (nsIDOMEventListener) is called, this
|
||||
// class extracts 'this' fomr the first argument to the called
|
||||
|
@ -179,37 +49,4 @@ public:
|
|||
NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR
|
||||
};
|
||||
|
||||
class nsDOMConstructorSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
explicit nsDOMConstructorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) override;
|
||||
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) override
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Resolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, bool *resolvedp,
|
||||
bool *_retval) override;
|
||||
NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, const JS::CallArgs &args, bool *_retval) override;
|
||||
|
||||
NS_IMETHOD Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, const JS::CallArgs &args, bool *_retval) override;
|
||||
|
||||
NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, JS::Handle<JS::Value> val, bool *bp,
|
||||
bool *_retval) override;
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsDOMConstructorSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* nsDOMClassInfo_h___ */
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* This file defines enum values for all of the DOM objects which have
|
||||
* an entry in nsDOMClassInfo.
|
||||
*/
|
||||
|
||||
#ifndef nsDOMClassInfoID_h__
|
||||
#define nsDOMClassInfoID_h__
|
||||
|
||||
#include "nsIXPCScriptable.h"
|
||||
|
||||
enum nsDOMClassInfoID
|
||||
{
|
||||
eDOMClassInfo_DOMPrototype_id,
|
||||
eDOMClassInfo_DOMConstructor_id,
|
||||
|
||||
// This one better be the last one in this list
|
||||
eDOMClassInfoIDCount
|
||||
};
|
||||
|
||||
/**
|
||||
* nsIClassInfo helper macros
|
||||
*/
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
|
||||
class nsIClassInfo;
|
||||
class nsXPCClassInfo;
|
||||
|
||||
extern nsIClassInfo*
|
||||
NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||
|
||||
#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class) \
|
||||
if (aIID.Equals(NS_GET_IID(nsIClassInfo)) || \
|
||||
aIID.Equals(NS_GET_IID(nsXPCClassInfo))) { \
|
||||
foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nullptr; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} else
|
||||
|
||||
#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(_class, condition) \
|
||||
if ((condition) && \
|
||||
(aIID.Equals(NS_GET_IID(nsIClassInfo)) || \
|
||||
aIID.Equals(NS_GET_IID(nsXPCClassInfo)))) { \
|
||||
foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nullptr; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} else
|
||||
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
|
||||
#endif // nsDOMClassInfoID_h__
|
|
@ -9,7 +9,6 @@
|
|||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/LayerTransactionChild.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
|
@ -1480,8 +1479,8 @@ nsDOMWindowUtils::CompareCanvases(nsISupports *aCanvas1,
|
|||
|
||||
nsCOMPtr<nsIContent> contentCanvas1 = do_QueryInterface(aCanvas1);
|
||||
nsCOMPtr<nsIContent> contentCanvas2 = do_QueryInterface(aCanvas2);
|
||||
auto canvas1 = HTMLCanvasElement::FromContentOrNull(contentCanvas1);
|
||||
auto canvas2 = HTMLCanvasElement::FromContentOrNull(contentCanvas2);
|
||||
auto canvas1 = HTMLCanvasElement::FromNodeOrNull(contentCanvas1);
|
||||
auto canvas2 = HTMLCanvasElement::FromNodeOrNull(contentCanvas2);
|
||||
|
||||
if (!canvas1 || !canvas2) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -4167,7 +4166,7 @@ nsDOMWindowUtils::ForceUseCounterFlush(nsIDOMNode *aNode)
|
|||
}
|
||||
|
||||
if (nsCOMPtr<nsIContent> content = do_QueryInterface(aNode)) {
|
||||
if (HTMLImageElement* img = HTMLImageElement::FromContent(content)) {
|
||||
if (HTMLImageElement* img = HTMLImageElement::FromNode(content)) {
|
||||
img->FlushUseCounters();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -4710,7 +4710,7 @@ static void
|
|||
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
|
||||
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
|
||||
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
|
||||
bool* contains = static_cast<bool*>(aContainsEME);
|
||||
if (mediaElem->GetMediaKeys()) {
|
||||
*contains = true;
|
||||
|
@ -4731,7 +4731,7 @@ static void
|
|||
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
|
||||
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
|
||||
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
|
||||
bool* contains = static_cast<bool*>(aContainsMSE);
|
||||
RefPtr<MediaSource> ms = mediaElem->GetMozMediaSourceObject();
|
||||
if (ms) {
|
||||
|
@ -4753,7 +4753,7 @@ static void
|
|||
NotifyActivityChanged(nsISupports *aSupports, void *aUnused)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
|
||||
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
|
||||
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
|
||||
mediaElem->NotifyOwnerDocumentActivityChanged();
|
||||
}
|
||||
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aSupports));
|
||||
|
@ -8051,7 +8051,7 @@ nsIDocument::Sanitize()
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
NS_ASSERTION(nodes->Item(i), "null item in node list!");
|
||||
|
||||
RefPtr<HTMLInputElement> input = HTMLInputElement::FromContentOrNull(nodes->Item(i));
|
||||
RefPtr<HTMLInputElement> input = HTMLInputElement::FromNodeOrNull(nodes->Item(i));
|
||||
if (!input)
|
||||
continue;
|
||||
|
||||
|
@ -8078,7 +8078,7 @@ nsIDocument::Sanitize()
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
NS_ASSERTION(nodes->Item(i), "null item in nodelist");
|
||||
|
||||
HTMLFormElement* form = HTMLFormElement::FromContent(nodes->Item(i));
|
||||
HTMLFormElement* form = HTMLFormElement::FromNode(nodes->Item(i));
|
||||
if (!form)
|
||||
continue;
|
||||
|
||||
|
@ -10068,7 +10068,7 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY)
|
|||
if (nodeIsAnonymous) {
|
||||
node = ptFrame->GetContent();
|
||||
nsIContent* nonanon = node->FindFirstNonChromeOnlyAccessContent();
|
||||
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(nonanon);
|
||||
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(nonanon);
|
||||
nsITextControlFrame* textFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
|
||||
nsNumberControlFrame* numberFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
|
||||
if (textFrame || numberFrame) {
|
||||
|
|
|
@ -151,9 +151,13 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
|
||||
if (aIID.Equals(NS_GET_IID(nsFrameLoader))) {
|
||||
// We want to end up with a pointer that can then be reinterpret_cast
|
||||
// from nsISupports* to nsFrameLoader* and end up with |this|.
|
||||
foundInterface = reinterpret_cast<nsISupports*>(this);
|
||||
} else
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserPersistable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersistable)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -165,7 +169,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, nsPIDOMWindowOuter* aOpener,
|
|||
, mRemoteBrowser(nullptr)
|
||||
, mChildID(0)
|
||||
, mJSPluginID(aJSPluginID)
|
||||
, mEventMode(EVENT_MODE_NORMAL_DISPATCH)
|
||||
, mEventMode(FrameLoaderBinding::EVENT_MODE_NORMAL_DISPATCH)
|
||||
, mBrowserChangingProcessBlockers(nullptr)
|
||||
, mDepthTooGreat(false)
|
||||
, mIsTopLevelContent(false)
|
||||
|
@ -231,18 +235,11 @@ nsFrameLoader::Create(Element* aOwner, nsPIDOMWindowOuter* aOpener, bool aNetwor
|
|||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::LoadFrame(bool aOriginalSrc, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = LoadFrame(aOriginalSrc);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::LoadFrame(bool aOriginalSrc)
|
||||
{
|
||||
NS_ENSURE_TRUE(mOwnerContent, NS_ERROR_NOT_INITIALIZED);
|
||||
if (NS_WARN_IF(!mOwnerContent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString src;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
@ -264,7 +261,7 @@ nsFrameLoader::LoadFrame(bool aOriginalSrc)
|
|||
if (mOwnerContent->IsXULElement() &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::nodefaultsrc,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
src.AssignLiteral("about:blank");
|
||||
}
|
||||
|
@ -272,12 +269,12 @@ nsFrameLoader::LoadFrame(bool aOriginalSrc)
|
|||
|
||||
nsIDocument* doc = mOwnerContent->OwnerDoc();
|
||||
if (doc->IsStaticDocument()) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (doc->IsLoadedAsInteractiveData()) {
|
||||
// XBL bindings doc shouldn't load sub-documents.
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> base_uri = mOwnerContent->GetBaseURI();
|
||||
|
@ -298,11 +295,7 @@ nsFrameLoader::LoadFrame(bool aOriginalSrc)
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
FireErrorEvent();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -318,16 +311,7 @@ nsFrameLoader::FireErrorEvent()
|
|||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::LoadURI(nsIURI* aURI, bool aOriginalSrc, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = LoadURI(aURI, aOriginalSrc);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsFrameLoader::LoadURI(nsIURI* aURI, bool aOriginalSrc)
|
||||
{
|
||||
return LoadURI(aURI, nullptr, aOriginalSrc);
|
||||
|
@ -448,27 +432,6 @@ nsFrameLoader::AddProcessChangeBlockingPromise(Promise& aPromise, ErrorResult& a
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::AddProcessChangeBlockingPromise(js::Handle<js::Value> aPromise,
|
||||
JSContext* aCx)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> go = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
|
||||
if (!go) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
ErrorResult rv;
|
||||
RefPtr<Promise> promise = Promise::Resolve(go, aCx, aPromise, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
AddProcessChangeBlockingPromise(*promise, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::ReallyStartLoading()
|
||||
{
|
||||
|
@ -573,7 +536,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
|||
// load iframe referrer attribute if enabled in preferences
|
||||
// per element referrer overrules document wide referrer if enabled
|
||||
net::ReferrerPolicy referrerPolicy = mOwnerContent->OwnerDoc()->GetReferrerPolicy();
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
|
||||
if (iframe) {
|
||||
net::ReferrerPolicy iframeReferrerPolicy = iframe->GetReferrerPolicyAsEnum();
|
||||
if (iframeReferrerPolicy != net::RP_Unset) {
|
||||
|
@ -642,25 +605,11 @@ nsFrameLoader::CheckURILoad(nsIURI* aURI, nsIPrincipal* aTriggeringPrincipal)
|
|||
return CheckForRecursiveLoad(aURI);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocShell>
|
||||
nsIDocShell*
|
||||
nsFrameLoader::GetDocShell(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
nsresult rv = GetDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
return docShell.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
|
||||
{
|
||||
*aDocShell = nullptr;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (IsRemoteFrame()) {
|
||||
return rv;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If we have an owner, make sure we have a docshell and return
|
||||
|
@ -669,16 +618,14 @@ nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
|
|||
if (mOwnerContent) {
|
||||
nsresult rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
NS_ASSERTION(mDocShell,
|
||||
"MaybeCreateDocShell succeeded, but null mDocShell");
|
||||
}
|
||||
|
||||
*aDocShell = mDocShell;
|
||||
NS_IF_ADDREF(*aDocShell);
|
||||
|
||||
return rv;
|
||||
return mDocShell;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1022,7 +969,7 @@ nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
|||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
os->NotifyObservers(ToSupports(this),
|
||||
"remote-browser-shown", nullptr);
|
||||
}
|
||||
} else {
|
||||
|
@ -1239,7 +1186,7 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
|||
// Perform the actual swap of the internal refptrs. We keep a strong reference
|
||||
// to ourselves to make sure we don't die while we overwrite our reference to
|
||||
// ourself.
|
||||
nsCOMPtr<nsIFrameLoader> kungFuDeathGrip(this);
|
||||
RefPtr<nsFrameLoader> kungFuDeathGrip(this);
|
||||
aThisOwner->InternalSetFrameLoader(aOther);
|
||||
aOtherOwner->InternalSetFrameLoader(kungFuDeathGrip);
|
||||
|
||||
|
@ -1664,7 +1611,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
// Perform the actual swap of the internal refptrs. We keep a strong reference
|
||||
// to ourselves to make sure we don't die while we overwrite our reference to
|
||||
// ourself.
|
||||
nsCOMPtr<nsIFrameLoader> kungFuDeathGrip(this);
|
||||
RefPtr<nsFrameLoader> kungFuDeathGrip(this);
|
||||
aThisOwner->InternalSetFrameLoader(aOther);
|
||||
aOtherOwner->InternalSetFrameLoader(kungFuDeathGrip);
|
||||
|
||||
|
@ -1702,19 +1649,9 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::Destroy(ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = Destroy();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::Destroy()
|
||||
{
|
||||
StartDestroy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsFrameLoaderDestroyRunnable : public Runnable
|
||||
|
@ -1937,13 +1874,6 @@ nsFrameLoader::DestroyComplete()
|
|||
mChildMessageManager = nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat)
|
||||
{
|
||||
*aDepthTooGreat = mDepthTooGreat;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::SetOwnerContent(Element* aContent)
|
||||
{
|
||||
|
@ -1976,14 +1906,6 @@ nsFrameLoader::OwnerIsMozBrowserFrame()
|
|||
return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
|
||||
}
|
||||
|
||||
// The xpcom getter version
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetOwnerIsMozBrowserFrame(bool* aResult)
|
||||
{
|
||||
*aResult = OwnerIsMozBrowserFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::OwnerIsIsolatedMozBrowserFrame()
|
||||
{
|
||||
|
@ -2089,8 +2011,8 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(docShell);
|
||||
nsCOMPtr<nsIDocShell> parentDocShell = doc->GetDocShell();
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(parentDocShell);
|
||||
NS_ENSURE_STATE(parentAsWebNav);
|
||||
|
||||
// Create the docshell...
|
||||
|
@ -2127,15 +2049,16 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
// Note: This logic duplicates a lot of logic in
|
||||
// nsSubDocumentFrame::AttributeChanged. We should fix that.
|
||||
|
||||
const int32_t parentType = docShell->ItemType();
|
||||
const int32_t parentType = parentDocShell->ItemType();
|
||||
|
||||
// XXXbz why is this in content code, exactly? We should handle
|
||||
// this some other way..... Not sure how yet.
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
parentDocShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
NS_ENSURE_STATE(parentTreeOwner);
|
||||
mIsTopLevelContent =
|
||||
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType, docShell);
|
||||
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType,
|
||||
parentDocShell);
|
||||
|
||||
if (mIsTopLevelContent) {
|
||||
mDocShell->SetCreatedDynamically(false);
|
||||
|
@ -2156,7 +2079,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
// Our parent shell is a content shell. Get the chrome event
|
||||
// handler from it and use that for our shell as well.
|
||||
|
||||
docShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
parentDocShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
}
|
||||
|
||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
|
@ -2204,8 +2127,8 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
}
|
||||
|
||||
OriginAttributes attrs;
|
||||
if (docShell->ItemType() == mDocShell->ItemType()) {
|
||||
attrs = nsDocShell::Cast(docShell)->GetOriginAttributes();
|
||||
if (parentDocShell->ItemType() == mDocShell->ItemType()) {
|
||||
attrs = nsDocShell::Cast(parentDocShell)->GetOriginAttributes();
|
||||
}
|
||||
|
||||
// Inherit origin attributes from parent document if
|
||||
|
@ -2248,7 +2171,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
// Note: ApplySandboxFlags should be called after mDocShell->SetFrameType
|
||||
// because we need to get the correct presentation URL in ApplySandboxFlags.
|
||||
uint32_t sandboxFlags = 0;
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
|
||||
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
|
||||
if (iframe) {
|
||||
sandboxFlags = iframe->GetSandboxFlags();
|
||||
}
|
||||
|
@ -2261,7 +2184,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
}
|
||||
|
||||
bool isPrivate = false;
|
||||
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(docShell);
|
||||
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(parentDocShell);
|
||||
NS_ENSURE_STATE(parentContext);
|
||||
|
||||
rv = parentContext->GetUsePrivateBrowsing(&isPrivate);
|
||||
|
@ -2274,7 +2197,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
// For inproc frames, set the docshell properties.
|
||||
nsAutoString name;
|
||||
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||
docShell->SetName(name);
|
||||
mDocShell->SetName(name);
|
||||
}
|
||||
mDocShell->SetFullscreenAllowed(
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
||||
|
@ -2324,7 +2247,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
os->NotifyObservers(ToSupports(this),
|
||||
"inprocess-browser-shown", nullptr);
|
||||
}
|
||||
|
||||
|
@ -2478,7 +2401,7 @@ nsFrameLoader::GetWindowDimensions(nsIntRect& aRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
|
||||
{
|
||||
if (IsRemoteFrame()) {
|
||||
|
@ -2503,9 +2426,8 @@ nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
|
|||
void
|
||||
nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell));
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow =
|
||||
do_QueryInterface(GetDocShell(IgnoreErrors()));
|
||||
|
||||
// resize the sub document
|
||||
if (baseWindow) {
|
||||
|
@ -2542,13 +2464,6 @@ nsFrameLoader::LazyWidth() const
|
|||
return lazyWidth;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
|
||||
{
|
||||
*aLazyWidth = LazyWidth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsFrameLoader::LazyHeight() const
|
||||
{
|
||||
|
@ -2562,35 +2477,7 @@ nsFrameLoader::LazyHeight() const
|
|||
return lazyHeight;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetLazyHeight(uint32_t* aLazyHeight)
|
||||
{
|
||||
*aLazyHeight = LazyHeight();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetEventMode(uint32_t* aEventMode)
|
||||
{
|
||||
*aEventMode = mEventMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SetEventMode(uint32_t aEventMode)
|
||||
{
|
||||
mEventMode = aEventMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetClipSubdocument(bool* aResult)
|
||||
{
|
||||
*aResult = mClipSubdocument;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsFrameLoader::SetClipSubdocument(bool aClip)
|
||||
{
|
||||
mClipSubdocument = aClip;
|
||||
|
@ -2612,17 +2499,9 @@ nsFrameLoader::SetClipSubdocument(bool aClip)
|
|||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetClampScrollPosition(bool* aResult)
|
||||
{
|
||||
*aResult = mClampScrollPosition;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
||||
{
|
||||
mClampScrollPosition = aClamp;
|
||||
|
@ -2642,7 +2521,6 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
|||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -2656,8 +2534,9 @@ GetContentParent(Element* aBrowser)
|
|||
return ReturnTuple(nullptr, nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFrameLoader> otherLoader;
|
||||
browser->GetSameProcessAsFrameLoader(getter_AddRefs(otherLoader));
|
||||
nsCOMPtr<nsISupports> otherLoaderAsSupports;
|
||||
browser->GetSameProcessAsFrameLoader(getter_AddRefs(otherLoaderAsSupports));
|
||||
RefPtr<nsFrameLoader> otherLoader = do_QueryObject(otherLoaderAsSupports);
|
||||
if (!otherLoader) {
|
||||
return ReturnTuple(nullptr, nullptr);
|
||||
}
|
||||
|
@ -2842,37 +2721,23 @@ nsFrameLoader::GetCurrentRenderFrame() const
|
|||
void
|
||||
nsFrameLoader::ActivateRemoteFrame(ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = ActivateRemoteFrame();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
if (!mRemoteBrowser) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ActivateRemoteFrame() {
|
||||
if (mRemoteBrowser) {
|
||||
mRemoteBrowser->Activate();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mRemoteBrowser->Activate();
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::DeactivateRemoteFrame(ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = DeactivateRemoteFrame();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
if (!mRemoteBrowser) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::DeactivateRemoteFrame() {
|
||||
if (mRemoteBrowser) {
|
||||
mRemoteBrowser->Deactivate();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mRemoteBrowser->Deactivate();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2885,72 +2750,50 @@ nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
|
|||
bool aIgnoreRootScrollFrame,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = SendCrossProcessMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
if (!mRemoteBrowser) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
int32_t aButton,
|
||||
int32_t aClickCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame)
|
||||
{
|
||||
if (mRemoteBrowser) {
|
||||
mRemoteBrowser->SendMouseEvent(aType, aX, aY, aButton,
|
||||
aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
mRemoteBrowser->SendMouseEvent(aType, aX, aY, aButton,
|
||||
aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame);
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = ActivateFrameEvent(aType, aCapture);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
if (!mRemoteBrowser) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
|
||||
bool aCapture)
|
||||
{
|
||||
if (mRemoteBrowser) {
|
||||
return mRemoteBrowser->SendActivateFrameEvent(nsString(aType), aCapture) ?
|
||||
NS_OK : NS_ERROR_NOT_AVAILABLE;
|
||||
bool ok = mRemoteBrowser->SendActivateFrameEvent(nsString(aType), aCapture);
|
||||
if (!ok) {
|
||||
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
|
||||
nsFrameLoader::CreateStaticClone(nsFrameLoader* aDest)
|
||||
{
|
||||
nsFrameLoader* dest = static_cast<nsFrameLoader*>(aDest);
|
||||
dest->MaybeCreateDocShell();
|
||||
NS_ENSURE_STATE(dest->mDocShell);
|
||||
aDest->MaybeCreateDocShell();
|
||||
NS_ENSURE_STATE(aDest->mDocShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> kungFuDeathGrip = dest->mDocShell->GetDocument();
|
||||
nsCOMPtr<nsIDocument> kungFuDeathGrip = aDest->mDocShell->GetDocument();
|
||||
Unused << kungFuDeathGrip;
|
||||
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
dest->mDocShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
aDest->mDocShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
NS_ENSURE_STATE(viewer);
|
||||
|
||||
nsCOMPtr<nsIDocShell> origDocShell;
|
||||
GetDocShell(getter_AddRefs(origDocShell));
|
||||
nsIDocShell* origDocShell = GetDocShell(IgnoreErrors());
|
||||
NS_ENSURE_STATE(origDocShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = origDocShell->GetDocument();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsCOMPtr<nsIDocument> clonedDoc = doc->CreateStaticClone(dest->mDocShell);
|
||||
nsCOMPtr<nsIDocument> clonedDoc = doc->CreateStaticClone(aDest->mDocShell);
|
||||
|
||||
viewer->SetDocument(clonedDoc);
|
||||
return NS_OK;
|
||||
|
@ -3047,22 +2890,9 @@ nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
|
|||
|
||||
already_AddRefed<nsIMessageSender>
|
||||
nsFrameLoader::GetMessageManager()
|
||||
{
|
||||
nsCOMPtr<nsIMessageSender> messageManager;
|
||||
MOZ_ALWAYS_SUCCEEDS(GetMessageManager(getter_AddRefs(messageManager)));
|
||||
return messageManager.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
|
||||
{
|
||||
EnsureMessageManager();
|
||||
if (mMessageManager) {
|
||||
RefPtr<nsFrameMessageManager> mm(mMessageManager);
|
||||
mm.forget(aManager);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
return do_AddRef(mMessageManager);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -3144,23 +2974,7 @@ nsFrameLoader::GetTabChildGlobalAsEventTarget()
|
|||
already_AddRefed<Element>
|
||||
nsFrameLoader::GetOwnerElement()
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(mOwnerContent);
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetOwnerElement(nsIDOMElement **aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> ownerElement = do_QueryInterface(mOwnerContent);
|
||||
ownerElement.forget(aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetChildID(uint64_t* aChildID)
|
||||
{
|
||||
*aChildID = mChildID;
|
||||
return NS_OK;
|
||||
return do_AddRef(mOwnerContent);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3279,44 +3093,28 @@ nsFrameLoader::AttributeChanged(mozilla::dom::Element* aElement,
|
|||
* Send the RequestNotifyAfterRemotePaint message to the current Tab.
|
||||
*/
|
||||
void
|
||||
nsFrameLoader::RequestNotifyAfterRemotePaint(ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = RequestNotifyAfterRemotePaint();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::RequestNotifyAfterRemotePaint()
|
||||
{
|
||||
// If remote browsing (e10s), handle this with the TabParent.
|
||||
if (mRemoteBrowser) {
|
||||
Unused << mRemoteBrowser->SendRequestNotifyAfterRemotePaint();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::RequestFrameLoaderClose(ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = RequestFrameLoaderClose();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::RequestFrameLoaderClose()
|
||||
{
|
||||
nsCOMPtr<nsIBrowser> browser = do_QueryInterface(mOwnerContent);
|
||||
if (NS_WARN_IF(!browser)) {
|
||||
// OwnerElement other than nsIBrowser is not supported yet.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return;
|
||||
}
|
||||
|
||||
return browser->CloseBrowser();
|
||||
nsresult rv = browser->CloseBrowser();
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3336,17 +3134,6 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
|
|||
nsIPrintSettings* aPrintSettings,
|
||||
nsIWebProgressListener* aProgressListener,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = Print(aOuterWindowID, aPrintSettings, aProgressListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::Print(uint64_t aOuterWindowID,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIWebProgressListener* aProgressListener)
|
||||
{
|
||||
#if defined(NS_PRINTING)
|
||||
if (mRemoteBrowser) {
|
||||
|
@ -3357,28 +3144,37 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
|
|||
nsresult rv = printingParent->SerializeAndEnsureRemotePrintJob(
|
||||
aPrintSettings, aProgressListener, nullptr, &printData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
bool success = mRemoteBrowser->SendPrint(aOuterWindowID, printData);
|
||||
return success ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (!success) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nsGlobalWindowOuter* outerWindow =
|
||||
nsGlobalWindowOuter::GetOuterWindowWithId(aOuterWindowID);
|
||||
if (NS_WARN_IF(!outerWindow)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebBrowserPrint> webBrowserPrint =
|
||||
do_GetInterface(outerWindow->AsOuter());
|
||||
if (NS_WARN_IF(!webBrowserPrint)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
return webBrowserPrint->Print(aPrintSettings, aProgressListener);
|
||||
nsresult rv = webBrowserPrint->Print(aPrintSettings, aProgressListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsITabParent>
|
||||
|
@ -3387,36 +3183,17 @@ nsFrameLoader::GetTabParent()
|
|||
return do_AddRef(mRemoteBrowser);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
|
||||
{
|
||||
nsCOMPtr<nsITabParent> tp = mRemoteBrowser;
|
||||
tp.forget(aTabParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsILoadContext>
|
||||
nsFrameLoader::LoadContext()
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
MOZ_ALWAYS_SUCCEEDS(GetLoadContext(getter_AddRefs(loadContext)));
|
||||
return loadContext.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (IsRemoteFrame() &&
|
||||
(mRemoteBrowser || TryRemoteBrowser())) {
|
||||
loadContext = mRemoteBrowser->GetLoadContext();
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShell(getter_AddRefs(docShell));
|
||||
loadContext = do_GetInterface(docShell);
|
||||
loadContext = do_GetInterface(GetDocShell(IgnoreErrors()));
|
||||
}
|
||||
loadContext.forget(aLoadContext);
|
||||
return NS_OK;
|
||||
return loadContext.forget();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3609,13 +3386,6 @@ nsFrameLoader::PopulateUserContextIdFromAttribute(OriginAttributes& aAttr)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetIsDead(bool* aIsDead)
|
||||
{
|
||||
*aIsDead = mDestroyCalled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIMessageSender*
|
||||
nsFrameLoader::GetProcessMessageManager() const
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIFrameLoaderOwner.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
@ -38,6 +38,10 @@ class AutoResetInFrameSwap;
|
|||
class nsITabParent;
|
||||
class nsIDocShellTreeItem;
|
||||
class nsIDocShellTreeOwner;
|
||||
class nsILoadContext;
|
||||
class nsIMessageSender;
|
||||
class nsIPrintSettings;
|
||||
class nsIWebProgressListener;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -66,8 +70,12 @@ class RenderFrameParent;
|
|||
typedef struct _GtkWidget GtkWidget;
|
||||
#endif
|
||||
|
||||
class nsFrameLoader final : public nsIFrameLoader,
|
||||
public nsIWebBrowserPersistable,
|
||||
// IID for nsFrameLoader, because some places want to QI to it.
|
||||
#define NS_FRAMELOADER_IID \
|
||||
{ 0x297fd0ea, 0x1b4a, 0x4c9a, \
|
||||
{ 0xa4, 0x04, 0xe5, 0x8b, 0xe8, 0x95, 0x10, 0x50 } }
|
||||
|
||||
class nsFrameLoader final : public nsIWebBrowserPersistable,
|
||||
public nsStubMutationObserver,
|
||||
public mozilla::dom::ipc::MessageManagerCallback,
|
||||
public nsWrapperCache
|
||||
|
@ -84,9 +92,11 @@ public:
|
|||
bool aNetworkCreated,
|
||||
int32_t aJSPluginID = nsFakePluginTag::NOT_JSPLUGIN);
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADER_IID)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
NS_DECL_NSIFRAMELOADER
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader,
|
||||
nsIWebBrowserPersistable)
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
NS_DECL_NSIWEBBROWSERPERSISTABLE
|
||||
nsresult CheckForRecursiveLoad(nsIURI* aURI);
|
||||
|
@ -96,35 +106,36 @@ public:
|
|||
void DestroyComplete();
|
||||
nsIDocShell* GetExistingDocShell() { return mDocShell; }
|
||||
mozilla::dom::EventTarget* GetTabChildGlobalAsEventTarget();
|
||||
nsresult CreateStaticClone(nsIFrameLoader* aDest);
|
||||
|
||||
nsresult CreateStaticClone(nsFrameLoader* aDest);
|
||||
nsresult UpdatePositionAndSize(nsSubDocumentFrame *aIFrame);
|
||||
|
||||
// WebIDL methods
|
||||
|
||||
already_AddRefed<nsIDocShell> GetDocShell(mozilla::ErrorResult& aRv);
|
||||
nsIDocShell* GetDocShell(mozilla::ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsITabParent> GetTabParent();
|
||||
|
||||
already_AddRefed<nsILoadContext> LoadContext();
|
||||
|
||||
void LoadFrame(bool aOriginalSrc, mozilla::ErrorResult& aRv);
|
||||
|
||||
void LoadURI(nsIURI* aURI, bool aOriginalSrc, mozilla::ErrorResult& aRv);
|
||||
/**
|
||||
* Start loading the frame. This method figures out what to load
|
||||
* from the owner content in the frame loader.
|
||||
*/
|
||||
void LoadFrame(bool aOriginalSrc);
|
||||
|
||||
/**
|
||||
* Triggers a load of the given URI.
|
||||
*
|
||||
* @param aURI The URI to load.
|
||||
* @param aTriggeringPrincipal The triggering principal for the load. May be
|
||||
* null, in which case the node principal of the owner content will be
|
||||
* used.
|
||||
* Loads the specified URI in this frame. Behaves identically to loadFrame,
|
||||
* except that this method allows specifying the URI to load.
|
||||
*/
|
||||
nsresult LoadURI(nsIURI* aURI, nsIPrincipal* aTriggeringPrincipal,
|
||||
bool aOriginalSrc);
|
||||
nsresult LoadURI(nsIURI* aURI, bool aOriginalSrc);
|
||||
|
||||
void AddProcessChangeBlockingPromise(mozilla::dom::Promise& aPromise, mozilla::ErrorResult& aRv);
|
||||
|
||||
void Destroy(mozilla::ErrorResult& aRv);
|
||||
/**
|
||||
* Destroy the frame loader and everything inside it. This will
|
||||
* clear the weak owner content reference.
|
||||
*/
|
||||
void Destroy();
|
||||
|
||||
void ActivateRemoteFrame(mozilla::ErrorResult& aRv);
|
||||
|
||||
|
@ -143,7 +154,7 @@ public:
|
|||
bool aCapture,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
void RequestNotifyAfterRemotePaint(mozilla::ErrorResult& aRv);
|
||||
void RequestNotifyAfterRemotePaint();
|
||||
|
||||
void RequestFrameLoaderClose(mozilla::ErrorResult& aRv);
|
||||
|
||||
|
@ -163,6 +174,10 @@ public:
|
|||
already_AddRefed<nsIMessageSender> GetMessageManager();
|
||||
|
||||
uint32_t EventMode() const { return mEventMode; }
|
||||
void SetEventMode(uint32_t aEventMode)
|
||||
{
|
||||
mEventMode = aEventMode;
|
||||
}
|
||||
|
||||
already_AddRefed<Element> GetOwnerElement();
|
||||
|
||||
|
@ -173,8 +188,10 @@ public:
|
|||
uint64_t ChildID() const { return mChildID; }
|
||||
|
||||
bool ClampScrollPosition() const { return mClampScrollPosition; }
|
||||
void SetClampScrollPosition(bool aClamp);
|
||||
|
||||
bool ClipSubdocument() const { return mClipSubdocument; }
|
||||
void SetClipSubdocument(bool aClip);
|
||||
|
||||
bool DepthTooGreat() const { return mDepthTooGreat; }
|
||||
|
||||
|
@ -222,8 +239,6 @@ public:
|
|||
*/
|
||||
void Hide();
|
||||
|
||||
nsresult CloneForStatic(nsIFrameLoader* aOriginal);
|
||||
|
||||
// The guts of an nsIFrameLoaderOwner::SwapFrameLoader implementation. A
|
||||
// frame loader owner needs to call this, and pass in the two references to
|
||||
// nsRefPtrs for frame loaders that need to be swapped.
|
||||
|
@ -425,6 +440,17 @@ private:
|
|||
// resolved which were added during the BrowserWillChangeProcess event.
|
||||
already_AddRefed<mozilla::dom::Promise> FireWillChangeProcessEvent();
|
||||
|
||||
/**
|
||||
* Triggers a load of the given URI.
|
||||
*
|
||||
* @param aURI The URI to load.
|
||||
* @param aTriggeringPrincipal The triggering principal for the load. May be
|
||||
* null, in which case the node principal of the owner content will be
|
||||
* used.
|
||||
*/
|
||||
nsresult LoadURI(nsIURI* aURI, nsIPrincipal* aTriggeringPrincipal,
|
||||
bool aOriginalSrc);
|
||||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURIToLoad;
|
||||
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
||||
|
@ -453,7 +479,7 @@ private:
|
|||
|
||||
int32_t mJSPluginID;
|
||||
|
||||
// See nsIFrameLoader.idl. EVENT_MODE_NORMAL_DISPATCH automatically
|
||||
// See FrameLoader.webidl. EVENT_MODE_NORMAL_DISPATCH automatically
|
||||
// forwards some input events to out-of-process content.
|
||||
uint32_t mEventMode;
|
||||
|
||||
|
@ -489,4 +515,12 @@ private:
|
|||
bool mFreshProcess : 1;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoader, NS_FRAMELOADER_IID)
|
||||
|
||||
inline nsISupports*
|
||||
ToSupports(nsFrameLoader* aFrameLoader)
|
||||
{
|
||||
return static_cast<nsIWebBrowserPersistable*>(aFrameLoader);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1030,7 +1030,7 @@ public:
|
|||
|
||||
nsresult
|
||||
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
nsIFrameLoader* aTargetFrameLoader,
|
||||
nsFrameLoader* aTargetFrameLoader,
|
||||
const nsAString& aMessage,
|
||||
bool aIsSync,
|
||||
StructuredCloneData* aCloneData,
|
||||
|
@ -1044,7 +1044,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
|
||||
nsresult
|
||||
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
nsIFrameLoader* aTargetFrameLoader,
|
||||
nsFrameLoader* aTargetFrameLoader,
|
||||
bool aTargetClosed,
|
||||
const nsAString& aMessage,
|
||||
bool aIsSync,
|
||||
|
@ -1157,7 +1157,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
argument.mSync = aIsSync;
|
||||
argument.mTarget = aTarget;
|
||||
if (aTargetFrameLoader) {
|
||||
argument.mTargetFrameLoader.Construct(aTargetFrameLoader);
|
||||
argument.mTargetFrameLoader.Construct(*aTargetFrameLoader);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> thisValue(cx, JS::UndefinedValue());
|
||||
|
@ -2190,7 +2190,7 @@ nsSameProcessAsyncMessageBase::Init(const nsAString& aMessage,
|
|||
|
||||
void
|
||||
nsSameProcessAsyncMessageBase::ReceiveMessage(nsISupports* aTarget,
|
||||
nsIFrameLoader* aTargetFrameLoader,
|
||||
nsFrameLoader* aTargetFrameLoader,
|
||||
nsFrameMessageManager* aManager)
|
||||
{
|
||||
// Make sure that we have called Init() and it has succeeded.
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "mozilla/jsipc/CpowHolder.h"
|
||||
|
||||
class nsIFrameLoader;
|
||||
class nsFrameLoader;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
static mozilla::dom::ChromeMessageSender*
|
||||
NewProcessMessageManager(bool aIsRemote);
|
||||
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
|
||||
const nsAString& aMessage,
|
||||
bool aIsSync, StructuredCloneData* aCloneData,
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
|
@ -351,7 +351,7 @@ protected:
|
|||
nsIPrincipal* aPrincipal, bool aIsSync,
|
||||
nsTArray<JS::Value>& aResult, mozilla::ErrorResult& aError);
|
||||
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
|
||||
bool aTargetClosed, const nsAString& aMessage,
|
||||
bool aIsSync, StructuredCloneData* aCloneData,
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
|
@ -438,7 +438,7 @@ public:
|
|||
StructuredCloneData& aData,
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
void ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
|
||||
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
|
||||
nsFrameMessageManager* aManager);
|
||||
private:
|
||||
nsSameProcessAsyncMessageBase(const nsSameProcessAsyncMessageBase&);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsHistory.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsIDOMStorageManager.h"
|
||||
#include "mozilla/dom/DOMJSProxyHandler.h"
|
||||
#include "mozilla/dom/DOMPrefs.h"
|
||||
#include "mozilla/dom/LocalStorage.h"
|
||||
#include "mozilla/dom/Storage.h"
|
||||
|
@ -51,7 +52,6 @@
|
|||
#include "nsIScriptTimeoutHandler.h"
|
||||
#include "nsITimeoutHandler.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "nsISlowScriptDebug.h"
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "nsWindowSizes.h"
|
||||
|
@ -69,7 +69,6 @@
|
|||
#include "js/Wrapper.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -239,6 +238,7 @@
|
|||
#include "mozilla/dom/NavigatorBinding.h"
|
||||
#include "mozilla/dom/ImageBitmap.h"
|
||||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
#include "mozilla/dom/InstallTriggerBinding.h"
|
||||
#include "mozilla/dom/ServiceWorker.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistration.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"
|
||||
|
@ -1220,6 +1220,7 @@ nsGlobalWindowInner::CleanUp()
|
|||
mPaintWorklet = nullptr;
|
||||
|
||||
mExternal = nullptr;
|
||||
mInstallTrigger = nullptr;
|
||||
|
||||
mPerformance = nullptr;
|
||||
|
||||
|
@ -1523,6 +1524,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioWorklet)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPaintWorklet)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mExternal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInstallTrigger)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIntlUtils)
|
||||
|
||||
tmp->TraverseHostObjectURIs(cb);
|
||||
|
@ -1607,6 +1609,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioWorklet)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPaintWorklet)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mExternal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInstallTrigger)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIntlUtils)
|
||||
|
||||
tmp->UnlinkHostObjectURIs();
|
||||
|
@ -2450,6 +2453,24 @@ nsGlobalWindowInner::ShouldReportForServiceWorkerScope(const nsAString& aScope)
|
|||
return result;
|
||||
}
|
||||
|
||||
already_AddRefed<InstallTriggerImpl>
|
||||
nsGlobalWindowInner::GetInstallTrigger()
|
||||
{
|
||||
if (!mInstallTrigger) {
|
||||
JS::Rooted<JSObject*> jsImplObj(RootingCx());
|
||||
ErrorResult rv;
|
||||
ConstructJSImplementation("@mozilla.org/addons/installtrigger;1", this,
|
||||
&jsImplObj, rv);
|
||||
if (rv.Failed()) {
|
||||
rv.SuppressException();
|
||||
return nullptr;
|
||||
}
|
||||
mInstallTrigger = new InstallTriggerImpl(jsImplObj, this);
|
||||
}
|
||||
|
||||
return do_AddRef(mInstallTrigger);
|
||||
}
|
||||
|
||||
nsGlobalWindowInner::CallState
|
||||
nsGlobalWindowInner::ShouldReportForServiceWorkerScopeInternal(const nsACString& aScope,
|
||||
bool* aResultOut)
|
||||
|
@ -2867,6 +2888,120 @@ nsGlobalWindowInner::IndexedGetter(uint32_t aIndex)
|
|||
FORWARD_TO_OUTER(IndexedGetterOuter, (aIndex), nullptr);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct InterfaceShimEntry {
|
||||
const char *geckoName;
|
||||
const char *domName;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// We add shims from Components.interfaces.nsIDOMFoo to window.Foo for each
|
||||
// interface that has interface constants that sites might be getting off
|
||||
// of Ci.
|
||||
const InterfaceShimEntry kInterfaceShimMap[] =
|
||||
{ { "nsIXMLHttpRequest", "XMLHttpRequest" },
|
||||
{ "nsIDOMDOMException", "DOMException" },
|
||||
{ "nsIDOMNode", "Node" },
|
||||
{ "nsIDOMCSSPrimitiveValue", "CSSPrimitiveValue" },
|
||||
{ "nsIDOMCSSRule", "CSSRule" },
|
||||
{ "nsIDOMCSSValue", "CSSValue" },
|
||||
{ "nsIDOMEvent", "Event" },
|
||||
{ "nsIDOMNSEvent", "Event" },
|
||||
{ "nsIDOMKeyEvent", "KeyEvent" },
|
||||
{ "nsIDOMMouseEvent", "MouseEvent" },
|
||||
{ "nsIDOMMouseScrollEvent", "MouseScrollEvent" },
|
||||
{ "nsIDOMMutationEvent", "MutationEvent" },
|
||||
{ "nsIDOMSimpleGestureEvent", "SimpleGestureEvent" },
|
||||
{ "nsIDOMUIEvent", "UIEvent" },
|
||||
{ "nsIDOMHTMLMediaElement", "HTMLMediaElement" },
|
||||
{ "nsIDOMOfflineResourceList", "OfflineResourceList" },
|
||||
{ "nsIDOMRange", "Range" },
|
||||
{ "nsIDOMSVGLength", "SVGLength" },
|
||||
// Think about whether Ci.nsINodeFilter can just go away for websites!
|
||||
{ "nsIDOMNodeFilter", "NodeFilter" },
|
||||
{ "nsIDOMXPathResult", "XPathResult" } };
|
||||
|
||||
bool
|
||||
nsGlobalWindowInner::ResolveComponentsShim(
|
||||
JSContext *aCx,
|
||||
JS::Handle<JSObject*> aGlobal,
|
||||
JS::MutableHandle<JS::PropertyDescriptor> aDesc)
|
||||
{
|
||||
// Keep track of how often this happens.
|
||||
Telemetry::Accumulate(Telemetry::COMPONENTS_SHIM_ACCESSED_BY_CONTENT, true);
|
||||
|
||||
// Warn once.
|
||||
nsCOMPtr<nsIDocument> doc = GetExtantDoc();
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eComponents, /* asError = */ true);
|
||||
}
|
||||
|
||||
// Create a fake Components object.
|
||||
AssertSameCompartment(aCx, aGlobal);
|
||||
JS::Rooted<JSObject*> components(aCx, JS_NewPlainObject(aCx));
|
||||
if (NS_WARN_IF(!components)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a fake interfaces object.
|
||||
JS::Rooted<JSObject*> interfaces(aCx, JS_NewPlainObject(aCx));
|
||||
if (NS_WARN_IF(!interfaces)) {
|
||||
return false;
|
||||
}
|
||||
bool ok =
|
||||
JS_DefineProperty(aCx, components, "interfaces", interfaces,
|
||||
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Define a bunch of shims from the Ci.nsIDOMFoo to window.Foo for DOM
|
||||
// interfaces with constants.
|
||||
for (uint32_t i = 0; i < ArrayLength(kInterfaceShimMap); ++i) {
|
||||
|
||||
// Grab the names from the table.
|
||||
const char *geckoName = kInterfaceShimMap[i].geckoName;
|
||||
const char *domName = kInterfaceShimMap[i].domName;
|
||||
|
||||
// Look up the appopriate interface object on the global.
|
||||
JS::Rooted<JS::Value> v(aCx, JS::UndefinedValue());
|
||||
ok = JS_GetProperty(aCx, aGlobal, domName, &v);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
return false;
|
||||
}
|
||||
if (!v.isObject()) {
|
||||
NS_WARNING("Unable to find interface object on global");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Define the shim on the interfaces object.
|
||||
ok = JS_DefineProperty(aCx, interfaces, geckoName, v,
|
||||
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FillPropertyDescriptor(aDesc, aGlobal, JS::ObjectValue(*components), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef RELEASE_OR_BETA
|
||||
#define USE_CONTROLLERS_SHIM
|
||||
#endif
|
||||
|
||||
#ifdef USE_CONTROLLERS_SHIM
|
||||
static const JSClass ControllersShimClass = {
|
||||
"Controllers", 0
|
||||
};
|
||||
static const JSClass XULControllersShimClass = {
|
||||
"XULControllers", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsGlobalWindowInner::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
JS::Handle<jsid> aId,
|
||||
|
@ -2888,11 +3023,44 @@ nsGlobalWindowInner::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
|||
return true;
|
||||
}
|
||||
|
||||
nsresult rv = nsWindowSH::GlobalResolve(this, aCx, aObj, aId, aDesc);
|
||||
if (NS_FAILED(rv)) {
|
||||
return Throw(aCx, rv);
|
||||
// We support a cut-down Components.interfaces in case websites are
|
||||
// using Components.interfaces.nsIFoo.CONSTANT_NAME for the ones
|
||||
// that have constants.
|
||||
if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
|
||||
return ResolveComponentsShim(aCx, aObj, aDesc);
|
||||
}
|
||||
|
||||
// We also support a "window.controllers" thing; apparently some
|
||||
// sites use it for browser-sniffing. See bug 1010577.
|
||||
#ifdef USE_CONTROLLERS_SHIM
|
||||
// Note: We use |aObj| rather than |this| to get the principal here, because
|
||||
// this is called during Window setup when the Document isn't necessarily
|
||||
// hooked up yet.
|
||||
if ((aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS) ||
|
||||
aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS_CLASS)) &&
|
||||
!xpc::IsXrayWrapper(aObj) &&
|
||||
!nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(aObj)))
|
||||
{
|
||||
if (GetExtantDoc()) {
|
||||
GetExtantDoc()->WarnOnceAbout(nsIDocument::eWindow_Cc_ontrollers);
|
||||
}
|
||||
const JSClass* clazz;
|
||||
if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS)) {
|
||||
clazz = &XULControllersShimClass;
|
||||
} else {
|
||||
clazz = &ControllersShimClass;
|
||||
}
|
||||
MOZ_ASSERT(JS_IsGlobalObject(aObj));
|
||||
JS::Rooted<JSObject*> shim(cx, JS_NewObject(cx, clazz));
|
||||
if (NS_WARN_IF(!shim)) {
|
||||
return false;
|
||||
}
|
||||
FillPropertyDescriptor(aDesc, aObj, JS::ObjectValue(*shim),
|
||||
/* readOnly = */ false);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2917,20 +3085,7 @@ nsGlobalWindowInner::MayResolve(jsid aId)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (WebIDLGlobalNameHash::MayResolve(aId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsScriptNameSpaceManager *nameSpaceManager = PeekNameSpaceManager();
|
||||
if (!nameSpaceManager) {
|
||||
// Really shouldn't happen. Fail safe.
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAutoString name;
|
||||
AssignJSFlatString(name, JSID_TO_FLAT_STRING(aId));
|
||||
|
||||
return nameSpaceManager->LookupName(name);
|
||||
return WebIDLGlobalNameHash::MayResolve(aId);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2942,10 +3097,8 @@ nsGlobalWindowInner::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aName
|
|||
// two codepaths. The ones coming from the WebIDLGlobalNameHash will end up
|
||||
// in the DefineConstructor function in BindingUtils, which always defines
|
||||
// things as non-enumerable. The ones coming from the script namespace
|
||||
// manager get defined by nsDOMClassInfo::PostCreatePrototype calling
|
||||
// ResolvePrototype and using the resulting descriptot to define the
|
||||
// property. ResolvePrototype always passes 0 to the FillPropertyDescriptor
|
||||
// for the property attributes, so all those are non-enumerable as well.
|
||||
// manager get defined by our resolve hook using FillPropertyDescriptor with
|
||||
// 0 for the property attributes, so non-enumerable as well.
|
||||
//
|
||||
// So in the aEnumerableOnly case we have nothing to do.
|
||||
return;
|
||||
|
@ -2954,43 +3107,24 @@ nsGlobalWindowInner::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aName
|
|||
// "Components" is marked as enumerable but only resolved on demand :-/.
|
||||
//aNames.AppendElement(NS_LITERAL_STRING("Components"));
|
||||
|
||||
nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager();
|
||||
if (nameSpaceManager) {
|
||||
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
|
||||
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
|
||||
|
||||
// There are actually two ways we can get called here: For normal
|
||||
// enumeration or for Xray enumeration. In the latter case, we want to
|
||||
// return all possible WebIDL names, because we don't really support
|
||||
// deleting these names off our Xray; trying to resolve them will just make
|
||||
// them come back. In the former case, we want to avoid returning deleted
|
||||
// names. But the JS engine already knows about the non-deleted
|
||||
// already-resolved names, so we can just return the so-far-unresolved ones.
|
||||
//
|
||||
// We can tell which case we're in by whether aCx is in our wrapper's
|
||||
// compartment. If not, we're in the Xray case.
|
||||
WebIDLGlobalNameHash::NameType nameType =
|
||||
js::IsObjectInContextCompartment(wrapper, aCx) ?
|
||||
WebIDLGlobalNameHash::UnresolvedNamesOnly :
|
||||
WebIDLGlobalNameHash::AllNames;
|
||||
if (!WebIDLGlobalNameHash::GetNames(aCx, wrapper, nameType, aNames)) {
|
||||
aRv.NoteJSContextException(aCx);
|
||||
}
|
||||
|
||||
for (auto i = nameSpaceManager->GlobalNameIter(); !i.Done(); i.Next()) {
|
||||
const GlobalNameMapEntry* entry = i.Get();
|
||||
if (nsWindowSH::NameStructEnabled(aCx, this, entry->mKey,
|
||||
entry->mGlobalName)) {
|
||||
// Just append all of these; even if they get deleted our resolve hook
|
||||
// just goes ahead and recreates them.
|
||||
JSString* str = JS_AtomizeUCStringN(aCx,
|
||||
entry->mKey.BeginReading(),
|
||||
entry->mKey.Length());
|
||||
if (!str || !aNames.append(NON_INTEGER_ATOM_TO_JSID(str))) {
|
||||
aRv.NoteJSContextException(aCx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// There are actually two ways we can get called here: For normal
|
||||
// enumeration or for Xray enumeration. In the latter case, we want to
|
||||
// return all possible WebIDL names, because we don't really support
|
||||
// deleting these names off our Xray; trying to resolve them will just make
|
||||
// them come back. In the former case, we want to avoid returning deleted
|
||||
// names. But the JS engine already knows about the non-deleted
|
||||
// already-resolved names, so we can just return the so-far-unresolved ones.
|
||||
//
|
||||
// We can tell which case we're in by whether aCx is in our wrapper's
|
||||
// compartment. If not, we're in the Xray case.
|
||||
WebIDLGlobalNameHash::NameType nameType =
|
||||
js::IsObjectInContextCompartment(wrapper, aCx) ?
|
||||
WebIDLGlobalNameHash::UnresolvedNamesOnly :
|
||||
WebIDLGlobalNameHash::AllNames;
|
||||
if (!WebIDLGlobalNameHash::GetNames(aCx, wrapper, nameType, aNames)) {
|
||||
aRv.NoteJSContextException(aCx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7707,8 +7841,7 @@ nsGlobalWindowInner::GetExternal(ErrorResult& aRv)
|
|||
{
|
||||
#ifdef HAVE_SIDEBAR
|
||||
if (!mExternal) {
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> jsImplObj(cx);
|
||||
JS::Rooted<JSObject*> jsImplObj(RootingCx());
|
||||
ConstructJSImplementation("@mozilla.org/sidebar;1", this, &jsImplObj, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
|
|
|
@ -110,6 +110,7 @@ enum class ImageBitmapFormat : uint8_t;
|
|||
class IdleRequest;
|
||||
class IdleRequestCallback;
|
||||
class IncrementalRunnable;
|
||||
class InstallTriggerImpl;
|
||||
class IntlUtils;
|
||||
class Location;
|
||||
class MediaQueryList;
|
||||
|
@ -989,6 +990,8 @@ public:
|
|||
|
||||
bool ShouldReportForServiceWorkerScope(const nsAString& aScope);
|
||||
|
||||
already_AddRefed<mozilla::dom::InstallTriggerImpl> GetInstallTrigger();
|
||||
|
||||
void UpdateTopInnerWindow();
|
||||
|
||||
virtual bool IsInSyncOperation() override
|
||||
|
@ -1266,6 +1269,10 @@ private:
|
|||
// Fire the JS engine's onNewGlobalObject hook. Only used on inner windows.
|
||||
void FireOnNewGlobalObject();
|
||||
|
||||
// Helper for resolving the components shim.
|
||||
bool ResolveComponentsShim(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
JS::MutableHandle<JS::PropertyDescriptor> aDesc);
|
||||
|
||||
// nsPIDOMWindow{Inner,Outer} should be able to see these helper methods.
|
||||
friend class nsPIDOMWindowInner;
|
||||
friend class nsPIDOMWindowOuter;
|
||||
|
@ -1387,6 +1394,7 @@ protected:
|
|||
// forward declared here means that ~nsGlobalWindow wouldn't compile because
|
||||
// it wouldn't see the ~External function's declaration.
|
||||
nsCOMPtr<nsISupports> mExternal;
|
||||
RefPtr<mozilla::dom::InstallTriggerImpl> mInstallTrigger;
|
||||
|
||||
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
||||
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsIScriptTimeoutHandler.h"
|
||||
#include "nsITimeoutHandler.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "nsISlowScriptDebug.h"
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "nsWindowSizes.h"
|
||||
|
@ -67,7 +66,6 @@
|
|||
#include "js/Wrapper.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -640,7 +638,7 @@ nsOuterWindowProxy::get(JSContext *cx, JS::Handle<JSObject*> proxy,
|
|||
JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JS::Value> vp) const
|
||||
{
|
||||
if (id == nsDOMClassInfo::sWrappedJSObject_id &&
|
||||
if (id == GetJSIDByIndex(cx, XPCJSContext::IDX_WRAPPED_JSOBJECT) &&
|
||||
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
|
||||
vp.set(JS::ObjectValue(*proxy));
|
||||
return true;
|
||||
|
|
|
@ -1008,31 +1008,41 @@ inline nsIContent* nsINode::AsContent()
|
|||
return static_cast<nsIContent*>(this);
|
||||
}
|
||||
|
||||
#define NS_IMPL_FROMCONTENT_HELPER(_class, _check) \
|
||||
static _class* FromContent(nsINode* aContent) \
|
||||
{ \
|
||||
return aContent->_check ? static_cast<_class*>(aContent) : nullptr; \
|
||||
} \
|
||||
static const _class* FromContent(const nsINode* aContent) \
|
||||
{ \
|
||||
return aContent->_check ? static_cast<const _class*>(aContent) : nullptr; \
|
||||
} \
|
||||
static _class* FromContentOrNull(nsINode* aContent) \
|
||||
{ \
|
||||
return aContent ? FromContent(aContent) : nullptr; \
|
||||
} \
|
||||
static const _class* FromContentOrNull(const nsINode* aContent) \
|
||||
{ \
|
||||
return aContent ? FromContent(aContent) : nullptr; \
|
||||
// Some checks are faster to do on nsIContent or Element than on
|
||||
// nsINode, so spit out FromNode versions taking those types too.
|
||||
#define NS_IMPL_FROMNODE_HELPER(_class, _check) \
|
||||
template<typename ArgType> \
|
||||
static _class* FromNode(ArgType&& aNode) \
|
||||
{ \
|
||||
/* We need the double-cast in case aNode is a smartptr. Those */ \
|
||||
/* can cast to superclasses of the type they're templated on, */ \
|
||||
/* but not directly to subclasses. */ \
|
||||
return aNode->_check ? \
|
||||
static_cast<_class*>(static_cast<nsINode*>(aNode)) : nullptr; \
|
||||
} \
|
||||
template<typename ArgType> \
|
||||
static _class* FromNodeOrNull(ArgType&& aNode) \
|
||||
{ \
|
||||
return aNode ? FromNode(aNode) : nullptr; \
|
||||
} \
|
||||
template<typename ArgType> \
|
||||
static const _class* FromNode(const ArgType* aNode) \
|
||||
{ \
|
||||
return aNode->_check ? static_cast<const _class*>(aNode) : nullptr; \
|
||||
} \
|
||||
template<typename ArgType> \
|
||||
static const _class* FromNodeOrNull(const ArgType* aNode) \
|
||||
{ \
|
||||
return aNode ? FromNode(aNode) : nullptr; \
|
||||
}
|
||||
|
||||
#define NS_IMPL_FROMCONTENT(_class, _nsid) \
|
||||
NS_IMPL_FROMCONTENT_HELPER(_class, IsInNamespace(_nsid))
|
||||
#define NS_IMPL_FROMNODE(_class, _nsid) \
|
||||
NS_IMPL_FROMNODE_HELPER(_class, IsInNamespace(_nsid))
|
||||
|
||||
#define NS_IMPL_FROMCONTENT_WITH_TAG(_class, _nsid, _tag) \
|
||||
NS_IMPL_FROMCONTENT_HELPER(_class, NodeInfo()->Equals(nsGkAtoms::_tag, _nsid))
|
||||
#define NS_IMPL_FROMNODE_WITH_TAG(_class, _nsid, _tag) \
|
||||
NS_IMPL_FROMNODE_HELPER(_class, NodeInfo()->Equals(nsGkAtoms::_tag, _nsid))
|
||||
|
||||
#define NS_IMPL_FROMCONTENT_HTML_WITH_TAG(_class, _tag) \
|
||||
NS_IMPL_FROMCONTENT_WITH_TAG(_class, kNameSpaceID_XHTML, _tag)
|
||||
#define NS_IMPL_FROMNODE_HTML_WITH_TAG(_class, _tag) \
|
||||
NS_IMPL_FROMNODE_WITH_TAG(_class, kNameSpaceID_XHTML, _tag)
|
||||
|
||||
#endif /* nsIContent_h___ */
|
||||
|
|
|
@ -95,7 +95,7 @@ GetFlattenedTreeParentNode(const nsINode* aNode)
|
|||
}
|
||||
|
||||
if (parentAsContent->IsInShadowTree()) {
|
||||
if (auto* slot = mozilla::dom::HTMLSlotElement::FromContent(parentAsContent)) {
|
||||
if (auto* slot = mozilla::dom::HTMLSlotElement::FromNode(parentAsContent)) {
|
||||
// If the assigned nodes list is empty, we're fallback content which is
|
||||
// active, otherwise we are not part of the flat tree.
|
||||
return slot->AssignedNodes().IsEmpty()
|
||||
|
|
|
@ -1,236 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsFrameLoader;
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
interface nsIFrame;
|
||||
interface nsSubDocumentFrame;
|
||||
interface nsIMessageSender;
|
||||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
interface nsITabParent;
|
||||
interface nsILoadContext;
|
||||
interface nsIPrintSettings;
|
||||
interface nsIWebProgressListener;
|
||||
|
||||
[builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the docshell from the frame loader.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Get this frame loader's TabParent, if it has a remote frame. Otherwise,
|
||||
* returns null.
|
||||
*/
|
||||
readonly attribute nsITabParent tabParent;
|
||||
|
||||
/**
|
||||
* Get an nsILoadContext for the top-level docshell. For remote
|
||||
* frames, a shim is returned that contains private browsing and app
|
||||
* information.
|
||||
*/
|
||||
readonly attribute nsILoadContext loadContext;
|
||||
|
||||
/**
|
||||
* Start loading the frame. This method figures out what to load
|
||||
* from the owner content in the frame loader.
|
||||
*/
|
||||
void loadFrame(in boolean originalSrc);
|
||||
|
||||
/**
|
||||
* Loads the specified URI in this frame. Behaves identically to loadFrame,
|
||||
* except that this method allows specifying the URI to load.
|
||||
*/
|
||||
void loadURI(in nsIURI aURI, in boolean originalSrc);
|
||||
|
||||
/**
|
||||
* Adds a blocking promise for the current cross process navigation.
|
||||
* This method can only be called while the "BrowserWillChangeProcess" event
|
||||
* is being fired.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void addProcessChangeBlockingPromise(in jsval aPromise);
|
||||
|
||||
/**
|
||||
* Destroy the frame loader and everything inside it. This will
|
||||
* clear the weak owner content reference.
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* Find out whether the loader's frame is at too great a depth in
|
||||
* the frame tree. This can be used to decide what operations may
|
||||
* or may not be allowed on the loader's docshell.
|
||||
*/
|
||||
readonly attribute boolean depthTooGreat;
|
||||
|
||||
/**
|
||||
* Updates the position and size of the subdocument loaded by this frameloader.
|
||||
*
|
||||
* @param aIFrame The nsIFrame for the content node that owns this frameloader
|
||||
*/
|
||||
[noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame);
|
||||
|
||||
/**
|
||||
* Activate remote frame.
|
||||
* Throws an exception with non-remote frames.
|
||||
*/
|
||||
void activateRemoteFrame();
|
||||
|
||||
/**
|
||||
* Deactivate remote frame.
|
||||
* Throws an exception with non-remote frames.
|
||||
*/
|
||||
void deactivateRemoteFrame();
|
||||
|
||||
/**
|
||||
* @see nsIDOMWindowUtils sendMouseEvent.
|
||||
*/
|
||||
void sendCrossProcessMouseEvent(in AString aType,
|
||||
in float aX,
|
||||
in float aY,
|
||||
in long aButton,
|
||||
in long aClickCount,
|
||||
in long aModifiers,
|
||||
[optional] in boolean aIgnoreRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client (remote frame) to parent.
|
||||
*/
|
||||
void activateFrameEvent(in AString aType, in boolean capture);
|
||||
|
||||
// Note, when frameloaders are swapped, also messageManagers are swapped.
|
||||
readonly attribute nsIMessageSender messageManager;
|
||||
|
||||
/**
|
||||
* Request that the next time a remote layer transaction has been
|
||||
* received by the Compositor, a MozAfterRemoteFrame event be sent
|
||||
* to the window.
|
||||
*/
|
||||
void requestNotifyAfterRemotePaint();
|
||||
|
||||
/**
|
||||
* Close the window through the ownerElement.
|
||||
*/
|
||||
void requestFrameLoaderClose();
|
||||
|
||||
/**
|
||||
* Print the current document.
|
||||
*
|
||||
* @param aOuterWindowID the ID of the outer window to print
|
||||
* @param aPrintSettings optional print settings to use; printSilent can be
|
||||
* set to prevent prompting.
|
||||
* @param aProgressListener optional print progress listener.
|
||||
*/
|
||||
void print(in unsigned long long aOuterWindowID,
|
||||
in nsIPrintSettings aPrintSettings,
|
||||
in nsIWebProgressListener aProgressListener);
|
||||
|
||||
/**
|
||||
* The default event mode automatically forwards the events
|
||||
* handled in EventStateManager::HandleCrossProcessEvent to
|
||||
* the child content process when these events are targeted to
|
||||
* the remote browser element.
|
||||
*
|
||||
* Used primarly for input events (mouse, keyboard)
|
||||
*/
|
||||
const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
|
||||
|
||||
/**
|
||||
* With this event mode, it's the application's responsability to
|
||||
* convert and forward events to the content process
|
||||
*/
|
||||
const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
|
||||
|
||||
attribute unsigned long eventMode;
|
||||
|
||||
/**
|
||||
* If false, then the subdocument is not clipped to its CSS viewport, and the
|
||||
* subdocument's viewport scrollbar(s) are not rendered.
|
||||
* Defaults to true.
|
||||
*/
|
||||
attribute boolean clipSubdocument;
|
||||
|
||||
/**
|
||||
* If false, then the subdocument's scroll coordinates will not be clamped
|
||||
* to their scroll boundaries.
|
||||
* Defaults to true.
|
||||
*/
|
||||
attribute boolean clampScrollPosition;
|
||||
|
||||
/**
|
||||
* The element which owns this frame loader.
|
||||
*
|
||||
* For example, if this is a frame loader for an <iframe>, this attribute
|
||||
* returns the iframe element.
|
||||
*/
|
||||
readonly attribute nsIDOMElement ownerElement;
|
||||
|
||||
|
||||
/**
|
||||
* Cached childID of the ContentParent owning the TabParent in this frame
|
||||
* loader. This can be used to obtain the childID after the TabParent died.
|
||||
*/
|
||||
readonly attribute unsigned long long childID;
|
||||
|
||||
/**
|
||||
* Find out whether the owner content really is a mozbrowser. <xul:browser>
|
||||
* is not considered to be a mozbrowser frame.
|
||||
*/
|
||||
readonly attribute boolean ownerIsMozBrowserFrame;
|
||||
|
||||
/**
|
||||
* The last known width of the frame. Reading this property will not trigger
|
||||
* a reflow, and therefore may not reflect the current state of things. It
|
||||
* should only be used in asynchronous APIs where values are not guaranteed
|
||||
* to be up-to-date when received.
|
||||
*/
|
||||
readonly attribute unsigned long lazyWidth;
|
||||
|
||||
/**
|
||||
* The last known height of the frame. Reading this property will not trigger
|
||||
* a reflow, and therefore may not reflect the current state of things. It
|
||||
* should only be used in asynchronous APIs where values are not guaranteed
|
||||
* to be up-to-date when received.
|
||||
*/
|
||||
readonly attribute unsigned long lazyHeight;
|
||||
|
||||
/**
|
||||
* Is `true` if the frameloader is dead (destroy has been called on it)
|
||||
*/
|
||||
[infallible] readonly attribute boolean isDead;
|
||||
};
|
||||
|
||||
%{C++
|
||||
class nsFrameLoader;
|
||||
%}
|
||||
|
||||
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
|
||||
|
||||
[scriptable, uuid(adc1b3ba-8deb-4943-8045-e6de0044f2ce)]
|
||||
interface nsIFrameLoaderOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* The frame loader owned by this nsIFrameLoaderOwner
|
||||
*/
|
||||
[binaryname(FrameLoaderXPCOM)] readonly attribute nsIFrameLoader frameLoader;
|
||||
[noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();
|
||||
|
||||
/**
|
||||
* This method is used internally by SwapFrameLoaders to set the frame loader
|
||||
* on the target nsFrameLoader.
|
||||
*
|
||||
* Avoid using this method outside of that context, and instead prefer using
|
||||
* SwapFrameLoaders.
|
||||
*/
|
||||
[noscript, notxpcom] void
|
||||
internalSetFrameLoader(in nsIFrameLoader aNewFrameLoader);
|
||||
};
|
|
@ -0,0 +1,37 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsFrameLoader;
|
||||
|
||||
%{C++
|
||||
class nsFrameLoader;
|
||||
%}
|
||||
|
||||
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
|
||||
|
||||
// We define a "native" type for nsFrameLoader so that the rust xpidl
|
||||
// codegen doesn't try to do anything with it.
|
||||
[ptr] native nativeFrameLoader(nsFrameLoader);
|
||||
|
||||
[scriptable, builtinclass, uuid(adc1b3ba-8deb-4943-8045-e6de0044f2ce)]
|
||||
interface nsIFrameLoaderOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* The frame loader owned by this nsIFrameLoaderOwner
|
||||
*/
|
||||
[noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();
|
||||
|
||||
/**
|
||||
* This method is used internally by SwapFrameLoaders to set the frame loader
|
||||
* on the target nsFrameLoader.
|
||||
*
|
||||
* Avoid using this method outside of that context, and instead prefer using
|
||||
* SwapFrameLoaders.
|
||||
*/
|
||||
[noscript, notxpcom] void
|
||||
internalSetFrameLoader(in nativeFrameLoader aNewFrameLoader);
|
||||
};
|
|
@ -9,8 +9,12 @@ interface mozIDOMWindowProxy;
|
|||
interface nsIDocShell;
|
||||
interface nsIContent;
|
||||
interface nsIEventTarget;
|
||||
interface nsIFrameLoader;
|
||||
interface nsIPrincipal;
|
||||
interface nsFrameLoader;
|
||||
|
||||
// We define a "native" type for nsFrameLoader so that the rust xpidl
|
||||
// codegen doesn't try to do anything with it.
|
||||
native nativeFrameLoader(nsFrameLoader*);
|
||||
|
||||
/**
|
||||
* Message managers provide a way for chrome-privileged JS code to
|
||||
|
@ -417,7 +421,7 @@ interface nsIContentFrameMessageManager : nsIMessageManagerGlobal
|
|||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
[notxpcom] void cacheFrameLoader(in nsIFrameLoader aFrameLoader);
|
||||
[notxpcom] void cacheFrameLoader(in nativeFrameLoader aFrameLoader);
|
||||
};
|
||||
|
||||
[uuid(6d12e467-2446-46db-9965-e4e93cb87ca5)]
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsIScriptNameSpaceManager_h__
|
||||
#define nsIScriptNameSpaceManager_h__
|
||||
|
||||
#define JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY \
|
||||
"JavaScript-global-constructor"
|
||||
|
||||
#define JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY \
|
||||
"JavaScript-global-property"
|
||||
|
||||
// a global property that is only accessible to privileged script
|
||||
#define JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY \
|
||||
"JavaScript-global-privileged-property"
|
||||
|
||||
#endif /* nsIScriptNameSpaceManager_h__ */
|
|
@ -39,7 +39,7 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx,
|
|||
if (mChromeMessageManager) {
|
||||
SameProcessCpowHolder cpows(JS::RootingContext::get(aCx), aCpows);
|
||||
RefPtr<nsFrameMessageManager> mm = mChromeMessageManager;
|
||||
nsCOMPtr<nsIFrameLoader> fl = GetFrameLoader();
|
||||
RefPtr<nsFrameLoader> fl = GetFrameLoader();
|
||||
mm->ReceiveMessage(mOwner, fl, aMessage, true, &aData, &cpows, aPrincipal,
|
||||
aRetVal);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
virtual nsresult HandleMessage() override
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoader> fl = mTabChild->GetFrameLoader();
|
||||
RefPtr<nsFrameLoader> fl = mTabChild->GetFrameLoader();
|
||||
ReceiveMessage(mTabChild->mOwner, fl, mTabChild->mChromeMessageManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ nsInProcessTabChildGlobal::WrapGlobalObject(JSContext* aCx,
|
|||
}
|
||||
|
||||
void
|
||||
nsInProcessTabChildGlobal::CacheFrameLoader(nsIFrameLoader* aFrameLoader)
|
||||
nsInProcessTabChildGlobal::CacheFrameLoader(nsFrameLoader* aFrameLoader)
|
||||
{
|
||||
mFrameLoader = aFrameLoader;
|
||||
}
|
||||
|
@ -382,11 +382,11 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL, bool aRunInGlo
|
|||
mLoadingScript = tmp;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFrameLoader>
|
||||
already_AddRefed<nsFrameLoader>
|
||||
nsInProcessTabChildGlobal::GetFrameLoader()
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(mOwner);
|
||||
nsCOMPtr<nsIFrameLoader> fl = owner ? owner->GetFrameLoader() : nullptr;
|
||||
RefPtr<nsFrameLoader> fl = owner ? owner->GetFrameLoader() : nullptr;
|
||||
if (!fl) {
|
||||
fl = mFrameLoader;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
return GetWrapper();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFrameLoader> GetFrameLoader();
|
||||
already_AddRefed<nsFrameLoader> GetFrameLoader();
|
||||
|
||||
protected:
|
||||
virtual ~nsInProcessTabChildGlobal();
|
||||
|
@ -140,7 +140,7 @@ protected:
|
|||
// We keep a strong reference to the frameloader after we've started
|
||||
// teardown. This allows us to dispatch message manager messages during this
|
||||
// time.
|
||||
nsCOMPtr<nsIFrameLoader> mFrameLoader;
|
||||
RefPtr<nsFrameLoader> mFrameLoader;
|
||||
public:
|
||||
nsIContent* mOwner;
|
||||
nsFrameMessageManager* mChromeMessageManager;
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "nsIObjectOutputStream.h"
|
||||
#include "WrapperFactory.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/MainThreadIdlePeriod.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
@ -199,7 +198,6 @@ static bool sNeedsFullGC = false;
|
|||
static bool sNeedsGCAfterCC = false;
|
||||
static bool sIncrementalCC = false;
|
||||
static int32_t sActiveIntersliceGCBudget = 5; // ms;
|
||||
static nsScriptNameSpaceManager *gNameSpaceManager;
|
||||
|
||||
static PRTime sFirstCollectionTime;
|
||||
|
||||
|
@ -2467,7 +2465,6 @@ mozilla::dom::StartupJSEnvironment()
|
|||
sNeedsFullCC = false;
|
||||
sNeedsFullGC = true;
|
||||
sNeedsGCAfterCC = false;
|
||||
gNameSpaceManager = nullptr;
|
||||
sIsInitialized = false;
|
||||
sDidShutdown = false;
|
||||
sShuttingDown = false;
|
||||
|
@ -2805,36 +2802,11 @@ nsJSContext::EnsureStatics()
|
|||
sIsInitialized = true;
|
||||
}
|
||||
|
||||
nsScriptNameSpaceManager*
|
||||
mozilla::dom::GetNameSpaceManager()
|
||||
{
|
||||
if (sDidShutdown)
|
||||
return nullptr;
|
||||
|
||||
if (!gNameSpaceManager) {
|
||||
gNameSpaceManager = new nsScriptNameSpaceManager;
|
||||
NS_ADDREF(gNameSpaceManager);
|
||||
|
||||
nsresult rv = gNameSpaceManager->Init();
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
}
|
||||
|
||||
return gNameSpaceManager;
|
||||
}
|
||||
|
||||
nsScriptNameSpaceManager*
|
||||
mozilla::dom::PeekNameSpaceManager()
|
||||
{
|
||||
return gNameSpaceManager;
|
||||
}
|
||||
|
||||
void
|
||||
mozilla::dom::ShutdownJSEnvironment()
|
||||
{
|
||||
KillTimers();
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
sShuttingDown = true;
|
||||
sDidShutdown = true;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "xpcpublic.h"
|
||||
|
||||
class nsICycleCollectorListener;
|
||||
class nsScriptNameSpaceManager;
|
||||
class nsIDocShell;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -168,12 +167,6 @@ namespace dom {
|
|||
void StartupJSEnvironment();
|
||||
void ShutdownJSEnvironment();
|
||||
|
||||
// Get the NameSpaceManager, creating if necessary
|
||||
nsScriptNameSpaceManager* GetNameSpaceManager();
|
||||
|
||||
// Peek the NameSpaceManager, without creating it.
|
||||
nsScriptNameSpaceManager* PeekNameSpaceManager();
|
||||
|
||||
// Runnable that's used to do async error reporting
|
||||
class AsyncErrorReporter final : public mozilla::Runnable
|
||||
{
|
||||
|
|
|
@ -560,7 +560,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
|
||||
if (wasRegistered && oldDoc != newDoc) {
|
||||
nsIContent* content = aNode->AsContent();
|
||||
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
|
||||
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
|
||||
mediaElem->NotifyOwnerDocumentActivityChanged();
|
||||
}
|
||||
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));
|
||||
|
|
|
@ -582,8 +582,9 @@ nsObjectLoadingContent::SetupDocShell(nsIURI* aRecursionCheckURI)
|
|||
if (aRecursionCheckURI) {
|
||||
nsresult rv = mFrameLoader->CheckForRecursiveLoad(aRecursionCheckURI);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mFrameLoader->GetDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) {
|
||||
IgnoredErrorResult result;
|
||||
docShell = mFrameLoader->GetDocShell(result);
|
||||
if (result.Failed()) {
|
||||
NS_NOTREACHED("Could not get DocShell from mFrameLoader?");
|
||||
}
|
||||
} else {
|
||||
|
@ -889,7 +890,7 @@ nsObjectLoadingContent::GetNestedParams(nsTArray<MozPluginParameter>& aParams)
|
|||
nsCOMPtr<nsIContent> parent = element->GetParent();
|
||||
RefPtr<HTMLObjectElement> objectElement;
|
||||
while (!objectElement && parent) {
|
||||
objectElement = HTMLObjectElement::FromContent(parent);
|
||||
objectElement = HTMLObjectElement::FromNode(parent);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
|
@ -1122,13 +1123,6 @@ nsObjectLoadingContent::OnDataAvailable(nsIRequest *aRequest,
|
|||
}
|
||||
|
||||
// nsIFrameLoaderOwner
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetFrameLoaderXPCOM(nsIFrameLoader** aFrameLoader)
|
||||
{
|
||||
NS_IF_ADDREF(*aFrameLoader = mFrameLoader);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<nsFrameLoader>)
|
||||
nsObjectLoadingContent::GetFrameLoader()
|
||||
{
|
||||
|
@ -1143,7 +1137,7 @@ nsObjectLoadingContent::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, mozilla:
|
|||
}
|
||||
|
||||
void
|
||||
nsObjectLoadingContent::InternalSetFrameLoader(nsIFrameLoader* aNewFrameLoader)
|
||||
nsObjectLoadingContent::InternalSetFrameLoader(nsFrameLoader* aNewFrameLoader)
|
||||
{
|
||||
MOZ_CRASH("You shouldn't be calling this function, it doesn't make any sense on this type.");
|
||||
}
|
||||
|
@ -2578,8 +2572,7 @@ void
|
|||
nsObjectLoadingContent::Traverse(nsObjectLoadingContent *tmp,
|
||||
nsCycleCollectionTraversalCallback &cb)
|
||||
{
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader");
|
||||
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(tmp->mFrameLoader));
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameLoader);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2969,10 +2962,10 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
|||
aType = eFallbackAlternate;
|
||||
}
|
||||
if (thisIsObject) {
|
||||
if (auto embed = HTMLEmbedElement::FromContent(child)) {
|
||||
if (auto embed = HTMLEmbedElement::FromNode(child)) {
|
||||
embed->StartObjectLoad(true, true);
|
||||
skipChildDescendants = true;
|
||||
} else if (auto object = HTMLObjectElement::FromContent(child)) {
|
||||
} else if (auto object = HTMLObjectElement::FromNode(child)) {
|
||||
object->StartObjectLoad(true, true);
|
||||
skipChildDescendants = true;
|
||||
}
|
||||
|
@ -3802,7 +3795,7 @@ nsObjectLoadingContent::BlockEmbedOrObjectContentLoading()
|
|||
// If we have an ancestor that is an object with a source, it'll have an
|
||||
// associated displayed type. If that type is not null, don't load content
|
||||
// for the embed.
|
||||
if (HTMLObjectElement* object = HTMLObjectElement::FromContent(parent)) {
|
||||
if (HTMLObjectElement* object = HTMLObjectElement::FromNode(parent)) {
|
||||
uint32_t type = object->DisplayedType();
|
||||
if (type != eType_Null) {
|
||||
return true;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "nsIRunnable.h"
|
||||
#include "nsIThreadInternal.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIFrameLoaderOwner.h"
|
||||
|
||||
class nsAsyncInstantiateEvent;
|
||||
class nsStopPluginRunnable;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/BasePrincipal.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIFrameLoaderOwner.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -2288,7 +2288,7 @@ nsRange::CutContents(DocumentFragment** aFragment)
|
|||
// XXX_kin: We need to also handle ProcessingInstruction
|
||||
// XXX_kin: according to the spec.
|
||||
|
||||
if (auto charData = CharacterData::FromContent(node)) {
|
||||
if (auto charData = CharacterData::FromNode(node)) {
|
||||
uint32_t dataLength = 0;
|
||||
|
||||
if (node == startContainer) {
|
||||
|
@ -2725,7 +2725,7 @@ nsRange::CloneContents(ErrorResult& aRv)
|
|||
// XXX_kin: We need to also handle ProcessingInstruction
|
||||
// XXX_kin: according to the spec.
|
||||
|
||||
if (auto charData = CharacterData::FromContent(clone))
|
||||
if (auto charData = CharacterData::FromNode(clone))
|
||||
{
|
||||
if (node == mEnd.Container()) {
|
||||
// We only need the data before mEndOffset, so get rid of any
|
||||
|
|
|
@ -1,434 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "nsScriptNameSpaceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
#include "xptinfo.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#define NS_INTERFACE_PREFIX "nsI"
|
||||
#define NS_DOM_INTERFACE_PREFIX "nsIDOM"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static PLDHashNumber
|
||||
GlobalNameHashHashKey(const void *key)
|
||||
{
|
||||
const nsAString *str = static_cast<const nsAString *>(key);
|
||||
return HashString(*str);
|
||||
}
|
||||
|
||||
static bool
|
||||
GlobalNameHashMatchEntry(const PLDHashEntryHdr *entry, const void *key)
|
||||
{
|
||||
const GlobalNameMapEntry *e =
|
||||
static_cast<const GlobalNameMapEntry *>(entry);
|
||||
const nsAString *str = static_cast<const nsAString *>(key);
|
||||
|
||||
return str->Equals(e->mKey);
|
||||
}
|
||||
|
||||
static void
|
||||
GlobalNameHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
GlobalNameMapEntry *e = static_cast<GlobalNameMapEntry *>(entry);
|
||||
|
||||
// An entry is being cleared, let the key (nsString) do its own
|
||||
// cleanup.
|
||||
e->mKey.~nsString();
|
||||
|
||||
// This will set e->mGlobalName.mType to
|
||||
// nsGlobalNameStruct::eTypeNotInitialized
|
||||
memset(&e->mGlobalName, 0, sizeof(nsGlobalNameStruct));
|
||||
}
|
||||
|
||||
static void
|
||||
GlobalNameHashInitEntry(PLDHashEntryHdr *entry, const void *key)
|
||||
{
|
||||
GlobalNameMapEntry *e = static_cast<GlobalNameMapEntry *>(entry);
|
||||
const nsAString *keyStr = static_cast<const nsAString *>(key);
|
||||
|
||||
// Initialize the key in the entry with placement new
|
||||
new (&e->mKey) nsString(*keyStr);
|
||||
|
||||
// This will set e->mGlobalName.mType to
|
||||
// nsGlobalNameStruct::eTypeNotInitialized
|
||||
memset(&e->mGlobalName, 0, sizeof(nsGlobalNameStruct));
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(
|
||||
nsScriptNameSpaceManager,
|
||||
nsIObserver,
|
||||
nsISupportsWeakReference,
|
||||
nsIMemoryReporter)
|
||||
|
||||
static const PLDHashTableOps hash_table_ops =
|
||||
{
|
||||
GlobalNameHashHashKey,
|
||||
GlobalNameHashMatchEntry,
|
||||
PLDHashTable::MoveEntryStub,
|
||||
GlobalNameHashClearEntry,
|
||||
GlobalNameHashInitEntry
|
||||
};
|
||||
|
||||
#define GLOBALNAME_HASHTABLE_INITIAL_LENGTH 32
|
||||
|
||||
nsScriptNameSpaceManager::nsScriptNameSpaceManager()
|
||||
: mGlobalNames(&hash_table_ops, sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH)
|
||||
{
|
||||
}
|
||||
|
||||
nsScriptNameSpaceManager::~nsScriptNameSpaceManager()
|
||||
{
|
||||
UnregisterWeakMemoryReporter(this);
|
||||
}
|
||||
|
||||
nsGlobalNameStruct *
|
||||
nsScriptNameSpaceManager::AddToHash(const char *aKey,
|
||||
const char16_t **aClassName)
|
||||
{
|
||||
NS_ConvertASCIItoUTF16 key(aKey);
|
||||
auto entry = static_cast<GlobalNameMapEntry*>(mGlobalNames.Add(&key, fallible));
|
||||
if (!entry) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebIDLGlobalNameHash::Remove(aKey, key.Length());
|
||||
|
||||
if (aClassName) {
|
||||
*aClassName = entry->mKey.get();
|
||||
}
|
||||
|
||||
return &entry->mGlobalName;
|
||||
}
|
||||
|
||||
void
|
||||
nsScriptNameSpaceManager::RemoveFromHash(const nsAString *aKey)
|
||||
{
|
||||
mGlobalNames.Remove(aKey);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
|
||||
const char *aCategory)
|
||||
{
|
||||
nsCOMPtr<nsISimpleEnumerator> e;
|
||||
nsresult rv = aCategoryManager->EnumerateCategory(aCategory,
|
||||
getter_AddRefs(e));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupports> entry;
|
||||
while (NS_SUCCEEDED(e->GetNext(getter_AddRefs(entry)))) {
|
||||
rv = AddCategoryEntryToHash(aCategoryManager, aCategory, entry);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::Init()
|
||||
{
|
||||
RegisterWeakMemoryReporter(this);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = FillHash(cm, JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = FillHash(cm, JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = FillHash(cm, JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Initial filling of the has table has been done.
|
||||
// Now, listen for changes.
|
||||
nsCOMPtr<nsIObserverService> serv =
|
||||
mozilla::services::GetObserverService();
|
||||
|
||||
if (serv) {
|
||||
serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID, true);
|
||||
serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID, true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsGlobalNameStruct*
|
||||
nsScriptNameSpaceManager::LookupName(const nsAString& aName,
|
||||
const char16_t **aClassName)
|
||||
{
|
||||
auto entry = static_cast<GlobalNameMapEntry*>(mGlobalNames.Search(&aName));
|
||||
|
||||
if (entry) {
|
||||
if (aClassName) {
|
||||
*aClassName = entry->mKey.get();
|
||||
}
|
||||
return &entry->mGlobalName;
|
||||
}
|
||||
|
||||
if (aClassName) {
|
||||
*aClassName = nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::RegisterClassName(const char *aClassName,
|
||||
int32_t aDOMClassInfoID,
|
||||
bool aPrivileged,
|
||||
bool aXBLAllowed,
|
||||
const char16_t **aResult)
|
||||
{
|
||||
if (!nsCRT::IsAscii(aClassName)) {
|
||||
NS_ERROR("Trying to register a non-ASCII class name");
|
||||
return NS_OK;
|
||||
}
|
||||
nsGlobalNameStruct *s = AddToHash(aClassName, aResult);
|
||||
NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (s->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If a external constructor is already defined with aClassName we
|
||||
// won't overwrite it.
|
||||
|
||||
if (s->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized,
|
||||
"Whaaa, JS environment name clash!");
|
||||
|
||||
s->mType = nsGlobalNameStruct::eTypeClassConstructor;
|
||||
s->mDOMClassInfoID = aDOMClassInfoID;
|
||||
s->mChromeOnly = aPrivileged;
|
||||
s->mAllowXBL = aXBLAllowed;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::RegisterClassProto(const char *aClassName,
|
||||
const nsIID *aConstructorProtoIID,
|
||||
bool *aFoundOld)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aConstructorProtoIID);
|
||||
|
||||
*aFoundOld = false;
|
||||
|
||||
nsGlobalNameStruct *s = AddToHash(aClassName);
|
||||
NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (s->mType != nsGlobalNameStruct::eTypeNotInitialized) {
|
||||
*aFoundOld = true;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
s->mType = nsGlobalNameStruct::eTypeClassProto;
|
||||
s->mIID = *aConstructorProtoIID;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::OperateCategoryEntryHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry,
|
||||
bool aRemove)
|
||||
{
|
||||
MOZ_ASSERT(aCategoryManager);
|
||||
// Get the type from the category name.
|
||||
// NOTE: we could have passed the type in FillHash() and guessed it in
|
||||
// Observe() but this way, we have only one place to update and this is
|
||||
// not performance sensitive.
|
||||
nsGlobalNameStruct::nametype type;
|
||||
if (strcmp(aCategory, JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY) == 0) {
|
||||
type = nsGlobalNameStruct::eTypeExternalConstructor;
|
||||
} else if (strcmp(aCategory, JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY) == 0 ||
|
||||
strcmp(aCategory, JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY) == 0) {
|
||||
type = nsGlobalNameStruct::eTypeProperty;
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsCString> strWrapper = do_QueryInterface(aEntry);
|
||||
|
||||
if (!strWrapper) {
|
||||
NS_WARNING("Category entry not an nsISupportsCString!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString categoryEntry;
|
||||
nsresult rv = strWrapper->GetData(categoryEntry);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We need to handle removal before calling GetCategoryEntry
|
||||
// because the category entry is already removed before we are
|
||||
// notified.
|
||||
if (aRemove) {
|
||||
NS_ConvertASCIItoUTF16 entry(categoryEntry);
|
||||
const nsGlobalNameStruct *s = LookupName(entry);
|
||||
// Verify mType so that this API doesn't remove names
|
||||
// registered by others.
|
||||
if (!s || s->mType != type) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RemoveFromHash(&entry);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString contractId;
|
||||
rv = aCategoryManager->GetCategoryEntry(aCategory, categoryEntry.get(),
|
||||
getter_Copies(contractId));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCID *cidPtr;
|
||||
rv = registrar->ContractIDToCID(contractId.get(), &cidPtr);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Bad contract id registed with the script namespace manager");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Copy CID onto the stack, so we can free it right away and avoid having
|
||||
// to add cleanup code at every exit point from this function.
|
||||
nsCID cid = *cidPtr;
|
||||
free(cidPtr);
|
||||
|
||||
nsGlobalNameStruct *s = AddToHash(categoryEntry.get());
|
||||
NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (s->mType == nsGlobalNameStruct::eTypeNotInitialized) {
|
||||
s->mType = type;
|
||||
s->mCID = cid;
|
||||
s->mChromeOnly =
|
||||
strcmp(aCategory, JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY) == 0;
|
||||
} else {
|
||||
NS_WARNING("Global script name not overwritten!");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry)
|
||||
{
|
||||
return OperateCategoryEntryHash(aCategoryManager, aCategory, aEntry,
|
||||
/* aRemove = */ false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::RemoveCategoryEntryFromHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry)
|
||||
{
|
||||
return OperateCategoryEntryHash(aCategoryManager, aCategory, aEntry,
|
||||
/* aRemove = */ true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!aData) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID)) {
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!cm) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return AddCategoryEntryToHash(cm, NS_ConvertUTF16toUTF8(aData).get(),
|
||||
aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID)) {
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!cm) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return RemoveCategoryEntryFromHash(cm, NS_ConvertUTF16toUTF8(aData).get(),
|
||||
aSubject);
|
||||
}
|
||||
|
||||
// TODO: we could observe NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID
|
||||
// but we are safe without it. See bug 600460.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(ScriptNameSpaceManagerMallocSizeOf)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptNameSpaceManager::CollectReports(
|
||||
nsIHandleReportCallback* aHandleReport, nsISupports* aData, bool aAnonymize)
|
||||
{
|
||||
MOZ_COLLECT_REPORT(
|
||||
"explicit/script-namespace-manager", KIND_HEAP, UNITS_BYTES,
|
||||
SizeOfIncludingThis(ScriptNameSpaceManagerMallocSizeOf),
|
||||
"Memory used for the script namespace manager.");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsScriptNameSpaceManager::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
n += mGlobalNames.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (auto iter = mGlobalNames.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto entry = static_cast<GlobalNameMapEntry*>(iter.Get());
|
||||
n += entry->SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsScriptNameSpaceManager_h__
|
||||
#define nsScriptNameSpaceManager_h__
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsID.h"
|
||||
#include "PLDHashTable.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
struct nsGlobalNameStruct
|
||||
{
|
||||
enum nametype {
|
||||
eTypeNotInitialized,
|
||||
eTypeProperty,
|
||||
eTypeExternalConstructor,
|
||||
eTypeClassConstructor,
|
||||
eTypeClassProto,
|
||||
} mType;
|
||||
|
||||
bool mChromeOnly : 1;
|
||||
bool mAllowXBL : 1;
|
||||
|
||||
union {
|
||||
int32_t mDOMClassInfoID; // eTypeClassConstructor
|
||||
nsIID mIID; // eTypeClassProto
|
||||
nsCID mCID; // All other types
|
||||
};
|
||||
};
|
||||
|
||||
class GlobalNameMapEntry : public PLDHashEntryHdr
|
||||
{
|
||||
public:
|
||||
// Our hash table ops don't care about the order of these members.
|
||||
nsString mKey;
|
||||
nsGlobalNameStruct mGlobalName;
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
// - mGlobalName
|
||||
return mKey.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
};
|
||||
|
||||
class nsICategoryManager;
|
||||
|
||||
class nsScriptNameSpaceManager : public nsIObserver,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIMemoryReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIMEMORYREPORTER
|
||||
|
||||
nsScriptNameSpaceManager();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
// Returns a nsGlobalNameStruct for aName, or null if one is not
|
||||
// found. The returned nsGlobalNameStruct is only guaranteed to be
|
||||
// valid until the next call to any of the methods in this class.
|
||||
// It also returns a pointer to the string buffer of the classname
|
||||
// in the nsGlobalNameStruct.
|
||||
const nsGlobalNameStruct* LookupName(const nsAString& aName,
|
||||
const char16_t **aClassName = nullptr);
|
||||
|
||||
nsresult RegisterClassName(const char *aClassName,
|
||||
int32_t aDOMClassInfoID,
|
||||
bool aPrivileged,
|
||||
bool aXBLAllowed,
|
||||
const char16_t **aResult);
|
||||
|
||||
nsresult RegisterClassProto(const char *aClassName,
|
||||
const nsIID *aConstructorProtoIID,
|
||||
bool *aFoundOld);
|
||||
|
||||
class NameIterator : public PLDHashTable::Iterator
|
||||
{
|
||||
public:
|
||||
typedef PLDHashTable::Iterator Base;
|
||||
explicit NameIterator(PLDHashTable* aTable) : Base(aTable) {}
|
||||
NameIterator(NameIterator&& aOther) : Base(mozilla::Move(aOther.mTable)) {}
|
||||
|
||||
const GlobalNameMapEntry* Get() const
|
||||
{
|
||||
return static_cast<const GlobalNameMapEntry*>(Base::Get());
|
||||
}
|
||||
|
||||
private:
|
||||
NameIterator() = delete;
|
||||
NameIterator(const NameIterator&) = delete;
|
||||
NameIterator& operator=(const NameIterator&) = delete;
|
||||
NameIterator& operator=(const NameIterator&&) = delete;
|
||||
};
|
||||
|
||||
NameIterator GlobalNameIter() { return NameIterator(&mGlobalNames); }
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
virtual ~nsScriptNameSpaceManager();
|
||||
|
||||
// Adds a new entry to the hash and returns the nsGlobalNameStruct
|
||||
// that aKey will be mapped to. If mType in the returned
|
||||
// nsGlobalNameStruct is != eTypeNotInitialized, an entry for aKey
|
||||
// already existed.
|
||||
nsGlobalNameStruct *AddToHash(const char *aKey,
|
||||
const char16_t **aClassName = nullptr);
|
||||
|
||||
// Removes an existing entry from the hash.
|
||||
void RemoveFromHash(const nsAString *aKey);
|
||||
|
||||
nsresult FillHash(nsICategoryManager *aCategoryManager,
|
||||
const char *aCategory);
|
||||
|
||||
/**
|
||||
* Add a new category entry into the hash table.
|
||||
* Only some categories can be added (see the beginning of the definition).
|
||||
* The other ones will be ignored.
|
||||
*
|
||||
* @aCategoryManager Instance of the category manager service.
|
||||
* @aCategory Category where the entry comes from.
|
||||
* @aEntry The entry that should be added.
|
||||
*/
|
||||
nsresult AddCategoryEntryToHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry);
|
||||
|
||||
/**
|
||||
* Remove an existing category entry from the hash table.
|
||||
* Only some categories can be removed (see the beginning of the definition).
|
||||
* The other ones will be ignored.
|
||||
*
|
||||
* @aCategory Category where the entry will be removed from.
|
||||
* @aEntry The entry that should be removed.
|
||||
*/
|
||||
nsresult RemoveCategoryEntryFromHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry);
|
||||
|
||||
// common helper for AddCategoryEntryToHash and RemoveCategoryEntryFromHash
|
||||
nsresult OperateCategoryEntryHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry,
|
||||
bool aRemove);
|
||||
|
||||
PLDHashTable mGlobalNames;
|
||||
};
|
||||
|
||||
#endif /* nsScriptNameSpaceManager_h__ */
|
|
@ -224,7 +224,7 @@ nsWindowRoot::GetControllers(bool aForVisibleWindow,
|
|||
getter_AddRefs(focusedWindow));
|
||||
if (focusedContent) {
|
||||
#ifdef MOZ_XUL
|
||||
RefPtr<nsXULElement> xulElement = nsXULElement::FromContent(focusedContent);
|
||||
RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(focusedContent);
|
||||
if (xulElement) {
|
||||
ErrorResult rv;
|
||||
*aResult = xulElement->GetControllers(rv);
|
||||
|
@ -234,12 +234,12 @@ nsWindowRoot::GetControllers(bool aForVisibleWindow,
|
|||
#endif
|
||||
|
||||
HTMLTextAreaElement* htmlTextArea =
|
||||
HTMLTextAreaElement::FromContent(focusedContent);
|
||||
HTMLTextAreaElement::FromNode(focusedContent);
|
||||
if (htmlTextArea)
|
||||
return htmlTextArea->GetControllers(aResult);
|
||||
|
||||
HTMLInputElement* htmlInputElement =
|
||||
HTMLInputElement::FromContent(focusedContent);
|
||||
HTMLInputElement::FromNode(focusedContent);
|
||||
if (htmlInputElement)
|
||||
return htmlInputElement->GetControllers(aResult);
|
||||
|
||||
|
|
|
@ -1719,7 +1719,6 @@ addExternalIface('LoadInfo', nativeType='nsILoadInfo',
|
|||
headerFile='nsILoadInfo.h', notflattened=True)
|
||||
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
|
||||
addExternalIface('XULControllers', nativeType='nsIControllers', notflattened=True)
|
||||
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
|
||||
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
|
||||
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
|
||||
notflattened=True)
|
||||
|
|
|
@ -284,8 +284,7 @@ BrowserElementParent::OpenWindowInProcess(nsPIDOMWindowOuter* aOpenerWindow,
|
|||
RefPtr<nsFrameLoader> frameLoader = popupFrameElement->GetFrameLoader();
|
||||
NS_ENSURE_TRUE(frameLoader, BrowserElementParent::OPEN_WINDOW_IGNORED);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docshell;
|
||||
frameLoader->GetDocShell(getter_AddRefs(docshell));
|
||||
nsCOMPtr<nsIDocShell> docshell = frameLoader->GetDocShell(IgnoreErrors());
|
||||
NS_ENSURE_TRUE(docshell, BrowserElementParent::OPEN_WINDOW_IGNORED);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = docshell->GetWindow();
|
||||
|
|
|
@ -81,7 +81,7 @@ BrowserElementParent.prototype = {
|
|||
setFrameLoader: function(frameLoader) {
|
||||
debug("Setting frameLoader");
|
||||
this._frameLoader = frameLoader;
|
||||
this._frameElement = frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerElement;
|
||||
this._frameElement = frameLoader.ownerElement;
|
||||
if (!this._frameElement) {
|
||||
debug("No frame element?");
|
||||
return;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDOMRequest;
|
||||
interface nsIFrameLoader;
|
||||
|
||||
[scriptable, function, uuid(00d0e19d-bd67-491f-8e85-b9905224d3bb)]
|
||||
interface nsIBrowserElementNextPaintListener : nsISupports
|
||||
|
@ -40,7 +39,8 @@ interface nsIBrowserElementAPI : nsISupports
|
|||
*/
|
||||
void destroyFrameScripts();
|
||||
|
||||
void setFrameLoader(in nsIFrameLoader frameLoader);
|
||||
// The argument should be a FrameLoader. Fix that when bug 1444991 is fixed.
|
||||
void setFrameLoader(in nsISupports frameLoader);
|
||||
|
||||
void sendMouseEvent(in DOMString type,
|
||||
in uint32_t x,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* 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/. */
|
||||
|
||||
interface MozFrameLoader;
|
||||
interface nsIEventTarget;
|
||||
interface Principal;
|
||||
|
||||
|
@ -44,7 +43,7 @@ dictionary ReceiveMessageArgument
|
|||
*/
|
||||
required Principal? principal;
|
||||
|
||||
MozFrameLoader targetFrameLoader;
|
||||
FrameLoader targetFrameLoader;
|
||||
};
|
||||
|
||||
callback interface MessageListener
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Maybe.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsMemory.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/DragEvent.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/FrameLoaderBinding.h"
|
||||
#include "mozilla/dom/MouseEventBinding.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
|
@ -1438,9 +1439,8 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32_t eventMode;
|
||||
frameLoader->GetEventMode(&eventMode);
|
||||
if (eventMode == nsIFrameLoader::EVENT_MODE_DONT_FORWARD_TO_CHILD) {
|
||||
if (frameLoader->EventMode() ==
|
||||
FrameLoaderBinding::EVENT_MODE_DONT_FORWARD_TO_CHILD) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1993,7 +1993,7 @@ EventStateManager::DetermineDragTargetAndDefaultData(nsPIDOMWindowOuter* aWindow
|
|||
// found, just use the clicked node.
|
||||
if (!*aSelection) {
|
||||
while (dragContent) {
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromContent(dragContent)) {
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromNode(dragContent)) {
|
||||
if (htmlElement->Draggable()) {
|
||||
break;
|
||||
}
|
||||
|
@ -4258,8 +4258,7 @@ EventStateManager::NotifyMouseOut(WidgetMouseEvent* aMouseEvent,
|
|||
// tell the subdocument that we're moving out of it
|
||||
nsSubDocumentFrame* subdocFrame = do_QueryFrame(wrapper->mLastOverFrame.GetFrame());
|
||||
if (subdocFrame) {
|
||||
nsCOMPtr<nsIDocShell> docshell;
|
||||
subdocFrame->GetDocShell(getter_AddRefs(docshell));
|
||||
nsIDocShell* docshell = subdocFrame->GetDocShell();
|
||||
if (docshell) {
|
||||
RefPtr<nsPresContext> presContext;
|
||||
docshell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
@ -5009,7 +5008,7 @@ static Element*
|
|||
GetLabelTarget(nsIContent* aPossibleLabel)
|
||||
{
|
||||
mozilla::dom::HTMLLabelElement* label =
|
||||
mozilla::dom::HTMLLabelElement::FromContent(aPossibleLabel);
|
||||
mozilla::dom::HTMLLabelElement::FromNode(aPossibleLabel);
|
||||
if (!label)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -1295,7 +1295,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
// if so, use the number control instead:
|
||||
Element* element = aContent->AsElement();
|
||||
HTMLInputElement* inputElement =
|
||||
HTMLInputElement::FromContentOrNull(aContent);
|
||||
HTMLInputElement::FromNodeOrNull(aContent);
|
||||
if (inputElement) {
|
||||
HTMLInputElement* ownerNumberControl =
|
||||
inputElement->GetOwnerNumberControl();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIConverterInputStream.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "mozilla/dom/BlobSet.h"
|
||||
#include "mozilla/dom/FileBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIMultiplexInputStream.h"
|
||||
#include "nsRFPService.h"
|
||||
#include "nsStringStream.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINamed.h"
|
||||
|
|
|
@ -93,7 +93,7 @@ DocAllResultMatch(Element* aElement, int32_t aNamespaceID, nsAtom* aAtom,
|
|||
return true;
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromContent(aElement);
|
||||
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromNode(aElement);
|
||||
if (!elm) {
|
||||
return false;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ HTMLAllCollection::GetSupportedNames(nsTArray<nsString>& aNames)
|
|||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
|
||||
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
|
||||
if (el) {
|
||||
// Note: nsINode::HasName means the name is exposed on the document,
|
||||
// which is false for options, so we don't check it here.
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAnchorElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLAnchorElement, a);
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAnchorElement, a);
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
virtual bool Draggable() const override;
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLAreaElement, area)
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAreaElement, area)
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class HTMLAudioElement final : public HTMLMediaElement
|
|||
public:
|
||||
typedef mozilla::dom::NodeInfo NodeInfo;
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLAudioElement, audio)
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAudioElement, audio)
|
||||
|
||||
explicit HTMLAudioElement(already_AddRefed<NodeInfo>& aNodeInfo);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
// nsISupports
|
||||
NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLBodyElement, nsGenericHTMLElement)
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLBodyElement, body);
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLBodyElement, body);
|
||||
|
||||
// Event listener stuff; we need to declare only the ones we need to
|
||||
// forward to window that don't come from nsIDOMHTMLBodyElement.
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLButtonElement, button)
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLButtonElement, button)
|
||||
|
||||
// Element
|
||||
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
|
||||
|
|
|
@ -133,7 +133,7 @@ class HTMLCanvasElement final : public nsGenericHTMLElement,
|
|||
public:
|
||||
explicit HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLCanvasElement, canvas)
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLCanvasElement, canvas)
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLDetailsElement, details)
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLDetailsElement, details)
|
||||
|
||||
nsIContent* GetFirstSummary() const;
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче