Bug 1519302 - Add pref to restrict BinAST feature to specific hosts. r=baku

To reduce the attack surface in early test for BinAST, add a preference to
restrict the hosts that Firefox accepts BinAST file from.
The preference is turned on by default (BinAST itself is turned off by
default for now), and the list contains hosts which is going to be used in
early test.
For hosts not listed in the list, Firefox doesn't send BinAST MIME-Type in
Accept field, and doesn't handle BinAST file in case the server returns
BinAST file.

Differential Revision: https://phabricator.services.mozilla.com/D16517
This commit is contained in:
Tooru Fujisawa
2019-01-16 13:12:00 +00:00
parent 10f6e60abe
commit ab7e297952
13 changed files with 178 additions and 8 deletions

View File

@@ -312,7 +312,12 @@ nsresult ScriptLoadHandler::EnsureKnownDataType(
TRACE_FOR_TEST(mRequest->Element(), "scriptloader_load_source");
return NS_OK;
}
return NS_ERROR_FAILURE;
// If the request isn't allowed to accept BinAST, fallback to text
// source. The possibly binary source will be passed to normal
// JS parser and will throw error there.
mRequest->SetTextSource();
return NS_OK;
}
}
}