fune/netwerk/protocol/viewsource/nsIViewSourceChannel.idl
Nika Layzell 10ecfc0ee0 Bug 1670530 - Part 1: Don't process multipart content when doing a view-source load, r=mattwoodrow,necko-reviewers,valentin
Before switching to using DocumentChannel to process multipart requests,
multipart documents loaded as a view-source load would be displayed their
plain-text data, as the multipart processing would be after the view-source
channel had wrapped the channel, and replaced the content type with
"application/x-view-source".

This change restores that behaviour, by preventing parent process multipart
processing for wrapped channels like `view-source` loads. This also allowed
removing the replaceRequest option on nsViewSourceChannel, as it was no longer
necessary, and required introducing a mechanism to get the inner http channel
for process switching.

The crash in Bug 1670530 was caused by a bad interaction between the view-source
replaceChannel logic, and the parent/content process switching logic, which
could lead to the load in the content process being initialized in a broken
state after a process switch, due to accidentally acting on a wrapped
view-source channel when an unwrapped one was expected. This patch also fixes
that issue, by removing the replaceRequest logic which caused it in the first
place.

Differential Revision: https://phabricator.services.mozilla.com/D98205
2020-12-03 17:03:45 +00:00

43 lines
1.5 KiB
Text

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIChannel.idl"
[uuid(3e9800f8-edb7-4c9a-9285-09b4f045b019)]
interface nsIViewSourceChannel : nsIChannel
{
/**
* The actual (MIME) content type of the data.
*
* nsIViewSourceChannel returns a content type of
* "application/x-view-source" if you ask it for the contentType
* attribute.
*
* However, callers interested in finding out or setting the
* actual content type can utilize this attribute.
*/
[must_use] attribute ACString originalContentType;
/**
* Whether the channel was created to view the source of a srcdoc document.
*/
[must_use] readonly attribute boolean isSrcdocChannel;
/**
* Set to indicate the base URI. If this channel is a srcdoc channel, it
* returns the base URI provided by the embedded channel. It is used to
* provide an indication of the base URI in circumstances where it isn't
* otherwise recoverable. Returns null when it isn't set and isn't a
* srcdoc channel.
*/
[must_use] attribute nsIURI baseURI;
/**
* Get the inner channel wrapped by this nsIViewSourceChannel.
*/
[notxpcom, nostdcall] nsIChannel getInnerChannel();
};