зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1500268
- remove customizableui toolbar's insertItem method, r=bgrins
Differential Revision: https://phabricator.services.mozilla.com/D9173 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e112064aa7
Коммит
cfd6524777
|
@ -3243,11 +3243,7 @@ var CustomizableUI = {
|
|||
/**
|
||||
* Ensure a XUL-based widget created in a window after areas were
|
||||
* initialized moves to its correct position.
|
||||
* This is roughly equivalent to manually looking up the position and using
|
||||
* insertItem in the old API, but a lot less work for consumers.
|
||||
* Always prefer this over using toolbar.insertItem (which might no-op
|
||||
* because it delegates to addWidgetToArea) or, worse, moving items in the
|
||||
* DOM yourself.
|
||||
* Always prefer this over moving items in the DOM yourself.
|
||||
*
|
||||
* @param aWidgetId the ID of the widget that was just created
|
||||
* @param aWindow the window in which you want to ensure it was added.
|
||||
|
|
|
@ -36,35 +36,6 @@
|
|||
CustomizableUI.registerToolbarNode(this, children);
|
||||
]]></constructor>
|
||||
|
||||
<method name="insertItem">
|
||||
<parameter name="aId"/>
|
||||
<parameter name="aBeforeElt"/>
|
||||
<parameter name="aWrapper"/>
|
||||
<body><![CDATA[
|
||||
if (aWrapper) {
|
||||
Cu.reportError("Can't insert " + aId + ": using insertItem " +
|
||||
"no longer supports wrapper elements.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Hack, the customizable UI code makes this be the last position
|
||||
let pos = null;
|
||||
if (aBeforeElt) {
|
||||
let beforeInfo = CustomizableUI.getPlacementOfWidget(aBeforeElt.id);
|
||||
if (beforeInfo.area != this.id) {
|
||||
Cu.reportError("Can't insert " + aId + " before " +
|
||||
aBeforeElt.id + " which isn't in this area (" +
|
||||
this.id + ").");
|
||||
return null;
|
||||
}
|
||||
pos = beforeInfo.position;
|
||||
}
|
||||
|
||||
CustomizableUI.addWidgetToArea(aId, this.id, pos);
|
||||
return this.ownerDocument.getElementById(aId);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="customizationTarget" readonly="true">
|
||||
<getter><![CDATA[
|
||||
if (this._customizationTarget)
|
||||
|
@ -74,9 +45,7 @@
|
|||
if (id)
|
||||
this._customizationTarget = document.getElementById(id);
|
||||
|
||||
if (this._customizationTarget)
|
||||
this._customizationTarget.insertItem = this.insertItem.bind(this);
|
||||
else
|
||||
if (!this._customizationTarget)
|
||||
this._customizationTarget = this;
|
||||
|
||||
return this._customizationTarget;
|
||||
|
@ -153,11 +122,6 @@
|
|||
return this.getAttribute("defaultset");
|
||||
]]></getter>
|
||||
</property>
|
||||
<method name="insertItem">
|
||||
<body><![CDATA[
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ add_task(async function() {
|
|||
hidden1.hidden = hidden2.hidden = true;
|
||||
|
||||
// Make sure we have some hidden items at the end of the nav-bar.
|
||||
navbar.insertItem(hidden1.id);
|
||||
navbar.insertItem(hidden2.id);
|
||||
CustomizableUI.addWidgetToArea(kHidden1Id, "nav-bar");
|
||||
CustomizableUI.addWidgetToArea(kHidden2Id, "nav-bar");
|
||||
|
||||
// Drag an item and drop it onto the nav-bar customization target, but
|
||||
// not over a particular item.
|
||||
|
|
Загрузка…
Ссылка в новой задаче