Skip to content

Commit

Permalink
Merge m-i to m-c, a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
philor committed May 10, 2015
2 parents 8ef72d4 + 312397b commit ba9ebd3
Show file tree
Hide file tree
Showing 44 changed files with 452 additions and 264 deletions.
6 changes: 3 additions & 3 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10739,7 +10739,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
// (ie. POST data, referrer, ...)
//
if (httpChannel) {
nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(httpChannel));
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
/* Get the cache Key from SH */
nsCOMPtr<nsISupports> cacheKey;
if (mLSHE) {
Expand Down Expand Up @@ -11289,7 +11289,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
"We shouldn't be updating session history for forced"
" reloads!");

nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(aChannel));
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(aChannel));
nsCOMPtr<nsISupports> cacheKey;
// Get the Cache Key and store it in SH.
if (cacheChannel) {
Expand Down Expand Up @@ -11843,7 +11843,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
nsCOMPtr<nsISupports> owner = aOwner;
bool expired = false;
bool discardLayoutState = false;
nsCOMPtr<nsICachingChannel> cacheChannel;
nsCOMPtr<nsICacheInfoChannel> cacheChannel;
if (aChannel) {
cacheChannel = do_QueryInterface(aChannel);

Expand Down
2 changes: 1 addition & 1 deletion docshell/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ support-files = bug530396-noref.sjs bug530396-subframe.html
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_bug551225.html]
[test_bug570341.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #debug-only failure, android bug 1040769
[test_bug580069.html]
[test_bug590573.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 823022 # b2g(queryinterfaces into webnavigation, might suffer from something similar as bug 823022) b2g-debug(queryinterfaces into webnavigation, might suffer from something similar as bug 823022) b2g-desktop(queryinterfaces into webnavigation, might suffer from something similar as bug 823022)
Expand Down
54 changes: 54 additions & 0 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7710,3 +7710,57 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
return NS_OK;
}

/* static */
void
nsContentUtils::FirePageHideEvent(nsIDocShellTreeItem* aItem,
EventTarget* aChromeEventHandler)
{
nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
NS_ASSERTION(doc, "What happened here?");
doc->OnPageHide(true, aChromeEventHandler);

int32_t childCount = 0;
aItem->GetChildCount(&childCount);
nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
kids.AppendElements(childCount);
for (int32_t i = 0; i < childCount; ++i) {
aItem->GetChildAt(i, getter_AddRefs(kids[i]));
}

for (uint32_t i = 0; i < kids.Length(); ++i) {
if (kids[i]) {
FirePageHideEvent(kids[i], aChromeEventHandler);
}
}
}

// The pageshow event is fired for a given document only if IsShowing() returns
// the same thing as aFireIfShowing. This gives us a way to fire pageshow only
// on documents that are still loading or only on documents that are already
// loaded.
/* static */
void
nsContentUtils::FirePageShowEvent(nsIDocShellTreeItem* aItem,
EventTarget* aChromeEventHandler,
bool aFireIfShowing)
{
int32_t childCount = 0;
aItem->GetChildCount(&childCount);
nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
kids.AppendElements(childCount);
for (int32_t i = 0; i < childCount; ++i) {
aItem->GetChildAt(i, getter_AddRefs(kids[i]));
}

for (uint32_t i = 0; i < kids.Length(); ++i) {
if (kids[i]) {
FirePageShowEvent(kids[i], aChromeEventHandler, aFireIfShowing);
}
}

nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
NS_ASSERTION(doc, "What happened here?");
if (doc->IsShowing() == aFireIfShowing) {
doc->OnPageShow(true, aChromeEventHandler);
}
}
8 changes: 8 additions & 0 deletions dom/base/nsContentUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class nsIConsoleService;
class nsIContent;
class nsIContentPolicy;
class nsIContentSecurityPolicy;
class nsIDocShellTreeItem;
class nsIDocument;
class nsIDocumentLoaderFactory;
class nsIDOMDocument;
Expand Down Expand Up @@ -2351,6 +2352,13 @@ class nsContentUtils
bool *aPreventDefault,
bool aIsSynthesized);

static void FirePageShowEvent(nsIDocShellTreeItem* aItem,
mozilla::dom::EventTarget* aChromeEventHandler,
bool aFireIfShowing);

static void FirePageHideEvent(nsIDocShellTreeItem* aItem,
mozilla::dom::EventTarget* aChromeEventHandler);

private:
static bool InitializeEventTable();

Expand Down
80 changes: 15 additions & 65 deletions dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,59 +502,6 @@ nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
return rv;
}

static void
FirePageHideEvent(nsIDocShellTreeItem* aItem,
EventTarget* aChromeEventHandler)
{
nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
NS_ASSERTION(doc, "What happened here?");
doc->OnPageHide(true, aChromeEventHandler);

int32_t childCount = 0;
aItem->GetChildCount(&childCount);
nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
kids.AppendElements(childCount);
for (int32_t i = 0; i < childCount; ++i) {
aItem->GetChildAt(i, getter_AddRefs(kids[i]));
}

for (uint32_t i = 0; i < kids.Length(); ++i) {
if (kids[i]) {
FirePageHideEvent(kids[i], aChromeEventHandler);
}
}
}

