forked from mirrors/gecko-dev
		
	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
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			417 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			417 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
function handleRequest(request, response) {
 | 
						|
  response.setHeader(
 | 
						|
    "Content-Type",
 | 
						|
    "multipart/x-mixed-replace;boundary=BOUNDARY",
 | 
						|
    false
 | 
						|
  );
 | 
						|
  response.setStatusLine(request.httpVersion, 200, "OK");
 | 
						|
 | 
						|
  response.write(`--BOUNDARY
 | 
						|
Content-Type: text/html
 | 
						|
 | 
						|
<h1>First</h1>
 | 
						|
Will be replaced
 | 
						|
--BOUNDARY
 | 
						|
Content-Type: text/html
 | 
						|
 | 
						|
<h1>Second</h1>
 | 
						|
This will stick around
 | 
						|
--BOUNDARY
 | 
						|
--BOUNDARY--
 | 
						|
`);
 | 
						|
}
 |