tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

stash.py (1050B)


      1 # Copyright 2023 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 """
      5 This file allows the different windows created by
      6 css/css-scroll-snap/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation.html
      7 to store and retrieve data.
      8 
      9 scroll-initial-target-with-text-fragment-navigation.html (test file) opens a window to
     10 scroll-initial-target-with-text-fragment-navigation-target.html which writes some data
     11 which the test file will eventually read. This file handles the requests from
     12 both windows.
     13 """
     14 
     15 import time
     16 
     17 def main(request, response):
     18    key = request.GET.first(b"key")
     19 
     20    if request.method == u"POST":
     21        # Received result data from target page
     22        request.server.stash.put(key, request.body, u'/css/css-scroll-snap/scroll-initial-target/')
     23        return u"ok"
     24    else:
     25        # Request for result data from test page
     26        value = request.server.stash.take(key, u'/css/css-scroll-snap/scroll-initial-target/')
     27        return value