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

images need be fetched via ResourceTask #35

Closed
brson opened this issue Jul 29, 2012 · 4 comments
Closed

images need be fetched via ResourceTask #35

brson opened this issue Jul 29, 2012 · 4 comments

Comments

@brson
Copy link
Contributor

brson commented Jul 29, 2012

images are loaded by apply_style directly from disk. In order to use the resource manager to load the image we need to know the url of the current document (in order to resolve relative paths), and that url isn't available to the layout task currently.

It seems like layout shouldn't be responsible for loading images anyway, so something needs to be reconsidered here.

@BrendanEich
Copy link

We do want to avoid loading images that are not presented, though -- see https://bugzilla.mozilla.org/show_bug.cgi?id=689623.

/be

@pcwalton
Copy link
Contributor

There are a couple of things to note here:

  • Sometimes, only layout can determine whether an image is going to be
    displayed at all. This is the case for the CSS background-image property,
    for example.
  • Layout needs to be in charge of loading the images, because we don't want
    to decode an image until it's visible. Gecko made the mistake of decoding
    images immediately regardless of their visibility, and it's the source of a
    lot of complaints about Firefox's memory usage. Let's make sure we do this
    right in Servo.
    On Jul 28, 2012 5:04 PM, "Brian Anderson" <
    [email protected]>
    wrote:

images are loaded by apply_style directly from disk. In order to use the
resource manager to load the image we need to know the url of the current
document (in order to resolve relative paths), and that url isn't available
to the layout task currently.

It seems like layout shouldn't be responsible for loading images anyway,
so something needs to be reconsidered here.


Reply to this email directly or view it on GitHub:
#35

@bzbarsky
Copy link
Contributor

Note that for background-image the relevant base URI is the base URI of the stylesheet, not of the document (though the two may happen to be equal). So really, only someone who knows what the source of the image is can possibly know what base URI to use for it.

A separate discussion to be had is how we want to represent URIs in servo....

@brson
Copy link
Contributor Author

brson commented Aug 11, 2012

OK, I've written an image cache task, with two operations, Prefetch and GetImage, and I've hooked it up to layout, so now images are being loaded through the resource manager.

Right now what happens is that when layout applies a background image style it sends the Prefetch message, at which point the image cache will tell the resource manager to begin loading the file.

Later on, when building the display list, we post the GetImage method, wait for the result and store the image in the display list. It's not until GetImage that the image cache actually does the decoding. Because we wait for the image, we are still doing decoding sequentially. What we really want is to store a future in the display list, but I need to rewrite the futures module for that.

The burrito kitty test works when loading from a local file, but when loading from the network the image doesn't arrive in time so it doesn't display. We'll need to post a reflow message in this case.

@brson brson closed this as completed Aug 11, 2012
ChrisParis pushed a commit to ChrisParis/servo that referenced this issue Sep 7, 2014
mbrubeck pushed a commit to mbrubeck/servo that referenced this issue May 11, 2015
pmocher pushed a commit to Brody-Eastwood/servo that referenced this issue Mar 30, 2018
# This is the 1st commit message:

Don't access the reflector when dropping a Promise (fixes servo#18651)

The reflector may be dead already.

# This is the commit message servo#2:

Run automated test for memory report charter.
# This is the commit message servo#3:

Run memory charting test on CI.
# This is the commit message servo#4:

Move the TravisCI test to the quick group.
# This is the commit message servo#5:

Add timeout pref to the mozilla/worklets wpt tests

# This is the commit message servo#6:

Added .ini for test_paint_worklet_timeout.html

# This is the commit message servo#7:

Update the in-tree status of WPT syncing.

# This is the commit message servo#8:

refactor(window): reference winit where applicable

- relates with servo#20299

# This is the commit message servo#9:

Update mozangle to 0.1.6.

# This is the commit message servo#10:

Update to handle WebRender API changes

Items now only take a clipping rectangle instead of a LocalClip.

# This is the commit message servo#11:

Update WR (local clip API change, texture cache optimizations).

# This is the commit message servo#12:

