Bug 721777 - B2G should open new windows as new frames in Gaia r=bz,fabrice

This commit is contained in:
Vivien Nicolas 2012-02-02 01:46:49 +01:00
parent 217269b303
commit 70c7d0c9cb
2 changed files with 45 additions and 0 deletions

View File

@ -394,6 +394,15 @@ pref("layers.acceleration.force-enabled", true);
pref("dom.screenEnabledProperty.enabled", true);
pref("dom.screenBrightnessProperty.enabled", true);
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
// 0: no restrictions - divert everything
// 1: don't divert window.open at all
// 2: don't divert window.open with features
pref("browser.link.open_newwindow.restriction", 0);
// Enable browser frame
pref("dom.mozBrowserFramesEnabled", true);
pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
@ -401,6 +410,7 @@ pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
// Temporary permission hack for WebSMS
pref("dom.sms.enabled", true);
pref("dom.sms.whitelist", "file://,http://localhost:6666");
// Ignore X-Frame-Options headers.
pref("b2g.ignoreXFrameOptions", true);

View File

@ -225,6 +225,10 @@ var shell = {
case 'load':
this.home.removeEventListener('load', this, true);
this.turnScreenOn();
let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow);
chromeWindow.browserDOMWindow = new nsBrowserAccess();
this.sendEvent(window, 'ContentStart');
break;
case 'MozApplicationManifest':
@ -356,3 +360,34 @@ MozKeyboard.prototype = {
}
};
function nsBrowserAccess() {
}
nsBrowserAccess.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow]),
openURI: function openURI(uri, opener, where, context) {
// TODO This should be replaced by an 'open-browser-window' intent
let contentWindow = content.wrappedJSObject;
if (!('getApplicationManager' in contentWindow))
return null;
let applicationManager = contentWindow.getApplicationManager();
if (!applicationManager)
return null;
let url = uri ? uri.spec : 'about:blank';
let window = applicationManager.launch(url, where);
return window.contentWindow;
},
openURIInFrame: function openURIInFrame(uri, opener, where, context) {
throw new Error('Not Implemented');
},
isTabContentWindow: function isTabContentWindow(contentWindow) {
return contentWindow == window;
}
};