Skip to content

Instantly share code, notes, and snippets.

// BEFORE
if authentication_fetch_flag {
let current_url = http_request.borrow().current_url();
if includes_credentials(current_url) {
authorization_value = Basic {
username: "",
password: None
};
if let Some(name) = current_url.username() {
authorization_value.username = name.to_owned();
pub enum DOMManipulationTaskMsg {
FireEvent(Atom, Trusted<Reflectable>, EventBubbles, EventCancelable),
FireSimpleEvent(Atom, Trusted<Reflectable>),
SendStorageNotification(Trusted<Storage>, Option<String>, Option<String>, Option<String>)
}
let (actual_response, response) = match Rc::try_unwrap(actual_response.unwrap()) {
Ok(actual_res) => (actual_res, &Rc::try_unwrap(response.unwrap()).ok()),
Err(res) => {
drop(response);
let res = Rc::try_unwrap(res.unwrap()).ok();
(res, &res)
}
}
let handler = move |request: HyperRequest, response: HyperResponse| {
let redirects = match request.uri {
RequestUri::AbsolutePath(url) =>
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0) + 1,
RequestUri::AbsoluteUri(url) =>
url.path().unwrap().first().unwrap().split("/").collect::<String>().parse::<u32>().unwrap_or(0) + 1,
_ => {}
};
let url =
<script>
test(function() {
var client = new XMLHttpRequest(),
urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
user = token();
client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false)
client.setRequestHeader("x-user", user)
client.send(null)
client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
client.setRequestHeader("x-user", user)
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id=testframe src="/common/blank.html"></iframe>
<script>
var simple_tests = [
{
name: "text.simple",
input: "<input name=foo value=bara>",
@KiChjang
KiChjang / maps.js
Created November 22, 2016 18:57
Google maps function
efa = function() {
var a = _.k.MessageChannel;
"undefined" === typeof a && "undefined" !== typeof window && window.postMessage && window.addEventListener && !_.kc("Presto") && (a = function() {
var a = window.document.createElement(_.Vea);
a.style.display = _.Wa;
a.src = "";
window.document.documentElement.appendChild(a);
var b = a.contentWindow,
a = b.document;
a.open();
// MIR for `main`
// source = Fn(NodeId(4))
// pass_name = NLL
// disambiguator = after
fn main() -> () {
let mut _0: (); // return pointer
scope 1 {
let _1: isize; // "i" in scope 1 at src/test/compile-fail/borrowck/borrowck-and-init.rs:12:9: 12:10
scope 2 {
warning: unused variable: `foo`
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:14:9
|
14 | let foo = false && { i = 5; true };
| ^^^
|
= note: #[warn(unused_variables)] on by default
= note: to avoid this warning, consider using `_foo` instead
warning: unused variable: `bar`
unsafe extern fn open(cx: *mut JSContext, _obj: HandleObject, this: *const XMLHttpRequest, args: *const JSJitMethodCallArgs) -> bool {
return wrap_panic(panic::AssertUnwindSafe(|| {
let this = &*this;
let args = &*args;
let argc = args._base.argc_;
let argcount = cmp::min(argc, 5);
match argcount {
2 => {
let arg0: ByteString = match FromJSValConvertible::from_jsval(cx, args.get(0), ()) {