Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using CORS filtered image responses as WebGL textures #24340

Merged
merged 6 commits into from Oct 8, 2019

Use the paint worklet's base URL for the 2d canvas' origin checks.

  • Loading branch information
jdm committed Oct 4, 2019
commit 583536c9406e685405d5b28da99dd8cab94c7d66
@@ -24,6 +24,7 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement};
use crate::dom::imagedata::ImageData;
use crate::dom::node::{Node, NodeDamage};
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use crate::dom::textmetrics::TextMetrics;
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
@@ -144,6 +145,14 @@ impl CanvasState {
.unwrap();
let (ipc_renderer, canvas_id) = receiver.recv().unwrap();
debug!("Done.");
// Worklets always receive a unique origin. This messes with fetching
// cached images in the case of paint worklets, since the image cache
// is keyed on the origin requesting the image data.
let origin = if global.is::<PaintWorkletGlobalScope>() {
global.api_base_url().origin()
} else {
global.origin().immutable().clone()
};
CanvasState {
ipc_renderer: ipc_renderer,
canvas_id: canvas_id,
@@ -153,7 +162,7 @@ impl CanvasState {
base_url: global.api_base_url(),
missing_image_urls: DomRefCell::new(Vec::new()),
saved_states: DomRefCell::new(Vec::new()),
origin: global.origin().immutable().clone(),
origin,
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.