зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1073462: Send synthetic property with Content:LocationChange message. r=felipe
The browser.isSynthetic property is needed by the zoom code to detect when to apply the correct zoom level. In e10s it is currently only set when a new document is created which means we don't set it right for history navigation. This sends it with the Content:LocationChange message which is where it is needed by the zoom code anyway. --HG-- extra : rebase_source : 3fe515c161dd036c18fc239af59ac934236eada8 extra : source : 8d5f10959b2c4ae498b4a9a3704a5859038190f5
This commit is contained in:
Родитель
9bcf04ed5b
Коммит
a8ee483d34
|
@ -140,6 +140,7 @@ let WebProgressListener = {
|
|||
json.charset = content.document.characterSet;
|
||||
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
||||
json.principal = content.document.nodePrincipal;
|
||||
json.synthetic = content.document.mozSyntheticDocument;
|
||||
}
|
||||
|
||||
sendAsyncMessage("Content:LocationChange", json, objects);
|
||||
|
@ -326,22 +327,6 @@ addEventListener("ImageContentLoaded", function (aEvent) {
|
|||
}
|
||||
}, false);
|
||||
|
||||
let DocumentObserver = {
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, "document-element-inserted", false);
|
||||
addEventListener("unload", () => {
|
||||
Services.obs.removeObserver(this, "document-element-inserted");
|
||||
});
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aSubject == content.document) {
|
||||
sendAsyncMessage("DocumentInserted", {synthetic: aSubject.mozSyntheticDocument});
|
||||
}
|
||||
},
|
||||
};
|
||||
DocumentObserver.init();
|
||||
|
||||
const ZoomManager = {
|
||||
get fullZoom() {
|
||||
return this._cache.fullZoom;
|
||||
|
|
|
@ -18,6 +18,9 @@ skip-if = e10s
|
|||
skip-if = e10s # Disabled for e10s: Bug ?????? - seems to be a timing issue with RemoteFinder.jsm messages coming later than the tests expect.
|
||||
[browser_input_file_tooltips.js]
|
||||
skip-if = e10s # Bug ?????? - test directly manipulates content (TypeError: doc.createElement is not a function)
|
||||
[browser_isSynthetic.js]
|
||||
support-files =
|
||||
empty.png
|
||||
[browser_keyevents_during_autoscrolling.js]
|
||||
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
|
||||
[browser_save_resend_postdata.js]
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
function LocationChangeListener(browser) {
|
||||
this.browser = browser;
|
||||
browser.addProgressListener(this);
|
||||
}
|
||||
|
||||
LocationChangeListener.prototype = {
|
||||
wasSynthetic: false,
|
||||
browser: null,
|
||||
|
||||
destroy: function() {
|
||||
this.browser.removeProgressListener(this);
|
||||
},
|
||||
|
||||
onLocationChange: function(webProgress, request, location, flags) {
|
||||
this.wasSynthetic = this.browser.isSyntheticDocument;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
||||
Ci.nsISupportsWeakReference])
|
||||
}
|
||||
|
||||
const FILES = gTestPath.replace("browser_isSynthetic.js", "")
|
||||
.replace("chrome://mochitests/content/", "http://example.com/");
|
||||
|
||||
function waitForPageShow(browser) {
|
||||
return ContentTask.spawn(browser, null, function*() {
|
||||
Cu.import("resource://gre/modules/PromiseUtils.jsm");
|
||||
yield new Promise(resolve => {
|
||||
let listener = () => {
|
||||
removeEventListener("pageshow", listener, true);
|
||||
resolve();
|
||||
}
|
||||
addEventListener("pageshow", listener, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
let tab = gBrowser.addTab("about:blank");
|
||||
let browser = tab.linkedBrowser;
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
let listener = new LocationChangeListener(browser);
|
||||
|
||||
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||
|
||||
let loadPromise = waitForPageShow(browser);
|
||||
browser.loadURI("data:text/html;charset=utf-8,<html/>");
|
||||
yield loadPromise;
|
||||
is(listener.wasSynthetic, false, "Should not be synthetic");
|
||||
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||
|
||||
loadPromise = waitForPageShow(browser);
|
||||
browser.loadURI(FILES + "empty.png");
|
||||
yield loadPromise;
|
||||
is(listener.wasSynthetic, true, "Should be synthetic");
|
||||
is(browser.isSyntheticDocument, true, "Should be synthetic");
|
||||
|
||||
loadPromise = waitForPageShow(browser);
|
||||
browser.goBack();
|
||||
yield loadPromise;
|
||||
is(listener.wasSynthetic, false, "Should not be synthetic");
|
||||
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||
|
||||
loadPromise = waitForPageShow(browser);
|
||||
browser.goForward();
|
||||
yield loadPromise;
|
||||
is(listener.wasSynthetic, true, "Should be synthetic");
|
||||
is(browser.isSyntheticDocument, true, "Should be synthetic");
|
||||
|
||||
listener.destroy();
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 14 KiB |
|
@ -322,10 +322,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case "DocumentInserted":
|
||||
this._isSyntheticDocument = data.synthetic;
|
||||
break;
|
||||
|
||||
case "FullZoomChange": {
|
||||
this._fullZoom = data.value;
|
||||
let event = document.createEvent("Events");
|
||||
|
|
|
@ -198,6 +198,7 @@ RemoteWebProgressManager.prototype = {
|
|||
this._browser._imageDocument = null;
|
||||
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
||||
this._browser._contentPrincipal = json.principal;
|
||||
this._browser._isSyntheticDocument = json.synthetic;
|
||||
}
|
||||
|
||||
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
|
||||
|
|
Загрузка…
Ссылка в новой задаче