Backed out changeset 4aef71d8a987 (bug 1326138)

This commit is contained in:
Sebastian Hengst 2017-02-15 10:01:32 +01:00
Родитель bb6d3532c3
Коммит 8b37a3cb66
3 изменённых файлов: 1 добавлений и 126 удалений

41
browser/extensions/formautofill/bootstrap.js поставляемый
Просмотреть файл

@ -7,8 +7,6 @@
/* exported startup, shutdown, install, uninstall */
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
const STYLESHEET_URI = "chrome://formautofill/content/formautofill.css";
const CACHED_STYLESHEETS = [];
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -16,25 +14,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FormAutofillParent",
"resource://formautofill/FormAutofillParent.jsm");
function insertStyleSheet(domWindow, url) {
let doc = domWindow.document;
let styleSheetAttr = `href="${url}" type="text/css"`;
let styleSheet = doc.createProcessingInstruction("xml-stylesheet", styleSheetAttr);
doc.insertBefore(styleSheet, doc.documentElement);
CACHED_STYLESHEETS.push(styleSheet);
}
let windowListener = {
onOpenWindow(aWindow) {
let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
domWindow.addEventListener("load", function onWindowLoaded() {
insertStyleSheet(domWindow, STYLESHEET_URI);
}, {once: true});
},
};
function startup() {
// Besides this pref, we'll need dom.forms.autocomplete.experimental enabled
// as well to make sure form autocomplete works correctly.
@ -43,28 +22,10 @@ function startup() {
}
let parent = new FormAutofillParent();
let enumerator = Services.wm.getEnumerator("navigator:browser");
// Load stylesheet to already opened windows
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
let domWindow = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
insertStyleSheet(domWindow, STYLESHEET_URI);
}
Services.wm.addListener(windowListener);
parent.init();
Services.mm.loadFrameScript("chrome://formautofill/content/FormAutofillFrameScript.js", true);
}
function shutdown() {
Services.wm.removeListener(windowListener);
while (CACHED_STYLESHEETS.length !== 0) {
CACHED_STYLESHEETS.pop().remove();
}
}
function shutdown() {}
function install() {}
function uninstall() {}

Просмотреть файл

@ -1,7 +0,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/. */
.autocomplete-richlistitem[originaltype="autofill-profile"] {
-moz-binding: url("chrome://formautofill/content/formautofill.xml#autocomplete-profile-listitem");
}

Просмотреть файл

@ -1,79 +0,0 @@
<?xml version="1.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/. -->
<bindings id="formautofillBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="autocomplete-profile-listitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<xbl:content xmlns="http://www.w3.org/1999/xhtml">
<div anonid="profile-item-box" class="profile-item-box">
<div class="profile-label-col profile-item-col">
<span anonid="profile-label" class="profile-label"></span>
</div>
<div class="profile-comment-col profile-item-col">
<span anonid="profile-comment" class="profile-comment"></span>
</div>
</div>
</xbl:content>
<implementation implements="nsIDOMXULSelectControlItemElement">
<constructor>
<![CDATA[
this._itemBox = document.getAnonymousElementByAttribute(
this, "anonid", "profile-item-box"
);
this._label = document.getAnonymousElementByAttribute(
this, "anonid", "profile-label"
);
this._comment = document.getAnonymousElementByAttribute(
this, "anonid", "profile-comment"
);
this._adjustAcItem();
]]>
</constructor>
<method name="_cleanup">
<body>
<![CDATA[
this._itemBox.removeAttribute("size");
]]>
</body>
</method>
<method name="_onOverflow">
<body></body>
</method>
<method name="_onUnderflow">
<body></body>
</method>
<method name="_adjustAcItem">
<body>
<![CDATA[
let outerBoxRect = this.parentNode.getBoundingClientRect();
let value = this.getAttribute("ac-value");
let comment = this.getAttribute("ac-comment");
this._comment.textContent = comment;
this._label.textContent = value;
// Use two-lines layout when width is smaller than 150px
if (outerBoxRect.width <= 150) {
this._itemBox.setAttribute("size", "small");
} else {
this._itemBox.removeAttribute("size");
}
]]>
</body>
</method>
</implementation>
</binding>
</bindings>