// The pageshow event is fired for a given document only if IsShowing() returns
// the same thing as aFireIfShowing. This gives us a way to fire pageshow only
// on documents that are still loading or only on documents that are already
// loaded.
static void
FirePageShowEvent(nsIDocShellTreeItem* aItem,
EventTarget* aChromeEventHandler,
bool aFireIfShowing)
{
int32_t childCount = 0;
aItem->GetChildCount(&childCount);
nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
kids.AppendElements(childCount);
for (int32_t i = 0; i < childCount; ++i) {
aItem->GetChildAt(i, getter_AddRefs(kids[i]));
}

for (uint32_t i = 0; i < kids.Length(); ++i) {
if (kids[i]) {
FirePageShowEvent(kids[i], aChromeEventHandler, aFireIfShowing);
}
}

nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
NS_ASSERTION(doc, "What happened here?");
if (doc->IsShowing() == aFireIfShowing) {
doc->OnPageShow(true, aChromeEventHandler);
}
}

static void
SetTreeOwnerAndChromeEventHandlerOnDocshellTree(nsIDocShellTreeItem* aItem,
nsIDocShellTreeOwner* aOwner,
Expand Down Expand Up @@ -1023,6 +970,9 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
otherDoc->FlushPendingNotifications(Flush_Layout);

mInSwap = aOther->mInSwap = false;

unused << mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
unused << aOther->mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
return NS_OK;
}

Expand Down Expand Up @@ -1199,34 +1149,34 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
// Fire pageshow events on still-loading pages, and then fire pagehide
// events. Note that we do NOT fire these in the normal way, but just fire
// them on the chrome event handlers.
FirePageShowEvent(ourDocshell, ourEventTarget, false);
FirePageShowEvent(otherDocshell, otherEventTarget, false);
FirePageHideEvent(ourDocshell, ourEventTarget);
FirePageHideEvent(otherDocshell, otherEventTarget);
nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, false);
nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, false);
nsContentUtils::FirePageHideEvent(ourDocshell, ourEventTarget);
nsContentUtils::FirePageHideEvent(otherDocshell, otherEventTarget);

nsIFrame* ourFrame = ourContent->GetPrimaryFrame();
nsIFrame* otherFrame = otherContent->GetPrimaryFrame();
if (!ourFrame || !otherFrame) {
mInSwap = aOther->mInSwap = false;
FirePageShowEvent(ourDocshell, ourEventTarget, true);
FirePageShowEvent(otherDocshell, otherEventTarget, true);
nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
return NS_ERROR_NOT_IMPLEMENTED;
}

nsSubDocumentFrame* ourFrameFrame = do_QueryFrame(ourFrame);
if (!ourFrameFrame) {
mInSwap = aOther->mInSwap = false;
FirePageShowEvent(ourDocshell, ourEventTarget, true);
FirePageShowEvent(otherDocshell, otherEventTarget, true);
nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
return NS_ERROR_NOT_IMPLEMENTED;
}

// OK. First begin to swap the docshells in the two nsIFrames
rv = ourFrameFrame->BeginSwapDocShells(otherFrame);
if (NS_FAILED(rv)) {
mInSwap = aOther->mInSwap = false;
FirePageShowEvent(ourDocshell, ourEventTarget, true);
FirePageShowEvent(otherDocshell, otherEventTarget, true);
nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
return rv;
}

Expand Down Expand Up @@ -1329,8 +1279,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
ourParentDocument->FlushPendingNotifications(Flush_Layout);
otherParentDocument->FlushPendingNotifications(Flush_Layout);

FirePageShowEvent(ourDocshell, ourEventTarget, true);
FirePageShowEvent(otherDocshell, otherEventTarget, true);
nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);