Update the MULTIPROCESS static when changing default options

# This is the commit message servo#13:

Add Windows support to the --nightly | -n flag.

# This is the commit message servo#14:

build(cargo): enable webrender capture feature

# This is the commit message servo#15:

feat(windowevent): expose CaptureWebRender event

# This is the commit message servo#16:

feat(window): bind hotkey to trigger capture event

# This is the commit message servo#17:

Avoid using WPT test runner to update the test manifest.

# This is the commit message servo#18:

Use typed coordinates.

We use Size2D and Point2D across compositing, constellation and script,
losing the type of pixels we use (DevicePixel, DeviceIndepententPixel
or CSSPixel) along the way, which might lead to bugs like
window.outerHeight not taking into account the page zoom (using
DeviceIndepententPixel instead of CSSPixel).

# This is the commit message servo#19:

alias some euclid types

# This is the commit message servo#20:

remove WindowMethods::size()

# This is the commit message servo#21:

Remove update-manifest argument that is no longer valid.
# This is the commit message servo#22:

Update web-platform-tests to revision e87f38097902e16348d4e17f4fe3bc2d0112bff1

# This is the commit message servo#23:

Add icon to servo.exe

# This is the commit message servo#24:

Use mozjs 0.3 fork without Heap::new

# This is the commit message servo#25:

Root JS object members in dictionaries

# This is the commit message servo#26:

Root `any` members in dictionaries

# This is the commit message servo#27:

Add key/value iterable HTML benchmark

# This is the commit message servo#28:

Fix tabs

# This is the commit message servo#29:

Use upstream mozjs 0.3

# This is the commit message servo#30:

Update WR (radial gradient optimizations).

# This is the commit message servo#31:

CounterBound::Integer made to store an Integer

# This is the commit message servo#32:

style: Remove unsound Atom From implementations.

Fixes servo#20158

# This is the commit message servo#33:

style: Cleanup @-moz-document parsing a bit.

MozReview-Commit-ID: 7vd0BLAqM0v
Bug: 1446470
Reviewed-by: xidorn

# This is the commit message servo#34:

style: Allow @-moz-document url-prefix() on content.

MozReview-Commit-ID: zaT41fpsDT
Bug: 1446470
Reviewed-by: xidorn

# This is the commit message servo#35:

style: Add another pref to control the url-prefix hack.

MozReview-Commit-ID: D4qL0oO69Uh
Bug: 1446470
Reviewed-by: xidorn

# This is the commit message servo#36:

style: Update bindings.

# This is the commit message servo#37:

Update web-platform-tests to revision 790e6601ee8b4b412b6ad9f6fde466b7ccb9cb7e

# This is the commit message servo#38:

style: Better Shadow DOM assertions.

Bug: 1445682
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D748

# This is the commit message servo#39:

Support memory report logs with interleaved non-report output, added automated tests

# This is the commit message servo#40:

Update WR revision.
# This is the commit message servo#41:

Add Servo_Property_IsShorthand to geckolib/glue.rs

# This is the commit message servo#42:

Re-expose webrender debugger feature in components/servo

Update ws in debugger  to 0.7.3

Update lockfile

# This is the commit message servo#43:

Update web-platform-tests to revision 3ec34e5a2c8cbeeb7fad521cce0daf923b272a92

# This is the commit message servo#44:

Make `type` argument as optional and ignore it in open method

# This is the commit message servo#45:

Update steps with new spec

# This is the commit message servo#46:

Make type-argument.window.js test as pass

# This is the commit message servo#47:

Simplify GetTexParameter

# This is the commit message servo#48:

Simplify VertexAttribOffset

# This is the commit message servo#49:

Simplify BufferParameter

# This is the commit message servo#50:

Simplify GetShaderPrecisionFormat

# This is the commit message servo#51:

Update web-platform-tests to revision 3a8328470d53c4501e31cec2775c4d33821c2275

# This is the commit message servo#52:

Mouse position from glutin is DevicePixel

# This is the commit message servo#53:

Update servo-websocket to 0.21

# This is the commit message servo#54:

