Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 549233 Details for
Bug 674651
[patch]
nsContentPolicy should skip resource and chrome schemes
fakebrowser (text/plain), 16.86 KB, created by
Benjamin Stover (:stechz)
(
hide
)
Description:
nsContentPolicy should skip resource and chrome schemes
Filename:
MIME Type:
Creator:
Benjamin Stover (:stechz)
Size:
16.86 KB
patch
obsolete
># HG changeset patch ># User Benjamin Stover <bstover@mozilla.com> ># Date 1311889821 25200 ># Node ID ada43d95a519998ce4d651be84ba4f3594d0f84d ># Parent c92d8c7b59ec941dc2f8151d99112232c2bf85bd >Bug 674651 nsContentPolicy should skip resource and chrome schemes > >diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp >--- a/dom/base/nsGlobalWindow.cpp >+++ b/dom/base/nsGlobalWindow.cpp >@@ -4465,39 +4465,47 @@ nsGlobalWindow::DOMWindowDumpEnabled() > // enable output from dump() or not, in debug builds it's always > // enabled. > return gDOMWindowDumpEnabled; > #else > return PR_TRUE; > #endif > } > >+#ifdef ANDROID >+#include <android/log.h> >+#endif >+ > NS_IMETHODIMP > nsGlobalWindow::Dump(const nsAString& aStr) > { >- if (!DOMWindowDumpEnabled()) { >- return NS_OK; >- } >+// if (!DOMWindowDumpEnabled()) { >+// return NS_OK; >+// } > > char *cstr = ToNewUTF8String(aStr); > > #if defined(XP_MACOSX) > // have to convert \r to \n so that printing to the console works > char *c = cstr, *cEnd = cstr + strlen(cstr); > while (c < cEnd) { > if (*c == '\r') > *c = '\n'; > c++; > } > #endif > > if (cstr) { >+#ifdef ANDROID >+ __android_log_print(ANDROID_LOG_INFO, "Fennec", cstr); >+#else > FILE *fp = gDumpFile ? gDumpFile : stdout; > fputs(cstr, fp); > fflush(fp); >+#endif > nsMemory::Free(cstr); > } > > return NS_OK; > } > > void > nsGlobalWindow::EnsureReflowFlushAndPaint() >diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp >--- a/dom/base/nsJSEnvironment.cpp >+++ b/dom/base/nsJSEnvironment.cpp >@@ -489,17 +489,17 @@ NS_ScriptErrorReporter(JSContext *cx, > new ScriptErrorEvent(globalObject, report->lineno, > report->uctokenptr - report->uclinebuf, > report->flags, msg, fileName, sourceLine, > report->errorNumber != JSMSG_OUT_OF_MEMORY, > windowID)); > } > } > >-#ifdef DEBUG >+//#ifdef DEBUG > // Print it to stderr as well, for the benefit of those invoking > // mozilla with -console. > nsCAutoString error; > error.Assign("JavaScript "); > if (JSREPORT_IS_STRICT(report->flags)) > error.Append("strict "); > if (JSREPORT_IS_WARNING(report->flags)) > error.Append("warning: "); >@@ -511,19 +511,19 @@ NS_ScriptErrorReporter(JSContext *cx, > error.Append(": "); > if (report->ucmessage) { > AppendUTF16toUTF8(reinterpret_cast<const PRUnichar*>(report->ucmessage), > error); > } else { > error.Append(message); > } > >- fprintf(stderr, "%s\n", error.get()); >+ printf_stderr("%s\n", error.get()); > fflush(stderr); >-#endif >+//#endif > > #ifdef PR_LOGGING > if (!gJSDiagnostics) > gJSDiagnostics = PR_NewLogModule("JSDiagnostics"); > > if (gJSDiagnostics) { > PR_LOG(gJSDiagnostics, > JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR, >diff --git a/extensions/widgetutils/src/nsWidgetUtils.cpp b/extensions/widgetutils/src/nsWidgetUtils.cpp >--- a/extensions/widgetutils/src/nsWidgetUtils.cpp >+++ b/extensions/widgetutils/src/nsWidgetUtils.cpp >@@ -135,17 +135,17 @@ nsWidgetUtils::nsWidgetUtils() > NS_IMETHODIMP > nsWidgetUtils::Init() > { > nsresult rv; > nsCOMPtr<nsIObserverService> obsSvc = > do_GetService("@mozilla.org/observer-service;1"); > NS_ENSURE_STATE(obsSvc); > >- rv = obsSvc->AddObserver(this, "domwindowopened", PR_FALSE); >+ rv = obsSvc->AddObserver(this, "browserwindowopened", PR_FALSE); > NS_ENSURE_SUCCESS(rv, rv); > rv = obsSvc->AddObserver(this, "domwindowclosed", PR_FALSE); > NS_ENSURE_SUCCESS(rv, rv); > mTimer = do_CreateInstance(NS_TIMER_CONTRACTID); > } > > nsresult > nsWidgetUtils::UpdateFromEvent(nsIDOMEvent *aDOMEvent) >@@ -472,17 +472,17 @@ NS_IMPL_ISUPPORTS4(nsWidgetUtils, > nsIDOMEventListener, > nsIContentPolicy, > nsISupportsWeakReference) > > NS_IMETHODIMP > nsWidgetUtils::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) > { > nsresult rv; >- if (!strcmp(aTopic,"domwindowopened")) >+ if (!strcmp(aTopic,"browserwindowopened")) > { > nsCOMPtr<nsIDOMWindow> chromeWindow = do_QueryInterface(aSubject); > if (chromeWindow) > AttachWindowListeners(chromeWindow); > return NS_OK; > } > > if (!strcmp(aTopic,"domwindowclosed")) >diff --git a/mobile/app/mobile.js b/mobile/app/mobile.js >--- a/mobile/app/mobile.js >+++ b/mobile/app/mobile.js >@@ -51,17 +51,16 @@ > // > pref("toolkit.browser.cacheRatioWidth", 2000); > pref("toolkit.browser.cacheRatioHeight", 3000); > > // How long before a content view (a handle to a remote scrollable object) > // expires. > pref("toolkit.browser.contentViewExpire", 3000); > >-pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul"); > pref("general.useragent.compatMode.firefox", true); > pref("browser.chromeURL", "chrome://browser/content/"); > > pref("browser.tabs.warnOnClose", true); > pref("browser.tabs.remote", true); > > pref("toolkit.screen.lock", false); > >diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js >--- a/mobile/chrome/content/browser-ui.js >+++ b/mobile/chrome/content/browser-ui.js >@@ -36,16 +36,18 @@ > * the terms of any one of the MPL, the GPL or the LGPL. > * > * ***** END LICENSE BLOCK ***** */ > > Cu.import("resource://gre/modules/XPCOMUtils.jsm"); > Cu.import("resource://gre/modules/Services.jsm"); > Cu.import("resource://gre/modules/AddonManager.jsm"); > >+Services.obs.notifyObservers(window, "browserwindowopened", null); >+ > [ > ["AllPagesList", "popup_autocomplete", "cmd_openLocation"], > ["HistoryList", "history-items", "cmd_history"], > ["BookmarkList", "bookmarks-items", "cmd_bookmarks"], > #ifdef MOZ_SERVICES_SYNC > ["RemoteTabsList", "remotetabs-items", "cmd_remoteTabs"] > #endif > ].forEach(function(aPanel) { >diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js >--- a/mobile/chrome/content/browser.js >+++ b/mobile/chrome/content/browser.js >@@ -348,17 +348,17 @@ var Browser = { > // First open any commandline URLs, except the homepage > if (commandURL && commandURL != this.getHomePage()) { > this.addTab(commandURL, true); > } else { > bringFront = true; > // Initial window resizes call functions that assume a tab is in the tab list > // and restored tabs are added too late. We add a dummy to to satisfy the resize > // code and then remove the dummy after the session has been restored. >- let dummy = this.addTab("about:blank"); >+ let dummy = this.addTab("about:blank", true); > let dummyCleanup = { > observe: function() { > Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored"); > dummy.chromeTab.ignoreUndo = true; > Browser.closeTab(dummy, { forceClose: true }); > } > }; > Services.obs.addObserver(dummyCleanup, "sessionstore-windows-restored", false); >@@ -381,17 +381,17 @@ var Browser = { > // Broadcast a UIReady message so add-ons know we are finished with startup > let event = document.createEvent("Events"); > event.initEvent("UIReady", true, false); > window.dispatchEvent(event); > > // If we have an opener this was not the first window opened and will not > // receive an initial resize event. instead we fire the resize handler manually > // Bug 610834 >- if (window.opener) >+ if (window.innerWidth) > resizeHandler({ target: window }); > }, > > _alertShown: function _alertShown() { > // ensure that the full notification still visible, even if the urlbar is floating > if (BrowserUI.isToolbarLocked()) > Browser.pageScrollboxScroller.scrollTo(0, 0); > }, >diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul >--- a/mobile/chrome/content/browser.xul >+++ b/mobile/chrome/content/browser.xul >@@ -263,17 +263,17 @@ > </toolbar> > </box> > </box> > > <!-- Content viewport --> > <vbox id="content-viewport" class="window-width window-height"> > <!-- Content viewport --> > <stack> >- <deck id="browsers" flex="1" observes="bcast_uidiscovery"/> >+ <deck id="browsers" flex="1" observes="bcast_uidiscovery" style="background-color: white"/> > <!-- vertical scrollbar --> > <box id="vertical-scroller" class="scroller" orient="vertical" end="2" top="0"/> > </stack> > </vbox> > </vbox> > </scrollbox> > > <!-- popup for content navigator helper --> >diff --git a/mobile/chrome/jar.mn b/mobile/chrome/jar.mn >--- a/mobile/chrome/jar.mn >+++ b/mobile/chrome/jar.mn >@@ -9,16 +9,17 @@ chrome.jar: > content/aboutCertError.xhtml (content/aboutCertError.xhtml) > content/aboutHome.xhtml (content/aboutHome.xhtml) > content/localePicker.xul (content/localePicker.xul) > content/localePicker.js (content/localePicker.js) > * content/aboutRights.xhtml (content/aboutRights.xhtml) > content/blockedSite.xhtml (content/blockedSite.xhtml) > content/languages.properties (content/languages.properties) > * content/browser.xul (content/browser.xul) >+* content/fakebrowser.xul (content/fakebrowser.xul) > * content/browser.js (content/browser.js) > * content/browser-ui.js (content/browser-ui.js) > * content/browser-scripts.js (content/browser-scripts.js) > * content/common-ui.js (content/common-ui.js) > * content/AlertsHelper.js (content/AlertsHelper.js) > content/AppMenu.js (content/AppMenu.js) > content/AwesomePanel.js (content/AwesomePanel.js) > content/BookmarkHelper.js (content/BookmarkHelper.js) >diff --git a/mobile/components/BrowserCLH.js b/mobile/components/BrowserCLH.js >--- a/mobile/components/BrowserCLH.js >+++ b/mobile/components/BrowserCLH.js >@@ -230,17 +230,17 @@ BrowserCLH.prototype = { > // Show the locale selector if we have a new profile > if (needHomepageOverride() == "new profile" && Services.prefs.getBoolPref("browser.firstrun.show.localepicker") && !haveSystemLocale()) { > > browserWin = openWindow(null, "chrome://browser/content/localePicker.xul", "_blank", "chrome,dialog=no,all", defaultURL); > aCmdLine.preventDefault = true; > return; > } > >- browserWin = openWindow(null, "chrome://browser/content/browser.xul", "_blank", "chrome,dialog=no,all", defaultURL); >+ browserWin = openWindow(null, "chrome://browser/content/fakebrowser.xul", "_blank", "chrome,dialog=no,all", defaultURL); > } > > browserWin.focus(); > > // Stop the normal commandline processing from continuing. We just opened the main browser window > aCmdLine.preventDefault = true; > } catch (e) { > Cu.reportError(e); >diff --git a/mobile/components/SessionStore.js b/mobile/components/SessionStore.js >--- a/mobile/components/SessionStore.js >+++ b/mobile/components/SessionStore.js >@@ -73,16 +73,19 @@ SessionStore.prototype = { > _windows: {}, > _lastSaveTime: 0, > _lastSessionTime: 0, > _interval: 10000, > _maxTabsUndo: 1, > _shouldRestore: false, > > init: function ss_init() { >+ if (this._sessionFile) >+ return; >+ > // Get file references > this._sessionFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile); > this._sessionFileBackup = this._sessionFile.clone(); > this._sessionCache = this._sessionFile.clone(); > this._sessionFile.append("sessionstore.js"); > this._sessionFileBackup.append("sessionstore.bak"); > this._sessionCache.append("sessionstoreCache"); > >@@ -169,33 +172,28 @@ SessionStore.prototype = { > }) > }, > > observe: function ss_observe(aSubject, aTopic, aData) { > let self = this; > let observerService = Services.obs; > switch (aTopic) { > case "app-startup": >- observerService.addObserver(this, "final-ui-startup", true); >- observerService.addObserver(this, "domwindowopened", true); >+ observerService.addObserver(this, "browserwindowopened", true); > observerService.addObserver(this, "domwindowclosed", true); > observerService.addObserver(this, "browser-lastwindow-close-granted", true); > observerService.addObserver(this, "browser:purge-session-history", true); > observerService.addObserver(this, "quit-application-requested", true); > observerService.addObserver(this, "quit-application-granted", true); > observerService.addObserver(this, "quit-application", true); > break; >- case "final-ui-startup": >- observerService.removeObserver(this, "final-ui-startup"); >- this.init(); >- break; >- case "domwindowopened": >+ case "browserwindowopened": > let window = aSubject; > window.addEventListener("load", function() { >- self.onWindowOpen(window); >+ self.onWindowOpened(window); > window.removeEventListener("load", arguments.callee, false); > }, false); > break; > case "domwindowclosed": // catch closed windows > this.onWindowClose(aSubject); > break; > case "browser-lastwindow-close-granted": > // If a save has been queued, kill the timer and save state now >@@ -234,17 +232,17 @@ SessionStore.prototype = { > > // Freeze the data at what we've got (ignoring closing windows) > this._loadState = STATE_QUITTING; > > // No need for this back up, we are shutting down just fine > if (this._sessionFileBackup.exists()) > this._sessionFileBackup.remove(false); > >- observerService.removeObserver(this, "domwindowopened"); >+ observerService.removeObserver(this, "browserwindowopened"); > observerService.removeObserver(this, "domwindowclosed"); > observerService.removeObserver(this, "browser-lastwindow-close-granted"); > observerService.removeObserver(this, "quit-application-requested"); > observerService.removeObserver(this, "quit-application-granted"); > observerService.removeObserver(this, "quit-application"); > > // If a save has been queued, kill the timer and save state now > if (this._saveTimer) { >@@ -302,25 +300,27 @@ SessionStore.prototype = { > } > }, > > receiveMessage: function ss_receiveMessage(aMessage) { > let window = aMessage.target.ownerDocument.defaultView; > this.onTabLoad(window, aMessage.target, aMessage); > }, > >- onWindowOpen: function ss_onWindowOpen(aWindow) { >+ onWindowOpened: function ss_onWindowOpened(aWindow) { > // Return if window has already been initialized > if (aWindow && aWindow.__SSID && this._windows[aWindow.__SSID]) > return; > > // Ignore non-browser windows and windows opened while shutting down > if (aWindow.document.documentElement.getAttribute("windowtype") != "navigator:browser" || this._loadState == STATE_QUITTING) > return; > >+ this.init(); >+ > // Assign it a unique identifier (timestamp) and create its data object > aWindow.__SSID = "window" + Date.now(); > this._windows[aWindow.__SSID] = { tabs: [], selected: 0, closedTabs: [] }; > > // Perform additional initialization when the first window is loading > if (this._loadState == STATE_STOPPED) { > this._loadState = STATE_RUNNING; > this._lastSaveTime = Date.now(); >diff --git a/services/sync/modules/engines/tabs.js b/services/sync/modules/engines/tabs.js >--- a/services/sync/modules/engines/tabs.js >+++ b/services/sync/modules/engines/tabs.js >@@ -296,34 +296,34 @@ TabTracker.prototype = { > }, > > _enabled: false, > observe: function TabTracker_observe(aSubject, aTopic, aData) { > switch (aTopic) { > case "weave:engine:start-tracking": > if (!this._enabled) { > Svc.Obs.add("private-browsing", this); >- Svc.Obs.add("domwindowopened", this); >+ Svc.Obs.add("browserwindowopened", this); > let wins = Services.wm.getEnumerator("navigator:browser"); > while (wins.hasMoreElements()) > this._registerListenersForWindow(wins.getNext()); > this._enabled = true; > } > break; > case "weave:engine:stop-tracking": > if (this._enabled) { > Svc.Obs.remove("private-browsing", this); >- Svc.Obs.remove("domwindowopened", this); >+ Svc.Obs.remove("browserwindowopened", this); > let wins = Services.wm.getEnumerator("navigator:browser"); > while (wins.hasMoreElements()) > this._unregisterListenersForWindow(wins.getNext()); > this._enabled = false; > } > return; >- case "domwindowopened": >+ case "browserwindowopened": > // Add tab listeners now that a window has opened > let self = this; > aSubject.addEventListener("load", function onLoad(event) { > aSubject.removeEventListener("load", onLoad, false); > // Only register after the window is done loading to avoid unloads > self._registerListenersForWindow(aSubject); > }, false); > break;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
|
Review
Attachments on
bug 674651
:
548877
|
548879
|
549233
|
549234
|
564306