mInSwap = aOther->mInSwap = false;
return NS_OK;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ skip-if = buildapp == 'b2g' # b2g(86 total, 4 failing - testing mozAnon - got fa
[test_XHR_system.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + )
[test_XHR_timeout.html]
skip-if = buildapp == 'b2g' # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
support-files = test_XHR_timeout.js
[test_base.xhtml]
[test_blobconstructor.html]
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ disabled = bug 407107
skip-if = (toolkit == 'gonk' && debug) #bug 1045153
[test_bug902651.html]
[test_canvas.html]
skip-if = (toolkit == 'gonk' && debug) || (toolkit == 'android' && processor == 'x86') #debug-only crash; bug 933541 #x86 only bug 913662
skip-if = (toolkit == 'gonk' && debug) || (toolkit == 'android' && processor == 'x86') || (android_version == '18' && debug) #debug-only crash; bug 933541 #x86 only bug 913662 #android 4.3 debug bug 1143317
[test_canvas_focusring.html]
skip-if = (toolkit == 'gonk' && !debug) || os == 'win' #specialpowers.wrap
[test_canvas_font_setter.html]
Expand Down
8 changes: 4 additions & 4 deletions dom/imptests/html/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createEvent.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction-literal-1.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction-literal-2.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction.html]
Expand Down Expand Up @@ -161,7 +161,7 @@ skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-insertBefore.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-isEqualNode.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-lookupPrefix.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-nodeName.html]
Expand Down Expand Up @@ -257,7 +257,7 @@ skip-if = buildapp == 'b2g' || android_version == '18' #Test timed out. Bug 1078
[dom/ranges/test_Range-selectNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-set.html]
skip-if = buildapp == 'b2g'
skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # android debug time outs
[dom/ranges/test_Range-surroundContents.html]
skip-if = buildapp == 'b2g'
[dom/test_historical.html]
Expand Down Expand Up @@ -290,7 +290,7 @@ skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-case.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.html]
Expand Down
6 changes: 6 additions & 0 deletions dom/ipc/PBrowser.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ child:
*/
AppOfflineStatus(uint32_t id, bool offline);

/**
* Tell the browser that its frame loader has been swapped
* with another.
*/
SwappedWithOtherRemoteLoader();

/*
* FIXME: write protocol!
Expand Down
21 changes: 21 additions & 0 deletions dom/ipc/TabChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,27 @@ TabChild::RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline)
return true;
}

bool
TabChild::RecvSwappedWithOtherRemoteLoader()
{
nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
if (NS_WARN_IF(!ourDocShell)) {
return true;
}

nsCOMPtr<nsPIDOMWindow> ourWindow = ourDocShell->GetWindow();
if (NS_WARN_IF(!ourWindow)) {
return true;
}

nsCOMPtr<EventTarget> ourEventTarget = ourWindow->GetParentTarget();

nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, false);
nsContentUtils::FirePageHideEvent(ourDocShell, ourEventTarget);
nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, true);
return true;
}

bool
TabChild::RecvDestroy()
{
Expand Down
2 changes: 2 additions & 0 deletions dom/ipc/TabChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ class TabChild final : public TabChildBase,

virtual bool RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline) override;

virtual bool RecvSwappedWithOtherRemoteLoader() override;

virtual PDocumentRendererChild*
AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform,
const nsString& bgcolor,
Expand Down
1 change: 1 addition & 0 deletions dom/media/webaudio/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ skip-if = toolkit == 'android' # bug 1056706
[test_channelMergerNodeWithVolume.html]
[test_channelSplitterNode.html]
[test_channelSplitterNodeWithVolume.html]
skip-if = (android_version == '18' && debug) # bug 1158417
[test_convolverNode.html]
[test_convolverNode_mono_mono.html]
[test_convolverNodeChannelCount.html]
Expand Down
1 change: 1 addition & 0 deletions dom/media/webspeech/recognition/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ support-files =
skip-if = toolkit == 'android' || toolkit == 'gonk' # bug 1037287
[test_audio_capture_error.html]
[test_call_start_from_end_handler.html]
skip-if = (android_version == '18' && debug) # bug 967606
[test_nested_eventloop.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(showmodaldialog)
[test_preference_enable.html]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "nsIHttpChannelInternal.h"
#include "nsIEncodedChannel.h"
#include "nsIUploadChannel.h"
#include "nsICachingChannel.h"
#include "nsICacheInfoChannel.h"
#include "nsIFileChannel.h"
#include "nsEscape.h"
#include "nsUnicharUtils.h"
Expand Down Expand Up @@ -1274,7 +1274,7 @@ nsresult nsWebBrowserPersist::SaveURIInternal(
}

// Cache key
nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(httpChannel));
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
if (cacheChannel && cacheKey)
{
cacheChannel->SetCacheKey(cacheKey);
Expand Down
6 changes: 0 additions & 6 deletions layout/reftests/text/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ HTTP(..) == synthetic-bold-papyrus-01.html synthetic-bold-papyrus-01-ref.html
!= text-align-justify-last-end.html text-align-justify-last-justify.html
!= text-align-justify-last-center.html text-align-justify-last-justify.html
== text-align-left-in-rtl-block.html text-align-left-in-rtl-block-ref.html
== text-align-match-parent-01.html text-align-match-parent-ref.html
== text-align-match-parent-02.html text-align-match-parent-ref.html
== text-align-match-parent-03.html text-align-match-parent-ref.html
== text-align-match-parent-04.html text-align-match-parent-ref.html
== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
HTTP(..) == variation-selector-unsupported-1.html variation-selector-unsupported-1-ref.html
== white-space-1a.html white-space-1-ref.html
== white-space-1b.html white-space-1-ref.html
Expand Down
Loading

0 comments on commit ba9ebd3

Please sign in to comment.