Bump ipc-channel and bincode

This required bumping uuid too which unfortunately duplicated rand.

# This is the commit message servo#55:

Remove our dependency on the gcc crate

# This is the commit message servo#56:

Blobs support typed arrays now

# This is the commit message servo#57:

Bump parking_lot to 0.5

# This is the commit message servo#58:

initial shot at initial steps

# This is the commit message servo#59:

Second shot at initial steps

# This is the commit message servo#60:

Progress on initial steps

# This is the commit message servo#61:

initial shot at initial steps
pmocher pushed a commit to Brody-Eastwood/servo that referenced this issue Mar 30, 2018
# This is the 1st commit message:

resolved merge conflict

# This is the commit message servo#2:

style(capture_webrender): use eprintln for error output

# This is the commit message servo#3:

Fix some more WebGL methods

# This is the commit message servo#4:

Implement OES_element_index_uint (fixes servo#20384)

# This is the commit message servo#5:

Use mozjs 0.4

# This is the commit message servo#6:

Add safe `handle` function for rooted heap values

# This is the commit message servo#7:

Use unsafe Heap::handle wherever needed

# This is the commit message servo#8:

Change WebGL function signatures accepting typed arrays

# This is the commit message servo#9:

Adapt function bodies for usage with typed array args

# This is the commit message servo#10:

Adapt uniform[fv] and similar to accept typed array args

# This is the commit message servo#11:

Appease test-tidy

# This is the commit message servo#12:

Fix sanity check in vertex attrib

# This is the commit message servo#13:

Fix indentation

# This is the commit message servo#14:

Unify argument auto rooting in codegen

# This is the commit message servo#15:

Add codegen test for function overloads taking typed array args

# This is the commit message servo#16:

Use safe to_vec() for typed arrays in WebGL bindings

# This is the commit message servo#17:

Bug 1448138 - Rename string DataFlags::SHARED to REFCOUNTED to make it clearer to those reading the code.  (Servo changes.)  r=erahm

# This is the commit message servo#18:

Used the zip function to iterate over both vectors simultaneously instead of an
index variable and unwrapping the result.

# This is the commit message servo#19:

Implement HTMLCanvasElement.toDataURL for WebGL canvas (fixes servo#19147)

# This is the commit message servo#20:

Update web-platform-tests to revision d04a8fc02b85bd32799691759c8c05ead07cd939

# This is the commit message servo#21:

Implement missing checks in WebGLRenderingContext::GetBufferParameter

# This is the commit message servo#22:

Implement WebGLRenderingContextBase.getAttachedShaders

# This is the commit message servo#23:

Implement missing WebGLShader checks

Methods compileShader and getShaderParameter should emit an error when
the shader has been deleted.

# This is the commit message servo#24:

Add constructors for typed arrays in DOMMatrix and DOMMatrixReadOnly

# This is the commit message servo#25:

feat(webidl): expose arraybuffer overload in body idl

# This is the commit message servo#26:

feat(consume_body): implement consume_body accepts arraybuffer

# This is the commit message servo#27:

refactor(consume_body): json stored in roottraceablebox

# This is the commit message servo#28:

test(wpt): update fetch test metadata

# This is the commit message servo#29:

Implement gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)

# This is the commit message servo#30:

TextDecoder's Decode now receives a BufferSource as input

# This is the commit message servo#31:

Update mozjs.

# This is the commit message servo#32:

Switches WriteValue to use BufferSource

# This is the commit message servo#33:

Switches characteristic to use BufferSource

# This is the commit message servo#34:

Updates Bluetooth type to use BufferSource

# This is the commit message servo#35:

Websockets send typed arrays now

# This is the commit message servo#36:

Dedupe lazy_static

:tada: :tada: :tada:

# This is the commit message servo#37:

Statically allocate static atoms.

# This is the commit message servo#38:

Update web-platform-tests to revision d04a8fc02b85bd32799691759c8c05ead07cd939

# This is the commit message servo#39:

refactor(websocket): do not borrow sender anymore
bors-servo added a commit that referenced this issue Oct 9, 2021
Fix UB in hashglobe

<!-- Please describe your changes on the following line: -->

This is a backport of rust-lang/rust#53804

Currently, this bug cause Firefox crash with Rust 1.56 ( LLVM 13 )

<details>
<summary>backtrace of Firefox</summary>

```
(lldb) bt
* thread #1, name = 'GeckoMain', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00007ffff4ff7bde libxul.so`::RustMozCrash(const char *, int, const char *) [inlined] MOZ_Crash(aLine=2220, aReason="attempt to write to unaligned or null pointer") at Assertions.h:256:3
    frame #1: 0x00007ffff4ff7bd4 libxul.so`::RustMozCrash(aFilename="/rustc/1.56.0/library/core/src/intrinsics.rs", aLine=2220, aReason="attempt to write to unaligned or null pointer") at wrappers.cpp:18:3
    frame #2: 0x00007ffff4ff7b53 libxul.so`mozglue_static::panic_hook::h91947f48d75eb4dd(info=<unavailable>) at lib.rs:91:9
    frame #3: 0x00007ffff4ff6e19 libxul.so`core::ops::function::Fn::call::h2f4e62c593234181((null)=<unavailable>, (null)=<unavailable>) at function.rs:70:5
    frame #4: 0x00007ffff5bd055b libxul.so`std::panicking::rust_panic_with_hook::h41696e81832261ff(payload=&mut dyn core::panic::BoxMeUp @ 0x00007f24a7e5fc70, message=Option<&core::fmt::Arguments> @ r13, location=<unavailable>) at panicking.rs:628:17
    frame #5: 0x00007ffff5bd00a2 libxul.so`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::hea2a534982472bd3 at panicking.rs:519:13
    frame #6: 0x00007ffff5bcc494 libxul.so`std::sys_common::backtrace::__rust_end_short_backtrace::h793de5eec3283122(f=<unavailable>) at backtrace.rs:141:18
    frame #7: 0x00007ffff5bd0039 libxul.so`rust_begin_unwind(info=0x00007fffffff7a78) at panicking.rs:517:5
    frame #8: 0x00007ffff5c2ece1 libxul.so`core::panicking::panic_fmt::h43c4759d9f1ef313(fmt=<unavailable>) at panicking.rs:101:14
    frame #9: 0x00007ffff5c2ebbd libxul.so`core::panicking::panic::hb6dc0edf878703a5(expr=<unavailable>) at panicking.rs:50:5
    frame #10: 0x00007ffff56dd397 libxul.so`core::intrinsics::write_bytes::h481ad0b8372e9e0a(dst=0x0000000000000000, val='\0', count=0) at intrinsics.rs:2220:5
    frame #11: 0x00007ffff589e749 libxul.so`hashglobe::table::RawTable$LT$K$C$V$GT$::new::h04532bdf928a2865(capacity=0) at table.rs:839:13
    frame #12: 0x00007ffff58b38f0 libxul.so`hashglobe::hash_map::HashMap$LT$K$C$V$C$S$GT$::try_with_hasher::h7086fbc016a9427d(hash_builder=<unavailable>) at hash_map.rs:622:20
    frame #13: 0x00007ffff58b3077 libxul.so`hashglobe::hash_map::HashMap$LT$K$C$V$C$S$GT$::with_hasher::h9ee840b6d255f9fa(hash_builder=<unavailable>) at hash_map.rs:628:9
    frame #14: 0x00007ffff5812c99 libxul.so`_$LT$hashglobe..hash_map..HashMap$LT$K$C$V$C$S$GT$$u20$as$u20$core..default..Default$GT$::default::h7a34c6ba884b9658 at hash_map.rs:1329:9
    frame #15: 0x00007ffff58dfb3a libxul.so`_$LT$style..selector_map..MaybeCaseInsensitiveHashMap$LT$style..gecko_string_cache..Atom$C$V$GT$$u20$as$u20$core..default..Default$GT$::default::h2c19828653342158 at selector_map.rs:704:37
    frame #16: 0x00007ffff5978919 libxul.so`_$LT$style..invalidation..stylesheets..StylesheetInvalidationSet$u20$as$u20$core..default..Default$GT$::default::h16e0d0431f387b3d at stylesheets.rs:103:5
    frame #17: 0x00007ffff58d54b9 libxul.so`style::invalidation::stylesheets::StylesheetInvalidationSet::new::h4eedeb3b15c2c2c5 at stylesheets.rs:112:9
    frame #18: 0x00007ffff58e43a6 libxul.so`style::stylesheet_set::DocumentStylesheetSet$LT$S$GT$::new::hf80ba16d4d55a4ca at stylesheet_set.rs:516:28
    frame #19: 0x00007ffff58f269a libxul.so`style::stylist::StylistStylesheetSet::new::h66b5d09ea8a90d6e at stylist.rs:462:30
    frame #20: 0x00007ffff58f26f0 libxul.so`style::stylist::Stylist::new::h4732ca5247e85cd7(device=<unavailable>, quirks_mode=Quirks) at stylist.rs:562:26
    frame #21: 0x00007ffff593d755 libxul.so`style::gecko::data::PerDocumentStyleData::new::h9dc814d46fec8d6c(document=<unavailable>) at data.rs:145:22
    frame #22: 0x00007ffff56781d9 libxul.so`Servo_StyleSet_Init(doc=<unavailable>) at glue.rs:4175:25
    frame #23: 0x00007ffff2b58416 libxul.so`mozilla::ServoStyleSet::ServoStyleSet(this=0x00007fffe3c5ba90, aDocument=0x00007fffd391d560) at ServoStyleSet.cpp:120:17
    frame #24: 0x00007ffff128ba5e libxul.so`mozilla::dom::Document::Init() [inlined] mozilla::detail::UniqueSelector<mozilla::ServoStyleSet>::SingleObject mozilla::MakeUnique<mozilla::ServoStyleSet, mozilla::dom::Document&>(aArgs=0x00007fffd391d560) at UniquePtr.h:609:27
    frame #25: 0x00007ffff128ba46 libxul.so`mozilla::dom::Document::Init(this=0x00007fffd391d560) at Document.cpp:2657:15
    frame #26: 0x00007ffff20847d9 libxul.so`nsHTMLDocument::Init(this=0x00007fffd391d560) at nsHTMLDocument.cpp:146:27
    frame #27: 0x00007ffff208462a libxul.so`NS_NewHTMLDocument(aInstancePtrResult=0x00007fffffff9c60, aLoadedAsData=false) at nsHTMLDocument.cpp:112:22
    frame #28: 0x00007ffff2ea18cf libxul.so`nsContentDLF::CreateBlankDocument(aLoadGroup=0x00007fffc2ec87a0, aPrincipal=0x00007fffe476cdb0, aPartitionedPrincipal=0x00007fffe476cdb0, aContainer=0x00007fffe34752c0) at nsContentDLF.cpp:212:22
    frame #29: 0x00007ffff32d1ea1 libxul.so`nsDocShell::CreateAboutBlankContentViewer(this=0x00007fffe34752c0, aPrincipal=0x00007fffe476cdb0, aPartitionedPrincipal=0x00007fffe476cdb0, aCSP=0x0000000000000000, aBaseURI=0x0000000000000000, aIsInitialDocument=true, aCOEP=0x00007fffffff9d86, aTryToSaveOldPresentation=<unavailable>, aCheckPermitUnload=<unavailable>, aActor=0x0000000000000000) at nsDocShell.cpp:6588:16
    frame #30: 0x00007ffff332380c libxul.so`nsAppShellService::JustCreateTopWindow(this=<unavailable>, aParent=0x0000000000000000, aUrl=<unavailable>, aChromeMask=4161799686, aInitialWidth=<unavailable>, aInitialHeight=<unavailable>, aIsHiddenWindow=<unavailable>, aResult=<unavailable>) at nsAppShellService.cpp:760:22
    frame #31: 0x00007ffff3323b03 libxul.so`nsAppShellService::CreateTopLevelWindow(this=<unavailable>, aParent=0x0000000000000000, aUrl=<unavailable>, aChromeMask=4161799686, aInitialWidth=<unavailable>, aInitialHeight=<unavailable>, aResult=<unavailable>) at nsAppShellService.cpp:173:8
    frame #32: 0x00007ffff35aad11 libxul.so`nsAppStartup::CreateChromeWindow(this=<unavailable>, aParent=<unavailable>, aChromeFlags=4161799686, aOpenWindowInfo=0x0000000000000000, aCancel=<unavailable>, _retval=0x00007fffffff9ef8) at nsAppStartup.cpp:750:15
    frame #33: 0x00007ffff3627118 libxul.so`nsWindowWatcher::CreateChromeWindow(this=<unavailable>, aParentChrome=<unavailable>, aChromeFlags=<unavailable>, aOpenWindowInfo=<unavailable>, aResult=0x00007fffffff9fd0) at nsWindowWatcher.cpp:419:33
    frame #34: 0x00007ffff3626ae6 libxul.so`nsWindowWatcher::OpenWindowInternal(this=<unavailable>, aParent=0x0000000000000000, aUrl=0x00007fffffffa2d8, aName=0x00007fffffffa288, aFeatures=0x00007fffffffa278, aCalledFromJS=<unavailable>, aDialog=<unavailable>, aNavigate=<unavailable>, aArgv=<unavailable>, aIsPopupSpam=<unavailable>, aForceNoOpener=<unavailable>, aForceNoReferrer=<unavailable>, aPrintKind=<unavailable>, aLoadState=<unavailable>, aResult=<unavailable>) at nsWindowWatcher.cpp:947:12
    frame #35: 0x00007ffff3624d83 libxul.so`nsWindowWatcher::OpenWindow(this=0x00007fffe3f1bbe0, aParent=0x0000000000000000, aUrl=0x00007fffffffa2d8, aName=0x00007fffffffa288, aFeatures=0x00007fffffffa278, aArguments=<unavailable>, aResult=<unavailable>) at nsWindowWatcher.cpp:293:3
    frame #36: 0x00007ffff365c15b libxul.so`ShowProfileManager(aProfileSvc=<unavailable>, aNative=0x00007fffe8ce8ec0) at nsAppRunner.cpp:2553:27
    frame #37: 0x00007ffff365ad8f libxul.so`XREMain::XRE_mainStartup(bool*) [inlined] SelectProfile(aProfileSvc=<unavailable>, aNative=<unavailable>, aRootDir=<unavailable>, aLocalDir=<unavailable>, aProfile=<unavailable>, aWasDefaultSelection=<unavailable>) at nsAppRunner.cpp:0:7
    frame #38: 0x00007ffff365ab56 libxul.so`XREMain::XRE_mainStartup(this=<unavailable>, aExitFlag=<unavailable>) at nsAppRunner.cpp:4501:8
    frame #39: 0x00007ffff365fd00 libxul.so`XREMain::XRE_main(this=0x00007fffffffa500, argc=2, argv=0x00007fffffffb6f8, aConfig=0x00007fffffffa690) at nsAppRunner.cpp:5465:12
    frame #40: 0x00007ffff3660175 libxul.so`XRE_main(argc=<unavailable>, argv=<unavailable>, aConfig=<unavailable>) at nsAppRunner.cpp:5536:21
    frame #41: 0x00007ffff3665ff1 libxul.so`mozilla::BootstrapImpl::XRE_main(this=<unavailable>, argc=<unavailable>, argv=<unavailable>, aConfig=<unavailable>) at Bootstrap.cpp:45:12
    frame #42: 0x0000555555579140 firefox`main [inlined] do_main(argc=<unavailable>, argv=0x00007fffffffb6f8, envp=<unavailable>) at nsBrowserApp.cpp:225:22
    frame #43: 0x0000555555579076 firefox`main(argc=<unavailable>, argv=<unavailable>, envp=<unavailable>) at nsBrowserApp.cpp:392:16
```
</details>

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants