Recent Activities
This page shows what are we working on.
-
head
-
head
-
fix: Handle corrupted CSP SRI data gracefully in PageSpeed plugin
Prevents site crashes when Subresource Integrity storage contains
invalid JSON by adding try-catch blocks and auto-clearing corrupted data. c52ed9
-
-
1.17.0
-
Version 1.17.0 c66e50
-
refactor(logger): Remove parameters, use LoggerSingleton lazy init
BREAKING CHANGE: Removed constructor parameters.
Debug mode auto-detected from PAGESPEED_DEBUG constant.
Removed:
- Logger/LoggerFactory.php (replaced by LoggerSingleton)
- parameters from 25+ classes
- properties from 15+ classes
- Explicit initLogger() calls
Changed:
- LoggerSingleton:: getInstance() - no param, auto-detects
- LoggerAwareTrait - lazy init + isDebugEnabled() method
- All logger-using classes - simplified constructors
- DuplicateValidator, PatchGrouper, PatchApplicator, ParentPatcher - use trait instead of injected logger
- DuplicateOffsetDetector:: detect(), OffsetStatistics::log() - removed param
Added:
- isDebugEnabled() checks before expensive operations (PatchGrouper, Pipeline, Tracker, NodeHtmlCache) 4ad59c -
refactor(offset-finder): Replace signature-based strategies with UniqueMarker + indexed lookup
BREAKING CHANGE: Replaced SignatureOffsetFinder, FastTagOffsetFinder, and AttributeOffsetFinder
with new strategy chain focused on markers and fast indexed lookups.
New strategy chain (priority order):
1. UniqueMarkerOffsetFinder - O(1) lookup by data-pspd-n markers (100% accurate)
2. IndexedAttributeOffsetFinder - Pre-indexed img/script/link/style tags by id/src/href
3. DirectAttributeOffsetFinder - Fallback for non-indexed attributes (id, data-role)
4. SiblingIndexTagOffsetFinder - Position-based matching for duplicate tags
5. ParentContextOffsetFinder - Parent-child context analysis
6. ContentOffsetFinder - Last resort content-based matching
Added:
- Model/Dom/Node/Position/OffsetFinder/Helper/TagIndex. php
Shared lazy-initialized index for fast tag lookup with duplicate detection
- Model/Dom/Node/Position/OffsetFinder/Strategy/UniqueMarkerOffsetFinder.php
Highest priority strategy using data-pspd-n markers added by UniqueMarkers patcher
- Model/Dom/Node/Position/OffsetFinder/Strategy/IndexedAttributeOffsetFinder.php
Fast O(1) hash lookup by unique attributes (id/src/href/data-role)
- Model/Dom/Node/Position/OffsetFinder/Strategy/DirectAttributeOffsetFinder.php
Fallback for elements with priority attributes not in index
- Model/Dom/Node/Position/OffsetFinder/Strategy/SiblingIndexTagOffsetFinder.php
Position-based matching with duplicate tag detection
- Test/Unit/Model/Dom/Node/Position/OffsetFinder/OffsetFinderChainSetup.php
Trait for consistent test setup across all offset finder tests
- Test/Unit/Model/Patch/UniqueMarkersIntegrationTest.php
Integration test for complete UniqueMarkers + OffsetFinder pipeline
Removed:
- Model/Dom/Node/Position/OffsetFinder/Strategy/AttributeOffsetFinder.php
Replaced by DirectAttributeOffsetFinder with clearer responsibility
- Model/Dom/Node/Position/OffsetFinder/Strategy/FastTagOffsetFinder.php
Split into IndexedAttributeOffsetFinder + SiblingIndexTagOffsetFinder
- Model/Dom/Node/Position/OffsetFinder/Strategy/SignatureOffsetFinder.php
Replaced by simpler, faster strategies with UniqueMarker as primary
- Model/Dom/Node/Position/OffsetFinder/Strategy/ContentPriorityOffsetFinder.php
Functionality merged into ContentOffsetFinder
Changed:
- Model/Dom/Node/Position/Tracker.php
Added '//style' to DEFAULT_XPATH_QUERIES for <style> tag indexing
- Model/Dom/Node/Position/TrackerFactory.php
Updated to use new strategy chain with TagIndex
- Test/Unit/Model/Dom/Node/Position/OffsetFinder/ChainTest.php
- Test/Unit/Model/Dom/Node/Position/OffsetFinder/DiagnosticDuplicateTest.php
- Test/Unit/Model/Dom/Node/Position/OffsetFinder/DuplicateOffsetAnalysisTest.php
- Test/Unit/Model/Dom/Node/Position/OffsetFinder/FixValidationTest.php
Refactored to use OffsetFinderChainSetup trait for consistent setup
- Test/Unit/Model/Dom/ScriptOffsetDuplicationTest.php
Updated for new strategy chain, all tests now use markers
Performance improvements:
- UniqueMarker strategy: ~50x faster than signature-based (O(1) hash lookup)
- IndexedAttribute strategy: ~20x faster (pre-built index on first use)
- Eliminated complex signature generation and filtering logic
- Reduced duplicate offset rate from 15+ duplicates to 0 with markers
Fixes:
- #82 Duplicate offsets for <script type=text/x-magento-init> tags
- Missing offset detection for <style> tags
- Inconsistent offset finding across identical opening tags
Migration:
- UniqueMarkers patcher adds data-pspd-n markers before offset tracking
- Markers removed after optimization with UniqueMarkers:: restore()
- No changes required for existing code using Tracker API
Tests:
- All existing tests pass with new strategy chain
- New integration test validates complete pipeline
- Test coverage maintained at 95%+
Related: swissup/module-pagespeed#82 7e2670 -
feat: add UniqueMarkerOffsetFinder strategy
New offset finder using data-pspd-n markers for accurate tracking.
Files:
- UniqueMarkerOffsetFinder.php (O(1) lookup strategy)
- UniqueMarkers.php (adds/removes markers)
- 15 unit tests
Results:
- Duplicate offsets: 6 → 0
- Failed strategies: ~20 → ~1
- indexNodes: 4.45ms → 2.5ms (-44%)
Registered as first strategy. Backwards compatible. 24704c -
refactor: move mode detection from Manager to TrackedDomDocument
- Remove Manager::isDocument() (31 lines)
- Add TrackedDomDocument::detectMode() for auto-detection
- Constructor accepts ? string = null (auto-detect if null)
- Remove 126 lines of Manager tests (logic encapsulated in TrackedDomDocument)
Simplifies Manager, eliminates duplication, improves encapsulation. aceda6 -
refactor: simplify HTML rendering, remove BomStripper/HtmlFragmentExtractor utils
- Remove Manager::saveHTML() (replaced by getOptimizedHtml)
- Rename Manager::renderDocument() → getOptimizedHtml() for clarity
- Delete BomStripper utility (DOMDocument doesn't add BOM)
- Move HtmlFragmentExtractor to trait for reusability
- Add shouldExtractFragment() to preserve <body>/<html> structure when present
- Context::getHtml() now calls getOptimizedHtml() directly
Result: cleaner architecture, fewer dependencies, explicit parameter passing. fba770 -
refactor(TrackedDomDocument): remove normalizedHtml, improve UTF-8 handling
- Remove normalizedHtml property - use originalHtml for indexing
- Extract libxml error logging into separate method
- Add detailed libxml parsing error summary
- Replace getNormalizedHtml() with saveHTML() in tests
- Add 9 new tests for node caching and UTF-8 preservation
- Fix spacing in parent::saveHTML() call
Breaking: Offset tracking now uses pre-parsed HTML instead of normalized 2be4ec -
refactor: migrate to Magento-generated ContextFactory
BREAKING CHANGE: Remove custom ContextFactory class
Changes:
- Remove Model/Optimizer/ContextFactory. php (use Magento DI)
- Create Test/Unit/Helper/ContextFactoryTrait for tests
- Supports both string (legacy) and array formats
- Provides createContext() helper for cleaner test code
- Throws clear errors for invalid input types
- Update AbstractStreamOptimizer and Pipeline to use array format
- Update all 25+ test files to use trait
- Remove ~100+ lines of duplicated test setup code
- Remove redundant createContext() methods from individual tests
- Update PipelineTest mock expectations to validate array structure
Benefits:
- Simplifies codebase by using Magento's auto-generated factory
- Centralizes test setup logic in single trait
- Improves maintainability with single point of change
- Reduces code duplication across test suite
- Maintains backward compatibility with string format
All 583 tests passing ✅ b0d899 -
test: Fix Pipeline and Preload optimizer test expectations
Fixed 3 failing tests:
1. PipelineTest::testRunHandlesOptimizerExceptionsGracefully
- Changed expectation from throwing exception to continuing with next optimizer
- Pipeline should gracefully handle optimizer failures and continue execution
- Added second optimizer to verify pipeline continues after first one fails
2. AddLinkPreloadTest::testProcessContextWithDomOperations
- Fixed isDirty() assertion order
- Context. isDirty() returns true BEFORE getHtml() call
- Context.isDirty() returns false AFTER getHtml() (resets dirty flag)
3. DnsprefetchTest::testProcessContextWithDomOperations
- Fixed isDirty() assertion order (same as AddLinkPreload)
All tests now correctly reflect actual behavior:
- Pipeline continues execution even if one optimizer fails
- Context. getHtml() resets the dirty flag after applying patches 99da9e -
refactor: simplify logging architecture in DOM pipeline
- Replace callback loggers with LoggerAwareTrait in Manager
- Refactor Pipeline into focused methods (filterOptimizers, collectQueries, runOptimizer)
- Add Context::getOriginalHtml() for pipeline debugging
- Reset isDirty flag after patch application in Context
- Add debug mode check before TrackedDomDocument creation logging
BREAKING CHANGE: Manager:: saveHTML() signature changed - removed logger callbacks ae0746 -
refactor: extract debug logs injection into separate plugin
- Created InjectDebugLogsPlugin for debug logs injection
- Removed log injection from Pipeline (now only handles optimization)
- Uses LoggerAwareTrait with LoggerSingleton for shared log collection
- InjectDebugLogsPlugin runs after optimization (sortOrder=-10)
- Follows Single Responsibility Principle
- Easier to enable/disable debug logs independently via di.xml
- Improved code organization and maintainability
Execution order:
1. AfterRenderResultPlugin (sortOrder=-15) - optimization pipeline
2. InjectDebugLogsPlugin (sortOrder=-10) - inject debug logs
Technical details:
- LoggerAwareTrait->flushLogs() retrieves logs from LoggerSingleton
- All classes using LoggerAwareTrait share the same logger instance
- Logs accumulated across Pipeline, Context, Manager, and Optimizers
- Single flush at the end outputs all logs to browser console
Breaking changes: None (log injection still works, just moved to plugin) 2ff1a7 -
refactor: extract TrackedDomDocument into focused traits
- Created 5 specialized traits following Single Responsibility Principle:
* Utf8CharsetInjectorTrait: UTF-8 charset injection/removal with 4 strategies
* ElementTrackingTrait: setAttribute/removeAttribute operations
* NodeTrackingTrait: appendChild/removeChild/replaceChild operations
* BatchModificationTrait: batchModifyElement for atomic changes
* HtmlSerializationTrait: getElementHtml with formatting control
- Reduced TrackedDomDocument from ~1200 to ~450 lines
- Improved UTF-8 handling with duplication check
- Enhanced meta charset removal with multiple fallback strategies
- Better code organization, testability, and maintainability
- Updated tests:
* TrackedDomDocumentTest: use TrackedDomDocument for UTF-8 preservation
* ContextTest: improved mock injection via DI instead of reflection
- Fixed typo in error message spacing
All tests passing (583/583) 4fffd6 -
refactor: extract DOM utilities and move logic from Context to Manager
- Created ScriptTagEscaper, HtmlFragmentExtractor, BomStripper utility classes
- Moved document/XPath caching from Context to Manager
- Manager now handles all HTML rendering, patch application, and fragment extraction
- Context simplified to pure coordinator (metadata, dirty state, delegation)
- TrackedDomDocument made originalHtml readonly and added mode getters (isDocument/isFragment)
- Manager auto-detects fragment mode from TrackedDomDocument
- Added clearCache() method to Manager for cache invalidation
- Fixed code style inconsistencies (spacing, comments) 41aee6 -
refactor: centralize UTF-8 BOM constant to TrackedDomDocument and remove duplicates 2ab7ba
-
Merge branch 'master' of github.com:swissup/module-pagespeed 2b0da4
-
refactor: move DomManager to Swissup\Pagespeed\Model\Dom\Manager and rename getDom() to getDocument()
- Moved DomManager from Model\Optimizer to Model\Dom (as Manager) for clearer domain separation and SRP.
- Updated all usages: Context, ContextFactory, optimizers, and tests now use Model\Dom\Manager (aliased as DocumentManager).
- Renamed method getDom() → getDocument() everywhere to clarify returned value meaning and avoid ambiguity.
- Renamed variables/params to for consistency.
- Removed obsolete Model\Optimizer\DomManager.php and related unit test.
- Aligned naming in tests and classes for better code readability and maintainability. 1bca16
-
-
head
-
head
-
1.9.22
-
Version 1.9.22 9c59ec
-
-
head
-
Added 'Local Business' section c7d12a
-
-
1.7.18
-
Version 1.7.18 d95bbd
-
Skip home breadcrumb in JSON-LD output and enforce minimum items for valid BreadcrumbList 6da95a
-
Add reeze integration for product breadcrumbs created via JS. ea00c7
-
Improve product page breadcrumbs snippet. Generate it via JS. d907f6
-
Refactor FAQPage and QAPage to use PageContext ViewModel for page context resolving. Remove copy/paste error. 5d2ca6
-
Update schema.org URLs to use HTTPS e31276
-
-
head
-
v1.7.0
-
1.34.2
-
Version 1.34.2 a02da7
-
-
1.34.2
-
Version 1.34.2 f84381
-
Show small summary loader instead of full screen 2405f4
-
Block "Place Order" button when loader is showing 54dce9
-
Improve StorePickup styles 3660f1
-
Do not allow pressing "place order" if smth is loading df4a2c
-
Prevent duplicate payment-information request on initial page load 23f2dc
-
Prevent duplicate shipping-method requests on initial page load b2118a
-
Do not send duplicate save address request on initial page load df7512
-
Fixed "Cancel" billing address button 2. With list of addresses. 2b505e
-
Fixed "Cancel" billing address button when address is not saved yet ddc6c3
-
Fix shipping method radio click handling (magento bug) 06b8f3
-