зеркало из 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 : 617b9b8bca1847ccd37e8a90d498d6cadad9bbf2
This commit is contained in:
Родитель
fcde1cafd4
Коммит
c001f8d670
|
@ -140,6 +140,7 @@ let WebProgressListener = {
|
||||||
json.charset = content.document.characterSet;
|
json.charset = content.document.characterSet;
|
||||||
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
||||||
json.principal = content.document.nodePrincipal;
|
json.principal = content.document.nodePrincipal;
|
||||||
|
json.synthetic = content.document.mozSyntheticDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendAsyncMessage("Content:LocationChange", json, objects);
|
sendAsyncMessage("Content:LocationChange", json, objects);
|
||||||
|
@ -326,22 +327,6 @@ addEventListener("ImageContentLoaded", function (aEvent) {
|
||||||
}
|
}
|
||||||
}, false);
|
}, 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 = {
|
const ZoomManager = {
|
||||||
get fullZoom() {
|
get fullZoom() {
|
||||||
return this._cache.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.
|
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]
|
[browser_input_file_tooltips.js]
|
||||||
skip-if = e10s # Bug ?????? - test directly manipulates content (TypeError: doc.createElement is not a function)
|
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]
|
[browser_keyevents_during_autoscrolling.js]
|
||||||
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
|
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
|
||||||
[browser_save_resend_postdata.js]
|
[browser_save_resend_postdata.js]
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
function waitForLoad(browser) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let wasSynthetic = browser.isSyntheticDocument;
|
||||||
|
|
||||||
|
browser.addProgressListener({
|
||||||
|
onLocationChange: function(webProgress, request, location, flags) {
|
||||||
|
wasSynthetic = browser.isSyntheticDocument;
|
||||||
|
},
|
||||||
|
|
||||||
|
onStateChange: function(webProgress, request, flags, status) {
|
||||||
|
let docStop = Ci.nsIWebProgressListener.STATE_IS_NETWORK |
|
||||||
|
Ci.nsIWebProgressListener.STATE_STOP;
|
||||||
|
if ((flags & docStop) == docStop) {
|
||||||
|
browser.removeProgressListener(this);
|
||||||
|
resolve(wasSynthetic);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
||||||
|
Ci.nsISupportsWeakReference])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const FILES = gTestPath.replace("browser_isSynthetic.js", "")
|
||||||
|
.replace("chrome://mochitests/content/", "http://example.com/");
|
||||||
|
|
||||||
|
add_task(function*() {
|
||||||
|
let tab = gBrowser.addTab("about:blank");
|
||||||
|
let browser = tab.linkedBrowser;
|
||||||
|
yield waitForLoad(browser);
|
||||||
|
|
||||||
|
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||||
|
|
||||||
|
let loadPromise = waitForLoad(browser);
|
||||||
|
browser.loadURI("data:text/html;charset=utf-8,<html/>");
|
||||||
|
let wasSynthetic = yield loadPromise;
|
||||||
|
is(wasSynthetic, false, "Should not be synthetic");
|
||||||
|
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||||
|
|
||||||
|
loadPromise = waitForLoad(browser);
|
||||||
|
browser.loadURI(FILES + "empty.png");
|
||||||
|
wasSynthetic = yield loadPromise;
|
||||||
|
is(wasSynthetic, true, "Should be synthetic");
|
||||||
|
is(browser.isSyntheticDocument, true, "Should be synthetic");
|
||||||
|
|
||||||
|
loadPromise = waitForLoad(browser);
|
||||||
|
browser.goBack();
|
||||||
|
wasSynthetic = yield loadPromise;
|
||||||
|
is(wasSynthetic, false, "Should not be synthetic");
|
||||||
|
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||||
|
|
||||||
|
loadPromise = waitForLoad(browser);
|
||||||
|
browser.goForward();
|
||||||
|
wasSynthetic = yield loadPromise;
|
||||||
|
is(wasSynthetic, true, "Should be synthetic");
|
||||||
|
is(browser.isSyntheticDocument, true, "Should be synthetic");
|
||||||
|
|
||||||
|
gBrowser.removeTab(tab);
|
||||||
|
});
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 14 KiB |
|
@ -322,10 +322,6 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "DocumentInserted":
|
|
||||||
this._isSyntheticDocument = data.synthetic;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "FullZoomChange": {
|
case "FullZoomChange": {
|
||||||
this._fullZoom = data.value;
|
this._fullZoom = data.value;
|
||||||
let event = document.createEvent("Events");
|
let event = document.createEvent("Events");
|
||||||
|
|
|
@ -198,6 +198,7 @@ RemoteWebProgressManager.prototype = {
|
||||||
this._browser._imageDocument = null;
|
this._browser._imageDocument = null;
|
||||||
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
||||||
this._browser._contentPrincipal = json.principal;
|
this._browser._contentPrincipal = json.principal;
|
||||||
|
this._browser._isSyntheticDocument = json.synthetic;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
|
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче